summaryrefslogtreecommitdiff
path: root/tests/egl/spec
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2017-05-25 12:01:26 -0700
committerIan Romanick <ian.d.romanick@intel.com>2017-05-30 20:26:35 -0700
commitb29747a00c6a977d8ece468a7b35c5fbca8f6a50 (patch)
tree054eff2fe97cd4f5268f7630b17f1307f19d2953 /tests/egl/spec
parent06d6df9595501d98358b831df7c6e2d91c342b8f (diff)
egl_khr_create_context: Don't expect GL_CONTEXT_FLAGS query to work when it cannot
The GL_KHR_create_context spec is quite clear that you cannot examine the state of the GL_CONTEXT_FLAG_DEBUG_BIT in OpenGL ES < 3.2 contexts because you cannot glGetIntegerv(GL_CONTEXT_FLAGS). This is also true, though not stated in the extension spec, on desktop OpenGL < 3.0. This should fix this test on any drivers that only support desktop OpenGL < 3.0 or OpenGL ES < 3.2. Tested on Intel BDW (OpenGL ES 3.1). Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'tests/egl/spec')
-rw-r--r--tests/egl/spec/egl_khr_create_context/valid-flag-debug.c62
1 files changed, 54 insertions, 8 deletions
diff --git a/tests/egl/spec/egl_khr_create_context/valid-flag-debug.c b/tests/egl/spec/egl_khr_create_context/valid-flag-debug.c
index 31f73980f..000a7fe2d 100644
--- a/tests/egl/spec/egl_khr_create_context/valid-flag-debug.c
+++ b/tests/egl/spec/egl_khr_create_context/valid-flag-debug.c
@@ -69,6 +69,7 @@ try_debug_flag(EGLenum context_api, EGLenum context_bit)
EGLint attribs[64];
int i = 0;
+ GLboolean debug_output;
if (!EGL_KHR_create_context_setup(context_bit))
piglit_report_result(PIGLIT_SKIP);
@@ -158,19 +159,64 @@ try_debug_flag(EGLenum context_api, EGLenum context_bit)
break;
}
- glGetIntegerv(GL_CONTEXT_FLAGS, &actual_flags);
+ /* The "Interactions with OpenGL ES" section of the GL_KHR_debug spec
+ * says:
+ *
+ * In OpenGL ES versions prior to and including ES 3.1 there is no
+ * CONTEXT_FLAGS state and therefore the CONTEXT_FLAG_DEBUG_BIT
+ * cannot be queried. GLES contexts must act as if this state
+ * existed as described in this specification even if the state
+ * itself is not visible to applications. For example, DEBUG_OUTPUT
+ * must still be enabled by default if the context was created with
+ * debug enabled.
+ *
+ * Nothing is explicitly said about versions of desktop OpenGL before
+ * 3.0 which also lack the ability to query GL_CONTEXT_FLAGS. We will
+ * assume that the behavior should be the same. It is likely that
+ * Mesa is the only existent such implementation.
+ */
+ if ((context_bit == EGL_OPENGL_BIT && piglit_get_gl_version() < 30) ||
+ (context_bit != EGL_OPENGL_BIT && piglit_get_gl_version() < 32)) {
+ glGetIntegerv(GL_CONTEXT_FLAGS, &actual_flags);
+
+ if (!piglit_check_gl_error(GL_INVALID_ENUM)) {
+ fprintf(stderr,
+ "glGetIntegerv(GL_CONTEXT_FLAGS) should not "
+ "be possible in this context\n");
+ piglit_report_result(PIGLIT_FAIL);
+ }
+ } else {
+ glGetIntegerv(GL_CONTEXT_FLAGS, &actual_flags);
+
+ if (!piglit_check_gl_error(GL_NO_ERROR)) {
+ fprintf(stderr,
+ "glGetIntegerv(GL_CONTEXT_FLAGS) failed\n");
+ piglit_report_result(PIGLIT_FAIL);
+ }
+
+ /* Verify that this is actually a debug context. */
+ if (!(actual_flags & GL_CONTEXT_FLAG_DEBUG_BIT)) {
+ fprintf(stderr,
+ "GL_CONTEXT_FLAGS=0x%x does not contain "
+ "GL_CONTEXT_FLAG_DEBUG_BIT=0x%x\n",
+ actual_flags, GL_CONTEXT_FLAG_DEBUG_BIT);
+ piglit_report_result(PIGLIT_FAIL);
+ }
+ }
+
+ /* Since we may not have been able to query GL_CONTEXT_FLAGS above,
+ * query GL_DEBUG_OUTPUT just so that we can check something.
+ */
+ debug_output = glIsEnabled(GL_DEBUG_OUTPUT);
if (!piglit_check_gl_error(GL_NO_ERROR)) {
- fprintf(stderr, "glGetIntegerv(GL_CONTEXT_FLAGS) failed\n");
+ fprintf(stderr, "glIsEnabled(GL_DEBUG_OUTPUT) failed\n");
piglit_report_result(PIGLIT_FAIL);
}
- /* Verify that this is actually a debug context. */
- if (!(actual_flags & GL_CONTEXT_FLAG_DEBUG_BIT)) {
- fprintf(stderr,
- "GL_CONTEXT_FLAGS=0x%x does not contain "
- "GL_CONTEXT_FLAG_DEBUG_BIT=0x%x\n",
- actual_flags, GL_CONTEXT_FLAG_DEBUG_BIT);
+ if (!debug_output) {
+ fprintf(stderr, "GL_DEBUG_OUTPUT should be enabled by "
+ "default, but it was not.\n");
piglit_report_result(PIGLIT_FAIL);
}