ext_gpu_shader4: add compiler tests for everything
[piglit.git] / tests / spec / gles-2.0 / invalid-es3-queries.c
blob894051820f66651f9c32336279f8ba1a408a047a
1 /* Copyright © 2012 Intel Corporation
3 * Permission is hereby granted, free of charge, to any person obtaining a
4 * copy of this software and associated documentation files (the "Software"),
5 * to deal in the Software without restriction, including without limitation
6 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 * and/or sell copies of the Software, and to permit persons to whom the
8 * Software is furnished to do so, subject to the following conditions:
10 * The above copyright notice and this permission notice (including the next
11 * paragraph) shall be included in all copies or substantial portions of the
12 * Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 * IN THE SOFTWARE.
23 #include "piglit-util-gl.h"
25 PIGLIT_GL_TEST_CONFIG_BEGIN
27 config.supports_gl_es_version = 20;
29 PIGLIT_GL_TEST_CONFIG_END
31 enum piglit_result
32 piglit_display(void)
34 return PIGLIT_FAIL;
37 static bool try(const GLenum *list, unsigned len) {
38 GLint param;
39 int i;
40 for (i = 0; i < len; i++) {
41 glGetIntegerv(list[i], &param);
43 if (!piglit_check_gl_error(GL_INVALID_ENUM)) {
44 fprintf(stderr, "\t%s\n",
45 piglit_get_gl_enum_name(list[i]));
46 return false;
49 return true;
52 void
53 piglit_init(int argc, char **argv)
55 bool pass = true;
57 /* ES 3 adds many new queries over ES 2. This test confirms that ES 2
58 * correctly rejects them with an INVALID_ENUM error.
60 static const GLenum
61 GL_ARB_ES3_compatibility_enums[] = {
62 /*GL_MAX_ELEMENT_INDEX*/ 0x8D6B,
64 GL_ARB_fragment_shader_enums[] = {
65 /*GL_MAX_FRAGMENT_UNIFORM_COMPONENTS*/ 0x8B49,
67 GL_ARB_framebuffer_object_enums[] = {
68 /*GL_MAX_SAMPLES*/ 0x8D57,
70 GL_ARB_sync_enums[] = {
71 /*GL_MAX_SERVER_WAIT_TIMEOUT*/ 0x9111,
73 GL_ARB_transform_feedback2_enums[] = {
74 /*GL_TRANSFORM_FEEDBACK_PAUSED*/ 0x8E23,
75 /*GL_TRANSFORM_FEEDBACK_ACTIVE*/ 0x8E24,
76 /*GL_TRANSFORM_FEEDBACK_BINDING*/ 0x8E25,
78 GL_ARB_uniform_buffer_object_enums[] = {
79 /*GL_MAX_VERTEX_UNIFORM_BLOCKS*/ 0x8A2B,
80 /*GL_MAX_FRAGMENT_UNIFORM_BLOCKS*/ 0x8A2D,
81 /*GL_MAX_COMBINED_UNIFORM_BLOCKS*/ 0x8A2E,
82 /*GL_MAX_UNIFORM_BLOCK_SIZE*/ 0x8A30,
83 /*GL_MAX_UNIFORM_BUFFER_BINDINGS*/ 0x8A2F,
84 /*GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS*/ 0x8A31,
85 /*GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS*/ 0x8A33,
86 /*GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT*/ 0x8A34,
87 /*GL_UNIFORM_BUFFER_BINDING*/ 0x8A28,
89 GL_ARB_vertex_shader_enums[] = {
90 /*GL_MAX_VERTEX_UNIFORM_COMPONENTS*/ 0x8B4A,
91 /*GL_MAX_VARYING_COMPONENTS*/ 0x8B4B,
93 GL_EXT_framebuffer_blit_enums[] = {
94 /*GL_READ_FRAMEBUFFER_BINDING*/ 0x8CAA,
96 GL_EXT_pixel_buffer_object_enums[] = {
97 /*GL_PIXEL_PACK_BUFFER_BINDING*/ 0x88ED,
98 /*GL_PIXEL_UNPACK_BUFFER_BINDING*/ 0x88EF,
100 GL_EXT_texture_lod_bias_enums[] = {
101 /*GL_MAX_TEXTURE_LOD_BIAS*/ 0x84FD,
103 GL_EXT_transform_feedback_enums[] = {
104 /*GL_TRANSFORM_FEEDBACK_BUFFER_BINDING*/ 0x8C8F,
105 /*GL_RASTERIZER_DISCARD*/ 0x8C89,
106 /*GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS*/ 0x8C8A,
107 /*GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS*/ 0x8C8B,
108 /*GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS*/ 0x8C80,
111 if (piglit_get_gl_version() >= 30) {
112 fprintf(stderr, "Test requires ES < 30\n");
113 piglit_report_result(PIGLIT_SKIP);
116 #define CHECK_QUERIES(extension) \
117 if (!piglit_is_extension_supported( #extension )) { \
118 pass = try(extension ## _enums, \
119 ARRAY_SIZE(extension ## _enums)); \
122 CHECK_QUERIES(GL_ARB_ES3_compatibility);
123 CHECK_QUERIES(GL_ARB_fragment_shader);
124 CHECK_QUERIES(GL_ARB_framebuffer_object);
125 CHECK_QUERIES(GL_ARB_sync);
126 CHECK_QUERIES(GL_ARB_transform_feedback2);
127 CHECK_QUERIES(GL_ARB_uniform_buffer_object);
128 CHECK_QUERIES(GL_ARB_vertex_shader);
129 CHECK_QUERIES(GL_EXT_framebuffer_blit);
130 CHECK_QUERIES(GL_EXT_pixel_buffer_object);
131 CHECK_QUERIES(GL_EXT_texture_lod_bias);
132 CHECK_QUERIES(GL_EXT_transform_feedback);
134 piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);