diff options
author | Chris Forbes <chrisf@ijw.co.nz> | 2014-07-20 13:23:13 +1200 |
---|---|---|
committer | Chris Forbes <chrisf@ijw.co.nz> | 2014-07-20 13:38:03 +1200 |
commit | 84a94b291613ac06a1b1fa8f61f4c361251e80f1 (patch) | |
tree | 6db4b97e99ff3c7412b842462deb2d61c6a1fa75 /tests/spec | |
parent | 068b81ab88f4b68dec0d2b25dd1fa2ebfa766876 (diff) |
arb_gpu_shader5: Add meaner d/u ubo array tests using two arrays
This ensures that the block index of the base of the array is correctly
taken into account, along with just being a little more stressful.
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Diffstat (limited to 'tests/spec')
3 files changed, 629 insertions, 0 deletions
diff --git a/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/fs-two-arrays.shader_test b/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/fs-two-arrays.shader_test new file mode 100644 index 000000000..2ae03e40a --- /dev/null +++ b/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/fs-two-arrays.shader_test @@ -0,0 +1,200 @@ +# This test verifies that dynamically uniform indexing of UBO arrays +# in the fragment shader behaves correctly, with two separate arrays. + +[require] +GLSL >= 1.50 +GL_ARB_gpu_shader5 + +[vertex shader passthrough] + +[fragment shader] +#version 150 +#extension GL_ARB_gpu_shader5: require + +uniform r_values { + float val; +} r_arr[5]; + +uniform g_values { + float val; +} g_arr[5]; + +uniform int n; +uniform int m; + +out vec4 color; + +void main() +{ + color.x = r_arr[n].val; + color.y = g_arr[m].val; + color.z = 0.0; + color.w = 0.0; +} + +[test] +clear color 0.2 0.2 0.2 0.2 +clear + +ubo array index 0 +uniform float r_values.val 0.0 +uniform float g_values.val 1.0 + +ubo array index 1 +uniform float r_values.val 0.2 +uniform float g_values.val 0.8 + +ubo array index 2 +uniform float r_values.val 0.4 +uniform float g_values.val 0.6 + +ubo array index 3 +uniform float r_values.val 0.6 +uniform float g_values.val 0.4 + +ubo array index 4 +uniform float r_values.val 0.8 +uniform float g_values.val 0.2 + + + +uniform int m 0 +uniform int n 0 +draw rect -1 -1 0.4 0.4 + +relative probe rect rgb (0.0, 0.0, 0.2, 0.2) (0.0, 1.0, 0.0) + +uniform int n 1 +draw rect -0.6 -1 0.4 0.4 + +relative probe rect rgb (0.2, 0.0, 0.2, 0.2) (0.2, 1.0, 0.0) + +uniform int n 2 +draw rect -0.2 -1 0.4 0.4 + +relative probe rect rgb (0.4, 0.0, 0.2, 0.2) (0.4, 1.0, 0.0) + +uniform int n 3 +draw rect 0.2 -1 0.4 0.4 + +relative probe rect rgb (0.6, 0.0, 0.2, 0.2) (0.6, 1.0, 0.0) + +uniform int n 4 +draw rect 0.6 -1 0.4 0.4 + +relative probe rect rgb (0.8, 0.0, 0.2, 0.2) (0.8, 1.0, 0.0) + + + + +uniform int m 1 +uniform int n 0 +draw rect -1 -0.6 0.4 0.4 + +relative probe rect rgb (0.0, 0.2, 0.2, 0.2) (0.0, 0.8, 0.0) + +uniform int n 1 +draw rect -0.6 -0.6 0.4 0.4 + +relative probe rect rgb (0.2, 0.2, 0.2, 0.2) (0.2, 0.8, 0.0) + +uniform int n 2 +draw rect -0.2 -0.6 0.4 0.4 + +relative probe rect rgb (0.4, 0.2, 0.2, 0.2) (0.4, 0.8, 0.0) + +uniform int n 3 +draw rect 0.2 -0.6 0.4 0.4 + +relative probe rect rgb (0.6, 0.2, 0.2, 0.2) (0.6, 0.8, 0.0) + +uniform int n 4 +draw rect 0.6 -0.6 0.4 0.4 + +relative probe rect rgb (0.8, 0.2, 0.2, 0.2) (0.8, 0.8, 0.0) + + + + +uniform int m 2 +uniform int n 0 +draw rect -1 -0.2 0.4 0.4 + +relative probe rect rgb (0.0, 0.4, 0.2, 0.2) (0.0, 0.6, 0.0) + +uniform int n 1 +draw rect -0.6 -0.2 0.4 0.4 + +relative probe rect rgb (0.2, 0.4, 0.2, 0.2) (0.2, 0.6, 0.0) + +uniform int n 2 +draw rect -0.2 -0.2 0.4 0.4 + +relative probe rect rgb (0.4, 0.4, 0.2, 0.2) (0.4, 0.6, 0.0) + +uniform int n 3 +draw rect 0.2 -0.2 0.4 0.4 + +relative probe rect rgb (0.6, 0.4, 0.2, 0.2) (0.6, 0.6, 0.0) + +uniform int n 4 +draw rect 0.6 -0.2 0.4 0.4 + +relative probe rect rgb (0.8, 0.4, 0.2, 0.2) (0.8, 0.6, 0.0) + + + +uniform int m 3 +uniform int n 0 +draw rect -1 0.2 0.4 0.4 + +relative probe rect rgb (0.0, 0.6, 0.2, 0.2) (0.0, 0.4, 0.0) + +uniform int n 1 +draw rect -0.6 0.2 0.4 0.4 + +relative probe rect rgb (0.2, 0.6, 0.2, 0.2) (0.2, 0.4, 0.0) + +uniform int n 2 +draw rect -0.2 0.2 0.4 0.4 + +relative probe rect rgb (0.4, 0.6, 0.2, 0.2) (0.4, 0.4, 0.0) + +uniform int n 3 +draw rect 0.2 0.2 0.4 0.4 + +relative probe rect rgb (0.6, 0.6, 0.2, 0.2) (0.6, 0.4, 0.0) + +uniform int n 4 +draw rect 0.6 0.2 0.4 0.4 + +relative probe rect rgb (0.8, 0.6, 0.2, 0.2) (0.8, 0.4, 0.0) + + + +uniform int m 4 +uniform int n 0 +draw rect -1 0.6 0.4 0.4 + +relative probe rect rgb (0.0, 0.8, 0.2, 0.2) (0.0, 0.2, 0.0) + +uniform int n 1 +draw rect -0.6 0.6 0.4 0.4 + +relative probe rect rgb (0.2, 0.8, 0.2, 0.2) (0.2, 0.2, 0.0) + +uniform int n 2 +draw rect -0.2 0.6 0.4 0.4 + +relative probe rect rgb (0.4, 0.8, 0.2, 0.2) (0.4, 0.2, 0.0) + +uniform int n 3 +draw rect 0.2 0.6 0.4 0.4 + +relative probe rect rgb (0.6, 0.8, 0.2, 0.2) (0.6, 0.2, 0.0) + +uniform int n 4 +draw rect 0.6 0.6 0.4 0.4 + +relative probe rect rgb (0.8, 0.8, 0.2, 0.2) (0.8, 0.2, 0.0) + diff --git a/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/gs-two-arrays.shader_test b/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/gs-two-arrays.shader_test new file mode 100644 index 000000000..4e2585357 --- /dev/null +++ b/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/gs-two-arrays.shader_test @@ -0,0 +1,218 @@ +# This test verifies that dynamically uniform indexing of UBO arrays +# in the geometry shader behaves correctly, with two separate arrays. + +[require] +GLSL >= 1.50 +GL_ARB_gpu_shader5 + +[vertex shader passthrough] + +[geometry shader] +#version 150 +#extension GL_ARB_gpu_shader5: require + +uniform r_values { + float val; +} r_arr[5]; + +uniform g_values { + float val; +} g_arr[5]; + +uniform int n; +uniform int m; + +layout(triangles) in; +layout(triangle_strip, max_vertices=3) out; +out vec4 color; + +void main() +{ + for (int i = 0; i < 3; i++) { + gl_Position = gl_in[i].gl_Position; + color.x = r_arr[n].val; + color.y = g_arr[m].val; + color.z = 0.0; + color.w = 0.0; + EmitVertex(); + } + EndPrimitive(); +} + +[fragment shader] +#version 150 + +in vec4 color; +out vec4 out_color; + +void main() +{ + out_color = color; +} + +[test] +clear color 0.2 0.2 0.2 0.2 +clear + +ubo array index 0 +uniform float r_values.val 0.0 +uniform float g_values.val 1.0 + +ubo array index 1 +uniform float r_values.val 0.2 +uniform float g_values.val 0.8 + +ubo array index 2 +uniform float r_values.val 0.4 +uniform float g_values.val 0.6 + +ubo array index 3 +uniform float r_values.val 0.6 +uniform float g_values.val 0.4 + +ubo array index 4 +uniform float r_values.val 0.8 +uniform float g_values.val 0.2 + + + +uniform int m 0 +uniform int n 0 +draw rect -1 -1 0.4 0.4 + +relative probe rect rgb (0.0, 0.0, 0.2, 0.2) (0.0, 1.0, 0.0) + +uniform int n 1 +draw rect -0.6 -1 0.4 0.4 + +relative probe rect rgb (0.2, 0.0, 0.2, 0.2) (0.2, 1.0, 0.0) + +uniform int n 2 +draw rect -0.2 -1 0.4 0.4 + +relative probe rect rgb (0.4, 0.0, 0.2, 0.2) (0.4, 1.0, 0.0) + +uniform int n 3 +draw rect 0.2 -1 0.4 0.4 + +relative probe rect rgb (0.6, 0.0, 0.2, 0.2) (0.6, 1.0, 0.0) + +uniform int n 4 +draw rect 0.6 -1 0.4 0.4 + +relative probe rect rgb (0.8, 0.0, 0.2, 0.2) (0.8, 1.0, 0.0) + + + + +uniform int m 1 +uniform int n 0 +draw rect -1 -0.6 0.4 0.4 + +relative probe rect rgb (0.0, 0.2, 0.2, 0.2) (0.0, 0.8, 0.0) + +uniform int n 1 +draw rect -0.6 -0.6 0.4 0.4 + +relative probe rect rgb (0.2, 0.2, 0.2, 0.2) (0.2, 0.8, 0.0) + +uniform int n 2 +draw rect -0.2 -0.6 0.4 0.4 + +relative probe rect rgb (0.4, 0.2, 0.2, 0.2) (0.4, 0.8, 0.0) + +uniform int n 3 +draw rect 0.2 -0.6 0.4 0.4 + +relative probe rect rgb (0.6, 0.2, 0.2, 0.2) (0.6, 0.8, 0.0) + +uniform int n 4 +draw rect 0.6 -0.6 0.4 0.4 + +relative probe rect rgb (0.8, 0.2, 0.2, 0.2) (0.8, 0.8, 0.0) + + + + +uniform int m 2 +uniform int n 0 +draw rect -1 -0.2 0.4 0.4 + +relative probe rect rgb (0.0, 0.4, 0.2, 0.2) (0.0, 0.6, 0.0) + +uniform int n 1 +draw rect -0.6 -0.2 0.4 0.4 + +relative probe rect rgb (0.2, 0.4, 0.2, 0.2) (0.2, 0.6, 0.0) + +uniform int n 2 +draw rect -0.2 -0.2 0.4 0.4 + +relative probe rect rgb (0.4, 0.4, 0.2, 0.2) (0.4, 0.6, 0.0) + +uniform int n 3 +draw rect 0.2 -0.2 0.4 0.4 + +relative probe rect rgb (0.6, 0.4, 0.2, 0.2) (0.6, 0.6, 0.0) + +uniform int n 4 +draw rect 0.6 -0.2 0.4 0.4 + +relative probe rect rgb (0.8, 0.4, 0.2, 0.2) (0.8, 0.6, 0.0) + + + +uniform int m 3 +uniform int n 0 +draw rect -1 0.2 0.4 0.4 + +relative probe rect rgb (0.0, 0.6, 0.2, 0.2) (0.0, 0.4, 0.0) + +uniform int n 1 +draw rect -0.6 0.2 0.4 0.4 + +relative probe rect rgb (0.2, 0.6, 0.2, 0.2) (0.2, 0.4, 0.0) + +uniform int n 2 +draw rect -0.2 0.2 0.4 0.4 + +relative probe rect rgb (0.4, 0.6, 0.2, 0.2) (0.4, 0.4, 0.0) + +uniform int n 3 +draw rect 0.2 0.2 0.4 0.4 + +relative probe rect rgb (0.6, 0.6, 0.2, 0.2) (0.6, 0.4, 0.0) + +uniform int n 4 +draw rect 0.6 0.2 0.4 0.4 + +relative probe rect rgb (0.8, 0.6, 0.2, 0.2) (0.8, 0.4, 0.0) + + + +uniform int m 4 +uniform int n 0 +draw rect -1 0.6 0.4 0.4 + +relative probe rect rgb (0.0, 0.8, 0.2, 0.2) (0.0, 0.2, 0.0) + +uniform int n 1 +draw rect -0.6 0.6 0.4 0.4 + +relative probe rect rgb (0.2, 0.8, 0.2, 0.2) (0.2, 0.2, 0.0) + +uniform int n 2 +draw rect -0.2 0.6 0.4 0.4 + +relative probe rect rgb (0.4, 0.8, 0.2, 0.2) (0.4, 0.2, 0.0) + +uniform int n 3 +draw rect 0.2 0.6 0.4 0.4 + +relative probe rect rgb (0.6, 0.8, 0.2, 0.2) (0.6, 0.2, 0.0) + +uniform int n 4 +draw rect 0.6 0.6 0.4 0.4 + +relative probe rect rgb (0.8, 0.8, 0.2, 0.2) (0.8, 0.2, 0.0) + diff --git a/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/vs-two-arrays.shader_test b/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/vs-two-arrays.shader_test new file mode 100644 index 000000000..8133b948e --- /dev/null +++ b/tests/spec/arb_gpu_shader5/execution/ubo_array_indexing/vs-two-arrays.shader_test @@ -0,0 +1,211 @@ +# This test verifies that dynamically uniform indexing of UBO arrays +# in the vertex shader behaves correctly, with two separate arrays. + +[require] +GLSL >= 1.50 +GL_ARB_gpu_shader5 + +[vertex shader] +#version 150 +#extension GL_ARB_gpu_shader5: require + +uniform r_values { + float val; +} r_arr[5]; + +uniform g_values { + float val; +} g_arr[5]; + +uniform int n; +uniform int m; + +in vec4 piglit_vertex; +out vec4 color; + +void main() +{ + gl_Position = piglit_vertex; + color.x = r_arr[n].val; + color.y = g_arr[m].val; + color.z = 0.0; + color.w = 0.0; +} + +[fragment shader] +#version 150 + +in vec4 color; +out vec4 out_color; + +void main() +{ + out_color = color; +} + +[test] +clear color 0.2 0.2 0.2 0.2 +clear + +ubo array index 0 +uniform float r_values.val 0.0 +uniform float g_values.val 1.0 + +ubo array index 1 +uniform float r_values.val 0.2 +uniform float g_values.val 0.8 + +ubo array index 2 +uniform float r_values.val 0.4 +uniform float g_values.val 0.6 + +ubo array index 3 +uniform float r_values.val 0.6 +uniform float g_values.val 0.4 + +ubo array index 4 +uniform float r_values.val 0.8 +uniform float g_values.val 0.2 + + + +uniform int m 0 +uniform int n 0 +draw rect -1 -1 0.4 0.4 + +relative probe rect rgb (0.0, 0.0, 0.2, 0.2) (0.0, 1.0, 0.0) + +uniform int n 1 +draw rect -0.6 -1 0.4 0.4 + +relative probe rect rgb (0.2, 0.0, 0.2, 0.2) (0.2, 1.0, 0.0) + +uniform int n 2 +draw rect -0.2 -1 0.4 0.4 + +relative probe rect rgb (0.4, 0.0, 0.2, 0.2) (0.4, 1.0, 0.0) + +uniform int n 3 +draw rect 0.2 -1 0.4 0.4 + +relative probe rect rgb (0.6, 0.0, 0.2, 0.2) (0.6, 1.0, 0.0) + +uniform int n 4 +draw rect 0.6 -1 0.4 0.4 + +relative probe rect rgb (0.8, 0.0, 0.2, 0.2) (0.8, 1.0, 0.0) + + + + +uniform int m 1 +uniform int n 0 +draw rect -1 -0.6 0.4 0.4 + +relative probe rect rgb (0.0, 0.2, 0.2, 0.2) (0.0, 0.8, 0.0) + +uniform int n 1 +draw rect -0.6 -0.6 0.4 0.4 + +relative probe rect rgb (0.2, 0.2, 0.2, 0.2) (0.2, 0.8, 0.0) + +uniform int n 2 +draw rect -0.2 -0.6 0.4 0.4 + +relative probe rect rgb (0.4, 0.2, 0.2, 0.2) (0.4, 0.8, 0.0) + +uniform int n 3 +draw rect 0.2 -0.6 0.4 0.4 + +relative probe rect rgb (0.6, 0.2, 0.2, 0.2) (0.6, 0.8, 0.0) + +uniform int n 4 +draw rect 0.6 -0.6 0.4 0.4 + +relative probe rect rgb (0.8, 0.2, 0.2, 0.2) (0.8, 0.8, 0.0) + + + + +uniform int m 2 +uniform int n 0 +draw rect -1 -0.2 0.4 0.4 + +relative probe rect rgb (0.0, 0.4, 0.2, 0.2) (0.0, 0.6, 0.0) + +uniform int n 1 +draw rect -0.6 -0.2 0.4 0.4 + +relative probe rect rgb (0.2, 0.4, 0.2, 0.2) (0.2, 0.6, 0.0) + +uniform int n 2 +draw rect -0.2 -0.2 0.4 0.4 + +relative probe rect rgb (0.4, 0.4, 0.2, 0.2) (0.4, 0.6, 0.0) + +uniform int n 3 +draw rect 0.2 -0.2 0.4 0.4 + +relative probe rect rgb (0.6, 0.4, 0.2, 0.2) (0.6, 0.6, 0.0) + +uniform int n 4 +draw rect 0.6 -0.2 0.4 0.4 + +relative probe rect rgb (0.8, 0.4, 0.2, 0.2) (0.8, 0.6, 0.0) + + + +uniform int m 3 +uniform int n 0 +draw rect -1 0.2 0.4 0.4 + +relative probe rect rgb (0.0, 0.6, 0.2, 0.2) (0.0, 0.4, 0.0) + +uniform int n 1 +draw rect -0.6 0.2 0.4 0.4 + +relative probe rect rgb (0.2, 0.6, 0.2, 0.2) (0.2, 0.4, 0.0) + +uniform int n 2 +draw rect -0.2 0.2 0.4 0.4 + +relative probe rect rgb (0.4, 0.6, 0.2, 0.2) (0.4, 0.4, 0.0) + +uniform int n 3 +draw rect 0.2 0.2 0.4 0.4 + +relative probe rect rgb (0.6, 0.6, 0.2, 0.2) (0.6, 0.4, 0.0) + +uniform int n 4 +draw rect 0.6 0.2 0.4 0.4 + +relative probe rect rgb (0.8, 0.6, 0.2, 0.2) (0.8, 0.4, 0.0) + + + +uniform int m 4 +uniform int n 0 +draw rect -1 0.6 0.4 0.4 + +relative probe rect rgb (0.0, 0.8, 0.2, 0.2) (0.0, 0.2, 0.0) + +uniform int n 1 +draw rect -0.6 0.6 0.4 0.4 + +relative probe rect rgb (0.2, 0.8, 0.2, 0.2) (0.2, 0.2, 0.0) + +uniform int n 2 +draw rect -0.2 0.6 0.4 0.4 + +relative probe rect rgb (0.4, 0.8, 0.2, 0.2) (0.4, 0.2, 0.0) + +uniform int n 3 +draw rect 0.2 0.6 0.4 0.4 + +relative probe rect rgb (0.6, 0.8, 0.2, 0.2) (0.6, 0.2, 0.0) + +uniform int n 4 +draw rect 0.6 0.6 0.4 0.4 + +relative probe rect rgb (0.8, 0.8, 0.2, 0.2) (0.8, 0.2, 0.0) + |