perf/pixel-rate: new pixel throughput microbenchmark
[piglit.git] / tests / spec / arb_gl_spirv / execution / xfb / vs_struct.shader_test
blob281c2aa1f994b256e9c7f8ad7eb6143b484e2ed5
1 # XFB test with a variable that is an struct.
2 [require]
3 SPIRV YES
4 GL >= 3.3
5 GLSL >= 4.50
6 GL_ARB_gl_spirv
8 [vertex shader spirv]
9 ; Automatically generated from the GLSL by shader_test_spirv.py. DO NOT EDIT
10 ; SPIR-V
11 ; Version: 1.0
12 ; Generator: Khronos Glslang Reference Front End; 7
13 ; Bound: 38
14 ; Schema: 0
15                OpCapability Shader
16                OpCapability TransformFeedback
17           %1 = OpExtInstImport "GLSL.std.450"
18                OpMemoryModel Logical GLSL450
19                OpEntryPoint Vertex %main "main" %color %var %gl_VertexID %gl_InstanceID
20                OpExecutionMode %main Xfb
21                OpSource GLSL 450
22                OpDecorate %color Location 0
23                OpDecorate %color XfbBuffer 0
24                OpDecorate %color XfbStride 28
25                OpDecorate %var Location 0
26                OpDecorate %var XfbBuffer 0
27                OpDecorate %var XfbStride 28
28                OpDecorate %var Offset 0
29                OpDecorate %gl_VertexID BuiltIn VertexId
30                OpDecorate %gl_InstanceID BuiltIn InstanceId
31        %void = OpTypeVoid
32           %3 = OpTypeFunction %void
33       %float = OpTypeFloat 32
34     %v4float = OpTypeVector %float 4
35 %_ptr_Output_v4float = OpTypePointer Output %v4float
36       %color = OpVariable %_ptr_Output_v4float Output
37     %float_0 = OpConstant %float 0
38     %float_1 = OpConstant %float 1
39          %12 = OpConstantComposite %v4float %float_0 %float_1 %float_0 %float_1
40        %uint = OpTypeInt 32 0
41      %uint_2 = OpConstant %uint 2
42 %_arr_float_uint_2 = OpTypeArray %float %uint_2
43           %S = OpTypeStruct %float %v4float %_arr_float_uint_2
44 %_ptr_Output_S = OpTypePointer Output %S
45         %var = OpVariable %_ptr_Output_S Output
46         %int = OpTypeInt 32 1
47       %int_0 = OpConstant %int 0
48 %_ptr_Output_float = OpTypePointer Output %float
49       %int_1 = OpConstant %int 1
50     %float_2 = OpConstant %float 2
51     %float_3 = OpConstant %float 3
52     %float_4 = OpConstant %float 4
53     %float_5 = OpConstant %float 5
54          %28 = OpConstantComposite %v4float %float_2 %float_3 %float_4 %float_5
55       %int_2 = OpConstant %int 2
56     %float_6 = OpConstant %float 6
57     %float_7 = OpConstant %float 7
58 %_ptr_Input_int = OpTypePointer Input %int
59 %gl_VertexID = OpVariable %_ptr_Input_int Input
60 %gl_InstanceID = OpVariable %_ptr_Input_int Input
61        %main = OpFunction %void None %3
62           %5 = OpLabel
63                OpStore %color %12
64          %22 = OpAccessChain %_ptr_Output_float %var %int_0
65                OpStore %22 %float_1
66          %29 = OpAccessChain %_ptr_Output_v4float %var %int_1
67                OpStore %29 %28
68          %32 = OpAccessChain %_ptr_Output_float %var %int_2 %int_0
69                OpStore %32 %float_6
70          %34 = OpAccessChain %_ptr_Output_float %var %int_2 %int_1
71                OpStore %34 %float_7
72                OpReturn
73                OpFunctionEnd
75 [vertex shader]
76 #version 450
78 struct S {
79    float f;
80    vec4 v;
81    float f2[2];
84 layout(location=0) out vec4 color;
86 layout(xfb_offset=0, xfb_buffer=0) out S var;
88 void main() {
89   color = vec4(0.0, 1.0, 0.0, 1.0);
91   var.f = 1.0;
92   var.v = vec4(2.0, 3.0, 4.0, 5.0);
93   var.f2[0] = 6.0;
94   var.f2[1] = 7.0;
97 [test]
98 xfb buffer object 0 32
100 xfb draw arrays GL_POINTS 0 1
102 verify query_object GL_PRIMITIVES_GENERATED 1
103 verify query_object GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 1
105 probe xfb buffer float 0 0  1.0
106 probe xfb buffer float 0 1  2.0
107 probe xfb buffer float 0 2  3.0
108 probe xfb buffer float 0 3  4.0
109 probe xfb buffer float 0 4  5.0
110 probe xfb buffer float 0 5  6.0
112 verify program_query GL_TRANSFORM_FEEDBACK_VARYINGS 3