[Piglit] [PATCH] arb_shader_subroutine: add a vertex shader test

Dave Airlie airlied at gmail.com
Wed Sep 30 17:58:33 PDT 2015


From: Dave Airlie <airlied at redhat.com>

This tests vertex shaders work with shader subroutine.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 .../execution/vs-simple-subroutine.shader-test     | 52 ++++++++++++++++++++++
 1 file changed, 52 insertions(+)
 create mode 100644 tests/spec/arb_shader_subroutine/execution/vs-simple-subroutine.shader-test

diff --git a/tests/spec/arb_shader_subroutine/execution/vs-simple-subroutine.shader-test b/tests/spec/arb_shader_subroutine/execution/vs-simple-subroutine.shader-test
new file mode 100644
index 0000000..1dfe6d3
--- /dev/null
+++ b/tests/spec/arb_shader_subroutine/execution/vs-simple-subroutine.shader-test
@@ -0,0 +1,52 @@
+# simple test using one shader subroutine.
+[require]
+GLSL >= 1.50
+GL_ARB_shader_subroutine
+
+[vertex shader]
+#version 150
+#extension GL_ARB_shader_subroutine: enable
+
+in vec4 piglit_vertex;
+out vec4 fcolor;
+subroutine vec4 getcolor();
+subroutine uniform getcolor GetColor;
+
+subroutine(getcolor)
+vec4 color_red()
+{
+	return vec4(1.0, 0.0, 0.0, 1.0);
+}
+
+subroutine(getcolor)
+vec4 color_green()
+{
+	return vec4(0.0, 1.0, 0.0, 1.0);
+}
+
+void main()
+{
+	gl_Position = piglit_vertex;
+	fcolor = GetColor();
+}
+
+[fragment shader]
+#version 150
+
+in vec4 fcolor;
+out vec4 color;
+
+void main()
+{
+	color = fcolor;
+}
+
+[test]
+clear color 0.0 0.0 1.0 0.0
+clear
+subuniform GL_VERTEX_SHADER GetColor color_red
+draw rect -1 -1 2 2
+probe all rgba 1.0 0.0 0.0 1.0
+subuniform GL_VERTEX_SHADER GetColor color_green
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
-- 
2.4.3



More information about the Piglit mailing list