[Piglit] [PATCH] fs-texelFetchOffset-2D: don't assume undefined values to be solid black
Jose Fonseca
jfonseca at vmware.com
Thu Nov 29 03:32:21 PST 2012
Commmited.
Roland, please file a fdo bug requesting commit access for future changes.
Jose
----- Original Message -----
> From: Roland Scheidegger <sroland at vmware.com>
>
> core GL specifies out-of-bound texel fetches return undefined
> results,
> except in a robust context with ARB_robust_buffer_access_behavior
> supported
> (which is core in 4.3), in which case texel fetch will return 0
> (OpenGL 4.3
> compatibility profile, page 387, subsection 11.1.3.2 Texel Fetches).
> Since the test requires neither robust context nor that extension it
> cannot
> assume any specific result value. In any case even returning zero is
> not what
> the test expected, since it wanted [0,0,0,1] instead.
> (With this change softpipe passes the test, as it clamps the coords.)
>
> v2: fix black->undefined, formatting, comments
> ---
> .../glsl-1.30/execution/fs-texelFetchOffset-2D.c | 29
> ++++++++++++++++----
> 1 file changed, 23 insertions(+), 6 deletions(-)
>
> diff --git a/tests/spec/glsl-1.30/execution/fs-texelFetchOffset-2D.c
> b/tests/spec/glsl-1.30/execution/fs-texelFetchOffset-2D.c
> index 19e3654..8bdca7a 100644
> --- a/tests/spec/glsl-1.30/execution/fs-texelFetchOffset-2D.c
> +++ b/tests/spec/glsl-1.30/execution/fs-texelFetchOffset-2D.c
> @@ -76,7 +76,7 @@ piglit_display(void)
> bool pass = true;
> float red[4] = {1.0, 0.0, 0.0, 1.0};
> float blue[4] = {0.0, 0.0, 1.0, 1.0};
> - float black[4] = {0.0, 0.0, 0.0, 1.0};
> + float undefined[4] = {0.0, 0.0, 0.0, 0.0};
>
> glClearColor(0.5, 0.5, 0.5, 1.0);
> glClear(GL_COLOR_BUFFER_BIT);
> @@ -92,12 +92,29 @@ piglit_display(void)
> for (q = 0; q < 4; q++) {
> const int tex_x = (q / 2) * ((width / 2));
> const int tex_y = (q % 2) * ((height / 2));
> - float *c = black;
> + float *c = undefined;
> const int x = 10+20*q;
>
> - /* fancy stuff - we should see red and blue
> - due to the offset for 3 levels,
> - otherwise we get lots of black border color */
> + /* fancy stuff - we should see some red and blue
> + * due to the offset for 3 levels, all the rest is
> + * undefined due to out-of-bounds.
> + * Only with ARB_robust_buffer_access_behavior
> + * (and a robust context) the undefined result would
> + * be guaranteed to be zero instead.
> + *
> + * From the GL 3.0 spec, page 105 ("Texel Fetches"):
> + *
> + * "The results of the texel fetch are
> + * undefined if any of the following
> + * conditions hold:
> + *
> + * ...
> + *
> + * - The texel coordinates refer to a
> + * border texel outside of the defined
> + * extents of the specified LOD"
> + */
> +
> if (l < 3) {
> if (q == 2) c = red;
> else if (q == 3) c = blue;
> @@ -107,7 +124,7 @@ piglit_display(void)
> piglit_Uniform2i(pos_location, tex_x, tex_y);
> piglit_draw_rect(x, y, 10, 10);
>
> - if (width > 2) /* below 1 wide no test */
> + if (width > 2 && c != undefined) /* below 1 wide no test */
> pass &= piglit_probe_rect_rgba(x, y, 10, 10, c);
> }
> }
> --
> 1.7.9.5
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
>
More information about the Piglit
mailing list