blob: 1bd44e3f3656b54c7607ba6363fae598054576a4 [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 constant_index.hlsl
;
; groupshared uint arr[4];
; RWStructuredBuffer<uint> buf;
; [numthreads(64, 1, 1)]
; void main(uint idx : SV_GroupIndex) {
; if (idx < 4) { arr[idx] = buf[idx]; }
; GroupMemoryBarrierWithGroupSync();
; uint v = arr[2];
; GroupMemoryBarrierWithGroupSync();
; if (v > 0) {
; buf[idx] = 1;
; GroupMemoryBarrierWithGroupSync();
; }
; }
; SPIR-V
; Version: 1.3
; Generator: Google spiregg; 0
; Bound: 39
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main" %gl_LocalInvocationIndex
OpExecutionMode %main LocalSize 64 1 1
OpSource HLSL 620
OpName %arr "arr"
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_4 = OpConstant %uint 4
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
%int_2 = OpConstant %int 2
%uint_0 = OpConstant %uint 0
%uint_1 = OpConstant %uint 1
%_arr_uint_uint_4 = OpTypeArray %uint %uint_4
%_ptr_Workgroup__arr_uint_uint_4 = OpTypePointer Workgroup %_arr_uint_uint_4
%_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
%19 = OpTypeFunction %void
%bool = OpTypeBool
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint
%uint_2 = OpConstant %uint 2
%uint_264 = OpConstant %uint 264
%arr = OpVariable %_ptr_Workgroup__arr_uint_uint_4 Workgroup
%buf = OpVariable %_ptr_Uniform_type_RWStructuredBuffer_uint Uniform
%gl_LocalInvocationIndex = OpVariable %_ptr_Input_uint Input
%main = OpFunction %void None %19
%25 = OpLabel
%26 = OpLoad %uint %gl_LocalInvocationIndex
%27 = OpULessThan %bool %26 %uint_4
OpSelectionMerge %28 None
OpBranchConditional %27 %29 %28
%29 = OpLabel
%30 = OpAccessChain %_ptr_Uniform_uint %buf %int_0 %26
%31 = OpLoad %uint %30
%32 = OpAccessChain %_ptr_Workgroup_uint %arr %26
OpStore %32 %31
OpBranch %28
%28 = OpLabel
OpControlBarrier %uint_2 %uint_2 %uint_264
%33 = OpAccessChain %_ptr_Workgroup_uint %arr %int_2
%34 = OpLoad %uint %33
OpControlBarrier %uint_2 %uint_2 %uint_264
%35 = OpUGreaterThan %bool %34 %uint_0
OpSelectionMerge %36 None
OpBranchConditional %35 %37 %36
%37 = OpLabel
%38 = OpAccessChain %_ptr_Uniform_uint %buf %int_0 %26
OpStore %38 %uint_1
OpControlBarrier %uint_2 %uint_2 %uint_264
OpBranch %36
%36 = OpLabel
OpReturn
OpFunctionEnd