SPIRV-Cross/shaders-no-opt/asm/comp/atomic-result-temporary.asm.comp
Hans-Kristian Arntzen 8b236f24f1 Fix infinite loop when OpAtomic* temporaries are used in other blocks.
We made the mistake of registering a dependency on the atomic variable
even if the atomic result was forced to a temporary. There is no need to
register reads from atomic variables like this as we always force atomic
results to a temporary and argument read/writes do not need to be
tracked.
2019-04-24 09:33:39 +02:00

60 lines
2.3 KiB
Plaintext

; SPIR-V
; Version: 1.0
; Generator: Khronos Glslang Reference Front End; 7
; Bound: 35
; Schema: 0
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationID
OpExecutionMode %main LocalSize 1 1 1
OpSource GLSL 450
OpName %main "main"
OpName %SSBO "SSBO"
OpMemberName %SSBO 0 "count"
OpMemberName %SSBO 1 "data"
OpName %_ ""
OpName %gl_GlobalInvocationID "gl_GlobalInvocationID"
OpDecorate %_runtimearr_uint ArrayStride 4
OpMemberDecorate %SSBO 0 Offset 0
OpMemberDecorate %SSBO 1 Offset 4
OpDecorate %SSBO BufferBlock
OpDecorate %_ DescriptorSet 0
OpDecorate %_ Binding 0
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
%void = OpTypeVoid
%3 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%_runtimearr_uint = OpTypeRuntimeArray %uint
%SSBO = OpTypeStruct %uint %_runtimearr_uint
%_ptr_Uniform_SSBO = OpTypePointer Uniform %SSBO
%_ = OpVariable %_ptr_Uniform_SSBO Uniform
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
%_ptr_Uniform_uint = OpTypePointer Uniform %uint
%uint_1 = OpConstant %uint 1
%uint_0 = OpConstant %uint 0
%uint_1024 = OpConstant %uint 1024
%bool = OpTypeBool
%int_1 = OpConstant %int 1
%v3uint = OpTypeVector %uint 3
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
%gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input
%_ptr_Input_uint = OpTypePointer Input %uint
%main = OpFunction %void None %3
%5 = OpLabel
%16 = OpAccessChain %_ptr_Uniform_uint %_ %int_0
%19 = OpAtomicIAdd %uint %16 %uint_1 %uint_0 %uint_1
%23 = OpULessThan %bool %19 %uint_1024
OpSelectionMerge %25 None
OpBranchConditional %23 %24 %25
%24 = OpLabel
%32 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_0
%33 = OpLoad %uint %32
%34 = OpAccessChain %_ptr_Uniform_uint %_ %int_1 %19
OpStore %34 %33
OpBranch %25
%25 = OpLabel
OpReturn
OpFunctionEnd