On 07/14/2015 08:34 AM, Jose Fonseca wrote:
Similar to glsl-vs-arrays, but due to optimizations, glsl-vs-arrays
actually ends up doing indirection of the CONST registers, not TEMP.

VMWARE PR 1470667.
---
  tests/shaders/glsl-vs-arrays-rw.shader_test | 37 +++++++++++++++++++++++++++++
  1 file changed, 37 insertions(+)
  create mode 100644 tests/shaders/glsl-vs-arrays-rw.shader_test

diff --git a/tests/shaders/glsl-vs-arrays-rw.shader_test 
b/tests/shaders/glsl-vs-arrays-rw.shader_test
new file mode 100644
index 0000000..1009388
--- /dev/null
+++ b/tests/shaders/glsl-vs-arrays-rw.shader_test
@@ -0,0 +1,37 @@
+[require]
+GLSL >= 1.10
+
+[vertex shader]
+/* VS array access (read-write) from temps using a varying
+ * array indices.
+ */
+uniform float one;
+uniform int writeIndex;
+uniform int readIndex;
+varying vec4 color;
+void main()
+{
+       vec4 colors[4];
+       colors[0] = vec4(0.0, 0.0, 0.0, 0.0);
+       colors[1] = vec4(0.0, 0.0, 0.0, 0.0);
+       colors[2] = vec4(0.0, 0.0, 0.0, 0.0);
+       colors[3] = vec4(0.0, 0.0, 0.0, 0.0);
+
+       gl_Position = gl_Vertex;
+
+       colors[writeIndex] = vec4(1.0, 1.0, 1.0, 1.0);
+       color = colors[readIndex];
+}
+
+[fragment shader]
+varying vec4 color;
+void main()
+{
+       gl_FragColor = color;
+}
+
+[test]
+uniform int readIndex 0.0
+uniform int writeIndex 0.0
+draw rect -1 -1 2 2
+relative probe rgb (0.0, 0.0) (1.0, 1.0, 1.0, 1.0)


Even better would be to declare two arrays so that we're sure to have an array whose storage does not start at TEMP[0]. That'll exercise a few more aspects of array indexing. I have such a test that I'll send you.

-Brian

_______________________________________________
Piglit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to