1# XFB test using a input block. On the original GLSL, setting the 2# xfb_offset on the block. That means that the frontend (glslang) will 3# assign an xfb_offset for all the members of the block, and all of 4# them will be captured. 5 6[require] 7SPIRV YES 8GL >= 3.3 9GLSL >= 4.50 10GL_ARB_gl_spirv 11 12[vertex shader spirv] 13; Automatically generated from the GLSL by shader_test_spirv.py. DO NOT EDIT 14; SPIR-V 15; Version: 1.0 16; Generator: Khronos Glslang Reference Front End; 7 17; Bound: 38 18; Schema: 0 19 OpCapability Shader 20 OpCapability TransformFeedback 21 %1 = OpExtInstImport "GLSL.std.450" 22 OpMemoryModel Logical GLSL450 23 OpEntryPoint Vertex %main "main" %color %x %gl_VertexID %gl_InstanceID 24 OpExecutionMode %main Xfb 25 OpSource GLSL 450 26 OpDecorate %color Location 0 27 OpDecorate %color XfbBuffer 0 28 OpDecorate %color XfbStride 28 29 OpMemberDecorate %block 0 Offset 0 30 OpMemberDecorate %block 1 Offset 4 31 OpMemberDecorate %block 2 Offset 20 32 OpDecorate %block Block 33 OpDecorate %x Location 0 34 OpDecorate %x XfbBuffer 0 35 OpDecorate %x XfbStride 28 36 OpDecorate %gl_VertexID BuiltIn VertexId 37 OpDecorate %gl_InstanceID BuiltIn InstanceId 38 %void = OpTypeVoid 39 %3 = OpTypeFunction %void 40 %float = OpTypeFloat 32 41 %v4float = OpTypeVector %float 4 42%_ptr_Output_v4float = OpTypePointer Output %v4float 43 %color = OpVariable %_ptr_Output_v4float Output 44 %float_0 = OpConstant %float 0 45 %11 = OpConstantComposite %v4float %float_0 %float_0 %float_0 %float_0 46 %uint = OpTypeInt 32 0 47 %uint_2 = OpConstant %uint 2 48%_arr_float_uint_2 = OpTypeArray %float %uint_2 49 %block = OpTypeStruct %float %v4float %_arr_float_uint_2 50%_ptr_Output_block = OpTypePointer Output %block 51 %x = OpVariable %_ptr_Output_block Output 52 %int = OpTypeInt 32 1 53 %int_0 = OpConstant %int 0 54 %float_1 = OpConstant %float 1 55%_ptr_Output_float = OpTypePointer Output %float 56 %int_1 = OpConstant %int 1 57 %float_2 = OpConstant %float 2 58 %float_3 = OpConstant %float 3 59 %float_4 = OpConstant %float 4 60 %float_5 = OpConstant %float 5 61 %28 = OpConstantComposite %v4float %float_2 %float_3 %float_4 %float_5 62 %int_2 = OpConstant %int 2 63 %float_6 = OpConstant %float 6 64 %float_7 = OpConstant %float 7 65%_ptr_Input_int = OpTypePointer Input %int 66%gl_VertexID = OpVariable %_ptr_Input_int Input 67%gl_InstanceID = OpVariable %_ptr_Input_int Input 68 %main = OpFunction %void None %3 69 %5 = OpLabel 70 OpStore %color %11 71 %22 = OpAccessChain %_ptr_Output_float %x %int_0 72 OpStore %22 %float_1 73 %29 = OpAccessChain %_ptr_Output_v4float %x %int_1 74 OpStore %29 %28 75 %32 = OpAccessChain %_ptr_Output_float %x %int_2 %int_0 76 OpStore %32 %float_6 77 %34 = OpAccessChain %_ptr_Output_float %x %int_2 %int_1 78 OpStore %34 %float_7 79 OpReturn 80 OpFunctionEnd 81 82[vertex shader] 83#version 450 84 85layout(xfb_buffer=0, xfb_offset=0) out block { 86 float f; 87 vec4 v; 88 float f2[2]; 89} x; 90 91layout(location=0) out vec4 color; 92 93void main() { 94 color = vec4(0.0); 95 96 x.f = 1.0; 97 x.v = vec4(2.0, 3.0, 4.0, 5.0); 98 x.f2[0] = 6.0; 99 x.f2[1] = 7.0; 100} 101 102[test] 103xfb buffer object 0 256 104 105xfb draw arrays GL_POINTS 0 1 106 107verify query_object GL_PRIMITIVES_GENERATED 1 108verify query_object GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 1 109 110 111probe xfb buffer float 0 0 1.0 112probe xfb buffer float 0 1 2.0 113probe xfb buffer float 0 2 3.0 114probe xfb buffer float 0 3 4.0 115probe xfb buffer float 0 4 5.0 116probe xfb buffer float 0 5 6.0 117probe xfb buffer float 0 6 7.0 118 119# 3 varyings: x.f, x.v, and x.f2 120verify program_query GL_TRANSFORM_FEEDBACK_VARYINGS 3 121