[Piglit] [PATCH 2/2] arb_shader_subroutine: Call a subroutine by the type name instead of by uniform name

Ian Romanick idr at freedesktop.org
Thu Jan 14 16:23:59 PST 2016


From: Ian Romanick <ian.d.romanick at intel.com>

This should be a compilation error because it shouldn't be able to find
a function prototype.  At least that's my understanding of the spec.

This was accidentally discovered while trying to reproduce bug #93722.

NOTE: This test fails on Mesa.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Cc: Dave Airlie <airlied at redhat.com>
---
 .../compiler/call-subroutine-type-name.frag        | 30 ++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 tests/spec/arb_shader_subroutine/compiler/call-subroutine-type-name.frag

diff --git a/tests/spec/arb_shader_subroutine/compiler/call-subroutine-type-name.frag b/tests/spec/arb_shader_subroutine/compiler/call-subroutine-type-name.frag
new file mode 100644
index 0000000..2cfc908
--- /dev/null
+++ b/tests/spec/arb_shader_subroutine/compiler/call-subroutine-type-name.frag
@@ -0,0 +1,30 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_shader_subroutine
+// [end config]
+
+#version 150
+#extension GL_ARB_shader_subroutine: require
+
+uniform vec4 u;
+out vec4 piglit_fragcolor;
+subroutine vec4 func_type(vec4 color);
+
+subroutine uniform func_type f;
+
+subroutine(func_type) float R(vec4 p)
+{
+    return p.r;
+}
+
+subroutine(func_type) float G(vec4 p)
+{
+    return p.g;
+}
+
+void main()
+{
+    // This should be f(u).  You can't call subroutine type name.
+    piglit_fragcolor = func_type(u);
+}
-- 
2.5.0



More information about the Piglit mailing list