summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2016-01-14 16:07:26 -0800
committerIan Romanick <ian.d.romanick@intel.com>2016-01-20 16:36:30 -0800
commitbf441e2c6981ed89c2163bc989371641800c03b6 (patch)
treeaca2e7b053e63fe1003e3c3c160fdd6115e4b8bd
parentd87159e42658b1ca4046183ce5505078a26ee9ed (diff)
arb_shader_subroutine: Call a subroutine by the type name instead of by uniform name
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. v2: Fix bad assignment to piglit_fragcolor. Noticed by Ilia. Also fix the type of func_type to match the functions. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> [v1] Cc: Dave Airlie <airlied@redhat.com>
-rw-r--r--tests/spec/arb_shader_subroutine/compiler/call-subroutine-type-name.frag30
1 files changed, 30 insertions, 0 deletions
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 000000000..d00336952
--- /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 vec2 u;
+out vec4 piglit_fragcolor;
+subroutine vec4 func_type(vec2 p);
+
+subroutine uniform func_type f;
+
+subroutine(func_type) vec4 R(vec2 p)
+{
+ return vec4(p.r);
+}
+
+subroutine(func_type) vec4 G(vec2 p)
+{
+ return vec4(p.g);
+}
+
+void main()
+{
+ // This should be f(u). You can't call subroutine type name.
+ piglit_fragcolor = func_type(u);
+}