[Piglit] [PATCH] glsl: update assumption in array out of bounds test

Timothy Arceri tarceri at itsqueeze.com
Thu Mar 30 23:53:42 UTC 2017


Section 5.7 of the GLSL 4.5 spec says:

   "Behavior is undefined if a shader subscripts an array with an
   index less than 0 or greater than or equal to the size the array
   was declared with."

So we cannot be sure which path the shader will take. Update the
test so that both branches end in the same result.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96684
---
 tests/shaders/glsl-array-bounds-01.shader_test | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/shaders/glsl-array-bounds-01.shader_test b/tests/shaders/glsl-array-bounds-01.shader_test
index 2e7c762..a06fef7 100644
--- a/tests/shaders/glsl-array-bounds-01.shader_test
+++ b/tests/shaders/glsl-array-bounds-01.shader_test
@@ -15,21 +15,21 @@ void main()
  */
 #version 120
 
 float array[] = float [] (1.0, 2.0, 3.0, 4.0);
 
 void main()
 {
    int idx = 20;
 
    if (array[idx] == 5.0)
-      gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
+      gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
    else
       gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
 }
 
 [test]
 clear color 0.0 0.0 0.0 0.0
 clear
 ortho
 draw rect 10 10 10 10
 probe rgb 15 15 0.0 1.0 0.0
-- 
2.9.3



More information about the Piglit mailing list