| [require] |
| VK_KHR_spirv_1_4 |
| |
| [compute shader spirv] |
| ; Use the IterationMultiple loop control. |
| ; Generated from with modified loop control: |
| ; |
| ; #version 430 |
| ; |
| ; |
| ; layout(std430, binding = 0) buffer input_buffer |
| ; { |
| ; int in_size; |
| ; ivec4 data_SSBO[]; |
| ; }; |
| ; |
| ; layout(std430, binding = 1) buffer output_buffer |
| ; { |
| ; int out_size; |
| ; ivec4 out_SSBO[]; |
| ; }; |
| ; |
| ; void main() { |
| ; for( int i = 0; i < in_size; ++i ) { |
| ; out_SSBO[i] = data_SSBO[i]; |
| ; } |
| ; } |
| OpCapability Shader |
| %1 = OpExtInstImport "GLSL.std.450" |
| OpMemoryModel Logical GLSL450 |
| OpEntryPoint GLCompute %main "main" %_ %__0 |
| OpExecutionMode %main LocalSize 1 1 1 |
| OpSource GLSL 430 |
| OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" |
| OpSourceExtension "GL_GOOGLE_include_directive" |
| OpName %main "main" |
| OpName %i "i" |
| OpName %input_buffer "input_buffer" |
| OpMemberName %input_buffer 0 "in_size" |
| OpMemberName %input_buffer 1 "data_SSBO" |
| OpName %_ "" |
| OpName %output_buffer "output_buffer" |
| OpMemberName %output_buffer 0 "out_size" |
| OpMemberName %output_buffer 1 "out_SSBO" |
| OpName %__0 "" |
| OpDecorate %_runtimearr_v4int ArrayStride 16 |
| OpMemberDecorate %input_buffer 0 Offset 0 |
| OpMemberDecorate %input_buffer 1 Offset 16 |
| OpDecorate %input_buffer Block |
| OpDecorate %_ DescriptorSet 0 |
| OpDecorate %_ Binding 0 |
| OpDecorate %_runtimearr_v4int_0 ArrayStride 16 |
| OpMemberDecorate %output_buffer 0 Offset 0 |
| OpMemberDecorate %output_buffer 1 Offset 16 |
| OpDecorate %output_buffer Block |
| OpDecorate %__0 DescriptorSet 0 |
| OpDecorate %__0 Binding 1 |
| %void = OpTypeVoid |
| %3 = OpTypeFunction %void |
| %int = OpTypeInt 32 1 |
| %_ptr_Function_int = OpTypePointer Function %int |
| %int_0 = OpConstant %int 0 |
| %v4int = OpTypeVector %int 4 |
| %_runtimearr_v4int = OpTypeRuntimeArray %v4int |
| %input_buffer = OpTypeStruct %int %_runtimearr_v4int |
| %_ptr_StorageBuffer_input_buffer = OpTypePointer StorageBuffer %input_buffer |
| %_ = OpVariable %_ptr_StorageBuffer_input_buffer StorageBuffer |
| %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int |
| %bool = OpTypeBool |
| %_runtimearr_v4int_0 = OpTypeRuntimeArray %v4int |
| %output_buffer = OpTypeStruct %int %_runtimearr_v4int_0 |
| %_ptr_StorageBuffer_output_buffer = OpTypePointer StorageBuffer %output_buffer |
| %__0 = OpVariable %_ptr_StorageBuffer_output_buffer StorageBuffer |
| %int_1 = OpConstant %int 1 |
| %_ptr_StorageBuffer_v4int = OpTypePointer StorageBuffer %v4int |
| %main = OpFunction %void None %3 |
| %5 = OpLabel |
| %i = OpVariable %_ptr_Function_int Function |
| OpStore %i %int_0 |
| OpBranch %10 |
| %10 = OpLabel |
| OpLoopMerge %12 %13 IterationMultiple 3 |
| OpBranch %14 |
| %14 = OpLabel |
| %15 = OpLoad %int %i |
| %23 = OpAccessChain %_ptr_StorageBuffer_int %_ %int_0 |
| %24 = OpLoad %int %23 |
| %26 = OpSLessThan %bool %15 %24 |
| OpBranchConditional %26 %11 %12 |
| %11 = OpLabel |
| %32 = OpLoad %int %i |
| %33 = OpLoad %int %i |
| %35 = OpAccessChain %_ptr_StorageBuffer_v4int %_ %int_1 %33 |
| %36 = OpLoad %v4int %35 |
| %37 = OpAccessChain %_ptr_StorageBuffer_v4int %__0 %int_1 %32 |
| OpStore %37 %36 |
| OpBranch %13 |
| %13 = OpLabel |
| %38 = OpLoad %int %i |
| %39 = OpIAdd %int %38 %int_1 |
| OpStore %i %39 |
| OpBranch %10 |
| %12 = OpLabel |
| OpReturn |
| OpFunctionEnd |
| |
| [test] |
| ssbo 0:0 112 |
| ssbo 0:0 subdata int 0 6 0 0 0 |
| ssbo 0:0 subdata int 16 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
| ssbo 0:1 112 |
| ssbo 0:1 subdata int 0 6 0 0 0 |
| ssbo 0:1 subdata int 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 |
| |
| compute entrypoint main |
| compute 1 1 1 |
| |
| probe ssbo int 0:1 16 == 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |