mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-20 14:31:08 +01:00
* add parsing for spirv::Op::AtomicLoad and spirv::Op::AtomicStore * spv-in parse AtomicExchange and AtomicCompareExchange * add atomic i decrement * bookend atomic store statement with emmitter.finish/emitter.start to suppress a double load expression bookend atomic result expressions with emitter.finish/start to prevent double defs * add atomic iadd, isub, smin, umin, smax, umax, and, or, xor * parse atomic flag test and set, parse atomic flag clear * remove atomic compare exchange work * changelog * moved spirv tests into front/spv/mod.rs * feature gate atomic spv tests because they require wgsl-[in,out] * BlockContext::get_contained_global_variable returns Result * Generate spans covering the entire instruction. Granted, there is pre-existing code in the SPIR-V front end that gets this wrong, but: It doesn't make sense to read `self.data_offset`, and then immediately pass that to `self.span_from_with_op`. The point of that function is to make the span cover the entire instruction, operands included. * Move `From` implementation into spv front end * doc comments, minor cleanups * remove parsing of OpAtomicFlagClear and OpAtomicFlagTestAndSet * sync atomic spvasm files --------- Co-authored-by: Jim Blandy <jimb@red-bean.com>
62 lines
2.3 KiB
Plaintext
62 lines
2.3 KiB
Plaintext
; SPIR-V
|
|
; Version: 1.5
|
|
; Generator: Google rspirv; 0
|
|
; Bound: 37
|
|
; Schema: 0
|
|
OpCapability Shader
|
|
OpCapability VulkanMemoryModel
|
|
OpMemoryModel Logical Vulkan
|
|
OpEntryPoint GLCompute %1 "stage::test_atomic_i_increment" %2 %3
|
|
OpExecutionMode %1 LocalSize 32 1 1
|
|
OpDecorate %_struct_6 Block
|
|
OpMemberDecorate %_struct_6 0 Offset 0
|
|
OpDecorate %2 Binding 0
|
|
OpDecorate %2 DescriptorSet 0
|
|
OpDecorate %3 NonWritable
|
|
OpDecorate %3 Binding 1
|
|
OpDecorate %3 DescriptorSet 0
|
|
%uint = OpTypeInt 32 0
|
|
%void = OpTypeVoid
|
|
%9 = OpTypeFunction %void
|
|
%bool = OpTypeBool
|
|
%uint_0 = OpConstant %uint 0
|
|
%uint_2 = OpConstant %uint 2
|
|
%false = OpConstantFalse %bool
|
|
%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
|
|
%uint_1 = OpConstant %uint 1
|
|
%true = OpConstantTrue %bool
|
|
%_struct_6 = OpTypeStruct %uint
|
|
%_ptr_StorageBuffer__struct_6 = OpTypePointer StorageBuffer %_struct_6
|
|
%2 = OpVariable %_ptr_StorageBuffer__struct_6 StorageBuffer
|
|
%3 = OpVariable %_ptr_StorageBuffer__struct_6 StorageBuffer
|
|
%18 = OpUndef %uint
|
|
%1 = OpFunction %void None %9
|
|
%19 = OpLabel
|
|
%20 = OpAccessChain %_ptr_StorageBuffer_uint %2 %uint_0
|
|
%21 = OpAccessChain %_ptr_StorageBuffer_uint %3 %uint_0
|
|
OpBranch %22
|
|
%22 = OpLabel
|
|
%23 = OpPhi %uint %uint_0 %19 %24 %25
|
|
OpLoopMerge %26 %25 None
|
|
OpBranch %27
|
|
%27 = OpLabel
|
|
%28 = OpLoad %uint %21
|
|
%29 = OpUGreaterThanEqual %bool %23 %28
|
|
OpSelectionMerge %30 None
|
|
OpBranchConditional %29 %31 %32
|
|
%31 = OpLabel
|
|
OpBranch %30
|
|
%32 = OpLabel
|
|
%33 = OpAtomicIIncrement %uint %20 %uint_2 %uint_0
|
|
%34 = OpIAdd %uint %23 %uint_1
|
|
OpBranch %30
|
|
%30 = OpLabel
|
|
%24 = OpPhi %uint %18 %31 %34 %32
|
|
%36 = OpSelect %bool %29 %false %true
|
|
OpBranch %25
|
|
%25 = OpLabel
|
|
OpBranchConditional %36 %22 %26
|
|
%26 = OpLabel
|
|
OpReturn
|
|
OpFunctionEnd
|