arb_gpu_shader5: add more complex structs with samplers indexing tests

Message ID 1440645688-25800-1-git-send-email-t_arceri@yahoo.com.au
State New
Headers show

Commit Message

'Timothy Arceri' via Patchwork Forward Aug. 27, 2015, 3:21 a.m.
When there is more that one sampler inside a struct Mesa doesn't currently
order the sampler indexs internally in a way that is usable for indirect
indexing. These tests expose the currently missing functionality in Mesa.

Other test results:
Nvidia GeForce 840M - NVIDIA 346.47: pass

---
 .../fs-nested-struct-arrays-nonconst.shader_test   | 94 ++++++++++++++++++++++
 ...s-struct-nonconst-multiple-samplers.shader_test | 79 ++++++++++++++++++
 2 files changed, 173 insertions(+)
 create mode 100644 tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/fs-nested-struct-arrays-nonconst.shader_test
 create mode 100644 tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/fs-struct-nonconst-multiple-samplers.shader_test

Patch hide | download patch | download mbox

diff --git a/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/fs-nested-struct-arrays-nonconst.shader_test b/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/fs-nested-struct-arrays-nonconst.shader_test
new file mode 100644
index 0000000..2c99c08
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/fs-nested-struct-arrays-nonconst.shader_test
@@ -0,0 +1,94 @@ 
+# This test verifies that dynamic uniform indexing of samplers within
+# a nested struct array for the fragment shader behaves correctly.
+
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader5
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+struct S_inner {
+   sampler2D tex;
+   sampler2D tex2;
+};
+
+struct S {
+   sampler2D tex;
+   S_inner si;
+};
+
+uniform S s[2];
+
+uniform int n;
+uniform int select;
+
+out vec4 color;
+
+void main()
+{
+   if (select == 0)
+      color = texture(s[n].tex, vec2(0.75, 0.25));
+   else
+      color = texture(s[n].si.tex, vec2(0.75, 0.25)) + texture(s[n].si.tex2, vec2(0.75, 0.25));
+}
+
+[test]
+clear color 0.2 0.2 0.2 0.2
+clear
+
+uniform int s[0].tex 0
+uniform int s[1].tex 1
+uniform int s[0].si.tex 2
+uniform int s[1].si.tex 3
+uniform int s[0].si.tex2 4
+uniform int s[1].si.tex2 5 
+
+texture checkerboard 0 0 (32, 32) (0.5, 0.0, 0.0, 0.0) (1.0, 0.0, 0.0, 0.0)
+texparameter 2D min nearest
+texparameter 2D mag nearest
+
+texture checkerboard 1 0 (32, 32) (0.5, 0.0, 0.0, 0.0) (0.0, 1.0, 0.0, 0.0)
+texparameter 2D min nearest
+texparameter 2D mag nearest
+
+texture checkerboard 2 0 (32, 32) (0.5, 0.0, 0.0, 0.0) (0.0, 0.0, 0.25, 0.0)
+texparameter 2D min nearest
+texparameter 2D mag nearest
+
+texture checkerboard 3 0 (32, 32) (0.5, 0.0, 0.0, 0.0) (0.25, 0.25, 0.25, 1.0)
+texparameter 2D min nearest
+texparameter 2D mag nearest
+
+texture checkerboard 4 0 (32, 32) (0.5, 0.0, 0.0, 0.0) (0.0, 0.0, 0.75, 0.0)
+texparameter 2D min nearest
+texparameter 2D mag nearest
+
+texture checkerboard 5 0 (32, 32) (0.5, 0.0, 0.0, 0.0) (0.75, 0.75, 0.75, 1.0)
+texparameter 2D min nearest
+texparameter 2D mag nearest
+
+uniform int select 0
+uniform int n 0
+draw rect -1 -1 1 1
+
+relative probe rect rgb (0.0, 0.0, 0.5, 0.5) (1.0, 0.0, 0.0)
+
+uniform int n 1
+draw rect 0 -1 1 1
+
+relative probe rect rgb (0.5, 0.0, 0.5, 0.5) (0.0, 1.0, 0.0)
+
+uniform int select 1
+uniform int n 0
+draw rect -1 0 1 1
+
+relative probe rect rgb (0.0, 0.5, 0.5, 0.5) (0.0, 0.0, 1.0)
+
+uniform int n 1
+draw rect 0 0 1 1
+
+relative probe rect rgb (0.5, 0.5, 0.5, 0.5) (1.0, 1.0, 1.0)
diff --git a/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/fs-struct-nonconst-multiple-samplers.shader_test b/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/fs-struct-nonconst-multiple-samplers.shader_test
new file mode 100644
index 0000000..b717196
--- /dev/null
+++ b/tests/spec/arb_gpu_shader5/execution/sampler_array_indexing/fs-struct-nonconst-multiple-samplers.shader_test
@@ -0,0 +1,79 @@ 
+# This test verifies that dynamic uniform indexing of samplers inside
+# a stuct array in the fragment shader behaves correctly.
+
+[require]
+GLSL >= 1.50
+GL_ARB_gpu_shader5
+
+[vertex shader passthrough]
+
+[fragment shader]
+#version 150
+#extension GL_ARB_gpu_shader5: require
+
+struct S {
+   sampler2D tex;
+   sampler2D tex2;
+};
+
+uniform S s[2];
+
+uniform int n;
+uniform int select;
+
+out vec4 color;
+
+void main()
+{
+   if (select == 0)
+      color = texture(s[n].tex, vec2(0.75, 0.25));
+   else
+      color = texture(s[n].tex2, vec2(0.75, 0.25));
+}
+
+[test]
+clear color 0.2 0.2 0.2 0.2
+clear
+
+uniform int s[0].tex 0
+uniform int s[1].tex 1
+uniform int s[0].tex2 2
+uniform int s[1].tex2 3
+
+texture checkerboard 0 0 (32, 32) (0.5, 0.0, 0.0, 0.0) (1.0, 0.0, 0.0, 0.0)
+texparameter 2D min nearest
+texparameter 2D mag nearest
+
+texture checkerboard 1 0 (32, 32) (0.5, 0.0, 0.0, 0.0) (0.0, 1.0, 0.0, 0.0)
+texparameter 2D min nearest
+texparameter 2D mag nearest
+
+texture checkerboard 2 0 (32, 32) (0.5, 0.0, 0.0, 0.0) (0.0, 0.0, 1.0, 0.0)
+texparameter 2D min nearest
+texparameter 2D mag nearest
+
+texture checkerboard 3 0 (32, 32) (0.5, 0.0, 0.0, 0.0) (1.0, 1.0, 1.0, 1.0)
+texparameter 2D min nearest
+texparameter 2D mag nearest
+
+uniform int n 0
+uniform int select 0
+draw rect -1 -1 1 1
+
+relative probe rect rgb (0.0, 0.0, 0.5, 0.5) (1.0, 0.0, 0.0)
+
+uniform int n 1
+draw rect 0 -1 1 1
+
+relative probe rect rgb (0.5, 0.0, 0.5, 0.5) (0.0, 1.0, 0.0)
+
+uniform int n 0
+uniform int select 1
+draw rect -1 0 1 1
+
+relative probe rect rgb (0.0, 0.5, 0.5, 0.5) (0.0, 0.0, 1.0)
+
+uniform int n 1
+draw rect 0 0 1 1
+
+relative probe rect rgb (0.5, 0.5, 0.5, 0.5) (1.0, 1.0, 1.0)