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 / vert_ubo_entry_point.amber
1 [require]
2 VK_KHR_spirv_1_4
3
4 [vertex shader spirv]
5 ; Test a vertex shader with a ubo on the OpEntryPoint.
6 ;
7 ; #version 450
8 ;
9 ; layout(binding = 0) uniform input_buffer
10 ; {
11 ;       vec2 in_data[3];
12 ; };
13 ;
14 ; void main() {
15 ;       gl_Position = vec4(in_data[gl_VertexIndex], 0.0, 1.0);
16 ; }
17                OpCapability Shader
18           %1 = OpExtInstImport "GLSL.std.450"
19                OpMemoryModel Logical GLSL450
20                OpEntryPoint Vertex %main "main" %_ %__0 %gl_VertexIndex
21                OpSource GLSL 450
22                OpName %main "main"
23                OpName %gl_PerVertex "gl_PerVertex"
24                OpMemberName %gl_PerVertex 0 "gl_Position"
25                OpMemberName %gl_PerVertex 1 "gl_PointSize"
26                OpMemberName %gl_PerVertex 2 "gl_ClipDistance"
27                OpMemberName %gl_PerVertex 3 "gl_CullDistance"
28                OpName %_ ""
29                OpName %input_buffer "input_buffer"
30                OpMemberName %input_buffer 0 "in_data"
31                OpName %__0 ""
32                OpName %gl_VertexIndex "gl_VertexIndex"
33                OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
34                OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
35                OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
36                OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance
37                OpDecorate %gl_PerVertex Block
38                OpDecorate %_arr_v2float_uint_3 ArrayStride 16
39                OpMemberDecorate %input_buffer 0 Offset 0
40                OpDecorate %input_buffer Block
41                OpDecorate %__0 DescriptorSet 0
42                OpDecorate %__0 Binding 0
43                OpDecorate %gl_VertexIndex BuiltIn VertexIndex
44        %void = OpTypeVoid
45           %3 = OpTypeFunction %void
46       %float = OpTypeFloat 32
47     %v4float = OpTypeVector %float 4
48        %uint = OpTypeInt 32 0
49      %uint_1 = OpConstant %uint 1
50 %_arr_float_uint_1 = OpTypeArray %float %uint_1
51 %gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1
52 %_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
53           %_ = OpVariable %_ptr_Output_gl_PerVertex Output
54         %int = OpTypeInt 32 1
55       %int_0 = OpConstant %int 0
56     %v2float = OpTypeVector %float 2
57      %uint_3 = OpConstant %uint 3
58 %_arr_v2float_uint_3 = OpTypeArray %v2float %uint_3
59 %input_buffer = OpTypeStruct %_arr_v2float_uint_3
60 %_ptr_Uniform_input_buffer = OpTypePointer Uniform %input_buffer
61         %__0 = OpVariable %_ptr_Uniform_input_buffer Uniform
62 %_ptr_Input_int = OpTypePointer Input %int
63 %gl_VertexIndex = OpVariable %_ptr_Input_int Input
64 %_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
65     %float_0 = OpConstant %float 0
66     %float_1 = OpConstant %float 1
67 %_ptr_Output_v4float = OpTypePointer Output %v4float
68        %main = OpFunction %void None %3
69           %5 = OpLabel
70          %24 = OpLoad %int %gl_VertexIndex
71          %26 = OpAccessChain %_ptr_Uniform_v2float %__0 %int_0 %24
72          %27 = OpLoad %v2float %26
73          %30 = OpCompositeExtract %float %27 0
74          %31 = OpCompositeExtract %float %27 1
75          %32 = OpCompositeConstruct %v4float %30 %31 %float_0 %float_1
76          %34 = OpAccessChain %_ptr_Output_v4float %_ %int_0
77                OpStore %34 %32
78                OpReturn
79                OpFunctionEnd
80 [fragment shader]
81 #version 430
82 layout(location = 0) out vec4 outColor;
83 void main() {
84     outColor = vec4(0.5, 0.5, 0.5, 0.5);
85 }
86
87 [vertex data]
88     0/R8G8_SNORM 1/R8G8B8A8_UNORM
89     -128 -128    255   0   0   255
90      127  127    255   0   0   255
91     -128  127    255   0   0   255
92
93 [test]
94 uniform ubo 0:0 float 0 -1.0 -1.0 0.0 0.0 1.0 -1.0 0.0 0.0 -1.0 1.0
95 clear
96 draw arrays TRIANGLE_LIST 0 3
97
98 probe rect rgba (0, 0, 125, 125) (0.5 0.5 0.5 0.5)
99 probe rect rgba (125, 125, 125, 125) (0.0 0.0 0.0 0.0)