diff options
Diffstat (limited to 'tests/spec/arb_gpu_shader5')
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) + |