When the extension was folded in, glDrawPixels of integer formats was disallowed. Disable the GL_EXT_texture_integer if 3.0 is exposed, and replace it with a simple "make sure it throws the error" API test.
I think actually the intent was that this is a correction to EXT_texture_integer, because I don't see how it was actually supposed to work back then (see comment in fbo-integer-precision-drawpixels). --- tests/all.tests | 1 + tests/spec/ext_texture_integer/api-drawpixels.c | 5 + .../fbo-integer-precision-drawpixels.c | 30 +++++++ tests/spec/gl-3.0/api/CMakeLists.gl.txt | 1 + tests/spec/gl-3.0/api/drawpixels-integer.c | 86 ++++++++++++++++++++ 5 files changed, 123 insertions(+), 0 deletions(-) create mode 100644 tests/spec/gl-3.0/api/drawpixels-integer.c diff --git a/tests/all.tests b/tests/all.tests index bbd31f1..96d2f51 100644 --- a/tests/all.tests +++ b/tests/all.tests @@ -800,6 +800,7 @@ add_concurrent_test(gl30, 'clearbuffer-invalid-drawbuffer') add_concurrent_test(gl30, 'clearbuffer-invalid-buffer') add_concurrent_test(gl30, 'clearbuffer-stencil') add_concurrent_test(gl30, 'getfragdatalocation') +add_concurrent_test(gl30, 'gl-3.0-drawpixels-integer') add_concurrent_test(gl30, 'gl-3.0-required-sized-texture-formats') add_concurrent_test(gl30, 'gl-3.0-required-renderbuffer-attachment-formats') add_concurrent_test(gl30, 'gl-3.0-required-texture-attachment-formats') diff --git a/tests/spec/ext_texture_integer/api-drawpixels.c b/tests/spec/ext_texture_integer/api-drawpixels.c index adf311e..eb91718 100644 --- a/tests/spec/ext_texture_integer/api-drawpixels.c +++ b/tests/spec/ext_texture_integer/api-drawpixels.c @@ -54,5 +54,10 @@ piglit_display(void) void piglit_init(int argc, char **argv) { + if (GLEW_VERSION_3_0) { + printf("See tests/spec/gl-3.0/api/drawpixels-integer.c\n"); + piglit_report_result(PIGLIT_SKIP); + } + piglit_require_extension("GL_EXT_texture_integer"); } diff --git a/tests/spec/ext_texture_integer/fbo-integer-precision-drawpixels.c b/tests/spec/ext_texture_integer/fbo-integer-precision-drawpixels.c index 5a341f7..fe1a0b2 100644 --- a/tests/spec/ext_texture_integer/fbo-integer-precision-drawpixels.c +++ b/tests/spec/ext_texture_integer/fbo-integer-precision-drawpixels.c @@ -283,6 +283,36 @@ piglit_init(int argc, char **argv) piglit_require_extension("GL_EXT_texture_integer"); piglit_require_GLSL_version(130); + if (GLEW_VERSION_3_0) { + /* The EXT_texture_integer spec doesn't explicitly + * disallow glDrawPixels with integer components, and + * specifies a couple of error cases, e.g. in + * "Rasterization of Pixel Rectangles": + * + * "If format is one of the integer component + * formats as defined in table 3.6 and type is + * FLOAT, the error INVALID ENUM occurs." + * + * while in Section 3.7.4 of the GL 3.0 specification + * (20080923, page 149), a new restriction has been + * added: + * + * "If format contains integer components, as + * shown in table 3.6, an INVALID OPERATION error + * is generated." + * + * The GL 3.0 behavior is tested in + * gl-3.0/api/drawpixels-integer.c. This restriction + * persists through GL 3.3 compatibility specs and + * presumably into the future. It makes sense, + * because how is the non-normalized integer value + * supposed to be assigned to the floating-point + * gl_Color input of the fragment shader? + */ + printf("GL 3.0 obsoletes this test\n"); + piglit_report_result(PIGLIT_SKIP); + } + PassthroughFragShader = piglit_compile_shader_text(GL_FRAGMENT_SHADER, PassthroughFragShaderText); assert(PassthroughFragShader); diff --git a/tests/spec/gl-3.0/api/CMakeLists.gl.txt b/tests/spec/gl-3.0/api/CMakeLists.gl.txt index 466ffeb..2cb72aa 100644 --- a/tests/spec/gl-3.0/api/CMakeLists.gl.txt +++ b/tests/spec/gl-3.0/api/CMakeLists.gl.txt @@ -19,5 +19,6 @@ add_executable (clearbuffer-invalid-drawbuffer clearbuffer-invalid-drawbuffer.c) add_executable (clearbuffer-invalid-buffer clearbuffer-invalid-buffer.c) add_executable (clearbuffer-stencil clearbuffer-common.c clearbuffer-stencil.c) add_executable (getfragdatalocation getfragdatalocation.c) +add_executable (gl-3.0-drawpixels-integer drawpixels-integer.c) # vim: ft=cmake: diff --git a/tests/spec/gl-3.0/api/drawpixels-integer.c b/tests/spec/gl-3.0/api/drawpixels-integer.c new file mode 100644 index 0000000..bc6aa68 --- /dev/null +++ b/tests/spec/gl-3.0/api/drawpixels-integer.c @@ -0,0 +1,86 @@ +/* + * Copyright © 2011 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. + */ + +/** + * @file drawpixels-integer.c + * + * Tests the GL 3.0 error behavior of glDrawPixels(), which is more + * restrictive than the original GL_EXT_texture_integer spec. + */ + +#include "piglit-util.h" + +int piglit_width = 10, piglit_height = 10; +int piglit_window_mode = GLUT_RGB | GLUT_ALPHA | GLUT_DOUBLE; + +enum piglit_result +piglit_display(void) +{ + static const int black[4] = {0, 0, 0, 0}; + static const float green[4] = {0, 1, 0, 0}; + bool pass; + + /* We don't have to do an integer FBO for this test, because + * no error is specified in the non-integer case: + * + * "Results of rasterization are undefined if any of the + * selected draw buffers of the draw framebuffer have an + * integer format and no fragment shader is active. " + */ + glClearColor(0.0, 1.0, 0.0, 0.0); + glClear(GL_COLOR_BUFFER_BIT); + + /* GL 3.0 introduced a new restriction on glDrawPixels() over + * what was in GL_EXT_texture_integer. From section 3.7.4 + * ("Rasterization of Pixel Rectangles) on page 151 of the GL + * 3.0 specification: + * + * "If format contains integer components, as shown in + * table 3.6, an INVALID OPERATION error is generated." + */ + glDrawPixels(1, 1, GL_RGBA_INTEGER_EXT, GL_UNSIGNED_INT, black); + piglit_check_gl_error(GL_INVALID_OPERATION, PIGLIT_FAIL); + + /* This precedes the restriction from GL_EXT_texture_integer + * which is still included in that section: + * + * "If format is one of the integer component formats as + * defined in table 3.6 and type is FLOAT, the error + * INVALID ENUM occurs." + * + * Based on this, we test for GL_INVALID_OPERATION even for FLOAT. + */ + glDrawPixels(1, 1, GL_RGBA_INTEGER_EXT, GL_FLOAT, black); + piglit_check_gl_error(GL_INVALID_OPERATION, PIGLIT_FAIL); + + /* Make sure that we really didn't render anything. */ + pass = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height, green); + + return pass ? PIGLIT_PASS : PIGLIT_FAIL; +} + +void +piglit_init(int argc, char **argv) +{ + piglit_require_gl_version(30); +} -- 1.7.7.3 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev