[Piglit] [PATCH 3/7] glx_arb_create_context_profile: Verify that the profile is ignored pre-3.2
Ian Romanick
idr at freedesktop.org
Wed Jul 4 14:25:33 PDT 2012
From: Ian Romanick <ian.d.romanick at intel.com>
The profile mechanism is only meaningful for OpenGL 3.2 or later.
Verify that the profile setting is silently ignored when a version
earlier than 3.2 is requested.
NVIDIA's closed-source driver passes this test. AMD's closed-source
driver has not been tested.
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Reviewed-by: Chad Versace <chad.versace at linux.intel.com>
---
tests/all.tests | 1 +
.../spec/glx_arb_create_context/CMakeLists.gl.txt | 1 +
.../spec/glx_arb_create_context/pre-GL3-profile.c | 67 ++++++++++++++++++++
3 files changed, 69 insertions(+), 0 deletions(-)
create mode 100644 tests/spec/glx_arb_create_context/pre-GL3-profile.c
diff --git a/tests/all.tests b/tests/all.tests
index 8bd88c2..37a7453 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -706,6 +706,7 @@ create_context_profile = Group();
glx['GLX_ARB_create_context_profile'] = create_context_profile
create_context_profile['3.2 core profile required'] = PlainExecTest(['glx-create-context-core-profile'])
create_context_profile['invalid profile'] = PlainExecTest(['glx-create-context-invalid-profile'])
+create_context_profile['pre-GL3 profile'] = PlainExecTest(['glx-create-context-pre-GL3-profile'])
texturing = Group()
add_concurrent_test(texturing, '1-1-linear-texture')
diff --git a/tests/spec/glx_arb_create_context/CMakeLists.gl.txt b/tests/spec/glx_arb_create_context/CMakeLists.gl.txt
index f318266..5b78843 100644
--- a/tests/spec/glx_arb_create_context/CMakeLists.gl.txt
+++ b/tests/spec/glx_arb_create_context/CMakeLists.gl.txt
@@ -32,6 +32,7 @@ IF(BUILD_GLX_TESTS)
piglit_add_executable (glx-create-context-invalid-profile invalid-profile.c common.c)
piglit_add_executable (glx-create-context-invalid-render-type invalid-render-type.c common.c)
piglit_add_executable (glx-create-context-invalid-render-type-color-index invalid-render-type-color-index.c common.c)
+ piglit_add_executable (glx-create-context-pre-GL3-profile pre-GL3-profile.c common.c)
piglit_add_executable (glx-create-context-valid-attribute-empty valid-attribute-empty.c common.c)
piglit_add_executable (glx-create-context-valid-attribute-null valid-attribute-null.c common.c)
piglit_add_executable (glx-create-context-valid-flag-forward-compatible valid-flag-forward-compatible.c common.c)
diff --git a/tests/spec/glx_arb_create_context/pre-GL3-profile.c b/tests/spec/glx_arb_create_context/pre-GL3-profile.c
new file mode 100644
index 0000000..7735f45
--- /dev/null
+++ b/tests/spec/glx_arb_create_context/pre-GL3-profile.c
@@ -0,0 +1,67 @@
+/* Copyright © 2012 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+#include "piglit-util.h"
+#include "piglit-glx-util.h"
+#include "common.h"
+
+int main(int argc, char **argv)
+{
+ static const int attribs[] = {
+ GLX_CONTEXT_PROFILE_MASK_ARB,
+ GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
+ None
+ };
+
+ bool pass = true;
+ GLXContext ctx;
+
+ GLX_ARB_create_context_setup();
+ piglit_require_glx_extension(dpy, "GLX_ARB_create_context_profile");
+
+ /* The GLX_ARB_create_context_profile spec says:
+ *
+ * "The attribute name GLX_CONTEXT_PROFILE_MASK_ARB requests an
+ * OpenGL context supporting a specific <profile> of the API....If
+ * the requested OpenGL version is less than 3.2,
+ * GLX_CONTEXT_PROFILE_MASK_ARB is ignored and the functionality
+ * of the context is determined solely by the requested version."
+ *
+ * Try to create a context with the default version (1.0). This
+ * should always succeed.
+ */
+ ctx = glXCreateContextAttribsARB(dpy, fbconfig, NULL, True, attribs);
+ XSync(dpy, 0);
+
+ if (ctx != NULL) {
+ glXDestroyContext(dpy, ctx);
+ } else {
+ fprintf(stderr,
+ "Failed to create 1.0 context with core profile "
+ "(profile value should be\nignored)\n");
+ pass = false;
+ }
+
+ GLX_ARB_create_context_teardown();
+
+ piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
+ return 0;
+}
--
1.7.6.5
More information about the Piglit
mailing list