From: Roland Scheidegger <[email protected]> The logic failed whenever the random number was 0 for formats which don't have an alpha channel. In this case all of expected/bias/value were 0 but the actual correct read back value is 1.0 (default value for alpha channel sampling for integer textures is 1 just like it is 1.0 for ordinary texture formats).
Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Jose Fonseca <[email protected]> Edited-by: Carl Worth <[email protected]> Use integer literals, not floating-point to assign to integer array. Add a comment describing the tweak of values for texture formats without some channels. --- I just ran into this same problem with this test, (lucky me, I got a value of 0 for alpha from "rand() % max"), and needed to chase down this fix. This fix should be applied right away. But we should also seriously consider updating this test so that's behavior is deterministic. One option would be to just using something like this to replace rand(): static unsigned long next = 1; /* RAND_MAX assumed to be 32767 */ int myrand(void) { next = next * 1103515245 + 12345; return((unsigned)(next/65536) % 32768); } [From Linux man-pages RAND(3)] -Carl .../ext_texture_integer/texture-integer-glsl130.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/tests/spec/ext_texture_integer/texture-integer-glsl130.c b/tests/spec/ext_texture_integer/texture-integer-glsl130.c index 17b02bc..2d392bc 100644 --- a/tests/spec/ext_texture_integer/texture-integer-glsl130.c +++ b/tests/spec/ext_texture_integer/texture-integer-glsl130.c @@ -358,7 +358,16 @@ test_format(const struct format_info *info) expected[2] = 0.75; expected[3] = 1.00; - /* need to swizzle things depending on texture format */ + /* Need to swizzle things depending on texture format. + * + * Also, for texture formats with no storage for a particular + * channel, instead of reading the randomly-chosen value + * above, we need to expect to read a 0, (for Green or Blue + * channels), or a 1 (for Alpha). + * + * Note: The alpha value read is an integer 1, not a + * maximum-valued integer representing 1.0. + */ switch (info->BaseFormat) { case GL_RGBA_INTEGER_EXT: /* nothing */ @@ -373,10 +382,11 @@ test_format(const struct format_info *info) value[0] = temp; break; case GL_RGB_INTEGER_EXT: - expected[3] = 0.0; + value[3] = 1; break; case GL_RG_INTEGER: - expected[2] = expected[3] = 0.0; + value[2] = 0; + value[3] = 1; break; case GL_ALPHA_INTEGER_EXT: expected[0] = expected[1] = expected[2] = 0.0; @@ -404,7 +414,8 @@ test_format(const struct format_info *info) expected[0] = expected[1] = expected[2] = expected[3] = 0.25; value[1] = value[2] = value[3] = value[0]; } else { - expected[1] = expected[2] = expected[3] = 0.0; + value[1] = value[2] = 0; + value[3] = 1; } break; default: -- 1.7.10.4 _______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
