8 layout(location = 0) in vec4 position;
9 layout(location = 1) in vec4 vert_color;
10 layout(location = 0) out vec4 tsc_color;
13 gl_Position = position;
14 tsc_color = vert_color;
17 [tessellation control shader]
19 #extension GL_ARB_separate_shader_objects : enable
21 layout(vertices = 3) out;
23 layout(location = 0) in vec4 tsc_color[];
24 layout(location = 0) out vec4 tse_color[];
26 #define ID gl_InvocationID
30 gl_out[ID].gl_Position = gl_in[ID].gl_Position;
31 tse_color[ID] = tsc_color[ID];
32 gl_TessLevelOuter[0] = 1.0;
33 gl_TessLevelOuter[1] = 1.0;
34 gl_TessLevelOuter[2] = 1.0;
35 gl_TessLevelInner[0] = 1.0;
36 gl_TessLevelInner[1] = 1.0;
39 [tessellation evaluation shader spirv]
40 ; Test tessellation evaluation shader with a UBO on the entry point.
42 ; #extension GL_ARB_separate_shader_objects : enable
44 ; layout(triangles, equal_spacing, cw) in;
46 ; layout(location = 0) in vec4 tse_color[];
47 ; layout(location = 0) out vec4 frag_color;
49 ; layout(binding = 0) uniform input_buffer
56 ; vec4 p0 = gl_TessCoord.x * gl_in[0].gl_Position;
57 ; vec4 p1 = gl_TessCoord.y * gl_in[1].gl_Position;
58 ; vec4 p2 = gl_TessCoord.z * gl_in[2].gl_Position;
59 ; gl_Position = p0 + p1 + p2;
60 ; frag_color = tse_color[0]+in_val;
62 OpCapability Tessellation
63 %1 = OpExtInstImport "GLSL.std.450"
64 OpMemoryModel Logical GLSL450
65 OpEntryPoint TessellationEvaluation %main "main" %gl_TessCoord %gl_in %_ %frag_color %tse_color %__0
66 OpExecutionMode %main Triangles
67 OpExecutionMode %main SpacingEqual
68 OpExecutionMode %main VertexOrderCw
70 OpSourceExtension "GL_ARB_separate_shader_objects"
73 OpName %gl_TessCoord "gl_TessCoord"
74 OpName %gl_PerVertex "gl_PerVertex"
75 OpMemberName %gl_PerVertex 0 "gl_Position"
76 OpMemberName %gl_PerVertex 1 "gl_PointSize"
77 OpMemberName %gl_PerVertex 2 "gl_ClipDistance"
78 OpMemberName %gl_PerVertex 3 "gl_CullDistance"
82 OpName %gl_PerVertex_0 "gl_PerVertex"
83 OpMemberName %gl_PerVertex_0 0 "gl_Position"
84 OpMemberName %gl_PerVertex_0 1 "gl_PointSize"
85 OpMemberName %gl_PerVertex_0 2 "gl_ClipDistance"
86 OpMemberName %gl_PerVertex_0 3 "gl_CullDistance"
88 OpName %frag_color "frag_color"
89 OpName %tse_color "tse_color"
90 OpName %input_buffer "input_buffer"
91 OpMemberName %input_buffer 0 "in_val"
93 OpDecorate %gl_TessCoord BuiltIn TessCoord
94 OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
95 OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
96 OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
97 OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance
98 OpDecorate %gl_PerVertex Block
99 OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
100 OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
101 OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
102 OpMemberDecorate %gl_PerVertex_0 3 BuiltIn CullDistance
103 OpDecorate %gl_PerVertex_0 Block
104 OpDecorate %frag_color Location 0
105 OpDecorate %tse_color Location 0
106 OpMemberDecorate %input_buffer 0 Offset 0
107 OpDecorate %input_buffer Block
108 OpDecorate %__0 DescriptorSet 0
109 OpDecorate %__0 Binding 0
111 %3 = OpTypeFunction %void
112 %float = OpTypeFloat 32
113 %v4float = OpTypeVector %float 4
114 %_ptr_Function_v4float = OpTypePointer Function %v4float
115 %v3float = OpTypeVector %float 3
116 %_ptr_Input_v3float = OpTypePointer Input %v3float
117 %gl_TessCoord = OpVariable %_ptr_Input_v3float Input
118 %uint = OpTypeInt 32 0
119 %uint_0 = OpConstant %uint 0
120 %_ptr_Input_float = OpTypePointer Input %float
121 %uint_1 = OpConstant %uint 1
122 %_arr_float_uint_1 = OpTypeArray %float %uint_1
123 %gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1
124 %uint_32 = OpConstant %uint 32
125 %_arr_gl_PerVertex_uint_32 = OpTypeArray %gl_PerVertex %uint_32
126 %_ptr_Input__arr_gl_PerVertex_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_uint_32
127 %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_uint_32 Input
128 %int = OpTypeInt 32 1
129 %int_0 = OpConstant %int 0
130 %_ptr_Input_v4float = OpTypePointer Input %v4float
131 %int_1 = OpConstant %int 1
132 %uint_2 = OpConstant %uint 2
133 %int_2 = OpConstant %int 2
134 %gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1
135 %_ptr_Output_gl_PerVertex_0 = OpTypePointer Output %gl_PerVertex_0
136 %_ = OpVariable %_ptr_Output_gl_PerVertex_0 Output
137 %_ptr_Output_v4float = OpTypePointer Output %v4float
138 %frag_color = OpVariable %_ptr_Output_v4float Output
139 %_arr_v4float_uint_32 = OpTypeArray %v4float %uint_32
140 %_ptr_Input__arr_v4float_uint_32 = OpTypePointer Input %_arr_v4float_uint_32
141 %tse_color = OpVariable %_ptr_Input__arr_v4float_uint_32 Input
142 %input_buffer = OpTypeStruct %v4float
143 %_ptr_Uniform_input_buffer = OpTypePointer Uniform %input_buffer
144 %__0 = OpVariable %_ptr_Uniform_input_buffer Uniform
145 %_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
146 %main = OpFunction %void None %3
148 %p0 = OpVariable %_ptr_Function_v4float Function
149 %p1 = OpVariable %_ptr_Function_v4float Function
150 %p2 = OpVariable %_ptr_Function_v4float Function
151 %16 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_0
152 %17 = OpLoad %float %16
153 %28 = OpAccessChain %_ptr_Input_v4float %gl_in %int_0 %int_0
154 %29 = OpLoad %v4float %28
155 %30 = OpVectorTimesScalar %v4float %29 %17
157 %32 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_1
158 %33 = OpLoad %float %32
159 %35 = OpAccessChain %_ptr_Input_v4float %gl_in %int_1 %int_0
160 %36 = OpLoad %v4float %35
161 %37 = OpVectorTimesScalar %v4float %36 %33
163 %40 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_2
164 %41 = OpLoad %float %40
165 %43 = OpAccessChain %_ptr_Input_v4float %gl_in %int_2 %int_0
166 %44 = OpLoad %v4float %43
167 %45 = OpVectorTimesScalar %v4float %44 %41
169 %49 = OpLoad %v4float %p0
170 %50 = OpLoad %v4float %p1
171 %51 = OpFAdd %v4float %49 %50
172 %52 = OpLoad %v4float %p2
173 %53 = OpFAdd %v4float %51 %52
174 %55 = OpAccessChain %_ptr_Output_v4float %_ %int_0
176 %60 = OpAccessChain %_ptr_Input_v4float %tse_color %int_0
177 %61 = OpLoad %v4float %60
178 %66 = OpAccessChain %_ptr_Uniform_v4float %__0 %int_0
179 %67 = OpLoad %v4float %66
180 %68 = OpFAdd %v4float %61 %67
181 OpStore %frag_color %68
188 layout(location = 0) in vec4 frag_color;
189 layout(location = 0) out vec4 final_color;
192 final_color = frag_color;
196 # position vert_color
197 0/R8G8_SNORM 1/R8G8B8A8_UNORM
199 # Red for entire frame
201 -128 -128 255 0 0 255
205 -128 -128 255 0 0 255
210 uniform ubo 0:0 float 0 0.0 0.0 0.3 0.0
212 draw arrays PATCH_LIST 0 6
213 relative probe rect rgb (0.0, 0.0, 1.0, 1.0) (1.0, 0, 0.3)