File tree Expand file tree Collapse file tree 1 file changed +25
-2
lines changed Expand file tree Collapse file tree 1 file changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -597,8 +597,31 @@ reset() {
597
597
query_glsl_version ();
598
598
599
599
#ifndef OPENGLES
600
- bool core_profile = is_at_least_gl_version (3 , 2 ) &&
601
- !has_extension (" GL_ARB_compatibility" );
600
+ // Determine whether this OpenGL context has compatibility features.
601
+ bool core_profile = false ;
602
+
603
+ if (_gl_version_major >= 3 ) {
604
+ if (_gl_version_major > 3 || _gl_version_minor >= 2 ) {
605
+ // OpenGL 3.2 has a built-in way to check this.
606
+ GLint profile_mask = 0 ;
607
+ glGetIntegerv (GL_CONTEXT_PROFILE_MASK, &profile_mask);
608
+
609
+ if (profile_mask & GL_CONTEXT_CORE_PROFILE_BIT) {
610
+ core_profile = true ;
611
+ } else if (profile_mask & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT) {
612
+ core_profile = false ;
613
+ } else {
614
+ core_profile = !has_extension (" GL_ARB_compatibility" );
615
+ }
616
+ } else {
617
+ // OpenGL 3.0/3.1.
618
+ GLint flags = 0 ;
619
+ glGetIntegerv (GL_CONTEXT_FLAGS, &flags);
620
+ if (flags & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT) {
621
+ core_profile = true ;
622
+ }
623
+ }
624
+ }
602
625
603
626
if (GLCAT.is_debug ()) {
604
627
if (core_profile) {
You can’t perform that action at this time.
0 commit comments