953fa6a5a7161978d643f3c2bf5e386096881913
[platform/upstream/VK-GL-CTS.git] / external / vulkancts / data / vulkan / amber / spirv_assembly / instruction / spirv1p4 / entrypoint / tess_eval_ssbo_entry_point.amber
1 [require]
2 VK_KHR_spirv_1_4
3 tessellationShader
4
5 [vertex shader]
6 #version 450
7
8 layout(location = 0) in vec4 position;
9 layout(location = 1) in vec4 vert_color;
10 layout(location = 0) out vec4 tsc_color;
11
12 void main() {
13     gl_Position = position;
14       tsc_color = vert_color;
15 }
16
17 [tessellation control shader]
18 #version 450
19 #extension GL_ARB_separate_shader_objects : enable
20
21 layout(vertices = 3) out;
22
23 layout(location = 0) in vec4 tsc_color[];
24 layout(location = 0) out vec4 tse_color[];
25
26 #define ID gl_InvocationID
27
28 void main()
29 {
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;
37 }
38
39 [tessellation evaluation shader spirv]
40 ; Test tessellation evaluation shader with an SSBO on the entry point.
41 ; #version 450
42 ; #extension GL_ARB_separate_shader_objects : enable
43 ;
44 ; layout(triangles, equal_spacing, cw) in;
45 ;
46 ; layout(location = 0) in vec4 tse_color[];
47 ; layout(location = 0) out vec4 frag_color;
48 ;
49 ; layout(std430, binding = 0) buffer input_buffer
50 ; {
51 ;   vec4 in_val;
52 ; };
53 ;
54 ; void main()
55 ; {
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;
61 ; }
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
69                OpSource GLSL 450
70                OpSourceExtension "GL_ARB_separate_shader_objects"
71                OpName %main "main"
72                OpName %p0 "p0"
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"
79                OpName %gl_in "gl_in"
80                OpName %p1 "p1"
81                OpName %p2 "p2"
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"
87                OpName %_ ""
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"
92                OpName %__0 ""
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
110        %void = OpTypeVoid
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_StorageBuffer_input_buffer = OpTypePointer StorageBuffer %input_buffer
144         %__0 = OpVariable %_ptr_StorageBuffer_input_buffer StorageBuffer
145 %_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
146        %main = OpFunction %void None %3
147           %5 = OpLabel
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
156                OpStore %p0 %30
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
162                OpStore %p1 %37
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
168                OpStore %p2 %45
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
175                OpStore %55 %53
176          %60 = OpAccessChain %_ptr_Input_v4float %tse_color %int_0
177          %61 = OpLoad %v4float %60
178          %66 = OpAccessChain %_ptr_StorageBuffer_v4float %__0 %int_0
179          %67 = OpLoad %v4float %66
180          %68 = OpFAdd %v4float %61 %67
181                OpStore %frag_color %68
182                OpReturn
183                OpFunctionEnd
184
185 [fragment shader]
186 #version 450
187
188 layout(location = 0) in vec4 frag_color;
189 layout(location = 0) out vec4 final_color;
190
191 void main() {
192   final_color = frag_color;
193 }
194
195 [vertex data]
196 #        position     vert_color
197      0/R8G8_SNORM 1/R8G8B8_UNORM
198
199 #           Red for entire frame
200 #         R8   G8     R8  G8  B8
201         -128 -128    255   0   0
202          127  127    255   0   0
203         -128  127    255   0   0
204
205         -128 -128    255   0   0
206          127  127    255   0   0
207          127 -128    255   0   0
208
209 [test]
210 ssbo 0:0 subdata float 0 0.0 0.0 0.3 0.0
211 clear
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)