diff mbox

[4/4] arb_arrays_of_arrays: simple subroutine execution test

Message ID 1438735003-10626-4-git-send-email-t_arceri@yahoo.com.au
State New
Headers show

Commit Message

'Timothy Arceri' via Patchwork Forward Aug. 5, 2015, 12:36 a.m. UTC
---
 .../subroutines/fs-subroutine.shader_test          | 63 ++++++++++++++++++++++
 1 file changed, 63 insertions(+)
 create mode 100644 tests/spec/arb_arrays_of_arrays/execution/subroutines/fs-subroutine.shader_test
diff mbox

Patch

diff --git a/tests/spec/arb_arrays_of_arrays/execution/subroutines/fs-subroutine.shader_test b/tests/spec/arb_arrays_of_arrays/execution/subroutines/fs-subroutine.shader_test
new file mode 100644
index 0000000..bc779ef
--- /dev/null
+++ b/tests/spec/arb_arrays_of_arrays/execution/subroutines/fs-subroutine.shader_test
@@ -0,0 +1,63 @@ 
+# test calling subroutine uniforms in an array
+# with a constant value works.
+[require]
+GLSL >= 1.50
+GL_ARB_shader_subroutine
+GL_ARB_arrays_of_arrays
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 150
+#extension GL_ARB_shader_subroutine: enable
+#extension GL_ARB_arrays_of_arrays: enable
+
+out vec4 color;
+
+subroutine float getchan1();
+
+subroutine uniform getchan1 GetChan1[2][2];
+
+subroutine(getchan1)
+float chan_full()
+{
+	return 1.0;
+}
+
+subroutine(getchan1)
+float chan_half()
+{
+	return 0.5;
+}
+
+subroutine(getchan1)
+float chan_quarter()
+{
+	return 0.25;
+}
+
+subroutine(getchan1)
+float chan_empty()
+{
+	return 0.0;
+}
+
+void main()
+{
+	color = vec4(GetChan1[1][1](), GetChan1[1][0](), GetChan1[0][0](), 1.0);
+}
+
+
+[test]
+clear color 0.0 0.0 1.0 0.0
+clear
+subuniform GL_FRAGMENT_SHADER GetChan1[1][1] chan_full
+subuniform GL_FRAGMENT_SHADER GetChan1[1][0] chan_empty
+subuniform GL_FRAGMENT_SHADER GetChan1[0][0] chan_quarter
+draw rect -1 -1 2 2
+probe all rgba 1.0 0.0 0.25 1.0
+subuniform GL_FRAGMENT_SHADER GetChan1[1][1] chan_empty
+subuniform GL_FRAGMENT_SHADER GetChan1[1][0] chan_full
+subuniform GL_FRAGMENT_SHADER GetChan1[0][0] chan_half
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.5 1.0