[Piglit] [PATCH] fs-texelFetchOffset-2D: don't assume undefined values to be solid black
sroland at vmware.com
sroland at vmware.com
Tue Nov 27 14:20:15 PST 2012
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 | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 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..de9a0f5 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,15 @@ 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 */
+ 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. */
if (l < 3) {
if (q == 2) c = red;
else if (q == 3) c = blue;
@@ -107,7 +110,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
More information about the Piglit
mailing list