[Piglit] [PATCH 2/2] gles-2.0: Check that ES 3 queries are not allowed in ES 2
Matt Turner
mattst88 at gmail.com
Mon Dec 10 14:19:50 PST 2012
---
tests/spec/gles-2.0/CMakeLists.gles2.txt | 2 +
tests/spec/gles-2.0/invalid-es3-queries.c | 103 +++++++++++++++++++++++++++++
2 files changed, 105 insertions(+), 0 deletions(-)
create mode 100644 tests/spec/gles-2.0/invalid-es3-queries.c
diff --git a/tests/spec/gles-2.0/CMakeLists.gles2.txt b/tests/spec/gles-2.0/CMakeLists.gles2.txt
index 2bf69f9..9983687 100644
--- a/tests/spec/gles-2.0/CMakeLists.gles2.txt
+++ b/tests/spec/gles-2.0/CMakeLists.gles2.txt
@@ -2,4 +2,6 @@ link_libraries(
piglitutil_${piglit_target_api}
)
+piglit_add_executable(gles-2.0-invalid-es3-queries invalid-es3-queries.c)
+
# vim: ft=cmake:
diff --git a/tests/spec/gles-2.0/invalid-es3-queries.c b/tests/spec/gles-2.0/invalid-es3-queries.c
new file mode 100644
index 0000000..761f65e
--- /dev/null
+++ b/tests/spec/gles-2.0/invalid-es3-queries.c
@@ -0,0 +1,103 @@
+/* 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-gl-common.h"
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+ config.supports_gl_es_version = 20;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+enum piglit_result
+piglit_display(void)
+{
+ return PIGLIT_FAIL;
+}
+
+void
+piglit_init(int argc, char **argv)
+{
+ /* ES 3 adds many new queries over ES 2. This test confirms that ES 2
+ * correctly rejects them with an INVALID_OPERATION error.
+ */
+ static const struct {
+ const char *name;
+ GLenum val;
+ } query[] = {
+ /* GL_ARB_ES3_compatibility */
+ { "GL_MAX_ELEMENT_INDEX", 0x8D6B },
+ /* GL_ARB_fragment_shader */
+ { "GL_MAX_FRAGMENT_UNIFORM_COMPONENTS", 0x8B49 },
+ /* GL_ARB_framebuffer_object */
+ { "GL_MAX_SAMPLES", 0x8D57 },
+ /* GL_ARB_sync */
+ { "GL_MAX_SERVER_WAIT_TIMEOUT", 0x9111 },
+ /* GL_ARB_transform_feedback2 */
+ { "GL_TRANSFORM_FEEDBACK_PAUSED", 0x8E23 },
+ { "GL_TRANSFORM_FEEDBACK_ACTIVE", 0x8E24 },
+ { "GL_TRANSFORM_FEEDBACK_BINDING", 0x8E25 },
+ /* GL_ARB_uniform_buffer_object */
+ { "GL_MAX_VERTEX_UNIFORM_BLOCKS", 0x8A2B },
+ { "GL_MAX_FRAGMENT_UNIFORM_BLOCKS", 0x8A2D },
+ { "GL_MAX_COMBINED_UNIFORM_BLOCKS", 0x8A2E },
+ { "GL_MAX_UNIFORM_BLOCK_SIZE", 0x8A30 },
+ { "GL_MAX_UNIFORM_BUFFER_BINDINGS", 0x8A2F },
+ { "GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS", 0x8A31 },
+ { "GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS", 0x8A33 },
+ { "GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT", 0x8A34 },
+ { "GL_UNIFORM_BUFFER_BINDING", 0x8A28 },
+ /* GL_ARB_vertex_shader */
+ { "GL_MAX_VERTEX_UNIFORM_COMPONENTS", 0x8B4A },
+ /* GL_EXT_framebuffer_blit */
+ { "GL_READ_FRAMEBUFFER_BINDING", 0x8CAA },
+ /* GL_EXT_pixel_buffer_object */
+ { "GL_PIXEL_PACK_BUFFER_BINDING", 0x88ED },
+ { "GL_PIXEL_UNPACK_BUFFER_BINDING", 0x88EF },
+ /* GL_EXT_texture_lod_bias */
+ { "GL_MAX_TEXTURE_LOD_BIAS", 0x84FD },
+ /* GL_EXT_transform_feedback */
+ { "GL_TRANSFORM_FEEDBACK_BUFFER_BINDING", 0x8C8F },
+ { "GL_RASTERIZER_DISCARD", 0x8C89 },
+ { "GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS", 0x8C8A },
+ { "GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS", 0x8C8B },
+ { "GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS", 0x8C80 },
+ };
+ GLint64 param;
+ int i;
+
+ if (piglit_get_gl_version() >= 30) {
+ fprintf(stderr, "Test requires ES < 30\n");
+ piglit_report_result(PIGLIT_SKIP);
+ }
+
+ for (i = 0; i < ARRAY_SIZE(query); i++) {
+ glGetInteger64v(query[i].val, ¶m);
+
+ if (!piglit_check_gl_error(GL_INVALID_OPERATION)) {
+ fprintf(stderr, "Incorrectly accepted %s\n", query[i].name);
+ piglit_report_result(PIGLIT_FAIL);
+ }
+ }
+
+ piglit_report_result(PIGLIT_PASS);
+}
--
1.7.8.6
More information about the Piglit
mailing list