[Piglit] [PATCH v2 2/2] shaders: add test to check (x+y cmp 0) optimization

Samuel Iglesias Gonsalvez siglesias at igalia.com
Sun Mar 1 23:31:10 PST 2015


Signed-off-by: Samuel Iglesias Gonsalvez <siglesias at igalia.com>
---

v2:
* Implement it as shader_runner test

 tests/shaders/glsl-opt-xy-cmp-0.shader_test | 33 +++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 tests/shaders/glsl-opt-xy-cmp-0.shader_test

diff --git a/tests/shaders/glsl-opt-xy-cmp-0.shader_test b/tests/shaders/glsl-opt-xy-cmp-0.shader_test
new file mode 100644
index 0000000..97aa1fe
--- /dev/null
+++ b/tests/shaders/glsl-opt-xy-cmp-0.shader_test
@@ -0,0 +1,33 @@
+/* Test (x+y cmp 0) optimization. */
+
+[require]
+GLSL >= 1.10
+
+[vertex shader]
+
+void main()
+{
+	gl_Position = ftransform();
+}
+
+[fragment shader]
+
+uniform float a;
+
+void main()
+{
+	if ((a - 1.0) >= 0.0)
+	    gl_FragColor = vec4(0, 1, 0, 1);
+	else
+	    gl_FragColor = vec4(1, 0, 0, 1);
+}
+
+[test]
+clear color 0.5 0.5 0.5 0.5
+clear
+uniform float a 0
+draw rect -1 -1 1 2
+uniform float a 2
+draw rect 0 -1 1 2
+probe rgb 125 0 0.0 1.0 0.0
+probe rgb 0 0 1.0 0.0 0.0
-- 
2.1.4



More information about the Piglit mailing list