OpenGL: GPU_legacy_support workaround for nVidia
nVidia Linux driver reports GL_CONTEXT_PROFILE_MASK = 0, which is a bug. In that case check for the ARB_compatibility extension. Non-buggy drivers will continue to use GL_CONTEXT_COMPATIBILITY_PROFILE_BIT. Thx to Dr Hackerman for reporting.
This commit is contained in:
parent
193b38cc47
commit
2e8a840307
@ -230,23 +230,39 @@ void gpu_extensions_exit(void)
|
||||
|
||||
bool GPU_legacy_support(void)
|
||||
{
|
||||
// return whether or not current GL context is compatible with legacy OpenGL
|
||||
/* return whether or not current GL context is compatible with legacy OpenGL */
|
||||
static bool checked = false;
|
||||
static bool support = true;
|
||||
|
||||
if (GLEW_VERSION_3_2) {
|
||||
static GLint profile = 0;
|
||||
|
||||
if (profile == 0) {
|
||||
if (!checked) {
|
||||
if (GLEW_VERSION_3_2) {
|
||||
GLint profile;
|
||||
glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &profile);
|
||||
|
||||
if (G.debug & G_DEBUG_GPU) {
|
||||
printf("GL_CONTEXT_PROFILE_MASK = %#x (%s profile)\n", profile,
|
||||
profile & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT ? "compatibility" :
|
||||
profile & GL_CONTEXT_CORE_PROFILE_BIT ? "core" : "unknown");
|
||||
}
|
||||
|
||||
if (profile == 0) {
|
||||
/* workaround for nVidia's Linux driver */
|
||||
support = GLEW_ARB_compatibility;
|
||||
}
|
||||
else {
|
||||
support = profile & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT;
|
||||
}
|
||||
}
|
||||
else if (GLEW_VERSION_3_1) {
|
||||
support = GLEW_ARB_compatibility;
|
||||
}
|
||||
|
||||
return profile & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT;
|
||||
}
|
||||
else if (GLEW_VERSION_3_1) {
|
||||
return GLEW_ARB_compatibility;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
/* any OpenGL version <= 3.0 is legacy, so support remains true */
|
||||
|
||||
checked = true;
|
||||
}
|
||||
|
||||
return support;
|
||||
}
|
||||
|
||||
bool GPU_glsl_support(void)
|
||||
|
Loading…
Reference in New Issue
Block a user