blob: 8fc6b04fc96326237acc82361b1cbcd0e4bf4fb0 [file] [edit]
; Generated by DXC from the HLSL below with:
; dxc -spirv -T cs_6_2 -E main -fspv-target-env=vulkan1.1 -O3 -HV 2021 two_loads.hlsl
;
; groupshared uint a;
; groupshared uint b;
; RWStructuredBuffer<uint> buf;
; [numthreads(64, 1, 1)]
; void main(uint idx : SV_GroupIndex) {
; if (idx == 0) { a = buf[0]; b = buf[1]; }
; GroupMemoryBarrierWithGroupSync();
; uint s = a + b;
; GroupMemoryBarrierWithGroupSync();
; if (s > 0) {
; buf[idx] = 1;
; GroupMemoryBarrierWithGroupSync();
; }
; }
; SPIR-V
; Version: 1.3
; Generator: Google spiregg; 0
; Bound: 38
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex
OpExecutionMode %main LocalSize 64 1 1
OpSource HLSL 620
OpName %a "a"
OpName %b "b"
OpName %type_RWStructuredBuffer_uint "type.RWStructuredBuffer.uint"
OpName %buf "buf"
OpName %main "main"
OpDecorate %gl_LocalInvocationIndex BuiltIn LocalInvocationIndex
OpDecorate %buf DescriptorSet 0
OpDecorate %buf Binding 0
OpDecorate %_runtimearr_uint ArrayStride 4
OpMemberDecorate %type_RWStructuredBuffer_uint 0 Offset 0
OpDecorate %type_RWStructuredBuffer_uint BufferBlock
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
%uint_1 = OpConstant %uint 1
%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint
%_runtimearr_uint = OpTypeRuntimeArray %uint
%type_RWStructuredBuffer_uint = OpTypeStruct %_runtimearr_uint
%_ptr_Uniform_type_RWStructuredBuffer_uint = OpTypePointer Uniform %type_RWStructuredBuffer_uint
%_ptr_Input_uint = OpTypePointer Input %uint
%void = OpTypeVoid
%17 = OpTypeFunction %void
%bool = OpTypeBool
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
%uint_2 = OpConstant %uint 2
%uint_264 = OpConstant %uint 264
%a = OpVariable %_ptr_Workgroup_uint Workgroup
%b = OpVariable %_ptr_Workgroup_uint Workgroup
%buf = OpVariable %_ptr_Uniform_type_RWStructuredBuffer_uint Uniform
%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input
%main = OpFunction %void None %17
%22 = OpLabel
%23 = OpLoad %uint %gl_LocalInvocationIndex
%24 = OpIEqual %bool %23 %uint_0
OpSelectionMerge %25 None
OpBranchConditional %24 %26 %25
%26 = OpLabel
%27 = OpAccessChain %_ptr_Uniform_uint %buf %int_0 %uint_0
%28 = OpLoad %uint %27
OpStore %a %28
%29 = OpAccessChain %_ptr_Uniform_uint %buf %int_0 %uint_1
%30 = OpLoad %uint %29
OpStore %b %30
OpBranch %25
%25 = OpLabel
OpControlBarrier %uint_2 %uint_2 %uint_264
%31 = OpLoad %uint %a
%32 = OpLoad %uint %b
%33 = OpIAdd %uint %31 %32
OpControlBarrier %uint_2 %uint_2 %uint_264
%34 = OpUGreaterThan %bool %33 %uint_0
OpSelectionMerge %35 None
OpBranchConditional %34 %36 %35
%36 = OpLabel
%37 = OpAccessChain %_ptr_Uniform_uint %buf %int_0 %23
OpStore %37 %uint_1
OpControlBarrier %uint_2 %uint_2 %uint_264
OpBranch %35
%35 = OpLabel
OpReturn
OpFunctionEnd