summaryrefslogtreecommitdiff
path: root/tests/spec/glsl-1.30
diff options
context:
space:
mode:
authorRoland Scheidegger <sroland@vmware.com>2012-11-29 00:12:36 +0100
committerJosé Fonseca <jfonseca@vmware.com>2012-11-29 11:29:51 +0000
commit5f9439564af85291229f3083fc7f3c18651da1c2 (patch)
tree6fc70b8f8eea33a2c345b696808cb3d736e18217 /tests/spec/glsl-1.30
parent4d84f3e7f5a647a78e8d80fc0b49d33f678794b6 (diff)
fs-texelFetchOffset-2D: don't assume undefined values to be solid black
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 Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: José Fonseca <jfonseca@vmware.com>
Diffstat (limited to 'tests/spec/glsl-1.30')
-rw-r--r--tests/spec/glsl-1.30/execution/fs-texelFetchOffset-2D.c29
1 files 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 19e3654ff..8bdca7ac9 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);
}
}