mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-21 10:49:14 +00:00
tint: Add support for atomic ops to spirv reader
The following operations are supported: OpAtomicLoad OpAtomicStore OpAtomicExchange OpAtomicCompareExchange OpAtomicCompareExchangeWeak OpAtomicIIncrement OpAtomicIDecrement OpAtomicIAdd OpAtomicISub OpAtomicSMin OpAtomicUMin OpAtomicSMax OpAtomicUMax OpAtomicAnd OpAtomicOr OpAtomicXor These are not, but may be supported in the future: OpAtomicFlagTestAndSet OpAtomicFlagClear OpAtomicFMinEXT OpAtomicFMaxEXT OpAtomicFAddEXT Bug: tint:1441 Change-Id: Ifd53643b38d43664905a0dddfca609add4914670 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/94121 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
57810d81d5
commit
268d7b8357
91
test/tint/builtins/atomicStore/struct/array_of_struct.spvasm
Normal file
91
test/tint/builtins/atomicStore/struct/array_of_struct.spvasm
Normal file
@@ -0,0 +1,91 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 54
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %compute_main "compute_main" %local_invocation_index_1
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %local_invocation_index_1 "local_invocation_index_1"
|
||||
OpName %S "S"
|
||||
OpMemberName %S 0 "x"
|
||||
OpMemberName %S 1 "a"
|
||||
OpMemberName %S 2 "y"
|
||||
OpName %wg "wg"
|
||||
OpName %compute_main_inner "compute_main_inner"
|
||||
OpName %local_invocation_index "local_invocation_index"
|
||||
OpName %idx "idx"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %local_invocation_index_1 BuiltIn LocalInvocationIndex
|
||||
OpMemberDecorate %S 0 Offset 0
|
||||
OpMemberDecorate %S 1 Offset 4
|
||||
OpMemberDecorate %S 2 Offset 8
|
||||
OpDecorate %_arr_S_uint_10 ArrayStride 12
|
||||
%uint = OpTypeInt 32 0
|
||||
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||
%local_invocation_index_1 = OpVariable %_ptr_Input_uint Input
|
||||
%int = OpTypeInt 32 1
|
||||
%S = OpTypeStruct %int %uint %uint
|
||||
%uint_10 = OpConstant %uint 10
|
||||
%_arr_S_uint_10 = OpTypeArray %S %uint_10
|
||||
%_ptr_Workgroup__arr_S_uint_10 = OpTypePointer Workgroup %_arr_S_uint_10
|
||||
%wg = OpVariable %_ptr_Workgroup__arr_S_uint_10 Workgroup
|
||||
%void = OpTypeVoid
|
||||
%10 = OpTypeFunction %void %uint
|
||||
%_ptr_Function_uint = OpTypePointer Function %uint
|
||||
%17 = OpConstantNull %uint
|
||||
%bool = OpTypeBool
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Workgroup_int = OpTypePointer Workgroup %int
|
||||
%32 = OpConstantNull %int
|
||||
%uint_2 = OpConstant %uint 2
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Workgroup_uint = OpTypePointer Workgroup %uint
|
||||
%_ptr_Workgroup_uint_0 = OpTypePointer Workgroup %uint
|
||||
%uint_264 = OpConstant %uint 264
|
||||
%int_4 = OpConstant %int 4
|
||||
%49 = OpTypeFunction %void
|
||||
%compute_main_inner = OpFunction %void None %10
|
||||
%local_invocation_index = OpFunctionParameter %uint
|
||||
%14 = OpLabel
|
||||
%idx = OpVariable %_ptr_Function_uint Function %17
|
||||
OpStore %idx %local_invocation_index
|
||||
OpBranch %18
|
||||
%18 = OpLabel
|
||||
OpLoopMerge %19 %20 None
|
||||
OpBranch %21
|
||||
%21 = OpLabel
|
||||
%23 = OpLoad %uint %idx
|
||||
%24 = OpULessThan %bool %23 %uint_10
|
||||
%22 = OpLogicalNot %bool %24
|
||||
OpSelectionMerge %26 None
|
||||
OpBranchConditional %22 %27 %26
|
||||
%27 = OpLabel
|
||||
OpBranch %19
|
||||
%26 = OpLabel
|
||||
%28 = OpLoad %uint %idx
|
||||
%31 = OpAccessChain %_ptr_Workgroup_int %wg %28 %uint_0
|
||||
OpStore %31 %32
|
||||
%38 = OpAccessChain %_ptr_Workgroup_uint %wg %28 %uint_1
|
||||
OpAtomicStore %38 %uint_2 %uint_0 %17
|
||||
%40 = OpAccessChain %_ptr_Workgroup_uint_0 %wg %28 %uint_2
|
||||
OpStore %40 %17
|
||||
OpBranch %20
|
||||
%20 = OpLabel
|
||||
%41 = OpLoad %uint %idx
|
||||
%42 = OpIAdd %uint %41 %uint_1
|
||||
OpStore %idx %42
|
||||
OpBranch %18
|
||||
%19 = OpLabel
|
||||
OpControlBarrier %uint_2 %uint_2 %uint_264
|
||||
%48 = OpAccessChain %_ptr_Workgroup_uint %wg %int_4 %uint_1
|
||||
OpAtomicStore %48 %uint_2 %uint_0 %uint_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %49
|
||||
%51 = OpLabel
|
||||
%53 = OpLoad %uint %local_invocation_index_1
|
||||
%52 = OpFunctionCall %void %compute_main_inner %53
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
Reference in New Issue
Block a user