|
| 1 | +; SPIR-V |
| 2 | +; Version: 1.0 |
| 3 | +; Generator: Khronos Glslang Reference Front End; 11 |
| 4 | +; Bound: 26 |
| 5 | +; Schema: 0 |
| 6 | + OpCapability Shader |
| 7 | + OpCapability VariablePointers |
| 8 | + OpExtension "SPV_KHR_variable_pointers" |
| 9 | + %1 = OpExtInstImport "GLSL.std.450" |
| 10 | + OpMemoryModel Logical GLSL450 |
| 11 | + OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex %gl_GlobalInvocationID |
| 12 | + OpExecutionMode %main LocalSize 64 1 1 |
| 13 | + OpSource GLSL 450 |
| 14 | + OpName %main "main" |
| 15 | + OpName %test "test" |
| 16 | + OpName %gl_LocalInvocationIndex "gl_LocalInvocationIndex" |
| 17 | + OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" |
| 18 | + OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex |
| 19 | + OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId |
| 20 | + OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize |
| 21 | + %void = OpTypeVoid |
| 22 | + %3 = OpTypeFunction %void |
| 23 | + %float = OpTypeFloat 32 |
| 24 | + %v2float = OpTypeVector %float 2 |
| 25 | + %uint = OpTypeInt 32 0 |
| 26 | + %uint_64 = OpConstant %uint 64 |
| 27 | +%_arr_v2float_uint_64 = OpTypeArray %v2float %uint_64 |
| 28 | +%_ptr_Workgroup__arr_v2float_uint_64 = OpTypePointer Workgroup %_arr_v2float_uint_64 |
| 29 | + %test = OpVariable %_ptr_Workgroup__arr_v2float_uint_64 Workgroup |
| 30 | +%_ptr_Input_uint = OpTypePointer Input %uint |
| 31 | +%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input |
| 32 | + %v3uint = OpTypeVector %uint 3 |
| 33 | +%_ptr_Input_v3uint = OpTypePointer Input %v3uint |
| 34 | +%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input |
| 35 | + %uint_0 = OpConstant %uint 0 |
| 36 | + %uint_1 = OpConstant %uint 1 |
| 37 | + %uint_2 = OpConstant %uint 2 |
| 38 | + %uint_3 = OpConstant %uint 3 |
| 39 | +%_ptr_Workgroup_float = OpTypePointer Workgroup %float |
| 40 | +%_ptr_Workgroup_v2float = OpTypePointer Workgroup %v2float |
| 41 | +%gl_WorkGroupSize = OpConstantComposite %v3uint %uint_64 %uint_1 %uint_1 |
| 42 | + %main = OpFunction %void None %3 |
| 43 | + %5 = OpLabel |
| 44 | + %14 = OpLoad %uint %gl_LocalInvocationIndex |
| 45 | + %19 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0 |
| 46 | + %20 = OpLoad %uint %19 |
| 47 | + %21 = OpConvertUToF %float %20 |
| 48 | + %22 = OpCompositeConstruct %v2float %21 %21 |
| 49 | + |
| 50 | + ; Dummy expression. *(&test + 0) |
| 51 | + %ptr0 = OpPtrAccessChain %_ptr_Workgroup__arr_v2float_uint_64 %test %uint_0 |
| 52 | + %ptr1 = OpPtrAccessChain %_ptr_Workgroup_v2float %ptr0 %uint_0 %uint_1 |
| 53 | + %ptr2 = OpPtrAccessChain %_ptr_Workgroup_v2float %ptr1 %uint_2 |
| 54 | + OpStore %ptr2 %22 |
| 55 | + |
| 56 | + ; Chain PtrAccessChain while keeping pointer type. |
| 57 | + %ptr3 = OpPtrAccessChain %_ptr_Workgroup_v2float %test %uint_0 %uint_1 |
| 58 | + %ptr4 = OpPtrAccessChain %_ptr_Workgroup_v2float %ptr3 %uint_2 |
| 59 | + OpStore %ptr4 %22 |
| 60 | + |
| 61 | + ; Same semantics. |
| 62 | + %ptr5 = OpPtrAccessChain %_ptr_Workgroup_v2float %test %uint_0 %uint_3 |
| 63 | + OpStore %ptr5 %22 |
| 64 | + |
| 65 | + ; Scalar shenanigans. |
| 66 | + %ptr6 = OpPtrAccessChain %_ptr_Workgroup_float %test %uint_0 %uint_2 %uint_0 |
| 67 | + %ptr7 = OpPtrAccessChain %_ptr_Workgroup_float %ptr6 %uint_1 |
| 68 | + OpStore %ptr7 %21 |
| 69 | + |
| 70 | + OpReturn |
| 71 | + OpFunctionEnd |
0 commit comments