[Piglit] [PATCH 3/3] framework: Request forward-compatible contexts when supports_gl_core_version == 31.

Jose Fonseca jfonseca at vmware.com
Sat Mar 14 00:45:33 PDT 2015


Core profiles can only be requested for 3.2 contexts and above.  For 3.1
contexts, the closest thing to a 3.1 core profile is a 3.1 context
without GL_ARB_compatibility.

Requesting a forward compatible context should gives precisely that.
The OpenGL 3.1 specification, section E, "The Deprecation Model" states

  "Forward com-
  patible contexts cannot restore deprecated functionality through
  extensions,"

hence, if my interpretation is correct, a forward-compatible context
must not advertise ARB_compatibility.

Therefore requestiong a forward-compatible context should eliminate the
need to falling back to creating a 3.2 core context in
special_case_gl31() with Waffle framework.  And will help with GLUT,
where we don't even have the logic to retry with 3.2 context -- and just
use whatever 3.1 context we get (shouldn't cause problems with Mesa
which never advertises ARB_compatibility, but it might cause false
negatives with other implementations.).

But truth is, the main drive for this change is thus: we are
considering to update Mesa to never return non-forward-compaible 3.1
contexts on Windows, because many Windows applications never bother to
check whether the created 3.1 context advertises ARB_compatibility or
not.
So we either set forward compatible flag for 3.1 contexts or have logic
to always retry 3.2 contexts, or tests that specifically want 3.1
contexts will just skip with Mesa on Windows.
---
 tests/util/piglit-framework-gl/piglit_glut_framework.c | 17 +++++++++++++++++
 tests/util/piglit-framework-gl/piglit_wfl_framework.c  |  9 ++++++++-
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/tests/util/piglit-framework-gl/piglit_glut_framework.c b/tests/util/piglit-framework-gl/piglit_glut_framework.c
index 4651937..6ce1872 100644
--- a/tests/util/piglit-framework-gl/piglit_glut_framework.c
+++ b/tests/util/piglit-framework-gl/piglit_glut_framework.c
@@ -147,6 +147,23 @@ init_glut(void)
 			glutInitContextProfile(GLUT_COMPATIBILITY_PROFILE);
 		}
 	}
+
+	int context_flags = 0;
+	/* There are no 3.1 core profiles -- the closest is 3.1 context without
+	 * ARB_compatibility or a 3.2 core context --, and setting
+	 * forward-compatible flag should ensure we don't get a 3.1 context w/
+	 * ARB_compatibility.
+	 */
+	if (test_config->require_forward_compatible_context ||
+	    test_config->supports_gl_core_version == 31) {
+		context_flags |= GLUT_FORWARD_COMPATIBLE;
+	}
+	if (test_config->require_debug_context) {
+		context_flags |= GLUT_DEBUG;
+	}
+	if (context_flags) {
+		glutInitContextFlags(context_flags);
+	}
 #endif
 
 	glut_fw.window = glutCreateWindow("Piglit");
diff --git a/tests/util/piglit-framework-gl/piglit_wfl_framework.c b/tests/util/piglit-framework-gl/piglit_wfl_framework.c
index cf7d2da..faf758b 100644
--- a/tests/util/piglit-framework-gl/piglit_wfl_framework.c
+++ b/tests/util/piglit-framework-gl/piglit_wfl_framework.c
@@ -342,7 +342,14 @@ make_config_attrib_list(const struct piglit_gl_test_config *test_config,
 			break;
 	}
 
-	if (test_config->require_forward_compatible_context) {
+	/* There are no 3.1 core profiles -- the closest is 3.1 context without
+	 * ARB_compatibility or a 3.2 core context --, and setting
+	 * forward-compatible flag should ensure we don't get a 3.1 context w/
+	 * ARB_compatibility.
+	 */
+	if (test_config->require_forward_compatible_context ||
+	    (flavor == CONTEXT_GL_CORE &&
+	     test_config->supports_gl_core_version == 31)) {
 		head_attrib_list[i++] = WAFFLE_CONTEXT_FORWARD_COMPATIBLE;
 		head_attrib_list[i++] = true;
 	}
-- 
2.1.0



More information about the Piglit mailing list