diff options
author | Tom Gall <tom.gall@linaro.org> | 2013-01-15 12:01:05 -0600 |
---|---|---|
committer | Tom Gall <tom.gall@linaro.org> | 2013-01-15 12:01:05 -0600 |
commit | 5dfa64425c0b0ca1e0eba64edea4d31f8d8903ea (patch) | |
tree | 0b1337254222948ad8111f1b155bd2b5d36207a4 | |
parent | aed636a41c672291d2df21c8ce2c37f986c4fadd (diff) | |
parent | 67f5ae3cfdb511259dc0bf580e37efb7bb4bcc42 (diff) |
Merge branch 'master' of git://anongit.freedesktop.org/git/piglit
69 files changed, 1364 insertions, 275 deletions
diff --git a/generated_tests/builtin_function.py b/generated_tests/builtin_function.py index d433865a..259bb688 100644 --- a/generated_tests/builtin_function.py +++ b/generated_tests/builtin_function.py @@ -1189,6 +1189,8 @@ def _make_vector_or_matrix_test_vectors(test_suite_dict): f('inverse', 1, 140, np.linalg.inv, None, [squaremats]) + f('determinant', 1, 150, np.linalg.det, None, [squaremats]) + _make_vector_or_matrix_test_vectors(test_suite) diff --git a/tests/all.tests b/tests/all.tests index fbfc32b6..164f9282 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -68,7 +68,7 @@ except SystemExit: pass # List of all of the MSAA sample counts we wish to test -MSAA_SAMPLE_COUNTS = (2, 4, 8, 16, 32) +MSAA_SAMPLE_COUNTS = (2, 4, 6, 8, 16, 32) def add_fbo_depthstencil_tests(group, format): if format == 'default_fb': @@ -501,6 +501,7 @@ add_plain_test(gl11, 'infinite-spot-light') add_plain_test(gl11, 'line-aa-width') add_plain_test(gl11, 'linestipple') add_plain_test(gl11, 'longprim') +add_concurrent_test(gl11, 'masked-clear') add_plain_test(gl11, 'point-line-no-cull') add_plain_test(gl11, 'polygon-mode') add_concurrent_test(gl11, 'push-pop-texture-state') @@ -818,6 +819,14 @@ for stage in ['vs', 'fs']: spec['glsl-1.40/execution/texelFetch/' + stage + '-texelFetch-' + sampler] = concurrent_test('texelFetch 140 ' + stage + ' ' + sampler) spec['glsl-1.40/execution/texelFetchOffset/' + stage + '-' + sampler] = concurrent_test('texelFetch offset 140 ' + stage + ' ' + sampler) +spec['glsl-1.50'] = Group() +import_glsl_parser_tests(spec['glsl-1.50'], + os.path.join(testsDir, 'spec', 'glsl-1.50'), + ['compiler']) +add_shader_test_dir(spec['glsl-1.50'], + os.path.join(testsDir, 'spec', 'glsl-1.50'), + recursive=True) + # Group spec/glsl-es-3.00 spec['glsl-es-3.00'] = Group() import_glsl_parser_tests(spec['glsl-es-3.00'], @@ -1011,7 +1020,11 @@ add_plain_test(arb_framebuffer_srgb, 'framebuffer-srgb') arb_occlusion_query = Group() spec['ARB_occlusion_query'] = arb_occlusion_query -add_plain_test(arb_occlusion_query, 'occlusion_query') +add_concurrent_test(arb_occlusion_query, 'occlusion_query') +add_concurrent_test(arb_occlusion_query, 'occlusion_query_lifetime') +add_concurrent_test(arb_occlusion_query, 'occlusion_query_meta_fragments') +add_concurrent_test(arb_occlusion_query, 'occlusion_query_meta_no_fragments') +add_concurrent_test(arb_occlusion_query, 'occlusion_query_order') # Group ARB_sampler_objects arb_sampler_objects = Group() @@ -1820,6 +1833,7 @@ add_plain_test(ext_timer_query, 'timer_query') arb_timer_query = Group() spec['ARB_timer_query'] = arb_timer_query arb_timer_query['query GL_TIMESTAMP'] = concurrent_test('ext_timer_query-time-elapsed timestamp') +arb_timer_query['query-lifetime'] = concurrent_test('ext_timer_query-lifetime') arb_timer_query['timestamp-get'] = concurrent_test('arb_timer_query-timestamp-get') ext_transform_feedback = Group() diff --git a/tests/general/CMakeLists.gl.txt b/tests/general/CMakeLists.gl.txt index efaa56e6..3f54f506 100644 --- a/tests/general/CMakeLists.gl.txt +++ b/tests/general/CMakeLists.gl.txt @@ -79,6 +79,7 @@ IF (UNIX) target_link_libraries (line-aa-width m) ENDIF (UNIX) piglit_add_executable (longprim longprim.c) +piglit_add_executable (masked-clear masked-clear.c) piglit_add_executable (pos-array pos-array.c) piglit_add_executable (pbo-drawpixels pbo-drawpixels.c) piglit_add_executable (pbo-read-argb8888 pbo-read-argb8888.c) @@ -132,7 +133,6 @@ piglit_add_executable (vbo-subdata-sync vbo-subdata-sync.c) piglit_add_executable (object_purgeable-api-pbo object_purgeable-api-pbo.c object_purgeable.c) piglit_add_executable (object_purgeable-api-texture object_purgeable-api-texture.c object_purgeable.c) piglit_add_executable (object_purgeable-api-vbo object_purgeable-api-vbo.c object_purgeable.c) -piglit_add_executable (occlusion_query occlusion_query.c) piglit_add_executable (occlusion-query-discard occlusion-query-discard.c) piglit_add_executable (quad-invariance quad-invariance.c) piglit_add_executable (clear-accum clear-accum.c) diff --git a/tests/general/masked-clear.c b/tests/general/masked-clear.c new file mode 100644 index 00000000..fdf81ba6 --- /dev/null +++ b/tests/general/masked-clear.c @@ -0,0 +1,236 @@ +/* + * Port of Glean maskedClear test to piglit. Original copyright follows. + * + * Copyright (C) 1999 Allen Akin All Rights Reserved. + * + * 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 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 ALLEN AKIN 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. + */ + +/* + * Test color/depth/stencil masking with glClear. + */ + + +#include "piglit-util-gl-common.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + config.supports_gl_compat_version = 10; + config.window_visual = (PIGLIT_GL_VISUAL_RGB | + PIGLIT_GL_VISUAL_DEPTH | + PIGLIT_GL_VISUAL_STENCIL | + PIGLIT_GL_VISUAL_DOUBLE); +PIGLIT_GL_TEST_CONFIG_END + + +static void +failRGB(GLint chan, GLfloat expected, + GLfloat actual, GLenum buffer) +{ + static const char *chanNames[] = { "Red", "Green", "Blue", "Alpha" }; + GLboolean mask[4]; + glGetBooleanv(GL_COLOR_WRITEMASK, mask); + fprintf(stderr, "masked-clear: %s is %f, expected %f in %s\n", + chanNames[chan], actual, expected, + piglit_get_gl_enum_name(buffer)); + fprintf(stderr, "\tGL_COLOR_WRITEMASK = (%s, %s, %s, %s)\n", + (mask[0] ? "GL_TRUE" : "GL_FALSE"), + (mask[1] ? "GL_TRUE" : "GL_FALSE"), + (mask[2] ? "GL_TRUE" : "GL_FALSE"), + (mask[3] ? "GL_TRUE" : "GL_FALSE")); +} + + +static void +failZ(GLfloat expected, GLfloat actual) +{ + GLboolean mask; + glGetBooleanv(GL_DEPTH_WRITEMASK, &mask); + fprintf(stderr, "masked-clear: depth buffer value is %f, expected %f\n", + actual, expected); + fprintf(stderr, "\tGL_DEPTH_WRITEMASK = %s\n", + mask ? "GL_TRUE" : "GL_FALSE"); +} + + +static void +failStencil(GLuint expected, GLuint actual) +{ + GLint mask; + glGetIntegerv(GL_STENCIL_WRITEMASK, &mask); + fprintf(stderr, "masked-clear: stencil buffer value is %d, expected %d\n", + actual, expected); + fprintf(stderr, "\tGL_STENCIL_WRITEMASK = 0x%x\n", mask); +} + + +static bool +test_color_masking(GLenum buffer) +{ + GLint a; + int chan, comp, numChannels; + bool passed = true; + + assert(buffer == GL_FRONT || buffer == GL_BACK); + + glReadBuffer(buffer); + glDrawBuffer(buffer); + + glGetIntegerv(GL_ALPHA_BITS, &a); + numChannels = a ? 4 : 3; + + for (chan = 0; chan < numChannels && passed; chan++) { + GLfloat pixel[4]; + + /* clear to black */ + glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); + glClearColor(0.0, 0.0, 0.0, 0.0); + glClear(GL_COLOR_BUFFER_BIT); + + /* select one channel to "clear" to 1.0 */ + glColorMask(chan == 0, chan == 1, chan == 2, chan == 3); + + /* try to clear surface to white */ + glClearColor(1.0, 1.0, 1.0, 1.0); + glClear(GL_COLOR_BUFFER_BIT); + + /* read 1x1 image at (x,y)=(4,4) */ + glReadPixels(4, 4, 1, 1, GL_RGBA, GL_FLOAT, pixel); + + if (!piglit_automatic) + piglit_present_results(); + + /* test results */ + for (comp = 0; comp < numChannels && passed; comp++) { + if (comp == chan) { + /* component should be 1.0 */ + if (pixel[comp] < 0.5) { + passed = false; + failRGB(comp, 1.0, + pixel[comp], buffer); + } + } else { + /* component should be 0.0 */ + if (pixel[comp] > 0.5) { + passed = false; + failRGB(comp, 0.0, + pixel[comp], buffer); + } + } + } + } + + return passed; +} + + +static bool +test_depth_masking(void) +{ + GLfloat depth; + bool passed = true; + + /* clear depth buffer to zero */ + glDepthMask(GL_TRUE); + glClearDepth(0.0); + glClear(GL_DEPTH_BUFFER_BIT); + + /* disable Z writes, try to clear to one */ + glDepthMask(GL_FALSE); + glClearDepth(1.0); + glClear(GL_DEPTH_BUFFER_BIT); + + /* read 1x1 image at (x,y)=(4,4); */ + glReadPixels(4, 4, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &depth); + + /* test result */ + if (depth != 0.0) { + passed = false; + failZ(0.0, depth); + } + + return passed; +} + + +static bool +test_stencil_masking(void) +{ + GLint stencilBits; + int bit; + bool passed = true; + + glGetIntegerv(GL_STENCIL_BITS, &stencilBits); + + /* We just run <stencilBits> tests rather than 2^stencilBits */ + for (bit = 0; bit < stencilBits; bit++) { + GLuint stencil; + + /* clear to 0 */ + glStencilMask(~0); + glClearStencil(0); + glClear(GL_STENCIL_BUFFER_BIT); + + /* select one bit to "clear" to 1 */ + glStencilMask(1 << bit); + + /* try to clear stencil buffer to ~0 */ + glClearStencil(~0); + glClear(GL_STENCIL_BUFFER_BIT); + + /* read 1x1 image at (x,y)=(4,4) */ + glReadPixels(4, 4, 1, 1, + GL_STENCIL_INDEX, GL_UNSIGNED_INT, &stencil); + + /* test results */ + if (stencil != (1U << bit)) { + passed = false; + failStencil(1 << bit, stencil); + } + } + + return passed; +} + + +enum piglit_result +piglit_display(void) +{ + bool pass = true; + + pass = test_color_masking(GL_FRONT) && pass; + + pass = test_color_masking(GL_BACK) && pass; + + pass = test_depth_masking() && pass; + + pass = test_stencil_masking() && pass; + + return pass ? PIGLIT_PASS : PIGLIT_FAIL; +} + + +void +piglit_init(int argc, char **argv) +{ + /* nothing */ +} diff --git a/tests/general/stencil-wrap.c b/tests/general/stencil-wrap.c index 86568427..b0f9c2d3 100644 --- a/tests/general/stencil-wrap.c +++ b/tests/general/stencil-wrap.c @@ -136,11 +136,11 @@ piglit_display(void) glColor3f(0.5, 0.5, 0.5); piglit_draw_rect(w * 9, start_y, w, h); - pass = piglit_probe_pixel_rgb(w * 1.5, piglit_height / 2, expected); - pass = piglit_probe_pixel_rgb(w * 3.5, piglit_height / 2, expected); - pass = piglit_probe_pixel_rgb(w * 5.5, piglit_height / 2, expected); - pass = piglit_probe_pixel_rgb(w * 7.5, piglit_height / 2, expected); - pass = piglit_probe_pixel_rgb(w * 9.5, piglit_height / 2, expected); + pass = piglit_probe_pixel_rgb(w * 1.5, piglit_height / 2, expected) && pass; + pass = piglit_probe_pixel_rgb(w * 3.5, piglit_height / 2, expected) && pass; + pass = piglit_probe_pixel_rgb(w * 5.5, piglit_height / 2, expected) && pass; + pass = piglit_probe_pixel_rgb(w * 7.5, piglit_height / 2, expected) && pass; + pass = piglit_probe_pixel_rgb(w * 9.5, piglit_height / 2, expected) && pass; piglit_present_results(); diff --git a/tests/glslparsertest/glsl2/comment-continuation.frag b/tests/glslparsertest/glsl2/comment-continuation.frag deleted file mode 100644 index ea39796b..00000000 --- a/tests/glslparsertest/glsl2/comment-continuation.frag +++ /dev/null @@ -1,15 +0,0 @@ -// [config] -// expect_result: pass -// glsl_version: 1.10 -// -// # NOTE: Config section was auto-generated from file -// # NOTE: 'glslparser.tests' at git revision -// # NOTE: 6cc17ae70b70d150aa1751f8e28db7b2a9bd50f0 -// [end config] - -void main() -{ -// This is a comment with a trailing backslash that shouldn't matter. \ - vec4 color = vec4(0.0, 1.0, 0.0, 0.0); - gl_FragColor = color; -} diff --git a/tests/shaders/glsl-explicit-location-05.c b/tests/shaders/glsl-explicit-location-05.c index b8d1c1d7..7f5527fa 100644 --- a/tests/shaders/glsl-explicit-location-05.c +++ b/tests/shaders/glsl-explicit-location-05.c @@ -38,8 +38,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_compat_version = 10; - config.window_width = 100; - config.window_height = 100; config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE; PIGLIT_GL_TEST_CONFIG_END diff --git a/tests/shaders/glsl-getactiveuniform-array-size.c b/tests/shaders/glsl-getactiveuniform-array-size.c index 80fc3af5..7f4ba612 100644 --- a/tests/shaders/glsl-getactiveuniform-array-size.c +++ b/tests/shaders/glsl-getactiveuniform-array-size.c @@ -36,8 +36,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_compat_version = 10; - config.window_width = 100; - config.window_height = 100; config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE; PIGLIT_GL_TEST_CONFIG_END diff --git a/tests/shaders/glsl-getactiveuniform-length.c b/tests/shaders/glsl-getactiveuniform-length.c index 1be8c771..cace5eb7 100644 --- a/tests/shaders/glsl-getactiveuniform-length.c +++ b/tests/shaders/glsl-getactiveuniform-length.c @@ -37,8 +37,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_compat_version = 10; - config.window_width = 100; - config.window_height = 100; config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE; PIGLIT_GL_TEST_CONFIG_END diff --git a/tests/shaders/shader_runner_gles_workarounds.h b/tests/shaders/shader_runner_gles_workarounds.h index 161f9851..2b91f635 100644 --- a/tests/shaders/shader_runner_gles_workarounds.h +++ b/tests/shaders/shader_runner_gles_workarounds.h @@ -88,7 +88,7 @@ static void #if defined(__GNUC__) __attribute__((unused)) #endif -unsupported_function(const char *name) +unsupported_function(const char *name, ...) { printf("Function \"%s\" not supported on this implementation\n", name); piglit_report_result(PIGLIT_SKIP); @@ -102,67 +102,52 @@ unsupported_function(const char *name) * GLES doesn't exist on Windows. So we're free to use the GCC/Clang extension * for statement expressions. */ -#define UNSUPPORTED_FUNCTION(name, return_value) \ +#define UNSUPPORTED_FUNCTION(name, return_value, ...) \ ({ \ - unsupported_function(#name); \ - return_value; \ + unsupported_function(#name, __VA_ARGS__); \ + return_value; \ }) #if defined(PIGLIT_USE_OPENGL_ES3) || defined(PIGLIT_USE_OPENGL_ES2) -#define piglit_frustum_projection(...) UNSUPPORTED_FUNCTION(piglit_frustum_projection, 0) -#define piglit_gen_ortho_projection(...) UNSUPPORTED_FUNCTION(piglit_gen_ortho_projection, 0) -#define piglit_miptree_texture(...) UNSUPPORTED_FUNCTION(piglit_miptree_texture, 0) -#define piglit_depth_texture(...) UNSUPPORTED_FUNCTION(piglit_depth_texture, 0) -#define piglit_ortho_projection(...) UNSUPPORTED_FUNCTION(piglit_ortho_projection, 0) -#define piglit_compile_program(...) UNSUPPORTED_FUNCTION(piglit_compile_program, 0) +#define piglit_frustum_projection(...) UNSUPPORTED_FUNCTION(piglit_frustum_projection, 0, __VA_ARGS__) +#define piglit_gen_ortho_projection(...) UNSUPPORTED_FUNCTION(piglit_gen_ortho_projection, 0, __VA_ARGS__) +#define piglit_miptree_texture() UNSUPPORTED_FUNCTION(piglit_miptree_texture, 0, 0) +#define piglit_depth_texture(...) UNSUPPORTED_FUNCTION(piglit_depth_texture, 0, __VA_ARGS__) +#define piglit_ortho_projection(...) UNSUPPORTED_FUNCTION(piglit_ortho_projection, 0, __VA_ARGS__) +#define piglit_compile_program(...) UNSUPPORTED_FUNCTION(piglit_compile_program, 0, __VA_ARGS__) -#define glClipPlane(...) UNSUPPORTED_FUNCTION(glClipPlane, 0) -#define glDisableClientState(...) UNSUPPORTED_FUNCTION(glDisableClientState, 0) -#define glEnableClientState(...) UNSUPPORTED_FUNCTION(glEnableClientState, 0) -#define glProgramEnvParameter4fvARB(...) UNSUPPORTED_FUNCTION(glProgramEnvParameter4fvARB, 0) -#define glProgramLocalParameter4fvARB(...) UNSUPPORTED_FUNCTION(glProgramLocalParameter4fvARB, 0) -#define glShadeModel(...) UNSUPPORTED_FUNCTION(glShadeModel, 0) +#define glClipPlane(...) UNSUPPORTED_FUNCTION(glClipPlane, 0, __VA_ARGS__) +#define glDisableClientState(...) UNSUPPORTED_FUNCTION(glDisableClientState, 0, __VA_ARGS__) +#define glEnableClientState(...) UNSUPPORTED_FUNCTION(glEnableClientState, 0, __VA_ARGS__) +#define glProgramEnvParameter4fvARB(...) UNSUPPORTED_FUNCTION(glProgramEnvParameter4fvARB, 0, __VA_ARGS__) +#define glProgramLocalParameter4fvARB(...) UNSUPPORTED_FUNCTION(glProgramLocalParameter4fvARB, 0, __VA_ARGS__) +#define glShadeModel(...) UNSUPPORTED_FUNCTION(glShadeModel, 0, __VA_ARGS__) #if defined(PIGLIT_USE_OPENGL_ES2) -#define glMapBuffer(...) UNSUPPORTED_FUNCTION(glMapBuffer, 0) -#define glUnmapBuffer(...) UNSUPPORTED_FUNCTION(glUnmapBuffer, 0) -#define glUniform1ui(...) UNSUPPORTED_FUNCTION(glUniform1ui, 0) -#define glUniform2uiv(...) UNSUPPORTED_FUNCTION(glUniform2uiv, 0) -#define glUniform3uiv(...) UNSUPPORTED_FUNCTION(glUniform3uiv, 0) -#define glUniform4uiv(...) UNSUPPORTED_FUNCTION(glUniform4uiv, 0) -#define glUniformMatrix2x3fv(...) UNSUPPORTED_FUNCTION(glUniformMatrix2x3fv, 0) -#define glUniformMatrix2x4fv(...) UNSUPPORTED_FUNCTION(glUniformMatrix2x4fv, 0) -#define glUniformMatrix3x2fv(...) UNSUPPORTED_FUNCTION(glUniformMatrix3x2fv, 0) -#define glUniformMatrix3x4fv(...) UNSUPPORTED_FUNCTION(glUniformMatrix3x4fv, 0) -#define glUniformMatrix4x2fv(...) UNSUPPORTED_FUNCTION(glUniformMatrix4x2fv, 0) -#define glUniformMatrix4x3fv(...) UNSUPPORTED_FUNCTION(glUniformMatrix4x3fv, 0) -#define glDrawArraysInstanced(...) UNSUPPORTED_FUNCTION(glDrawArrayInstanced, 0) -#define glGetActiveUniformBlockiv(...) UNSUPPORTED_FUNCTION(glGetActiveUniformBlockiv, 0) -#define glBindBufferBase(...) UNSUPPORTED_FUNCTION(glBindBufferiBase, 0) -#define glGetUniformIndices(...) UNSUPPORTED_FUNCTION(glGetUniformIndices, 0) -#define glGetActiveUniformsiv(...) UNSUPPORTED_FUNCTION(glGetActiveUniformsiv, 0) -#define glGenVertexArrays(...) UNSUPPORTED_FUNCTION(glGenVertexArrays, 0) -#define glBindVertexArray(...) UNSUPPORTED_FUNCTION(glBindVertexArray, 0) +#define glMapBuffer(...) UNSUPPORTED_FUNCTION(glMapBuffer, NULL, __VA_ARGS__) +#define glUnmapBuffer(...) UNSUPPORTED_FUNCTION(glUnmapBuffer, 0, __VA_ARGS__) +#define glUniform1ui(...) UNSUPPORTED_FUNCTION(glUniform1ui, 0, __VA_ARGS__) +#define glUniform2uiv(...) UNSUPPORTED_FUNCTION(glUniform2uiv, 0, __VA_ARGS__) +#define glUniform3uiv(...) UNSUPPORTED_FUNCTION(glUniform3uiv, 0, __VA_ARGS__) +#define glUniform4uiv(...) UNSUPPORTED_FUNCTION(glUniform4uiv, 0, __VA_ARGS__) +#define glUniformMatrix2x3fv(...) UNSUPPORTED_FUNCTION(glUniformMatrix2x3fv, 0, __VA_ARGS__) +#define glUniformMatrix2x4fv(...) UNSUPPORTED_FUNCTION(glUniformMatrix2x4fv, 0, __VA_ARGS__) +#define glUniformMatrix3x2fv(...) UNSUPPORTED_FUNCTION(glUniformMatrix3x2fv, 0, __VA_ARGS__) +#define glUniformMatrix3x4fv(...) UNSUPPORTED_FUNCTION(glUniformMatrix3x4fv, 0, __VA_ARGS__) +#define glUniformMatrix4x2fv(...) UNSUPPORTED_FUNCTION(glUniformMatrix4x2fv, 0, __VA_ARGS__) +#define glUniformMatrix4x3fv(...) UNSUPPORTED_FUNCTION(glUniformMatrix4x3fv, 0, __VA_ARGS__) +#define glDrawArraysInstanced(...) UNSUPPORTED_FUNCTION(glDrawArrayInstanced, 0, __VA_ARGS__) +#define glGetActiveUniformBlockiv(...) UNSUPPORTED_FUNCTION(glGetActiveUniformBlockiv, 0, __VA_ARGS__) +#define glBindBufferBase(...) UNSUPPORTED_FUNCTION(glBindBufferiBase, 0, __VA_ARGS__) +#define glGetUniformIndices(...) UNSUPPORTED_FUNCTION(glGetUniformIndices, 0, __VA_ARGS__) +#define glGetActiveUniformsiv(...) UNSUPPORTED_FUNCTION(glGetActiveUniformsiv, 0, __VA_ARGS__) +#define glGenVertexArrays(...) UNSUPPORTED_FUNCTION(glGenVertexArrays, 0, __VA_ARGS__) +#define glBindVertexArray(...) UNSUPPORTED_FUNCTION(glBindVertexArray, 0, __VA_ARGS__) #endif /* PIGLIT_USE_OPENGL_ES2 */ -#define glBindProgramARB(a, b) \ - /* Custom definition to suppress unused-variable warnings. */ \ - ({ \ - (void) a; \ - (void) b; \ - unsupported_function("glBindProgramARB"); \ - }) - -#define glVertexPointer(a, b, c, d) \ - /* Custom definition to suppress unused-variable warnings. */ \ - ({ \ - (void) a; \ - (void) b; \ - (void) c; \ - (void) d; \ - unsupported_function("glVertexPointer"); \ - }) +#define glBindProgramARB(...) UNSUPPORTED_FUNCTION(glBindProgramARB, 0, __VA_ARGS__) +#define glVertexPointer(...) UNSUPPORTED_FUNCTION(glVertexPointer, 0, __VA_ARGS__) #if defined(PIGLIT_USE_OPENGL_ES3) static GLvoid* diff --git a/tests/shaders/vpfp-generic.cpp b/tests/shaders/vpfp-generic.cpp index 116a5e0a..18c6dd21 100644 --- a/tests/shaders/vpfp-generic.cpp +++ b/tests/shaders/vpfp-generic.cpp @@ -171,8 +171,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_compat_version = 10; - config.window_width = 100; - config.window_height = 100; config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_ALPHA; PIGLIT_GL_TEST_CONFIG_END diff --git a/tests/spec/CMakeLists.txt b/tests/spec/CMakeLists.txt index 9ec37fa7..a4342b7c 100644 --- a/tests/spec/CMakeLists.txt +++ b/tests/spec/CMakeLists.txt @@ -9,6 +9,7 @@ add_subdirectory (arb_internalformat_query) add_subdirectory (arb_map_buffer_alignment) add_subdirectory (arb_map_buffer_range) add_subdirectory (arb_multisample) +add_subdirectory (arb_occlusion_query) add_subdirectory (arb_occlusion_query2) add_subdirectory (arb_robustness) add_subdirectory (arb_sampler_objects) diff --git a/tests/spec/arb_debug_output/api_error.c b/tests/spec/arb_debug_output/api_error.c index b7c41c4c..6dc25a42 100644 --- a/tests/spec/arb_debug_output/api_error.c +++ b/tests/spec/arb_debug_output/api_error.c @@ -28,8 +28,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_compat_version = 10; - config.window_width = 100; - config.window_height = 50; config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_ALPHA | PIGLIT_GL_VISUAL_DOUBLE; PIGLIT_GL_TEST_CONFIG_END diff --git a/tests/spec/arb_es2_compatibility/arb_es2_compatibility-maxvectors.c b/tests/spec/arb_es2_compatibility/arb_es2_compatibility-maxvectors.c index 6ad3c5cc..4bc40990 100644 --- a/tests/spec/arb_es2_compatibility/arb_es2_compatibility-maxvectors.c +++ b/tests/spec/arb_es2_compatibility/arb_es2_compatibility-maxvectors.c @@ -32,8 +32,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_compat_version = 10; - config.window_width = 100; - config.window_height = 100; config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE; PIGLIT_GL_TEST_CONFIG_END diff --git a/tests/spec/arb_es2_compatibility/arb_es2_compatibility-releaseshadercompiler.c b/tests/spec/arb_es2_compatibility/arb_es2_compatibility-releaseshadercompiler.c index 1f3554cf..a9e6a8ca 100644 --- a/tests/spec/arb_es2_compatibility/arb_es2_compatibility-releaseshadercompiler.c +++ b/tests/spec/arb_es2_compatibility/arb_es2_compatibility-releaseshadercompiler.c @@ -37,8 +37,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_compat_version = 10; - config.window_width = 100; - config.window_height = 100; config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_ALPHA | PIGLIT_GL_VISUAL_DOUBLE; PIGLIT_GL_TEST_CONFIG_END diff --git a/tests/spec/arb_es2_compatibility/arb_es2_compatibility-shadercompiler.c b/tests/spec/arb_es2_compatibility/arb_es2_compatibility-shadercompiler.c index e73f6e2d..7e711677 100644 --- a/tests/spec/arb_es2_compatibility/arb_es2_compatibility-shadercompiler.c +++ b/tests/spec/arb_es2_compatibility/arb_es2_compatibility-shadercompiler.c @@ -33,8 +33,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_compat_version = 10; - config.window_width = 100; - config.window_height = 100; config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE; PIGLIT_GL_TEST_CONFIG_END diff --git a/tests/spec/arb_map_buffer_alignment/sanity_test.c b/tests/spec/arb_map_buffer_alignment/sanity_test.c index 56e34333..2cc41315 100644 --- a/tests/spec/arb_map_buffer_alignment/sanity_test.c +++ b/tests/spec/arb_map_buffer_alignment/sanity_test.c @@ -28,8 +28,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_compat_version = 10; - config.window_width = 100; - config.window_height = 100; config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE; PIGLIT_GL_TEST_CONFIG_END diff --git a/tests/spec/arb_occlusion_query/CMakeLists.gl.txt b/tests/spec/arb_occlusion_query/CMakeLists.gl.txt new file mode 100644 index 00000000..30fb5194 --- /dev/null +++ b/tests/spec/arb_occlusion_query/CMakeLists.gl.txt @@ -0,0 +1,16 @@ +include_directories( + ${GLEXT_INCLUDE_DIR} + ${OPENGL_INCLUDE_PATH} +) + +link_libraries ( + piglitutil_${piglit_target_api} + ${OPENGL_gl_LIBRARY} + ${OPENGL_glu_LIBRARY} +) + +piglit_add_executable (occlusion_query occlusion_query.c) +piglit_add_executable (occlusion_query_lifetime occlusion_query_lifetime.c) +piglit_add_executable (occlusion_query_meta_no_fragments occlusion_query_meta_no_fragments.c) +piglit_add_executable (occlusion_query_meta_fragments occlusion_query_meta_fragments.c) +piglit_add_executable (occlusion_query_order occlusion_query_order.c) diff --git a/tests/spec/arb_occlusion_query/CMakeLists.txt b/tests/spec/arb_occlusion_query/CMakeLists.txt new file mode 100644 index 00000000..144a306f --- /dev/null +++ b/tests/spec/arb_occlusion_query/CMakeLists.txt @@ -0,0 +1 @@ +piglit_include_target_api() diff --git a/tests/general/occlusion_query.c b/tests/spec/arb_occlusion_query/occlusion_query.c index ba35ed0c..e099f069 100644 --- a/tests/general/occlusion_query.c +++ b/tests/spec/arb_occlusion_query/occlusion_query.c @@ -43,12 +43,6 @@ PIGLIT_GL_TEST_CONFIG_END #define MAX_QUERIES 5 static GLuint occ_queries[MAX_QUERIES]; -static PFNGLGENQUERIESPROC gen_queries = NULL; -static PFNGLBEGINQUERYPROC begin_query = NULL; -static PFNGLENDQUERYPROC end_query = NULL; -static PFNGLGETQUERYIVPROC get_queryiv = NULL; -static PFNGLGETQUERYOBJECTIVPROC get_query_objectiv = NULL; - static void draw_box(float x, float y, float z, float w, float h) { @@ -113,15 +107,15 @@ static int do_test(float x, int all_at_once) draw_box(x + 20.0f, 20.0f, 0.0f, 55.0f, 55.0f); for (i = 0; i < MAX_QUERIES; i++) { - (*begin_query)(GL_SAMPLES_PASSED, occ_queries[i]); + glBeginQuery(GL_SAMPLES_PASSED, occ_queries[i]); glColor3ubv(tests[i].color); draw_box(x + tests[i].x, tests[i].y, tests[i].z, tests[i].w, tests[i].h); - (*end_query)(GL_SAMPLES_PASSED); + glEndQuery(GL_SAMPLES_PASSED); if (! all_at_once) { - (*get_query_objectiv)(occ_queries[i], - GL_QUERY_RESULT, &passed); + glGetQueryObjectiv(occ_queries[i], + GL_QUERY_RESULT, &passed); test_pass &= check_result(passed, tests[i].expected); } } @@ -129,8 +123,8 @@ static int do_test(float x, int all_at_once) if (all_at_once) { for (i = 0; i < MAX_QUERIES; i++) { - (*get_query_objectiv)(occ_queries[i], GL_QUERY_RESULT, - &passed); + glGetQueryObjectiv(occ_queries[i], GL_QUERY_RESULT, + &passed); test_pass &= check_result(passed, tests[i].expected); } } @@ -166,34 +160,18 @@ piglit_init(int argc, char **argv) glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LESS); - - if (piglit_get_gl_version() >= 15) { - gen_queries = glGenQueries; - begin_query = glBeginQuery; - end_query = glEndQuery; - get_queryiv = glGetQueryiv; - get_query_objectiv = glGetQueryObjectiv; - } else if (piglit_is_extension_supported("GL_ARB_occlusion_query")) { - gen_queries = glGenQueriesARB; - begin_query = glBeginQueryARB; - end_query = glEndQueryARB; - get_queryiv = glGetQueryivARB; - get_query_objectiv = glGetQueryObjectivARB; - } else { - piglit_report_result(PIGLIT_SKIP); - } - + piglit_require_extension("GL_ARB_occlusion_query"); /* It is legal for a driver to support the query API but not have * any query bits. I wonder how many applications actually check for * this case... */ - (*get_queryiv)(GL_SAMPLES_PASSED, GL_QUERY_COUNTER_BITS, + glGetQueryiv(GL_SAMPLES_PASSED, GL_QUERY_COUNTER_BITS, & query_bits); if (query_bits == 0) { piglit_report_result(PIGLIT_SKIP); } - (*gen_queries)(MAX_QUERIES, occ_queries); + glGenQueries(MAX_QUERIES, occ_queries); } diff --git a/tests/spec/arb_occlusion_query/occlusion_query_lifetime.c b/tests/spec/arb_occlusion_query/occlusion_query_lifetime.c new file mode 100644 index 00000000..1e8b5d45 --- /dev/null +++ b/tests/spec/arb_occlusion_query/occlusion_query_lifetime.c @@ -0,0 +1,104 @@ +/* + * Copyright © 2009,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. + * + * Authors: + * Ian Romanick <ian.d.romanick@intel.com> + * Carl Worth <cworth@cworth.org> + */ + +/** + * \file occlusion_query_lifetime.c + * + * Ensure that glIsQuery reports correct values throughout each stage + * of a query's lifetime. + */ + +#include "piglit-util-gl-common.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 10; + + config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_DEPTH; + +PIGLIT_GL_TEST_CONFIG_END + +/* Check is glIsQuery() for 'query' returns 'expected' + */ +static bool +is_query_matches(GLuint query, GLboolean expected, const char *lifetime) +{ + int is_query = glIsQuery(query); + + if (is_query != expected) { + fprintf(stderr, "glIsQuery returned %d (expected %d) %s\n", + is_query, expected, lifetime); + return false; + } + + return true; +} + +enum piglit_result +piglit_display(void) +{ + int test_pass = 1; + GLuint query; + GLint result; + + piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + /* Guaranteed to be random, see: http://xkcd.com/221 + */ + query = 3243; + test_pass &= is_query_matches(query, 0, "with un-generated name"); + + glGenQueries(1, &query); + test_pass &= is_query_matches(query, 0, "after glGenQueries"); + + glBeginQuery(GL_SAMPLES_PASSED, query); + test_pass &= is_query_matches(query, 1, "after glBeginQuery"); + + /* Do a little drawing at least */ + glColor3ub(0x00, 0xff, 0x00); + piglit_draw_rect(0, 0, piglit_width, piglit_height); + + glEndQuery(GL_SAMPLES_PASSED); + test_pass &= is_query_matches(query, 1, "after glEndQuery"); + + glGetQueryObjectiv(query, GL_QUERY_RESULT, &result); + test_pass &= is_query_matches(query, 1, "after glGetQueryObjectiv"); + + glDeleteQueries(1, &query); + test_pass &= is_query_matches(query, 0, "after glDeleteQueries"); + + piglit_present_results(); + + return test_pass ? PIGLIT_PASS : PIGLIT_FAIL; +} + +void +piglit_init(int argc, char **argv) +{ + piglit_require_extension("GL_ARB_occlusion_query"); +} diff --git a/tests/spec/arb_occlusion_query/occlusion_query_meta_fragments.c b/tests/spec/arb_occlusion_query/occlusion_query_meta_fragments.c new file mode 100644 index 00000000..50e57933 --- /dev/null +++ b/tests/spec/arb_occlusion_query/occlusion_query_meta_fragments.c @@ -0,0 +1,165 @@ +/* + * Copyright © 2009,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. + * + * Authors: + * Ian Romanick <ian.d.romanick@intel.com> + * Carl Worth <cworth@cworth.org> + */ + +/** + * \file occlusion_query_meta_fragments.c + * + * Verify that various operations, (potentially implemented as + * meta-operations within the OpenGL implementation), generate + * fragments as specified. + */ + +#include "piglit-util-gl-common.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 10; + + config.window_width = 16; + config.window_height = 16; + config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_DEPTH; + +PIGLIT_GL_TEST_CONFIG_END + +static bool +verify_fragments(GLuint query, const char *operation, int expected_fragments) +{ + GLint result; + + glGetQueryObjectiv(query, GL_QUERY_RESULT, &result); + + if (result == expected_fragments) + return true; + + printf("Occlusion query for %s resulted in %d samples, (expected %d)\n", + operation, result, expected_fragments); + return false; +} + +/* Draw several things that should generate fragments, each within an + * occlusion query. Then verify that each query returns a non-zero + * value. + */ +enum piglit_result +piglit_display(void) +{ + /* 2x2 data: Red, Green, Blue, and White. */ + float data[16] = { 1.0, 0.0, 0.0, + 0.0, 1.0, 0.0, + 0.0, 0.0, 1.0, + 1.0, 1.0, 1.0 }; + GLubyte bitmap[16] = { 0x5f, 0xff, 0xff, 0xff, + 0xAf, 0xff, 0xff, 0xff, + 0x5f, 0xff, 0xff, 0xff, + 0xAf, 0xff, 0xff, 0xff }; + GLuint query; + int test_pass = 1; + + piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE); + + glClearColor(0.0, 1.0, 0.0, 0.0); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + glGenQueries(1, &query); + + /* Fragments for glDrawPixels + * + * Assuming one fragment per pixel based on: + * + * Rectangles of color, depth, and certain + * other values may be converted to fragments + * using the DrawPixels command. [OpenGL 3.0 § 3.7] + */ + glBeginQuery(GL_SAMPLES_PASSED, query); + { + glRasterPos2i(2, 2); + glDrawPixels(2, 2, GL_RGB, GL_FLOAT, data); + } + glEndQuery(GL_SAMPLES_PASSED); + test_pass &= verify_fragments(query, "glDrawPixels", 4); + + /* Fragments for glCopyPixels + * + * And here, CopyPixels is specified to behave + * identically to DrawPixels: + * + * The groups of elements so obtained are then + * written to the framebuffer just as if + * DrawPixels had been given width and height, + * beginning with final conversion of elements. + * [OpenGL 3.0 § 4.3.3] + */ + glBeginQuery(GL_SAMPLES_PASSED, query); + { + glRasterPos2i(6, 2); + glCopyPixels(2, 2, 2, 2, GL_COLOR); + } + glEndQuery(GL_SAMPLES_PASSED); + test_pass &= verify_fragments(query, "glCopyPixels", 4); + + /* Fragments for glBitmap. + * + * The specification implies very strongly that a bitmap + * should generate one fragment per set bit: + * + * Bitmaps are rectangles of zeros and ones + * specifying a particular pattern of frag- + * ments to be produced. [OpenGL 3.0 § 3.8] + */ + glBeginQuery(GL_SAMPLES_PASSED, query); + { + glRasterPos2i(10, 2); + glColor4f(0.0, 0.0, 1.0, 0.0); + glBitmap(4, 4, 0, 0, 0, 0, bitmap); + } + glEndQuery(GL_SAMPLES_PASSED); + test_pass &= verify_fragments(query, "glBitmap", 8); + + glDeleteQueries(1, &query); + + piglit_present_results(); + + return test_pass ? PIGLIT_PASS : PIGLIT_FAIL; +} + +void +piglit_init(int argc, char **argv) +{ + GLint query_bits; + + piglit_require_extension("GL_ARB_occlusion_query"); + + /* It is legal for a driver to support the query API but not have + * any query bits. I wonder how many applications actually check for + * this case... + */ + glGetQueryiv(GL_SAMPLES_PASSED, GL_QUERY_COUNTER_BITS, + & query_bits); + if (query_bits == 0) { + piglit_report_result(PIGLIT_SKIP); + } +} diff --git a/tests/spec/arb_occlusion_query/occlusion_query_meta_no_fragments.c b/tests/spec/arb_occlusion_query/occlusion_query_meta_no_fragments.c new file mode 100644 index 00000000..33da98d4 --- /dev/null +++ b/tests/spec/arb_occlusion_query/occlusion_query_meta_no_fragments.c @@ -0,0 +1,205 @@ +/* + * Copyright © 2009,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. + * + * Authors: + * Ian Romanick <ian.d.romanick@intel.com> + * Carl Worth <cworth@cworth.org> + */ + +/** + * \file occlusion_query_meta_no_fragments.c + * + * Verify that various operations, (potentially implemented as + * meta-operations within the OpenGL implementation), do not generate + * fragments as specified. + */ + +#include "piglit-util-gl-common.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 10; + + config.window_width = 64; + config.window_height = 64; + config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_DEPTH; + +PIGLIT_GL_TEST_CONFIG_END + +static bool +verify_no_fragments(GLuint query, const char *operation) +{ + GLint result; + + glGetQueryObjectiv(query, GL_QUERY_RESULT, &result); + + if (result != 0) { + printf("Occlusion query for %s resulted in %d samples, (expected 0)\n", operation, result); + return false; + } + + return true; +} + +/* Draw several things that should not generate fragments, each within + * an occlusion query. Then verify that each query returns 0. + */ + +enum piglit_result +piglit_display(void) +{ + /* 2x2 texture data: Red, Green, Blue, and White. */ + float data[16] = { 1.0, 0.0, 0.0, + 0.0, 1.0, 0.0, + 0.0, 0.0, 1.0, + 1.0, 1.0, 1.0 }; + GLuint texture, texture_copy, fb; + GLuint query; + int test_pass = 1; + + piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE); + + glGenQueries(1, &query); + glGenTextures(1, &texture); + glGenTextures(1, &texture_copy); + glBindTexture(GL_TEXTURE_2D, texture); + glGenFramebuffers(1, &fb); + + /* No fragments for glClear + * + * Clear is specified to bypass most of the fragment pipeline: + * + * When Clear is called, the only per-fragment + * operations that are applied (if enabled) are + * the pixel ownership test, the scissor test, + * and dithering. [OpenGL 3.1 § 4.2.3] + */ + glBeginQuery(GL_SAMPLES_PASSED, query); + { + glClearColor(0.0, 1.0, 0.0, 0.0); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + } + glEndQuery(GL_SAMPLES_PASSED); + test_pass &= verify_no_fragments(query, "glClear"); + + /* No fragments for glGenerateMipmap + * + * This call does not affect the framebuffer, so + * should not generate any fragments. */ + glBeginQuery(GL_SAMPLES_PASSED, query); + { + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, 2, 2, 0, + GL_RGB, GL_FLOAT, data); + + glGenerateMipmap(GL_TEXTURE_2D); + } + glEndQuery(GL_SAMPLES_PASSED); + test_pass &= verify_no_fragments(query, "glGenerateMipmap"); + + /* No fragments for glBlitFramebuffer + * + * The specification could not be more clear: + * + * Blit operations bypass the fragment + * pipeline. [OpenGL 3.1 § 4.3] + */ + glBeginQuery(GL_SAMPLES_PASSED, query); + { + glBindFramebuffer(GL_FRAMEBUFFER, fb); + + glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, + GL_COLOR_ATTACHMENT0_EXT, + GL_TEXTURE_2D, + texture, + 0); + + glBindFramebuffer(GL_READ_FRAMEBUFFER, fb); + glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); + glBlitFramebuffer(0, 0, 2, 2, + 2, 2, 20, 20, + GL_COLOR_BUFFER_BIT, GL_NEAREST); + glBindFramebuffer(GL_FRAMEBUFFER, 0); + } + glEndQuery(GL_SAMPLES_PASSED); + test_pass &= verify_no_fragments(query, "glBlitFramebuffer"); + + /* No fragments for glCopyTexImage + * + * This call does not affect the framebuffer, so + * should not generate any fragments. */ + glBeginQuery(GL_SAMPLES_PASSED, query); + { + glBindTexture(GL_TEXTURE_2D, texture_copy); + glBindFramebuffer(GL_READ_FRAMEBUFFER, fb); + glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, + 0, 0, 2, 2, 0); + } + glEndQuery(GL_SAMPLES_PASSED); + test_pass &= verify_no_fragments(query, "glCopyTexImage2D"); + + /* Paint the copied texture just ensure it worked. */ + glEnable(GL_TEXTURE_2D); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + piglit_draw_rect_tex(22, 2, 18, 18, 0, 0, 1, 1); + + /* No fragments for glCopyTexSubImage */ + glBeginQuery(GL_SAMPLES_PASSED, query); + { + glBindTexture(GL_TEXTURE_2D, texture_copy); + glBindFramebuffer(GL_READ_FRAMEBUFFER, fb); + glCopyTexSubImage2D(GL_TEXTURE_2D, 0, + 1, 1, 0, 0, 1, 1); + glBindFramebuffer(GL_FRAMEBUFFER, 0); + } + glEndQuery(GL_SAMPLES_PASSED); + test_pass &= verify_no_fragments(query, "glCopyTexImage2D"); + + /* Paint the copied texture so a user can see that it worked. */ + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + piglit_draw_rect_tex(42, 2, 18, 18, 0, 0, 1, 1); + + glDeleteQueries(1, &query); + + piglit_present_results(); + + return test_pass ? PIGLIT_PASS : PIGLIT_FAIL; +} + +void +piglit_init(int argc, char **argv) +{ + GLint query_bits; + + piglit_require_extension("GL_ARB_occlusion_query"); + + /* It is legal for a driver to support the query API but not have + * any query bits. I wonder how many applications actually check for + * this case... + */ + glGetQueryiv(GL_SAMPLES_PASSED, GL_QUERY_COUNTER_BITS, + & query_bits); + if (query_bits == 0) { + piglit_report_result(PIGLIT_SKIP); + } +} diff --git a/tests/spec/arb_occlusion_query/occlusion_query_order.c b/tests/spec/arb_occlusion_query/occlusion_query_order.c new file mode 100644 index 00000000..64827a80 --- /dev/null +++ b/tests/spec/arb_occlusion_query/occlusion_query_order.c @@ -0,0 +1,153 @@ +/* + * Copyright © 2009,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. + * + * Authors: + * Ian Romanick <ian.d.romanick@intel.com> + * Carl Worth <cworth@cworth.org> + */ + +/** + * \file occlusion_query_order.c + * + * Verify that once one occlusion query has results, all previous + * occlusion queries also have results available, as per the spec.: + * + * It must always be true that if any query object + * returns a result available of TRUE, all queries of + * the same type issued prior to that query must also + * return TRUE. [OpenGL 3.1 § 6.1.6] + */ + +#include "piglit-util-gl-common.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 10; + + config.window_width = 64; + config.window_height = 64; + config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_DEPTH; + +PIGLIT_GL_TEST_CONFIG_END + +static void +draw_some_things(double frac) +{ + int i; + float x, y; + + x = 0.0; + y = frac * piglit_height; + + glBegin(GL_QUADS); + + for (i=0; i < 1024; i++) { + glVertex3f(x, y, 0.0); + glVertex3f(x + 1.0, y, 0.0); + glVertex3f(x + 1.0, y + 1.0, 0.0); + glVertex3f(x, y + 1.0, 0.0); + + x++; + if (x >= piglit_width) { + x = 0.0; + y++; + if (y >= piglit_height) { + y = 0.0; + } + } + } + + glEnd(); +} + +enum piglit_result +piglit_display(void) +{ +#define NUM_QUERIES 5 + GLuint queries[NUM_QUERIES], available; + bool test_pass = true; + GLint result; + int i; + + piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE); + + glClearColor(1.0, 0.0, 0.0, 1.0); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + glGenQueries(NUM_QUERIES, queries); + + glColor4f(0.0f, 1.0f, 0.0f, 1.0f); + + /* Queue up a bunch of drawing with several queries. */ + for (i = 0; i < NUM_QUERIES - 1; i++) + { + glBeginQuery(GL_SAMPLES_PASSED, queries[i]); + + draw_some_things((double)i / (NUM_QUERIES - 1)); + + glEndQuery(GL_SAMPLES_PASSED); + } + + /* Now fire off a query with no drawing. */ + glBeginQuery(GL_SAMPLES_PASSED, queries[NUM_QUERIES - 1]); + glEndQuery(GL_SAMPLES_PASSED); + + /* Get the result for the final query. */ + glGetQueryObjectiv(queries[NUM_QUERIES - 1], GL_QUERY_RESULT, &result); + + /* At this point, the results of all the previous queries + * should be available. + */ + for (i = 0; i < NUM_QUERIES - 1; i++) + { + glGetQueryObjectuiv(queries[i], GL_QUERY_RESULT_AVAILABLE, + &available); + if (available != 1) { + printf("Query #%d result not available (expected in-order processing)\n", i); + test_pass = false; + } + } + + glDeleteQueries(NUM_QUERIES, queries); + + piglit_present_results(); + + return test_pass ? PIGLIT_PASS : PIGLIT_FAIL; +} + +void +piglit_init(int argc, char **argv) +{ + GLint query_bits; + + piglit_require_extension("GL_ARB_occlusion_query"); + + /* It is legal for a driver to support the query API but not have + * any query bits. I wonder how many applications actually check for + * this case... + */ + glGetQueryiv(GL_SAMPLES_PASSED, GL_QUERY_COUNTER_BITS, + & query_bits); + if (query_bits == 0) { + piglit_report_result(PIGLIT_SKIP); + } +} diff --git a/tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-block-index.c b/tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-block-index.c index 521c11dd..c9db22a7 100644 --- a/tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-block-index.c +++ b/tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-block-index.c @@ -34,8 +34,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_compat_version = 10; - config.window_width = 100; - config.window_height = 100; config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_ALPHA; PIGLIT_GL_TEST_CONFIG_END diff --git a/tests/spec/arb_uniform_buffer_object/getuniformblockindex.c b/tests/spec/arb_uniform_buffer_object/getuniformblockindex.c index 4f051944..84d086a8 100644 --- a/tests/spec/arb_uniform_buffer_object/getuniformblockindex.c +++ b/tests/spec/arb_uniform_buffer_object/getuniformblockindex.c @@ -34,8 +34,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_compat_version = 10; - config.window_width = 100; - config.window_height = 100; config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_ALPHA; PIGLIT_GL_TEST_CONFIG_END diff --git a/tests/spec/arb_uniform_buffer_object/getuniformindices.c b/tests/spec/arb_uniform_buffer_object/getuniformindices.c index b513c734..b3b083e2 100644 --- a/tests/spec/arb_uniform_buffer_object/getuniformindices.c +++ b/tests/spec/arb_uniform_buffer_object/getuniformindices.c @@ -33,8 +33,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_compat_version = 10; - config.window_width = 100; - config.window_height = 100; config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_ALPHA; PIGLIT_GL_TEST_CONFIG_END diff --git a/tests/spec/arb_uniform_buffer_object/getuniformlocation.c b/tests/spec/arb_uniform_buffer_object/getuniformlocation.c index bbec2ca9..0b71ff30 100644 --- a/tests/spec/arb_uniform_buffer_object/getuniformlocation.c +++ b/tests/spec/arb_uniform_buffer_object/getuniformlocation.c @@ -43,8 +43,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_compat_version = 10; - config.window_width = 100; - config.window_height = 100; config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_ALPHA; PIGLIT_GL_TEST_CONFIG_END diff --git a/tests/spec/arb_uniform_buffer_object/layout-std140.c b/tests/spec/arb_uniform_buffer_object/layout-std140.c index 1d57bd94..0f85f3b9 100644 --- a/tests/spec/arb_uniform_buffer_object/layout-std140.c +++ b/tests/spec/arb_uniform_buffer_object/layout-std140.c @@ -40,8 +40,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_compat_version = 10; - config.window_width = 100; - config.window_height = 100; config.window_visual = PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_ALPHA; PIGLIT_GL_TEST_CONFIG_END diff --git a/tests/spec/ext_framebuffer_multisample/accuracy.cpp b/tests/spec/ext_framebuffer_multisample/accuracy.cpp index 126a0907..3b2205bb 100644 --- a/tests/spec/ext_framebuffer_multisample/accuracy.cpp +++ b/tests/spec/ext_framebuffer_multisample/accuracy.cpp @@ -103,8 +103,9 @@ piglit_init(int argc, char **argv) } } - piglit_require_gl_version(30); - piglit_require_GLSL_version(130); + piglit_require_gl_version(21); + piglit_require_extension("GL_ARB_framebuffer_object"); + piglit_require_extension("GL_ARB_vertex_array_object"); /* Skip the test if num_samples > GL_MAX_SAMPLES */ glGetIntegerv(GL_MAX_SAMPLES, &max_samples); diff --git a/tests/spec/ext_framebuffer_multisample/alpha-to-coverage-no-draw-buffer-zero.cpp b/tests/spec/ext_framebuffer_multisample/alpha-to-coverage-no-draw-buffer-zero.cpp index 30ff8114..cad6bfc0 100644 --- a/tests/spec/ext_framebuffer_multisample/alpha-to-coverage-no-draw-buffer-zero.cpp +++ b/tests/spec/ext_framebuffer_multisample/alpha-to-coverage-no-draw-buffer-zero.cpp @@ -81,7 +81,9 @@ piglit_init(int argc, char **argv) print_usage_and_exit(argv[0]); } - piglit_require_gl_version(30); + piglit_require_gl_version(21); + piglit_require_extension("GL_ARB_framebuffer_object"); + piglit_require_extension("GL_ARB_vertex_array_object"); int pattern_width = piglit_width / 2; int pattern_height = piglit_height / num_attachments; diff --git a/tests/spec/ext_framebuffer_multisample/alpha-to-one-msaa-disabled.cpp b/tests/spec/ext_framebuffer_multisample/alpha-to-one-msaa-disabled.cpp index 80c159fa..043f9b6f 100644 --- a/tests/spec/ext_framebuffer_multisample/alpha-to-one-msaa-disabled.cpp +++ b/tests/spec/ext_framebuffer_multisample/alpha-to-one-msaa-disabled.cpp @@ -71,7 +71,9 @@ piglit_init(int argc, char **argv) print_usage_and_exit(argv[0]); } - piglit_require_gl_version(30); + piglit_require_gl_version(21); + piglit_require_extension("GL_ARB_framebuffer_object"); + piglit_require_extension("GL_ARB_vertex_array_object"); int pattern_width = piglit_width / 2; int pattern_height = piglit_height / num_attachments; diff --git a/tests/spec/ext_framebuffer_multisample/alpha-to-one-single-sample-buffer.cpp b/tests/spec/ext_framebuffer_multisample/alpha-to-one-single-sample-buffer.cpp index f297cea9..83e75ad0 100644 --- a/tests/spec/ext_framebuffer_multisample/alpha-to-one-single-sample-buffer.cpp +++ b/tests/spec/ext_framebuffer_multisample/alpha-to-one-single-sample-buffer.cpp @@ -56,7 +56,9 @@ piglit_init(int argc, char **argv) /* For single sample buffer */ const int samples = 0; - piglit_require_gl_version(30); + piglit_require_gl_version(21); + piglit_require_extension("GL_ARB_framebuffer_object"); + piglit_require_extension("GL_ARB_vertex_array_object"); int pattern_width = piglit_width / 2; int pattern_height = piglit_height / num_attachments; diff --git a/tests/spec/ext_framebuffer_multisample/bitmap.cpp b/tests/spec/ext_framebuffer_multisample/bitmap.cpp index 7a82e55c..ec49f013 100644 --- a/tests/spec/ext_framebuffer_multisample/bitmap.cpp +++ b/tests/spec/ext_framebuffer_multisample/bitmap.cpp @@ -148,7 +148,10 @@ piglit_init(int argc, char **argv) print_usage_and_exit(argv[0]); } - piglit_require_gl_version(30); + piglit_require_gl_version(21); + piglit_require_extension("GL_ARB_framebuffer_object"); + piglit_require_extension("GL_ARB_vertex_array_object"); + piglit_ortho_projection(pattern_width, pattern_height, GL_TRUE); /* Skip the test if num_samples > GL_MAX_SAMPLES */ diff --git a/tests/spec/ext_framebuffer_multisample/blit-flipped.cpp b/tests/spec/ext_framebuffer_multisample/blit-flipped.cpp index 26f918fa..1f2cf7f3 100644 --- a/tests/spec/ext_framebuffer_multisample/blit-flipped.cpp +++ b/tests/spec/ext_framebuffer_multisample/blit-flipped.cpp @@ -102,7 +102,9 @@ piglit_init(int argc, char **argv) print_usage_and_exit(argv[0]); } - piglit_require_gl_version(30); + piglit_require_gl_version(21); + piglit_require_extension("GL_ARB_framebuffer_object"); + piglit_require_extension("GL_ARB_vertex_array_object"); /* Skip the test if num_samples > GL_MAX_SAMPLES */ GLint max_samples; diff --git a/tests/spec/ext_framebuffer_multisample/blit-mismatched-formats.cpp b/tests/spec/ext_framebuffer_multisample/blit-mismatched-formats.cpp index 5162de1f..017e5f0c 100644 --- a/tests/spec/ext_framebuffer_multisample/blit-mismatched-formats.cpp +++ b/tests/spec/ext_framebuffer_multisample/blit-mismatched-formats.cpp @@ -92,7 +92,9 @@ piglit_display() void piglit_init(int argc, char **argv) { - piglit_require_gl_version(30); + piglit_require_gl_version(21); + piglit_require_extension("GL_ARB_framebuffer_object"); + piglit_require_extension("GL_ARB_vertex_array_object"); /* Passing sample count = 1 will create the FBOs with minimum supported * sample count. Both FBOs are created with GL_RGBA format by default. diff --git a/tests/spec/ext_framebuffer_multisample/blit-mismatched-samples.cpp b/tests/spec/ext_framebuffer_multisample/blit-mismatched-samples.cpp index 31547205..dfbfa8ad 100644 --- a/tests/spec/ext_framebuffer_multisample/blit-mismatched-samples.cpp +++ b/tests/spec/ext_framebuffer_multisample/blit-mismatched-samples.cpp @@ -70,7 +70,10 @@ void piglit_init(int argc, char **argv) { GLint samples, max_samples; - piglit_require_gl_version(30); + + piglit_require_gl_version(21); + piglit_require_extension("GL_ARB_framebuffer_object"); + piglit_require_extension("GL_ARB_vertex_array_object"); /* OpenGL driver is supposed to round up the specified sample count to * the next available sample count. So, this will create the FBO with diff --git a/tests/spec/ext_framebuffer_multisample/blit-mismatched-sizes.cpp b/tests/spec/ext_framebuffer_multisample/blit-mismatched-sizes.cpp index 02b13058..22ea0dab 100644 --- a/tests/spec/ext_framebuffer_multisample/blit-mismatched-sizes.cpp +++ b/tests/spec/ext_framebuffer_multisample/blit-mismatched-sizes.cpp @@ -71,7 +71,9 @@ piglit_display() void piglit_init(int argc, char **argv) { - piglit_require_gl_version(30); + piglit_require_gl_version(21); + piglit_require_extension("GL_ARB_framebuffer_object"); + piglit_require_extension("GL_ARB_vertex_array_object"); /* Passing sample count = 1 will create the FBOs with minimum supported * sample count. diff --git a/tests/spec/ext_framebuffer_multisample/clear.cpp b/tests/spec/ext_framebuffer_multisample/clear.cpp index 10388129..2ba701e3 100644 --- a/tests/spec/ext_framebuffer_multisample/clear.cpp +++ b/tests/spec/ext_framebuffer_multisample/clear.cpp @@ -117,7 +117,9 @@ piglit_init(int argc, char **argv) print_usage_and_exit(argv[0]); } - piglit_require_gl_version(30); + piglit_require_gl_version(21); + piglit_require_extension("GL_ARB_framebuffer_object"); + piglit_require_extension("GL_ARB_vertex_array_object"); /* Skip the test if num_samples > GL_MAX_SAMPLES */ GLint max_samples; diff --git a/tests/spec/ext_framebuffer_multisample/clip-and-scissor-blit.cpp b/tests/spec/ext_framebuffer_multisample/clip-and-scissor-blit.cpp index 4ad4c2d4..fc4310ac 100644 --- a/tests/spec/ext_framebuffer_multisample/clip-and-scissor-blit.cpp +++ b/tests/spec/ext_framebuffer_multisample/clip-and-scissor-blit.cpp @@ -327,8 +327,9 @@ print_usage_and_exit(char *prog_name) extern "C" void piglit_init(int argc, char **argv) { - piglit_require_gl_version(30); - piglit_require_GLSL_version(130); + piglit_require_gl_version(21); + piglit_require_extension("GL_ARB_framebuffer_object"); + piglit_require_extension("GL_ARB_vertex_array_object"); if (argc < 3) print_usage_and_exit(argv[0]); diff --git a/tests/spec/ext_framebuffer_multisample/common.cpp b/tests/spec/ext_framebuffer_multisample/common.cpp index fe6b40bd..c58ba3bc 100644 --- a/tests/spec/ext_framebuffer_multisample/common.cpp +++ b/tests/spec/ext_framebuffer_multisample/common.cpp @@ -195,12 +195,13 @@ Fbo::try_setup(const FboConfig &new_config) GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, color_rb); } else { - glBindTexture(GL_TEXTURE_2D, color_tex); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, + piglit_require_extension("GL_ARB_texture_rectangle"); + glBindTexture(GL_TEXTURE_RECTANGLE, color_tex); + glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, + glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexImage2D(GL_TEXTURE_2D, + glTexImage2D(GL_TEXTURE_RECTANGLE, 0 /* level */, config.color_internalformat, config.width, @@ -211,7 +212,7 @@ Fbo::try_setup(const FboConfig &new_config) NULL /* data */); glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, - GL_TEXTURE_2D, + GL_TEXTURE_RECTANGLE, color_tex, 0 /* level */); } @@ -274,10 +275,10 @@ void DownsampleProg::compile(int supersample_factor) { static const char *vert = - "#version 130\n" - "in vec2 pos;\n" - "in vec2 texCoord;\n" - "out vec2 texCoordVarying;\n" + "#version 120\n" + "attribute vec2 pos;\n" + "attribute vec2 texCoord;\n" + "varying vec2 texCoordVarying;\n" "void main()\n" "{\n" " gl_Position = vec4(pos, 0.0, 1.0);\n" @@ -285,18 +286,18 @@ DownsampleProg::compile(int supersample_factor) "}\n"; static const char *frag = - "#version 130\n" - "uniform sampler2D samp;\n" + "#version 120\n" + "uniform sampler2DRect samp;\n" "uniform int supersample_factor;\n" - "in vec2 texCoordVarying;\n" + "varying vec2 texCoordVarying;\n" "void main()\n" "{\n" " vec4 sum = vec4(0.0);\n" - " ivec2 pixel = ivec2(texCoordVarying);\n" + " vec2 pixel = floor(texCoordVarying);\n" " for (int i = 0; i < supersample_factor; ++i) {\n" " for (int j = 0; j < supersample_factor; ++j) {\n" - " sum += texelFetch(\n" - " samp, pixel * supersample_factor + ivec2(i, j), 0);\n" + " sum += texture2DRect(\n" + " samp, pixel * float(supersample_factor) + vec2(i, j));\n" " }\n" " }\n" " gl_FragColor = sum / (supersample_factor * supersample_factor);\n" @@ -354,7 +355,7 @@ DownsampleProg::run(const Fbo *src_fbo, int dest_width, int dest_height, float h = dest_height; glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, src_fbo->color_tex); + glBindTexture(GL_TEXTURE_RECTANGLE, src_fbo->color_tex); glUseProgram(prog); glBindVertexArray(vao); @@ -384,15 +385,15 @@ void ManifestStencil::compile() { static const char *vert = - "#version 130\n" - "in vec2 pos;\n" + "#version 120\n" + "attribute vec2 pos;\n" "void main()\n" "{\n" " gl_Position = vec4(pos, 0.0, 1.0);\n" "}\n"; static const char *frag = - "#version 130\n" + "#version 120\n" "uniform vec4 color;\n" "void main()\n" "{\n" @@ -483,8 +484,8 @@ void ManifestDepth::compile() { static const char *vert = - "#version 130\n" - "in vec2 pos;\n" + "#version 120\n" + "attribute vec2 pos;\n" "uniform float depth;\n" "void main()\n" "{\n" @@ -492,7 +493,7 @@ ManifestDepth::compile() "}\n"; static const char *frag = - "#version 130\n" + "#version 120\n" "uniform vec4 color;\n" "void main()\n" "{\n" @@ -618,8 +619,8 @@ void Triangles::compile() float final_scale = 0.95; static const char *vert = - "#version 130\n" - "in vec2 pos_within_tri;\n" + "#version 120\n" + "attribute vec2 pos_within_tri;\n" "uniform float tri_scale;\n" "uniform float rotation_delta;\n" "uniform int tris_across;\n" @@ -633,7 +634,7 @@ void Triangles::compile() " float rotation = rotation_delta * tri_num;\n" " pos = mat2(cos(rotation), sin(rotation),\n" " -sin(rotation), cos(rotation)) * pos;\n" - " int i = tri_num % tris_across;\n" + " int i = int(mod(float(tri_num), float(tris_across)));\n" " int j = tris_across - 1 - tri_num / tris_across;\n" " pos += (vec2(i, j) * 2.0 + 1.0) / tris_across - 1.0;\n" " pos *= final_scale;\n" @@ -641,7 +642,7 @@ void Triangles::compile() "}\n"; static const char *frag = - "#version 130\n" + "#version 120\n" "void main()\n" "{\n" " gl_FragColor = vec4(1.0);\n" @@ -731,13 +732,13 @@ InterpolationTestPattern::compile() float final_scale = 0.95; static const char *vert = - "#version 130\n" - "in vec2 pos_within_tri;\n" - "in vec3 in_barycentric_coords;\n" - "out vec3 barycentric_coords;\n" - "centroid out vec3 barycentric_coords_centroid;\n" - "out vec2 pixel_pos;\n" - "centroid out vec2 pixel_pos_centroid;\n" + "#version 120\n" + "attribute vec2 pos_within_tri;\n" + "attribute vec3 in_barycentric_coords;\n" + "varying vec3 barycentric_coords;\n" + "centroid varying vec3 barycentric_coords_centroid;\n" + "varying vec2 pixel_pos;\n" + "centroid varying vec2 pixel_pos_centroid;\n" "uniform float tri_scale;\n" "uniform float rotation_delta;\n" "uniform int tris_across;\n" @@ -752,7 +753,7 @@ InterpolationTestPattern::compile() " float rotation = rotation_delta * tri_num;\n" " pos = mat2(cos(rotation), sin(rotation),\n" " -sin(rotation), cos(rotation)) * pos;\n" - " int i = tri_num % tris_across;\n" + " int i = int(mod(float(tri_num), float(tris_across)));\n" " int j = tris_across - 1 - tri_num / tris_across;\n" " pos += (vec2(i, j) * 2.0 + 1.0) / tris_across - 1.0;\n" " pos *= final_scale;\n" @@ -852,8 +853,8 @@ void Lines::compile() float final_scale = 0.95; static const char *vert = - "#version 130\n" - "in vec2 pos_line;\n" + "#version 120\n" + "attribute vec2 pos_line;\n" "uniform float line_scale;\n" "uniform float rotation_delta;\n" "uniform int lines_across;\n" @@ -867,7 +868,7 @@ void Lines::compile() " float rotation = rotation_delta * line_num;\n" " pos = mat2(cos(rotation), sin(rotation),\n" " -sin(rotation), cos(rotation)) * pos;\n" - " int i = line_num % lines_across;\n" + " int i = int(mod(float(line_num), float(lines_across)));\n" " int j = lines_across - 1 - line_num / lines_across;\n" " pos += (vec2(i, j) * 2.0 + 1.0) / lines_across - 1.0;\n" " pos *= final_scale;\n" @@ -875,7 +876,7 @@ void Lines::compile() "}\n"; static const char *frag = - "#version 130\n" + "#version 120\n" "void main()\n" "{\n" " gl_FragColor = vec4(1.0);\n" @@ -951,8 +952,8 @@ void Points::compile() float final_scale = 0.95; static const char *vert = - "#version 130\n" - "in vec2 pos_point;\n" + "#version 120\n" + "attribute vec2 pos_point;\n" "uniform float point_scale;\n" "uniform int points_across;\n" "uniform float final_scale;\n" @@ -963,7 +964,7 @@ void Points::compile() "void main()\n" "{\n" " vec2 pos = point_scale * pos_point;\n" - " int i = point_num % points_across;\n" + " int i = int(mod(float(point_num), float(points_across)));\n" " int j = points_across - 1 - point_num / points_across;\n" " pos += (vec2(i, j) * 2.0 + 1.0) / points_across - 1.0;\n" " pos *= final_scale;\n" @@ -971,7 +972,7 @@ void Points::compile() "}\n"; static const char *frag = - "#version 130\n" + "#version 120\n" "void main()\n" "{\n" " gl_FragColor = vec4(1.0);\n" @@ -1076,15 +1077,20 @@ void Sunburst::compile() { { 0.0, 1.0 }, { 0, 1, 0 } }, { { 0.3, -0.8 }, { 0, 0, 1 } } }; + bool need_glsl130 = out_type == GL_INT || out_type == GL_UNSIGNED_INT; + + if (need_glsl130) { + piglit_require_gl_version(30); + } /* Total number of triangles drawn */ num_tris = 7; - static const char *vert = - "#version 130\n" - "in vec2 pos_within_tri;\n" - "in vec3 in_barycentric_coords;\n" - "out vec3 barycentric_coords;\n" + static const char *vert_template = + "#version %s\n" + "attribute vec2 pos_within_tri;\n" + "attribute vec3 in_barycentric_coords;\n" + "varying vec3 barycentric_coords;\n" "uniform float rotation;\n" "uniform float vert_depth;\n" "uniform mat4 proj;\n" @@ -1099,17 +1105,23 @@ void Sunburst::compile() "}\n"; static const char *frag_template = - "#version 130\n" + "#version %s\n" "#define OUT_TYPE %s\n" "#define COMPUTE_DEPTH %s\n" "uniform float frag_depth;\n" - "in vec3 barycentric_coords;\n" + "varying vec3 barycentric_coords;\n" "uniform mat3x4 draw_colors;\n" - "out OUT_TYPE frag_out;\n" + "#if __VERSION__ == 130\n" + " out OUT_TYPE frag_out;\n" + "#endif\n" "\n" "void main()\n" "{\n" + "#if __VERSION__ == 130\n" " frag_out = OUT_TYPE(draw_colors * barycentric_coords);\n" + "#else\n" + " gl_FragColor = draw_colors * barycentric_coords;\n" + "#endif\n" "#if COMPUTE_DEPTH\n" " gl_FragDepth = (frag_depth + 1.0) / 2.0;\n" "#endif\n" @@ -1117,20 +1129,30 @@ void Sunburst::compile() /* Compile program */ prog = glCreateProgram(); + unsigned vert_alloc_len = + strlen(vert_template) + 4; + char *vert = (char *) malloc(vert_alloc_len); + sprintf(vert, vert_template, need_glsl130 ? "130" : "120"); GLint vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vert); + free(vert); glAttachShader(prog, vs); + const char *out_type_glsl = get_out_type_glsl(); unsigned frag_alloc_len = - strlen(frag_template) + strlen(out_type_glsl) + 1; + strlen(frag_template) + strlen(out_type_glsl) + 4; char *frag = (char *) malloc(frag_alloc_len); - sprintf(frag, frag_template, out_type_glsl, + sprintf(frag, frag_template, need_glsl130 ? "130" : "120", + out_type_glsl, compute_depth ? "1" : "0"); GLint fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, frag); free(frag); glAttachShader(prog, fs); + glBindAttribLocation(prog, 0, "pos_within_tri"); glBindAttribLocation(prog, 1, "in_barycentric_coords"); - glBindFragDataLocation(prog, 0, "frag_out"); + if (need_glsl130) { + glBindFragDataLocation(prog, 0, "frag_out"); + } glLinkProgram(prog); if (!piglit_link_check_status(prog)) { piglit_report_result(PIGLIT_FAIL); @@ -1197,8 +1219,8 @@ ColorGradientSunburst::draw_with_scale_and_offset(const float (*proj)[4], } case GL_UNSIGNED_NORMALIZED: case GL_FLOAT: { - float clear_color[4] = { offset, offset, offset, offset }; - glClearBufferfv(GL_COLOR, 0, clear_color); + glClearColor(offset, offset, offset, offset); + glClear(GL_COLOR_BUFFER_BIT); break; } default: diff --git a/tests/spec/ext_framebuffer_multisample/draw-buffers-alpha-to-coverage.cpp b/tests/spec/ext_framebuffer_multisample/draw-buffers-alpha-to-coverage.cpp index aab156f4..45876306 100644 --- a/tests/spec/ext_framebuffer_multisample/draw-buffers-alpha-to-coverage.cpp +++ b/tests/spec/ext_framebuffer_multisample/draw-buffers-alpha-to-coverage.cpp @@ -79,7 +79,9 @@ piglit_init(int argc, char **argv) print_usage_and_exit(argv[0]); } - piglit_require_gl_version(30); + piglit_require_gl_version(21); + piglit_require_extension("GL_ARB_framebuffer_object"); + piglit_require_extension("GL_ARB_vertex_array_object"); int pattern_width = piglit_width / 2; int pattern_height = piglit_height / num_attachments; diff --git a/tests/spec/ext_framebuffer_multisample/draw-buffers-alpha-to-one.cpp b/tests/spec/ext_framebuffer_multisample/draw-buffers-alpha-to-one.cpp index 5256fc9a..bd574db1 100644 --- a/tests/spec/ext_framebuffer_multisample/draw-buffers-alpha-to-one.cpp +++ b/tests/spec/ext_framebuffer_multisample/draw-buffers-alpha-to-one.cpp @@ -100,7 +100,9 @@ piglit_init(int argc, char **argv) print_usage_and_exit(argv[0]); } - piglit_require_gl_version(30); + piglit_require_gl_version(21); + piglit_require_extension("GL_ARB_framebuffer_object"); + piglit_require_extension("GL_ARB_vertex_array_object"); int pattern_width = piglit_width / 2; int pattern_height = piglit_height / num_attachments; diff --git a/tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp b/tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp index 3831720d..5382ef4e 100644 --- a/tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp +++ b/tests/spec/ext_framebuffer_multisample/draw-buffers-common.cpp @@ -107,9 +107,9 @@ static const GLenum draw_buffers[] = { /* Offset the viewport transformation on depth value passed to the vertex * shader by setting it to (2 * depth - 1.0). */ -static const char *vert = - "#version 130\n" - "in vec2 pos;\n" +static const char *vert_template = + "#version %s\n" + "attribute vec2 pos;\n" "uniform float depth;\n" "void main()\n" "{\n" @@ -122,13 +122,19 @@ static const char *vert = * are enabled or not. */ static const char *frag_template = - "#version 130\n" + "#version %s\n" "#define DUAL_SRC_BLEND %d\n" "#define ALPHA_TO_COVERAGE %d\n" "#define OUT_TYPE %s\n" + "#if __VERSION__ == 130\n" "out OUT_TYPE frag_out_0;\n" "out vec4 frag_out_1;\n" "out vec4 frag_out_2;\n" + "#else\n" + "#define frag_out_0 gl_FragData[0]\n" + "#define frag_out_1 gl_FragData[1]\n" + "#define frag_out_2 gl_FragData[2]\n" + "#endif\n" "uniform OUT_TYPE frag_0_color;\n" "uniform vec4 color;\n" "void main()\n" @@ -155,16 +161,28 @@ get_out_type_glsl(void) void shader_compile(bool sample_alpha_to_coverage, bool dual_src_blend) { + bool need_glsl130 = is_buffer_zero_integer_format || dual_src_blend; + + if (need_glsl130) { + piglit_require_gl_version(30); + } + is_dual_src_blending = dual_src_blend; + /* Compile program */ + unsigned vert_alloc_len = strlen(vert_template) + 4; + char *vert = (char *) malloc(vert_alloc_len); + sprintf(vert, vert_template, need_glsl130 ? "130" : "120"); GLint vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vert); + free(vert); /* Generate appropriate fragment shader program */ - const char *out_type_glsl = get_out_type_glsl();; + const char *out_type_glsl = get_out_type_glsl(); unsigned frag_alloc_len = strlen(frag_template) + - strlen(out_type_glsl) + 1; + strlen(out_type_glsl) + 4; char *frag = (char *) malloc(frag_alloc_len); - sprintf(frag, frag_template, is_dual_src_blending, + sprintf(frag, frag_template, need_glsl130 ? "130" : "120", + is_dual_src_blending, sample_alpha_to_coverage, out_type_glsl); GLint fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, frag); @@ -175,18 +193,20 @@ shader_compile(bool sample_alpha_to_coverage, bool dual_src_blend) } free(frag); - if (is_dual_src_blending) { - glBindFragDataLocationIndexed(prog, 0, 0, "frag_out_0"); - glBindFragDataLocationIndexed(prog, 0, 1, "frag_out_1"); + if (need_glsl130) { + if (is_dual_src_blending) { + glBindFragDataLocationIndexed(prog, 0, 0, "frag_out_0"); + glBindFragDataLocationIndexed(prog, 0, 1, "frag_out_1"); + } + else if (num_draw_buffers > 1) { + glBindFragDataLocation(prog, 0, "frag_out_0"); + glBindFragDataLocation(prog, 1, "frag_out_1"); + glBindFragDataLocation(prog, 2, "frag_out_2"); + } + else + glBindFragDataLocation(prog, 0, "frag_out_0"); } - else if (num_draw_buffers > 1) { - glBindFragDataLocation(prog, 0, "frag_out_0"); - glBindFragDataLocation(prog, 1, "frag_out_1"); - glBindFragDataLocation(prog, 2, "frag_out_2"); - } - else - glBindFragDataLocation(prog, 0, "frag_out_0"); glBindAttribLocation(prog, 0, "pos"); glEnableVertexAttribArray(0); diff --git a/tests/spec/ext_framebuffer_multisample/enable-flag.cpp b/tests/spec/ext_framebuffer_multisample/enable-flag.cpp index edf0d9ad..05a8064a 100644 --- a/tests/spec/ext_framebuffer_multisample/enable-flag.cpp +++ b/tests/spec/ext_framebuffer_multisample/enable-flag.cpp @@ -84,7 +84,9 @@ Triangles triangles; extern "C" void piglit_init(int argc, char **argv) { - piglit_require_gl_version(30); + piglit_require_gl_version(21); + piglit_require_extension("GL_ARB_framebuffer_object"); + piglit_require_extension("GL_ARB_vertex_array_object"); GLint max_samples; glGetIntegerv(GL_MAX_SAMPLES, &max_samples); diff --git a/tests/spec/ext_framebuffer_multisample/formats.cpp b/tests/spec/ext_framebuffer_multisample/formats.cpp index 1947c483..7d739491 100644 --- a/tests/spec/ext_framebuffer_multisample/formats.cpp +++ b/tests/spec/ext_framebuffer_multisample/formats.cpp @@ -169,11 +169,13 @@ PatternRenderer::try_setup(GLenum internalformat) color_clamping_mode = GL_FIXED_ONLY; switch (component_type) { case GL_INT: + assert(test_pattern_ivec4); test_pattern = test_pattern_ivec4; color_offset = 1.0 - pow(2.0, color_bits[0] - 1); color_scale = -2.0 * color_offset; break; case GL_UNSIGNED_INT: + assert(test_pattern_uvec4); test_pattern = test_pattern_uvec4; color_scale = pow(2.0, color_bits[0]) - 1.0; color_offset = 0.0; @@ -453,6 +455,11 @@ test_format(const struct format_desc *format) { bool pass = true; + if (format->internalformat == 3 || + format->internalformat == 4) { + return PIGLIT_SKIP; + } + /* Caller messes with the clear color. Reset it to the * default. */ @@ -574,7 +581,9 @@ piglit_init(int argc, char **argv) if (argc == 3) test_set = fbo_lookup_test_set(argv[2]); - piglit_require_gl_version(30); + piglit_require_gl_version(21); + piglit_require_extension("GL_ARB_framebuffer_object"); + piglit_require_extension("GL_ARB_vertex_array_object"); /* Skip the test if num_samples > GL_MAX_SAMPLES */ GLint max_samples; @@ -586,10 +595,12 @@ piglit_init(int argc, char **argv) GL_TRUE /* print_options */); test_pattern_vec4 = new ColorGradientSunburst(GL_UNSIGNED_NORMALIZED); test_pattern_vec4->compile(); - test_pattern_ivec4 = new ColorGradientSunburst(GL_INT); - test_pattern_ivec4->compile(); - test_pattern_uvec4 = new ColorGradientSunburst(GL_UNSIGNED_INT); - test_pattern_uvec4->compile(); + if (piglit_get_gl_version() >= 30) { + test_pattern_ivec4 = new ColorGradientSunburst(GL_INT); + test_pattern_ivec4->compile(); + test_pattern_uvec4 = new ColorGradientSunburst(GL_UNSIGNED_INT); + test_pattern_uvec4->compile(); + } } extern "C" enum piglit_result diff --git a/tests/spec/ext_framebuffer_multisample/interpolation.cpp b/tests/spec/ext_framebuffer_multisample/interpolation.cpp index 841e0e1e..559487d2 100644 --- a/tests/spec/ext_framebuffer_multisample/interpolation.cpp +++ b/tests/spec/ext_framebuffer_multisample/interpolation.cpp @@ -167,8 +167,8 @@ bool disable_msaa_during_test_image = false; * each triangle. */ const char *frag_non_centroid_barycentric = - "#version 130\n" - "in vec3 barycentric_coords;\n" + "#version 120\n" + "varying vec3 barycentric_coords;\n" "\n" "void main()\n" "{\n" @@ -182,8 +182,8 @@ const char *frag_non_centroid_barycentric = * triangle. */ const char *frag_centroid_barycentric = - "#version 130\n" - "centroid in vec3 barycentric_coords_centroid;\n" + "#version 120\n" + "centroid varying vec3 barycentric_coords_centroid;\n" "\n" "void main()\n" "{\n" @@ -197,8 +197,8 @@ const char *frag_centroid_barycentric = * barycentric coordinates is outside the range [0, 1]. */ const char *frag_centroid_range_check = - "#version 130\n" - "centroid in vec3 barycentric_coords_centroid;\n" + "#version 120\n" + "centroid varying vec3 barycentric_coords_centroid;\n" "\n" "void main()\n" "{\n" @@ -218,8 +218,8 @@ const char *frag_centroid_range_check = * are non-centroid interpolated. */ const char *frag_non_centroid_deriv = - "#version 130\n" - "in vec2 pixel_pos;\n" + "#version 120\n" + "varying vec2 pixel_pos;\n" "\n" "void main()\n" "{\n" @@ -237,8 +237,8 @@ const char *frag_non_centroid_deriv = * are non-centroid interpolated. */ const char *frag_centroid_deriv = - "#version 130\n" - "centroid in vec2 pixel_pos_centroid;\n" + "#version 120\n" + "centroid varying vec2 pixel_pos_centroid;\n" "\n" "void main()\n" "{\n" @@ -254,8 +254,8 @@ const char *frag_centroid_deriv = * tolerance. */ const char *frag_centroid_deriv_range_check = - "#version 130\n" - "centroid in vec2 pixel_pos_centroid;\n" + "#version 120\n" + "centroid varying vec2 pixel_pos_centroid;\n" "\n" "void main()\n" "{\n" @@ -272,7 +272,7 @@ const char *frag_centroid_deriv_range_check = * frag_centroid_range_check and frag_centroid_deriv_range_check). */ const char *frag_blue = - "#version 130\n" + "#version 120\n" "\n" "void main()\n" "{\n" @@ -286,7 +286,7 @@ const char *frag_blue = * frag_centroid_deriv). */ const char *frag_rg_0_5 = - "#version 130\n" + "#version 120\n" "\n" "void main()\n" "{\n" @@ -359,7 +359,9 @@ piglit_init(int argc, char **argv) print_usage_and_exit(argv[0]); } - piglit_require_gl_version(30); + piglit_require_gl_version(21); + piglit_require_extension("GL_ARB_framebuffer_object"); + piglit_require_extension("GL_ARB_vertex_array_object"); /* Skip the test if num_samples > GL_MAX_SAMPLES */ GLint max_samples; diff --git a/tests/spec/ext_framebuffer_multisample/line-smooth.cpp b/tests/spec/ext_framebuffer_multisample/line-smooth.cpp index 4fe9554e..2fb1b68b 100644 --- a/tests/spec/ext_framebuffer_multisample/line-smooth.cpp +++ b/tests/spec/ext_framebuffer_multisample/line-smooth.cpp @@ -81,7 +81,10 @@ piglit_init(int argc, char **argv) print_usage_and_exit(argv[0]); } - piglit_require_gl_version(30); + piglit_require_gl_version(21); + piglit_require_extension("GL_ARB_framebuffer_object"); + piglit_require_extension("GL_ARB_vertex_array_object"); + glClear(GL_COLOR_BUFFER_BIT); /* Skip the test if num_samples > GL_MAX_SAMPLES */ diff --git a/tests/spec/ext_framebuffer_multisample/multisample-blit.cpp b/tests/spec/ext_framebuffer_multisample/multisample-blit.cpp index a6935624..ed547984 100644 --- a/tests/spec/ext_framebuffer_multisample/multisample-blit.cpp +++ b/tests/spec/ext_framebuffer_multisample/multisample-blit.cpp @@ -79,8 +79,9 @@ piglit_init(int argc, char **argv) print_usage_and_exit(argv[0]); } - piglit_require_gl_version(30); - piglit_require_GLSL_version(130); + piglit_require_gl_version(21); + piglit_require_extension("GL_ARB_framebuffer_object"); + piglit_require_extension("GL_ARB_vertex_array_object"); /* Skip the test if num_samples > GL_MAX_SAMPLES */ GLint max_samples; diff --git a/tests/spec/ext_framebuffer_multisample/negative-readpixels.c b/tests/spec/ext_framebuffer_multisample/negative-readpixels.c index 1152a4c4..09c87352 100644 --- a/tests/spec/ext_framebuffer_multisample/negative-readpixels.c +++ b/tests/spec/ext_framebuffer_multisample/negative-readpixels.c @@ -59,7 +59,6 @@ piglit_init(int argc, char **argv) GLint max_samples; GLuint rb, fb; GLenum status; - bool pass = true; float data[4]; piglit_require_extension("GL_EXT_framebuffer_multisample"); @@ -94,5 +93,5 @@ piglit_init(int argc, char **argv) glDeleteRenderbuffersEXT(1, &rb); glDeleteFramebuffersEXT(1, &fb); - piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL); + piglit_report_result(PIGLIT_PASS); } diff --git a/tests/spec/ext_framebuffer_multisample/no-color.cpp b/tests/spec/ext_framebuffer_multisample/no-color.cpp index 7ebdcbdd..df796fc9 100644 --- a/tests/spec/ext_framebuffer_multisample/no-color.cpp +++ b/tests/spec/ext_framebuffer_multisample/no-color.cpp @@ -155,8 +155,9 @@ piglit_init(int argc, char **argv) print_usage_and_exit(argv[0]); } - piglit_require_gl_version(30); - piglit_require_GLSL_version(130); + piglit_require_gl_version(21); + piglit_require_extension("GL_ARB_framebuffer_object"); + piglit_require_extension("GL_ARB_vertex_array_object"); /* Skip the test if num_samples > GL_MAX_SAMPLES */ GLint max_samples; diff --git a/tests/spec/ext_framebuffer_multisample/point-smooth.cpp b/tests/spec/ext_framebuffer_multisample/point-smooth.cpp index a596b80c..21643890 100644 --- a/tests/spec/ext_framebuffer_multisample/point-smooth.cpp +++ b/tests/spec/ext_framebuffer_multisample/point-smooth.cpp @@ -81,7 +81,10 @@ piglit_init(int argc, char **argv) print_usage_and_exit(argv[0]); } - piglit_require_gl_version(30); + piglit_require_gl_version(21); + piglit_require_extension("GL_ARB_framebuffer_object"); + piglit_require_extension("GL_ARB_vertex_array_object"); + glClear (GL_COLOR_BUFFER_BIT); /* Skip the test if num_samples > GL_MAX_SAMPLES */ diff --git a/tests/spec/ext_framebuffer_multisample/polygon-smooth.cpp b/tests/spec/ext_framebuffer_multisample/polygon-smooth.cpp index b8b018bf..fe197faa 100644 --- a/tests/spec/ext_framebuffer_multisample/polygon-smooth.cpp +++ b/tests/spec/ext_framebuffer_multisample/polygon-smooth.cpp @@ -81,7 +81,9 @@ piglit_init(int argc, char **argv) print_usage_and_exit(argv[0]); } - piglit_require_gl_version(30); + piglit_require_gl_version(21); + piglit_require_extension("GL_ARB_framebuffer_object"); + piglit_require_extension("GL_ARB_vertex_array_object"); /* Skip the test if num_samples > GL_MAX_SAMPLES */ GLint max_samples; diff --git a/tests/spec/ext_framebuffer_multisample/polygon-stipple.cpp b/tests/spec/ext_framebuffer_multisample/polygon-stipple.cpp index 578ac604..947829f7 100644 --- a/tests/spec/ext_framebuffer_multisample/polygon-stipple.cpp +++ b/tests/spec/ext_framebuffer_multisample/polygon-stipple.cpp @@ -97,8 +97,8 @@ static GLubyte stipple_pattern[] = }; static const char *vert = - "#version 130\n" - "in vec2 pos;\n" + "#version 120\n" + "attribute vec2 pos;\n" "uniform float depth;\n" "void main()\n" "{\n" @@ -107,7 +107,7 @@ static const char *vert = "}\n"; static const char *frag = - "#version 130\n" + "#version 120\n" "uniform vec4 color;\n" "void main()\n" "{\n" @@ -224,7 +224,10 @@ piglit_init(int argc, char **argv) print_usage_and_exit(argv[0]); } - piglit_require_gl_version(30); + piglit_require_gl_version(21); + piglit_require_extension("GL_ARB_framebuffer_object"); + piglit_require_extension("GL_ARB_vertex_array_object"); + piglit_ortho_projection(pattern_width, pattern_height, GL_TRUE); /* Skip the test if num_samples > GL_MAX_SAMPLES */ diff --git a/tests/spec/ext_framebuffer_multisample/sample-alpha-to-coverage.cpp b/tests/spec/ext_framebuffer_multisample/sample-alpha-to-coverage.cpp index a0b4377a..3301c3af 100644 --- a/tests/spec/ext_framebuffer_multisample/sample-alpha-to-coverage.cpp +++ b/tests/spec/ext_framebuffer_multisample/sample-alpha-to-coverage.cpp @@ -71,7 +71,11 @@ piglit_init(int argc, char **argv) { const int num_attachments = 1; int samples; - piglit_require_gl_version(30); + + piglit_require_gl_version(21); + piglit_require_extension("GL_ARB_framebuffer_object"); + piglit_require_extension("GL_ARB_vertex_array_object"); + if (argc < 3) print_usage_and_exit(argv[0]); { diff --git a/tests/spec/ext_framebuffer_multisample/sample-alpha-to-one.cpp b/tests/spec/ext_framebuffer_multisample/sample-alpha-to-one.cpp index 100e2881..9ccc3941 100644 --- a/tests/spec/ext_framebuffer_multisample/sample-alpha-to-one.cpp +++ b/tests/spec/ext_framebuffer_multisample/sample-alpha-to-one.cpp @@ -71,7 +71,9 @@ piglit_init(int argc, char **argv) print_usage_and_exit(argv[0]); } - piglit_require_gl_version(30); + piglit_require_gl_version(21); + piglit_require_extension("GL_ARB_framebuffer_object"); + piglit_require_extension("GL_ARB_vertex_array_object"); int pattern_width = piglit_width / 2; int pattern_height = piglit_height / num_attachments; diff --git a/tests/spec/ext_framebuffer_multisample/sample-coverage.cpp b/tests/spec/ext_framebuffer_multisample/sample-coverage.cpp index 1838f8eb..b0d5ebd2 100644 --- a/tests/spec/ext_framebuffer_multisample/sample-coverage.cpp +++ b/tests/spec/ext_framebuffer_multisample/sample-coverage.cpp @@ -91,8 +91,8 @@ static int depth_loc; static const float bg_color[4] = { 0.4, 0.6, 0.0, 0.8 }; static const char *vert = - "#version 130\n" - "in vec2 pos;\n" + "#version 120\n" + "attribute vec2 pos;\n" "uniform float depth;\n" "void main()\n" "{\n" @@ -101,7 +101,7 @@ static const char *vert = "}\n"; static const char *frag = - "#version 130\n" + "#version 120\n" "uniform vec4 color;\n" "void main()\n" "{\n" @@ -369,7 +369,10 @@ piglit_init(int argc, char **argv) coverage_invert = false; } - piglit_require_gl_version(30); + piglit_require_gl_version(21); + piglit_require_extension("GL_ARB_framebuffer_object"); + piglit_require_extension("GL_ARB_vertex_array_object"); + piglit_ortho_projection(pattern_width, pattern_height, GL_TRUE); /* Skip the test if samples > GL_MAX_SAMPLES */ diff --git a/tests/spec/ext_framebuffer_multisample/turn-on-off.cpp b/tests/spec/ext_framebuffer_multisample/turn-on-off.cpp index 8d5ed9e9..4a2b558e 100644 --- a/tests/spec/ext_framebuffer_multisample/turn-on-off.cpp +++ b/tests/spec/ext_framebuffer_multisample/turn-on-off.cpp @@ -136,7 +136,9 @@ piglit_init(int argc, char **argv) print_usage_and_exit(argv[0]); } - piglit_require_gl_version(30); + piglit_require_gl_version(21); + piglit_require_extension("GL_ARB_framebuffer_object"); + piglit_require_extension("GL_ARB_vertex_array_object"); /* Skip the test if num_samples > GL_MAX_SAMPLES */ glGetIntegerv(GL_MAX_SAMPLES, &max_samples); diff --git a/tests/spec/ext_framebuffer_multisample/unaligned-blit.cpp b/tests/spec/ext_framebuffer_multisample/unaligned-blit.cpp index ad4c944f..d322799c 100644 --- a/tests/spec/ext_framebuffer_multisample/unaligned-blit.cpp +++ b/tests/spec/ext_framebuffer_multisample/unaligned-blit.cpp @@ -125,7 +125,9 @@ piglit_init(int argc, char **argv) if (endptr != argv[1] + strlen(argv[1])) print_usage_and_exit(argv[0]); - piglit_require_gl_version(30); + piglit_require_gl_version(21); + piglit_require_extension("GL_ARB_framebuffer_object"); + piglit_require_extension("GL_ARB_vertex_array_object"); /* Skip the test if num_samples > GL_MAX_SAMPLES */ GLint max_samples; diff --git a/tests/spec/ext_framebuffer_multisample/upsample.cpp b/tests/spec/ext_framebuffer_multisample/upsample.cpp index 48f436b2..4a01e7ed 100644 --- a/tests/spec/ext_framebuffer_multisample/upsample.cpp +++ b/tests/spec/ext_framebuffer_multisample/upsample.cpp @@ -94,8 +94,9 @@ piglit_init(int argc, char **argv) print_usage_and_exit(argv[0]); } - piglit_require_gl_version(30); - piglit_require_GLSL_version(130); + piglit_require_gl_version(21); + piglit_require_extension("GL_ARB_framebuffer_object"); + piglit_require_extension("GL_ARB_vertex_array_object"); /* Skip the test if num_samples > GL_MAX_SAMPLES */ GLint max_samples; diff --git a/tests/spec/ext_timer_query/CMakeLists.gl.txt b/tests/spec/ext_timer_query/CMakeLists.gl.txt index 04af60f5..f7019ad0 100644 --- a/tests/spec/ext_timer_query/CMakeLists.gl.txt +++ b/tests/spec/ext_timer_query/CMakeLists.gl.txt @@ -12,3 +12,5 @@ link_libraries ( IF (UNIX) piglit_add_executable (ext_timer_query-time-elapsed time-elapsed.c) ENDIF (UNIX) + + piglit_add_executable (ext_timer_query-lifetime lifetime.c) diff --git a/tests/spec/ext_timer_query/lifetime.c b/tests/spec/ext_timer_query/lifetime.c new file mode 100644 index 00000000..557d6260 --- /dev/null +++ b/tests/spec/ext_timer_query/lifetime.c @@ -0,0 +1,101 @@ +/* + * Copyright © 2009,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. + * + * Authors: + * Ian Romanick <ian.d.romanick@intel.com> + * Carl Worth <cworth@cworth.org> + */ + +/** + * \file lifetime.c + * + * Ensure that glIsQuery reports correct values throughout each stage + * of a timer query's lifetime. + */ + +#include "piglit-util-gl-common.h" + +PIGLIT_GL_TEST_CONFIG_BEGIN + + config.supports_gl_compat_version = 10; + + config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_DEPTH; + +PIGLIT_GL_TEST_CONFIG_END + +/* Check is glIsQuery() for 'query' returns 'expected' + */ +static bool +is_query_matches(GLuint query, GLboolean expected, const char *lifetime) +{ + int is_query = glIsQuery(query); + + if (is_query != expected) { + printf("glIsQuery returned %d (expected %d) %s\n", + is_query, expected, lifetime); + return false; + } + + return true; +} + +enum piglit_result +piglit_display(void) +{ + int test_pass = 1; + GLuint query; + GLint result; + + piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + /* Guaranteed to be random, see: http://xkcd.com/221 + */ + query = 3243; + test_pass &= is_query_matches(query, 0, "with un-generated name"); + + glGenQueries(1, &query); + test_pass &= is_query_matches(query, 0, "after glGenQueries"); + + glQueryCounter(query, GL_TIMESTAMP); + test_pass &= is_query_matches(query, 1, "after glQueryCounter"); + + /* Do a little drawing at least */ + glColor3ub(0x00, 0xff, 0x00); + piglit_draw_rect(0, 0, piglit_width, piglit_height); + + glGetQueryObjectiv(query, GL_QUERY_RESULT, &result); + test_pass &= is_query_matches(query, 1, "after glGetQueryObjectiv"); + + glDeleteQueries(1, &query); + test_pass &= is_query_matches(query, 0, "after glDeleteQueries"); + + piglit_present_results(); + + return test_pass ? PIGLIT_PASS : PIGLIT_FAIL; +} + +void +piglit_init(int argc, char **argv) +{ + piglit_require_extension("GL_ARB_timer_query"); +} diff --git a/tests/spec/glsl-1.10/execution/clipping/clip-plane-transformation.c b/tests/spec/glsl-1.10/execution/clipping/clip-plane-transformation.c index 62c4d7bf..9844bc3a 100644 --- a/tests/spec/glsl-1.10/execution/clipping/clip-plane-transformation.c +++ b/tests/spec/glsl-1.10/execution/clipping/clip-plane-transformation.c @@ -174,8 +174,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_compat_version = 10; - config.window_width = 100; - config.window_height = 100; config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE; PIGLIT_GL_TEST_CONFIG_END diff --git a/tests/spec/glsl-1.10/execution/varying-packing/simple.c b/tests/spec/glsl-1.10/execution/varying-packing/simple.c index 1b6f9396..f7fd6483 100644 --- a/tests/spec/glsl-1.10/execution/varying-packing/simple.c +++ b/tests/spec/glsl-1.10/execution/varying-packing/simple.c @@ -101,8 +101,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_compat_version = 10; - config.window_width = 100; - config.window_height = 100; config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE; PIGLIT_GL_TEST_CONFIG_END diff --git a/tests/spec/glsl-1.20/recursion/recursion.c b/tests/spec/glsl-1.20/recursion/recursion.c index 5ccd292b..0862e7cd 100644 --- a/tests/spec/glsl-1.20/recursion/recursion.c +++ b/tests/spec/glsl-1.20/recursion/recursion.c @@ -53,8 +53,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_compat_version = 10; - config.window_width = 100; - config.window_height = 100; config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_DOUBLE; PIGLIT_GL_TEST_CONFIG_END diff --git a/tests/spec/glsl-1.30/execution/isinf-and-isnan.c b/tests/spec/glsl-1.30/execution/isinf-and-isnan.c index 36a078bc..08079edc 100644 --- a/tests/spec/glsl-1.30/execution/isinf-and-isnan.c +++ b/tests/spec/glsl-1.30/execution/isinf-and-isnan.c @@ -114,8 +114,6 @@ PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_compat_version = 10; - config.window_width = 100; - config.window_height = 100; config.window_visual = PIGLIT_GL_VISUAL_RGB | PIGLIT_GL_VISUAL_ALPHA | PIGLIT_GL_VISUAL_DOUBLE; PIGLIT_GL_TEST_CONFIG_END diff --git a/tests/spec/glsl-1.50/compiler/no-statement-before-first-case.vert b/tests/spec/glsl-1.50/compiler/no-statement-before-first-case.vert new file mode 100644 index 00000000..3cff8e7e --- /dev/null +++ b/tests/spec/glsl-1.50/compiler/no-statement-before-first-case.vert @@ -0,0 +1,24 @@ +#version 150 + +/* [config] + * expect_result: fail + * glsl_version: 1.50 + * [end config] + * + * Page 66 of the OpenGL Shading Language 1.50 spec says: + * + * "No statements are allowed in a switch statement before the first case + * statement." + */ + +uniform int x; + +void main() +{ + switch (x) { + gl_Position = vec4(0.); + default: + gl_Position = vec4(1.); + break; + } +} diff --git a/tests/spec/glsl-1.50/execution/sanity.shader_test b/tests/spec/glsl-1.50/execution/sanity.shader_test new file mode 100644 index 00000000..cd8331dc --- /dev/null +++ b/tests/spec/glsl-1.50/execution/sanity.shader_test @@ -0,0 +1,44 @@ +# Fill the window with red, then green, then blue. + +[require] +GL >= 3.1 +GLSL >= 1.50 + +[vertex shader] +#version 150 + +in vec4 vertex; + +void main() { + gl_Position = vertex; +} + +[fragment shader] +#version 150 + +uniform vec4 u_color; +out vec4 color; + +void main() { + color = u_color; +} + +[vertex data] +vertex/float/2 +-1.0 -1.0 + 1.0 -1.0 + 1.0 1.0 +-1.0 1.0 + +[test] +uniform vec4 u_color 1.0 0.0 0.0 1.0 +draw arrays GL_TRIANGLE_FAN 0 4 +probe all rgba 1.0 0.0 0.0 1.0 + +uniform vec4 u_color 0.0 1.0 0.0 1.0 +draw arrays GL_TRIANGLE_FAN 0 4 +probe all rgba 0.0 1.0 0.0 1.0 + +uniform vec4 u_color 0.0 0.0 1.0 1.0 +draw arrays GL_TRIANGLE_FAN 0 4 +probe all rgba 0.0 0.0 1.0 1.0 diff --git a/tests/util/piglit-util-gl-common.c b/tests/util/piglit-util-gl-common.c index 92a0a4d3..7674d4eb 100644 --- a/tests/util/piglit-util-gl-common.c +++ b/tests/util/piglit-util-gl-common.c @@ -538,13 +538,13 @@ void piglit_gen_ortho_uniform(GLint location, double l, double r, double b, double t, double n, double f) { - float values[4][4] = { + const GLfloat values[4][4] = { { 2/(r-l), 0, 0, -(r+l)/(r-l) }, { 0, 2/(t-b), 0, -(t+b)/(t-b) }, { 0, 0, -2/(f-n), -(f+n)/(f-n) }, { 0, 0, 0, 1 } }; - glUniformMatrix4fv(location, 1, GL_TRUE, values); + glUniformMatrix4fv(location, 1, GL_TRUE, (const GLfloat *)values); } |