[Piglit] [PATCH 2/3 v2] 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:57:20 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.
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 at intel.com>
Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu> [v1]
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..d003369
--- /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);
+}
--
2.5.0
More information about the Piglit
mailing list