[Piglit] [PATCH 1/2] fbo-integer-precision-drawpixels: Delete this broken test.
Eric Anholt
eric at anholt.net
Thu Dec 1 20:28:31 PST 2011
Regardless of the resolution of "should glDrawPixels(integer format)
be allowed at all?", this test is broken because it is testing the
behavior of rendering with a fragment shader producing a floating
point color into an integer renderbuffer. From the
EXT_texture_integer spec:
" The color components used for per-fragment operations and written into a
color buffer are undefined:
* for fixed-function fragment processing with an integer color buffer,
* for fragment shaders that write floating-point color components to an
integer color buffer, or..."
---
tests/all.tests | 1 -
tests/spec/ext_texture_integer/CMakeLists.gl.txt | 1 -
.../fbo-integer-precision-drawpixels.c | 294 --------------------
3 files changed, 0 insertions(+), 296 deletions(-)
delete mode 100644 tests/spec/ext_texture_integer/fbo-integer-precision-drawpixels.c
diff --git a/tests/all.tests b/tests/all.tests
index 61a020d..a7101d4 100644
--- a/tests/all.tests
+++ b/tests/all.tests
@@ -1239,7 +1239,6 @@ ext_texture_integer['api-drawpixels'] = concurrent_test('ext_texture_integer-api
ext_texture_integer['api-teximage'] = concurrent_test('ext_texture_integer-api-teximage')
ext_texture_integer['api-readpixels'] = concurrent_test('ext_texture_integer-api-readpixels')
ext_texture_integer['fbo_integer_precision_clear'] = plain_test('ext_texture_integer-fbo_integer_precision_clear')
-ext_texture_integer['fbo_integer_precision_drawpixels'] = plain_test('ext_texture_integer-fbo_integer_precision_drawpixels')
ext_texture_integer['fbo_integer_readpixels_sint_uint'] = plain_test('ext_texture_integer-fbo_integer_readpixels_sint_uint')
ext_texture_integer['texture_integer_glsl130'] = concurrent_test('ext_texture_integer-texture_integer_glsl130')
diff --git a/tests/spec/ext_texture_integer/CMakeLists.gl.txt b/tests/spec/ext_texture_integer/CMakeLists.gl.txt
index 39ec8e5..52ca4f2 100644
--- a/tests/spec/ext_texture_integer/CMakeLists.gl.txt
+++ b/tests/spec/ext_texture_integer/CMakeLists.gl.txt
@@ -14,7 +14,6 @@ link_libraries (
)
add_executable (ext_texture_integer-fbo_integer_precision_clear fbo-integer-precision-clear.c)
-add_executable (ext_texture_integer-fbo_integer_precision_drawpixels fbo-integer-precision-drawpixels.c)
add_executable (ext_texture_integer-fbo_integer_readpixels_sint_uint fbo-integer-readpixels-sint-uint.c)
add_executable (ext_texture_integer-texture_integer_glsl130 texture-integer-glsl130.c)
add_executable (ext_texture_integer-api-drawpixels api-drawpixels.c)
diff --git a/tests/spec/ext_texture_integer/fbo-integer-precision-drawpixels.c b/tests/spec/ext_texture_integer/fbo-integer-precision-drawpixels.c
deleted file mode 100644
index 5a341f7..0000000
--- a/tests/spec/ext_texture_integer/fbo-integer-precision-drawpixels.c
+++ /dev/null
@@ -1,294 +0,0 @@
-/*
- * Copyright (c) 2010 VMware, Inc.
- * Copyright (c) 2011 Dave Airlie
- *
- * 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
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, 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
- * NON-INFRINGEMENT. IN NO EVENT SHALL VMWARE AND/OR THEIR SUPPLIERS
- * 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 fbo-integer-precision-drawpixels.c
- *
- * Tests FBO integer glDrawPixels() with a value that is outside a
- * float precision, if any part of the stack does an int->float
- * conversion this test will fail also tests read/draw pixels paths.
- */
-
-
-#include "piglit-util.h"
-
-int piglit_width = 100, piglit_height = 100;
-int piglit_window_mode = GLUT_RGB | GLUT_ALPHA | GLUT_DOUBLE;
-
-static const char *TestName = "fbo-integer-precision-clear";
-
-static GLint TexWidth = 256, TexHeight = 256;
-
-struct format_info
-{
- const char *Name;
- GLenum IntFormat, BaseFormat;
- GLuint BitsPerChannel;
- GLboolean Signed;
-};
-
-/* Only test 32-bit formats - since you won't see precision problems on lower sizes */
-static const struct format_info Formats[] = {
- { "GL_RGBA32I_EXT", GL_RGBA32I_EXT, GL_RGBA_INTEGER_EXT, 32, GL_TRUE },
- { "GL_RGBA32UI_EXT", GL_RGBA32UI_EXT, GL_RGBA_INTEGER_EXT, 32, GL_FALSE },
-
- { "GL_RGB32I_EXT", GL_RGB32I_EXT, GL_RGB_INTEGER_EXT, 32, GL_TRUE },
- { "GL_RGB32UI_EXT", GL_RGB32UI_EXT, GL_RGB_INTEGER_EXT, 32, GL_FALSE },
-};
-
-#define NUM_FORMATS (sizeof(Formats) / sizeof(Formats[0]))
-
-/* For glDrawPixels */
-static const char *PassthroughFragShaderText =
- "void main() \n"
- "{ \n"
- " gl_FragColor = gl_Color; \n"
- "} \n";
-
-static GLuint PassthroughFragShader, PassthroughProgram;
-
-static int
-get_max_val(const struct format_info *info)
-{
- int max;
-
- switch (info->BitsPerChannel) {
- case 32:
- if (info->Signed)
- max = 300000000; /* don't use 0x8fffffff to avoid overflow issues */
- else
- max = 200000000;
- break;
- default:
- assert(0);
- max = 0;
- }
-
- return max;
-}
-
-
-static int
-num_components(GLenum format)
-{
- switch (format) {
- case GL_RGBA:
- case GL_RGBA_INTEGER_EXT:
- return 4;
- case GL_RGB_INTEGER_EXT:
- return 3;
- case GL_ALPHA_INTEGER_EXT:
- return 1;
- case GL_LUMINANCE_INTEGER_EXT:
- return 1;
- case GL_LUMINANCE_ALPHA_INTEGER_EXT:
- return 2;
- case GL_RED_INTEGER_EXT:
- return 1;
- default:
- assert(0);
- return 0;
- }
-}
-
-
-static GLenum
-get_datatype(const struct format_info *info)
-{
- switch (info->BitsPerChannel) {
- case 8:
- return info->Signed ? GL_BYTE : GL_UNSIGNED_BYTE;
- case 16:
- return info->Signed ? GL_SHORT : GL_UNSIGNED_SHORT;
- case 32:
- return info->Signed ? GL_INT : GL_UNSIGNED_INT;
- default:
- assert(0);
- return 0;
- }
-}
-
-
-static GLboolean
-check_error(const char *file, int line)
-{
- GLenum err = glGetError();
- if (err) {
- fprintf(stderr, "%s: error 0x%x at %s:%d\n",
- TestName, err, file, line);
- return GL_TRUE;
- }
- return GL_FALSE;
-}
-
-
-/** \return GL_TRUE for pass, GL_FALSE for fail */
-static GLboolean
-test_fbo(const struct format_info *info)
-{
- const int max = get_max_val(info);
- const int comps = num_components(info->BaseFormat);
- const GLenum type = get_datatype(info);
- GLint f;
- GLuint fbo, texObj;
- GLenum status;
- GLboolean intMode;
- GLint buf;
-#define W 15
-#define H 10
- GLint image[H * W * 4], readback[H * W * 4];
- GLint i;
-
- if (0)
- fprintf(stderr, "============ Testing format = %s ========\n",
- info->Name);
-
- /* Create texture */
- glGenTextures(1, &texObj);
- glBindTexture(GL_TEXTURE_2D, texObj);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
-
- glTexImage2D(GL_TEXTURE_2D, 0, info->IntFormat, TexWidth, TexHeight, 0,
- info->BaseFormat, type, NULL);
-
- if (check_error(__FILE__, __LINE__))
- return GL_FALSE;
-
- glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_INTERNAL_FORMAT,
- &f);
- assert(f == info->IntFormat);
-
-
- /* Create FBO to render to texture */
- glGenFramebuffers(1, &fbo);
- glBindFramebuffer(GL_FRAMEBUFFER, fbo);
- glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
- GL_TEXTURE_2D, texObj, 0);
-
- if (check_error(__FILE__, __LINE__))
- return GL_FALSE;
-
- status = glCheckFramebufferStatus(GL_FRAMEBUFFER_EXT);
- if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
- fprintf(stderr, "%s: failure: framebuffer incomplete.\n",
- TestName);
- return GL_FALSE;
- }
-
- glGetBooleanv(GL_RGBA_INTEGER_MODE_EXT, &intMode);
- if (check_error(__FILE__, __LINE__))
- return GL_FALSE;
- if (!intMode) {
- fprintf(stderr,
- "%s: GL_RGBA_INTEGER_MODE_EXT return GL_FALSE\n",
- TestName);
- return GL_FALSE;
- }
-
- glGetIntegerv(GL_READ_BUFFER, &buf);
- assert(buf == GL_COLOR_ATTACHMENT0_EXT);
- glGetIntegerv(GL_DRAW_BUFFER, &buf);
- assert(buf == GL_COLOR_ATTACHMENT0_EXT);
-
- /* Do glDraw/ReadPixels test */
- if (info->Signed) {
- for (i = 0; i < W * H * 4; i++) {
- image[i] = ((i - 10) % max) + max;
- }
- }
- else {
- for (i = 0; i < W * H * 4; i++) {
- image[i] = ((i + 3) % max) + max;
- }
- }
-
- glUseProgram(PassthroughProgram);
-
- glWindowPos2i(1, 1);
- glDrawPixels(W, H, GL_RGBA_INTEGER_EXT, GL_INT, image);
-
- if (check_error(__FILE__, __LINE__))
- return GL_FALSE;
-
- glReadPixels(1, 1, W, H, GL_RGBA_INTEGER_EXT, GL_INT, readback);
-
- if (check_error(__FILE__, __LINE__))
- return GL_FALSE;
-
- for (i = 0; i < W * H * 4; i++) {
- if (readback[i] != image[i]) {
- /* alpha = 1 if base format == RGB */
- if (comps == 3 && i % 4 == 3 &&
- readback[i] == 1)
- continue;
-
- fprintf(stderr,
- "%s: glDraw/ReadPixels failed at %d. "
- "Expected %d, found %d\n",
- TestName, i, image[i], readback[i]);
- fprintf(stderr, "Texture format = %s\n",
- info->Name);
- return GL_FALSE;
- }
- }
-
- piglit_present_results();
-
- glDeleteTextures(1, &texObj);
- glDeleteFramebuffers(1, &fbo);
-
- return GL_TRUE;
-}
-
-
-enum piglit_result
-piglit_display(void)
-{
- int f;
- for (f = 0; f < NUM_FORMATS; f++) {
- GLboolean pass = test_fbo(&Formats[f]);
- if (!pass)
- return PIGLIT_FAIL;
- }
- return PIGLIT_PASS;
-}
-
-
-void
-piglit_init(int argc, char **argv)
-{
- piglit_require_extension("GL_EXT_texture_integer");
- piglit_require_GLSL_version(130);
-
- PassthroughFragShader = piglit_compile_shader_text(GL_FRAGMENT_SHADER,
- PassthroughFragShaderText);
- assert(PassthroughFragShader);
- PassthroughProgram = piglit_link_simple_program(0, PassthroughFragShader);
-
- (void) check_error(__FILE__, __LINE__);
-
- piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
-}
--
1.7.7.3
More information about the Piglit
mailing list