Files
Vulkan-CTS-bin/vulkan/amber/compute/webgl_spirv_loop.amber
T
2026-05-06 23:44:13 +02:00

90 lines
3.0 KiB
Plaintext

#!amber
SHADER compute compute_shader SPIRV-ASM
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 36
; Schema: 0
OpCapability Shader
OpExtension "SPV_KHR_storage_buffer_storage_class"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
OpName %flow_block "flow_block"
OpMemberName %flow_block 0 "inner"
OpName %flow "flow"
OpName %main "main"
OpName %LOOP_COUNTER "LOOP_COUNTER"
OpDecorate %flow_block Block
OpMemberDecorate %flow_block 0 Offset 0
OpDecorate %_arr_uint_uint_2 ArrayStride 4
OpDecorate %flow DescriptorSet 0
OpDecorate %flow Binding 0
%uint = OpTypeInt 32 0
%uint_2 = OpConstant %uint 2
%_arr_uint_uint_2 = OpTypeArray %uint %uint_2
%flow_block = OpTypeStruct %_arr_uint_uint_2
%_ptr_StorageBuffer_flow_block = OpTypePointer StorageBuffer %flow_block
%flow = OpVariable %_ptr_StorageBuffer_flow_block StorageBuffer
%void = OpTypeVoid
%7 = OpTypeFunction %void
%11 = OpConstantNull %uint
%_ptr_Function_uint = OpTypePointer Function %uint
%uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer_uint = OpTypePointer StorageBuffer %uint
%uint_1 = OpConstant %uint 1
%bool = OpTypeBool
%main = OpFunction %void None %7
%10 = OpLabel
%LOOP_COUNTER = OpVariable %_ptr_Function_uint Function %11
OpStore %LOOP_COUNTER %11
OpBranch %14
%14 = OpLabel
OpLoopMerge %15 %16 None
OpBranch %17
%17 = OpLabel
%20 = OpAccessChain %_ptr_StorageBuffer_uint %flow %uint_0 %11
%21 = OpAccessChain %_ptr_StorageBuffer_uint %flow %uint_0 %11
%22 = OpLoad %uint %21
%24 = OpIAdd %uint %22 %uint_1
OpStore %20 %24
%25 = OpLoad %uint %LOOP_COUNTER
%26 = OpUGreaterThanEqual %bool %25 %uint_1
OpSelectionMerge %28 None
OpBranchConditional %26 %29 %28
%29 = OpLabel
%30 = OpAccessChain %_ptr_StorageBuffer_uint %flow %uint_0 %uint_1
%31 = OpAccessChain %_ptr_StorageBuffer_uint %flow %uint_0 %uint_1
%32 = OpLoad %uint %31
%33 = OpIAdd %uint %32 %uint_1
OpStore %30 %33
OpBranch %15
%28 = OpLabel
%34 = OpLoad %uint %LOOP_COUNTER
%35 = OpIAdd %uint %34 %uint_1
OpStore %LOOP_COUNTER %35
OpBranch %16
%16 = OpLabel
OpBranch %14
%15 = OpLabel
OpReturn
OpFunctionEnd
END
BUFFER buf0 DATA_TYPE uint32 DATA 0 0 END
BUFFER expected0 DATA_TYPE uint32 DATA 2 1 END
PIPELINE compute pipeline
ATTACH compute_shader
BIND BUFFER buf0 AS storage DESCRIPTOR_SET 0 BINDING 0
END
RUN pipeline 1 1 1
#EXPECT buf0 IDX 0 EQ 2
#EXPECT buf0 IDX 4 EQ 1
EXPECT buf0 EQ_BUFFER expected0