[Piglit] [PATCH] glsl: Adds a test that checks correct regalloc with varying pack in i965

Vincent Lejeune vljn at ovi.com
Thu Feb 16 06:57:56 PST 2012


---
 .../glsl-varyings-packing-arrays.shader_test       |   75 ++++++++++++++++++++
 1 files changed, 75 insertions(+), 0 deletions(-)
 create mode 100644 tests/shaders/glsl-varyings-packing-arrays.shader_test

diff --git a/tests/shaders/glsl-varyings-packing-arrays.shader_test b/tests/shaders/glsl-varyings-packing-arrays.shader_test
new file mode 100644
index 0000000..9345c4d
--- /dev/null
+++ b/tests/shaders/glsl-varyings-packing-arrays.shader_test
@@ -0,0 +1,75 @@
+[require]
+GLSL >= 1.10
+
+[vertex shader]
+/* The varyings declaration layout in this shader can
+ * exhibit a wrong behavior in initial implementation of horizontal
+ * location of i965 : only the first declared varying type was taken
+ * into account when sharing a location, making bigger or overlapping
+ * varying array be assigned non contiguous (and thus, false) location
+ */
+
+varying float a[10];
+varying float b[8];
+varying float c[8];
+
+void main()
+{
+	gl_Position = gl_Vertex;
+	float index = 0.0;
+
+	for (int i = 0; i < 10; i++) {
+		a[i] = index;
+		index ++;
+	}
+
+	for (int i = 0; i < 8; i++) {
+		b[i] = index;
+		index ++;
+	}
+
+	for (int i = 0; i < 8; i++) {
+		c[i] = index;
+		index ++;
+	}
+}
+
+[fragment shader]
+varying float a[10];
+varying float b[8];
+varying float c[8];
+
+void main()
+{
+	bool pass = true;
+
+
+	float index = 0.0;
+
+	for (int i = 0; i < 10; i++) {
+		if (a[i] != index)
+			pass = false;
+		index ++;
+	}
+
+	for (int i = 0; i < 8; i++) {
+		if (b[i] != index)
+			pass = false;
+		index ++;
+	}
+
+	for (int i = 0; i < 8; i++) {
+		if (c[i] != index)
+			pass = false;
+		index ++;
+	}
+
+	if (pass)
+		gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
+	else
+		gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
+}
+
+[test]
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
-- 
1.7.7



More information about the Piglit mailing list