浏览代码

Backends: OpenGL3: Fixed erroneous use glGetIntegerv(GL_CONTEXT_PROFILE_MASK) on contexts lower than 3.2. (#6539, #6333)

ocornut 2 年之前
父节点
当前提交
cb5542bce5
共有 2 个文件被更改,包括 5 次插入1 次删除
  1. 3 1
      backends/imgui_impl_opengl3.cpp
  2. 2 0
      docs/CHANGELOG.txt

+ 3 - 1
backends/imgui_impl_opengl3.cpp

@@ -19,6 +19,7 @@
 
 
 // CHANGELOG
 // CHANGELOG
 // (minor and older changes stripped away, please see git history for details)
 // (minor and older changes stripped away, please see git history for details)
+//  2023-06-20: OpenGL: Fixed erroneous use glGetIntegerv(GL_CONTEXT_PROFILE_MASK) on contexts lower than 3.2. (#6539, #6333)
 //  2023-05-09: OpenGL: Support for glBindSampler() backup/restore on ES3. (#6375)
 //  2023-05-09: OpenGL: Support for glBindSampler() backup/restore on ES3. (#6375)
 //  2023-04-18: OpenGL: Restore front and back polygon mode separately when supported by context. (#6333)
 //  2023-04-18: OpenGL: Restore front and back polygon mode separately when supported by context. (#6333)
 //  2023-03-23: OpenGL: Properly restoring "no shader program bound" if it was the case prior to running the rendering function. (#6267, #6220, #6224)
 //  2023-03-23: OpenGL: Properly restoring "no shader program bound" if it was the case prior to running the rendering function. (#6267, #6220, #6224)
@@ -301,7 +302,8 @@ bool    ImGui_ImplOpenGL3_Init(const char* glsl_version)
     }
     }
     bd->GlVersion = (GLuint)(major * 100 + minor * 10);
     bd->GlVersion = (GLuint)(major * 100 + minor * 10);
 #if defined(GL_CONTEXT_PROFILE_MASK)
 #if defined(GL_CONTEXT_PROFILE_MASK)
-    glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &bd->GlProfileMask);
+    if (bd->GlVersion >= 320)
+        glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &bd->GlProfileMask);
     bd->GlProfileIsCompat = (bd->GlProfileMask & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT) != 0;
     bd->GlProfileIsCompat = (bd->GlProfileMask & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT) != 0;
 #endif
 #endif
 
 

+ 2 - 0
docs/CHANGELOG.txt

@@ -76,6 +76,8 @@ Other changes:
   comments. Currently mainly for inspecting Docking .ini data, but makes saving slower.
   comments. Currently mainly for inspecting Docking .ini data, but makes saving slower.
 - Demo: Added more developed "Widgets->Tooltips" section. (#1485)
 - Demo: Added more developed "Widgets->Tooltips" section. (#1485)
 - Backends: OpenGL3: Fixed support for glBindSampler() backup/restore on ES3. (#6375, #6508) [@jsm174]
 - Backends: OpenGL3: Fixed support for glBindSampler() backup/restore on ES3. (#6375, #6508) [@jsm174]
+- Backends: OpenGL3: Fixed erroneous use glGetIntegerv(GL_CONTEXT_PROFILE_MASK) on contexts
+  lower than 3.2. (#6539, #6333) [@krumelmonster]
 - Backends: GLFW: Accept glfwGetTime() not returning a monotonically increasing value.
 - Backends: GLFW: Accept glfwGetTime() not returning a monotonically increasing value.
   This seems to happens on some Windows setup when peripherals disconnect, and is likely
   This seems to happens on some Windows setup when peripherals disconnect, and is likely
   to also happen on browser+Emscripten. Matches similar 1.89.4 fix in SDL backend. (#6491)
   to also happen on browser+Emscripten. Matches similar 1.89.4 fix in SDL backend. (#6491)