1# The i965 backend has special code to handle TCS output reads. This is a 2# simple test to make sure we handle component packing correctly in that case. 3 4[require] 5GLSL >= 1.50 6GL_ARB_arrays_of_arrays 7GL_ARB_enhanced_layouts 8GL_ARB_tessellation_shader 9GL_ARB_separate_shader_objects 10 11[vertex shader] 12#extension GL_ARB_enhanced_layouts: require 13#extension GL_ARB_separate_shader_objects: require 14 15in vec4 vertex; 16 17// consume Y/Z/W components 18layout(location = 0, component = 1) out vec3 a; 19 20// consumes X component 21layout(location = 0) out float b; 22 23void main() 24{ 25 gl_Position = vertex; 26 27 a = vec3(0.0, 0.75, 1.0); 28 b = 0.25; 29} 30 31 32[tessellation control shader] 33#extension GL_ARB_arrays_of_arrays: require 34#extension GL_ARB_enhanced_layouts: require 35#extension GL_ARB_tessellation_shader: require 36#extension GL_ARB_separate_shader_objects: require 37 38layout(vertices = 3) out; 39 40// consume Y/Z/W components 41layout(location = 0, component = 1) in vec3 a[]; 42 43// consumes X component 44layout(location = 0) in float b[]; 45 46// consume Y/Z/W components 47layout(location = 0, component = 1) patch out vec3 a_tcs[2]; 48 49// consumes X component 50layout(location = 0) patch out float b_tcs[2]; 51 52void main() { 53 float tmpf[2]; 54 55 gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; 56 gl_TessLevelOuter = float[4](1.0, 1.0, 1.0, 0.0); 57 gl_TessLevelInner = float[2](0.0, 0.0); 58 a_tcs[1] = a[gl_InvocationID]; 59 b_tcs[1] = b[gl_InvocationID]; 60 61 // swap output 62 tmpf[0] = a_tcs[1].y; 63 tmpf[1] = b_tcs[1]; 64 a_tcs[1].y = tmpf[1]; 65 b_tcs[1] = tmpf[0]; 66} 67 68 69[tessellation evaluation shader] 70#extension GL_ARB_arrays_of_arrays: require 71#extension GL_ARB_enhanced_layouts: require 72#extension GL_ARB_tessellation_shader: require 73#extension GL_ARB_separate_shader_objects: require 74 75layout(triangles) in; 76 77// consume Y/Z/W components 78layout(location = 0, component = 1) patch in vec3 a_tcs[2]; 79 80// consumes X component 81layout(location = 0) patch in float b_tcs[2]; 82 83// consume Y/Z/W components 84layout(location = 0, component = 1) out vec3 a_tes; 85 86// consumes X component 87layout(location = 0) out float b_tes; 88 89void main() { 90 gl_Position = gl_in[0].gl_Position * gl_TessCoord[0] 91 + gl_in[1].gl_Position * gl_TessCoord[1] 92 + gl_in[2].gl_Position * gl_TessCoord[2]; 93 94 a_tes = a_tcs[1]; 95 b_tes = b_tcs[1]; 96} 97 98 99[fragment shader] 100#extension GL_ARB_enhanced_layouts: require 101#extension GL_ARB_separate_shader_objects: require 102 103// consume Y/Z/W components 104layout(location = 0, component = 1) in vec3 a_tes; 105 106// consumes X component 107layout(location = 0) in float b_tes; 108 109void main() 110{ 111 gl_FragColor = vec4(b_tes, a_tes); 112} 113 114[vertex data] 115vertex/float/2 116-1.0 -1.0 117 1.0 -1.0 118-1.0 1.0 119-1.0 1.0 120 1.0 -1.0 121 1.0 1.0 122 123[test] 124clear color 0.1 0.1 0.1 0.1 125clear 126patch parameter vertices 3 127draw arrays GL_PATCHES 0 6 128probe all rgba 0.75 0.0 0.25 1.0 129