Repository: xbmc/xbmc
File: xbmc/rendering/gl/RenderSystemGL.cpp (C++)

Code before:
    {
      auto glDebugMessageCallback =
          CEGLUtils::GetRequiredProcAddress<PFNGLDEBUGMESSAGECALLBACKPROC>(
              "glDebugMessageCallback");
      auto glDebugMessageControl =
          CEGLUtils::GetRequiredProcAddress<PFNGLDEBUGMESSAGECONTROLPROC>("glDebugMessageControl");

      glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
      glDebugMessageCallback(KODI::UTILS::GL::GlErrorCallback, nullptr);

      // ignore shader compilation information
      glDebugMessageControl(GL_DEBUG_SOURCE_SHADER_COMPILER, GL_DEBUG_TYPE_OTHER, GL_DONT_CARE, 0,
                            nullptr, GL_FALSE);

      CLog::Log(LOGDEBUG, "OpenGL: debugging enabled");
    }
    else
    {
      CLog::Log(LOGDEBUG, "OpenGL: debugging requested but the required extension isn't "
                          "available (GL_KHR_debug)");
    }
  }
#endif

  // Shut down gracefully if OpenGL context could not be allocated
  if (!m_RenderVersionMajor) {
    CMessagePrinter::DisplayError("ERROR: Can not initialize OpenGL context. Exiting");
    return false;
  }

  LogGraphicsInfo();

  // Get our driver vendor and renderer
  const char* tmpVendor = reinterpret_cast<const char*>(glGetString(GL_VENDOR));
  m_RenderVendor.clear();
  if (tmpVendor)
    m_RenderVendor = tmpVendor;

  const char* tmpRenderer = reinterpret_cast<const char*>(glGetString(GL_RENDERER));
  m_RenderRenderer.clear();
  if (tmpRenderer)
    m_RenderRenderer = tmpRenderer;

  m_bRenderCreated = true;

  if (m_RenderVersionMajor > 3 ||
      (m_RenderVersionMajor == 3 && m_RenderVersionMinor >= 2))
  {
    glGenVertexArrays(1, &m_vertexArray);
    glBindVertexArray(m_vertexArray);
  }

Review comment (suggestion):
```suggestion
  if (m_RenderVersionMajor == 0) {
```

Code after:
    if (IsExtSupported("GL_KHR_debug"))
    {
      auto glDebugMessageCallback =
          CEGLUtils::GetRequiredProcAddress<PFNGLDEBUGMESSAGECALLBACKPROC>(
              "glDebugMessageCallback");
      auto glDebugMessageControl =
          CEGLUtils::GetRequiredProcAddress<PFNGLDEBUGMESSAGECONTROLPROC>("glDebugMessageControl");

      glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
      glDebugMessageCallback(KODI::UTILS::GL::GlErrorCallback, nullptr);

      // ignore shader compilation information
      glDebugMessageControl(GL_DEBUG_SOURCE_SHADER_COMPILER, GL_DEBUG_TYPE_OTHER, GL_DONT_CARE, 0,
                            nullptr, GL_FALSE);

      CLog::Log(LOGDEBUG, "OpenGL: debugging enabled");
    }
    else
    {
      CLog::Log(LOGDEBUG, "OpenGL: debugging requested but the required extension isn't "
                          "available (GL_KHR_debug)");
    }
  }
#endif

  // Shut down gracefully if OpenGL context could not be allocated
  if (m_RenderVersionMajor == 0)
  {
    CLog::Log(LOGFATAL, "Can not initialize OpenGL context. Exiting");
    CMessagePrinter::DisplayError("ERROR: Can not initialize OpenGL context. Exiting");
    return false;
  }

  LogGraphicsInfo();

  // Get our driver vendor and renderer
  const char* tmpVendor = reinterpret_cast<const char*>(glGetString(GL_VENDOR));
  m_RenderVendor.clear();
  if (tmpVendor)
    m_RenderVendor = tmpVendor;

  const char* tmpRenderer = reinterpret_cast<const char*>(glGetString(GL_RENDERER));
  m_RenderRenderer.clear();
  if (tmpRenderer)
    m_RenderRenderer = tmpRenderer;

  m_bRenderCreated = true;

  if (m_RenderVersionMajor > 3 ||
      (m_RenderVersionMajor == 3 && m_RenderVersionMinor >= 2))
  {