From 1c6388d3b8b691d7e5b97d529f192e074f24d7a5 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Mon, 11 Mar 2019 21:04:48 -0500 Subject: [PATCH] Add a test for writing to an indirect component of a vec4 TCS output Reviewed-by: Timothy Arceri Reviewed-by: Kenneth Graunke --- .../tcs-patch-vec4-index-wr.shader_test | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 tests/spec/arb_tessellation_shader/execution/variable-indexing/tcs-patch-vec4-index-wr.shader_test diff --git a/tests/spec/arb_tessellation_shader/execution/variable-indexing/tcs-patch-vec4-index-wr.shader_test b/tests/spec/arb_tessellation_shader/execution/variable-indexing/tcs-patch-vec4-index-wr.shader_test new file mode 100644 index 000000000..a05ad0697 --- /dev/null +++ b/tests/spec/arb_tessellation_shader/execution/variable-indexing/tcs-patch-vec4-index-wr.shader_test @@ -0,0 +1,82 @@ +[require] +GLSL >= 1.50 +GL_ARB_tessellation_shader + +[vertex shader] +#version 150 + +in vec4 piglit_vertex; + +void main() +{ + gl_Position = piglit_vertex; +} + +[tessellation control shader] +#version 150 +#extension GL_ARB_tessellation_shader : require +layout(vertices = 4) out; + +uniform int index; +patch out ivec4 v; + +void main() +{ + if (gl_InvocationID == 0) + v = ivec4(-1); + + barrier(); + + v[gl_InvocationID] = int(gl_InvocationID); + + gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; + gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 1.0); + gl_TessLevelInner = float[2](1.0, 1.0); +} + +[tessellation evaluation shader] +#version 150 +#extension GL_ARB_tessellation_shader : require +layout(quads, equal_spacing) in; + +uniform int index; +patch in ivec4 v; +out vec4 fscolor; + +#define INTERP_QUADj(INj, OUT) do { \ + vec4 v[4]; \ + for (int j = 0; j < 4; j++) v[j] = INj; \ + OUT = mix(mix(v[0], v[1], gl_TessCoord[0]), mix(v[2], v[3], gl_TessCoord[0]), \ + gl_TessCoord[1]); \ +} while(false) + +void main() { + bool pass = true; + + for (int i = 0; i < 4; i++) + pass = pass && (v[i] == i); + + fscolor = pass ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0); + + INTERP_QUADj(gl_in[j].gl_Position, gl_Position); +} + +[fragment shader] +#version 150 +in vec4 fscolor; +out vec4 outcolor; + +void main() +{ + outcolor = fscolor; +} + +[test] +clear color 0.5 0.5 0.5 0.5 +clear + +patch parameter vertices 4 + +draw rect patch -1 -1 0.09 0.09 +#draw arrays GL_PATCHES 0 4 +probe rgb 6 6 0.0 1.0 0.0 -- GitLab