[Piglit] [PATCH] fs-texelFetchOffset-2D: don't assume undefined values to be solid black

sroland at vmware.com sroland at vmware.com
Mon Nov 26 15:31:24 PST 2012


From: Roland Scheidegger <sroland at vmware.com>

core GL specifies out-of-bound accesses have undefined behavior,
which includes crashes.
Crashes are very much undesired, but ARB_robustness still allows undefined
values to be returned (with a recommendation to return 0).
Only ARB_robust_buffer_access_behavior would require to return zero, but the
test doesn't need this extension. In any case even returning zero is not what
the test expected, since it wanted [0,0,0,1].
(With this change softpipe passes the test, as it clamps the coords.)
---
 .../glsl-1.30/execution/fs-texelFetchOffset-2D.c   |    6 +++---
 1 file changed, 3 insertions(+), 3 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..f61dfce 100644
--- a/tests/spec/glsl-1.30/execution/fs-texelFetchOffset-2D.c
+++ b/tests/spec/glsl-1.30/execution/fs-texelFetchOffset-2D.c
@@ -96,8 +96,8 @@ piglit_display(void)
 			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 */
 			if (l < 3) {
 				if (q == 2) c = red;
 				else if (q == 3) c = blue;
@@ -107,7 +107,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 != black) /* 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