summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2012-02-23 13:32:49 -0800
committerEric Anholt <eric@anholt.net>2012-02-29 15:39:42 -0800
commit8ee32d3b944733d05fbca151f29b04717ebed85c (patch)
treea2dbd50d15f5c0d4938a22db7c3257a43349ccc9
parent867f77023322247493ee78d6f763bb90dfac8804 (diff)
glsl-vs-deadcode-*: New tests for changes to Mesa's opt_dead_code_local.cpp.
The second test is a slight strip-down of a glean test that regressed. The first was just what I wrote to first look at the implementation. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
-rw-r--r--tests/shaders/glsl-vs-deadcode-1.shader_test37
-rw-r--r--tests/shaders/glsl-vs-deadcode-2.shader_test34
2 files changed, 71 insertions, 0 deletions
diff --git a/tests/shaders/glsl-vs-deadcode-1.shader_test b/tests/shaders/glsl-vs-deadcode-1.shader_test
new file mode 100644
index 000000000..134ade301
--- /dev/null
+++ b/tests/shaders/glsl-vs-deadcode-1.shader_test
@@ -0,0 +1,37 @@
+[require]
+GLSL >= 1.10
+
+[vertex shader]
+varying vec4 color;
+uniform vec4 v4;
+uniform vec3 v3;
+uniform vec2 v2;
+uniform float v1;
+
+void main()
+{
+ gl_Position = gl_Vertex;
+
+ color.xyzw = v4;
+ color.xyz = v3;
+ color.xy = v2;
+ color.x = v1;
+}
+
+[fragment shader]
+varying vec4 color;
+
+void main()
+{
+ gl_FragColor = color;
+}
+
+[test]
+uniform vec4 v4 0.9 0.9 0.9 0.4
+uniform vec3 v3 0.9 0.9 0.3
+uniform vec2 v2 0.9 0.2
+uniform float v1 0.1
+
+draw rect -1 -1 2 2
+
+probe all rgba 0.1 0.2 0.3 0.4
diff --git a/tests/shaders/glsl-vs-deadcode-2.shader_test b/tests/shaders/glsl-vs-deadcode-2.shader_test
new file mode 100644
index 000000000..47d5e9d25
--- /dev/null
+++ b/tests/shaders/glsl-vs-deadcode-2.shader_test
@@ -0,0 +1,34 @@
+[require]
+GLSL >= 1.10
+
+[vertex shader]
+varying vec3 color;
+uniform vec4 v1;
+uniform float v2;
+uniform float v3;
+
+void main()
+{
+ gl_Position = gl_Vertex;
+
+ color.xyz = v1.xyz;
+ color.y = v2;
+ color.z = v3;
+}
+
+[fragment shader]
+varying vec3 color;
+
+void main()
+{
+ gl_FragColor = vec4(color, 0.4);
+}
+
+[test]
+uniform vec4 v1 0.1 0.9 0.9
+uniform float v2 0.2
+uniform float v3 0.3
+
+draw rect -1 -1 2 2
+
+probe all rgba 0.1 0.2 0.3 0.4