Change vertex buffer format to VK_FORMAT_R8G8B8A8_UNORM
[platform/upstream/VK-GL-CTS.git] / external / vulkancts / data / vulkan / amber / spirv_assembly / instruction / spirv1p4 / entrypoint / tess_eval_pc_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 a push constant 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(push_constant) uniform pushConstants {
50 ;     vec4 in_val;
51 ; } pc;
52 ;
53 ; void main()
54 ; {
55 ;   vec4 p0 = gl_TessCoord.x * gl_in[0].gl_Position;
56 ;   vec4 p1 = gl_TessCoord.y * gl_in[1].gl_Position;
57 ;   vec4 p2 = gl_TessCoord.z * gl_in[2].gl_Position;
58 ;   gl_Position = p0 + p1 + p2;
59 ;   frag_color = tse_color[0]+pc.in_val;
60 ; }
61                OpCapability Tessellation
62           %1 = OpExtInstImport "GLSL.std.450"
63                OpMemoryModel Logical GLSL450
64                OpEntryPoint TessellationEvaluation %main "main" %gl_TessCoord %gl_in %_ %frag_color %tse_color %pc
65                OpExecutionMode %main Triangles
66                OpExecutionMode %main SpacingEqual
67                OpExecutionMode %main VertexOrderCw
68                OpSource GLSL 450
69                OpSourceExtension "GL_ARB_separate_shader_objects"
70                OpName %main "main"
71                OpName %p0 "p0"
72                OpName %gl_TessCoord "gl_TessCoord"
73                OpName %gl_PerVertex "gl_PerVertex"
74                OpMemberName %gl_PerVertex 0 "gl_Position"
75                OpMemberName %gl_PerVertex 1 "gl_PointSize"
76                OpMemberName %gl_PerVertex 2 "gl_ClipDistance"
77                OpMemberName %gl_PerVertex 3 "gl_CullDistance"
78                OpName %gl_in "gl_in"
79                OpName %p1 "p1"
80                OpName %p2 "p2"
81                OpName %gl_PerVertex_0 "gl_PerVertex"
82                OpMemberName %gl_PerVertex_0 0 "gl_Position"
83                OpMemberName %gl_PerVertex_0 1 "gl_PointSize"
84                OpMemberName %gl_PerVertex_0 2 "gl_ClipDistance"
85                OpMemberName %gl_PerVertex_0 3 "gl_CullDistance"
86                OpName %_ ""
87                OpName %frag_color "frag_color"
88                OpName %tse_color "tse_color"
89                OpName %pushConstants "pushConstants"
90                OpMemberName %pushConstants 0 "in_val"
91                OpName %pc "pc"
92                OpDecorate %gl_TessCoord BuiltIn TessCoord
93                OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
94                OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
95                OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
96                OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance
97                OpDecorate %gl_PerVertex Block
98                OpMemberDecorate %gl_PerVertex_0 0 BuiltIn Position
99                OpMemberDecorate %gl_PerVertex_0 1 BuiltIn PointSize
100                OpMemberDecorate %gl_PerVertex_0 2 BuiltIn ClipDistance
101                OpMemberDecorate %gl_PerVertex_0 3 BuiltIn CullDistance
102                OpDecorate %gl_PerVertex_0 Block
103                OpDecorate %frag_color Location 0
104                OpDecorate %tse_color Location 0
105                OpMemberDecorate %pushConstants 0 Offset 0
106                OpDecorate %pushConstants Block
107        %void = OpTypeVoid
108           %3 = OpTypeFunction %void
109       %float = OpTypeFloat 32
110     %v4float = OpTypeVector %float 4
111 %_ptr_Function_v4float = OpTypePointer Function %v4float
112     %v3float = OpTypeVector %float 3
113 %_ptr_Input_v3float = OpTypePointer Input %v3float
114 %gl_TessCoord = OpVariable %_ptr_Input_v3float Input
115        %uint = OpTypeInt 32 0
116      %uint_0 = OpConstant %uint 0
117 %_ptr_Input_float = OpTypePointer Input %float
118      %uint_1 = OpConstant %uint 1
119 %_arr_float_uint_1 = OpTypeArray %float %uint_1
120 %gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1
121     %uint_32 = OpConstant %uint 32
122 %_arr_gl_PerVertex_uint_32 = OpTypeArray %gl_PerVertex %uint_32
123 %_ptr_Input__arr_gl_PerVertex_uint_32 = OpTypePointer Input %_arr_gl_PerVertex_uint_32
124       %gl_in = OpVariable %_ptr_Input__arr_gl_PerVertex_uint_32 Input
125         %int = OpTypeInt 32 1
126       %int_0 = OpConstant %int 0
127 %_ptr_Input_v4float = OpTypePointer Input %v4float
128       %int_1 = OpConstant %int 1
129      %uint_2 = OpConstant %uint 2
130       %int_2 = OpConstant %int 2
131 %gl_PerVertex_0 = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1
132 %_ptr_Output_gl_PerVertex_0 = OpTypePointer Output %gl_PerVertex_0
133           %_ = OpVariable %_ptr_Output_gl_PerVertex_0 Output
134 %_ptr_Output_v4float = OpTypePointer Output %v4float
135  %frag_color = OpVariable %_ptr_Output_v4float Output
136 %_arr_v4float_uint_32 = OpTypeArray %v4float %uint_32
137 %_ptr_Input__arr_v4float_uint_32 = OpTypePointer Input %_arr_v4float_uint_32
138   %tse_color = OpVariable %_ptr_Input__arr_v4float_uint_32 Input
139 %pushConstants = OpTypeStruct %v4float
140 %_ptr_PushConstant_pushConstants = OpTypePointer PushConstant %pushConstants
141          %pc = OpVariable %_ptr_PushConstant_pushConstants PushConstant
142 %_ptr_PushConstant_v4float = OpTypePointer PushConstant %v4float
143        %main = OpFunction %void None %3
144           %5 = OpLabel
145          %p0 = OpVariable %_ptr_Function_v4float Function
146          %p1 = OpVariable %_ptr_Function_v4float Function
147          %p2 = OpVariable %_ptr_Function_v4float Function
148          %16 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_0
149          %17 = OpLoad %float %16
150          %28 = OpAccessChain %_ptr_Input_v4float %gl_in %int_0 %int_0
151          %29 = OpLoad %v4float %28
152          %30 = OpVectorTimesScalar %v4float %29 %17
153                OpStore %p0 %30
154          %32 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_1
155          %33 = OpLoad %float %32
156          %35 = OpAccessChain %_ptr_Input_v4float %gl_in %int_1 %int_0
157          %36 = OpLoad %v4float %35
158          %37 = OpVectorTimesScalar %v4float %36 %33
159                OpStore %p1 %37
160          %40 = OpAccessChain %_ptr_Input_float %gl_TessCoord %uint_2
161          %41 = OpLoad %float %40
162          %43 = OpAccessChain %_ptr_Input_v4float %gl_in %int_2 %int_0
163          %44 = OpLoad %v4float %43
164          %45 = OpVectorTimesScalar %v4float %44 %41
165                OpStore %p2 %45
166          %49 = OpLoad %v4float %p0
167          %50 = OpLoad %v4float %p1
168          %51 = OpFAdd %v4float %49 %50
169          %52 = OpLoad %v4float %p2
170          %53 = OpFAdd %v4float %51 %52
171          %55 = OpAccessChain %_ptr_Output_v4float %_ %int_0
172                OpStore %55 %53
173          %60 = OpAccessChain %_ptr_Input_v4float %tse_color %int_0
174          %61 = OpLoad %v4float %60
175          %66 = OpAccessChain %_ptr_PushConstant_v4float %pc %int_0
176          %67 = OpLoad %v4float %66
177          %68 = OpFAdd %v4float %61 %67
178                OpStore %frag_color %68
179                OpReturn
180                OpFunctionEnd
181
182 [fragment shader]
183 #version 450
184
185 layout(location = 0) in vec4 frag_color;
186 layout(location = 0) out vec4 final_color;
187
188 void main() {
189   final_color = frag_color;
190 }
191
192 [vertex data]
193 #        position     vert_color
194      0/R8G8_SNORM 1/R8G8B8A8_UNORM
195
196 #           Red for entire frame
197 #         R8   G8     R8  G8  B8    A8
198         -128 -128    255   0   0   255
199          127  127    255   0   0   255
200         -128  127    255   0   0   255
201
202         -128 -128    255   0   0   255
203          127  127    255   0   0   255
204          127 -128    255   0   0   255
205
206 [test]
207 uniform float 0 0.0 0.0 0.3 0.0
208 clear
209 draw arrays PATCH_LIST 0 6
210 relative probe rect rgb (0.0, 0.0, 1.0, 1.0) (1.0, 0, 0.3)