1[require] 2VK_KHR_spirv_1_4 3 4[compute shader spirv] 5; Use the IterationMultiple loop control. 6; Generated from with modified loop control: 7; 8; #version 430 9; 10; 11; layout(std430, binding = 0) buffer input_buffer 12; { 13; int in_size; 14; ivec4 data_SSBO[]; 15; }; 16; 17; layout(std430, binding = 1) buffer output_buffer 18; { 19; int out_size; 20; ivec4 out_SSBO[]; 21; }; 22; 23; void main() { 24; for( int i = 0; i < in_size; ++i ) { 25; out_SSBO[i] = data_SSBO[i]; 26; } 27; } 28 OpCapability Shader 29 %1 = OpExtInstImport "GLSL.std.450" 30 OpMemoryModel Logical GLSL450 31 OpEntryPoint GLCompute %main "main" %_ %__0 32 OpExecutionMode %main LocalSize 1 1 1 33 OpSource GLSL 430 34 OpSourceExtension "GL_GOOGLE_cpp_style_line_directive" 35 OpSourceExtension "GL_GOOGLE_include_directive" 36 OpName %main "main" 37 OpName %i "i" 38 OpName %input_buffer "input_buffer" 39 OpMemberName %input_buffer 0 "in_size" 40 OpMemberName %input_buffer 1 "data_SSBO" 41 OpName %_ "" 42 OpName %output_buffer "output_buffer" 43 OpMemberName %output_buffer 0 "out_size" 44 OpMemberName %output_buffer 1 "out_SSBO" 45 OpName %__0 "" 46 OpDecorate %_runtimearr_v4int ArrayStride 16 47 OpMemberDecorate %input_buffer 0 Offset 0 48 OpMemberDecorate %input_buffer 1 Offset 16 49 OpDecorate %input_buffer Block 50 OpDecorate %_ DescriptorSet 0 51 OpDecorate %_ Binding 0 52 OpDecorate %_runtimearr_v4int_0 ArrayStride 16 53 OpMemberDecorate %output_buffer 0 Offset 0 54 OpMemberDecorate %output_buffer 1 Offset 16 55 OpDecorate %output_buffer Block 56 OpDecorate %__0 DescriptorSet 0 57 OpDecorate %__0 Binding 1 58 %void = OpTypeVoid 59 %3 = OpTypeFunction %void 60 %int = OpTypeInt 32 1 61%_ptr_Function_int = OpTypePointer Function %int 62 %int_0 = OpConstant %int 0 63 %v4int = OpTypeVector %int 4 64%_runtimearr_v4int = OpTypeRuntimeArray %v4int 65%input_buffer = OpTypeStruct %int %_runtimearr_v4int 66%_ptr_StorageBuffer_input_buffer = OpTypePointer StorageBuffer %input_buffer 67 %_ = OpVariable %_ptr_StorageBuffer_input_buffer StorageBuffer 68%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int 69 %bool = OpTypeBool 70%_runtimearr_v4int_0 = OpTypeRuntimeArray %v4int 71%output_buffer = OpTypeStruct %int %_runtimearr_v4int_0 72%_ptr_StorageBuffer_output_buffer = OpTypePointer StorageBuffer %output_buffer 73 %__0 = OpVariable %_ptr_StorageBuffer_output_buffer StorageBuffer 74 %int_1 = OpConstant %int 1 75%_ptr_StorageBuffer_v4int = OpTypePointer StorageBuffer %v4int 76 %main = OpFunction %void None %3 77 %5 = OpLabel 78 %i = OpVariable %_ptr_Function_int Function 79 OpStore %i %int_0 80 OpBranch %10 81 %10 = OpLabel 82 OpLoopMerge %12 %13 IterationMultiple 3 83 OpBranch %14 84 %14 = OpLabel 85 %15 = OpLoad %int %i 86 %23 = OpAccessChain %_ptr_StorageBuffer_int %_ %int_0 87 %24 = OpLoad %int %23 88 %26 = OpSLessThan %bool %15 %24 89 OpBranchConditional %26 %11 %12 90 %11 = OpLabel 91 %32 = OpLoad %int %i 92 %33 = OpLoad %int %i 93 %35 = OpAccessChain %_ptr_StorageBuffer_v4int %_ %int_1 %33 94 %36 = OpLoad %v4int %35 95 %37 = OpAccessChain %_ptr_StorageBuffer_v4int %__0 %int_1 %32 96 OpStore %37 %36 97 OpBranch %13 98 %13 = OpLabel 99 %38 = OpLoad %int %i 100 %39 = OpIAdd %int %38 %int_1 101 OpStore %i %39 102 OpBranch %10 103 %12 = OpLabel 104 OpReturn 105 OpFunctionEnd 106 107[test] 108ssbo 0:0 112 109ssbo 0:0 subdata int 0 6 0 0 0 110ssbo 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 111ssbo 0:1 112 112ssbo 0:1 subdata int 0 6 0 0 0 113ssbo 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 114 115compute entrypoint main 116compute 1 1 1 117 118probe 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 119