| [require] |
| VK_KHR_spirv_1_4 |
| VK_KHR_storage_buffer_storage_class |
| |
| [compute shader spirv] |
| OpCapability Shader |
| OpMemoryModel Logical GLSL450 |
| OpEntryPoint GLCompute %main "main" %gid_var %in_var %out_var |
| OpExecutionMode %main LocalSize 8 1 1 |
| |
| OpDecorate %lid_var BuiltIn LocalInvocationId |
| OpDecorate %gid_var BuiltIn GlobalInvocationId |
| |
| OpDecorate %int_rta ArrayStride 4 |
| OpDecorate %struct Block |
| OpMemberDecorate %struct 0 Offset 0 |
| OpDecorate %in_var DescriptorSet 0 |
| OpDecorate %in_var Binding 0 |
| OpDecorate %out_var DescriptorSet 0 |
| OpDecorate %out_var Binding 1 |
| |
| OpDecorateId %in_ld UniformId %workgroup |
| |
| %void = OpTypeVoid |
| %int = OpTypeInt 32 0 |
| %int_0 = OpConstant %int 0 |
| %workgroup = OpConstant %int 2 |
| %int3 = OpTypeVector %int 3 |
| |
| %int_rta = OpTypeRuntimeArray %int |
| %struct = OpTypeStruct %int_rta |
| %ptr_ssbo_struct = OpTypePointer StorageBuffer %struct |
| %in_var = OpVariable %ptr_ssbo_struct StorageBuffer |
| %out_var = OpVariable %ptr_ssbo_struct StorageBuffer |
| %ptr_ssbo_int = OpTypePointer StorageBuffer %int |
| |
| %ptr_input_int3 = OpTypePointer Input %int3 |
| %lid_var = OpVariable %ptr_input_int3 Input |
| %gid_var = OpVariable %ptr_input_int3 Input |
| |
| %void_fn = OpTypeFunction %void |
| %main = OpFunction %void None %void_fn |
| %entry = OpLabel |
| %gid = OpLoad %int3 %gid_var |
| %gid_x = OpCompositeExtract %int %gid 0 |
| %in_gep = OpAccessChain %ptr_ssbo_int %in_var %int_0 %gid_x |
| %in_ld = OpLoad %int %in_gep |
| %out_gep = OpAccessChain %ptr_ssbo_int %out_var %int_0 %gid_x |
| OpStore %out_gep %in_ld |
| OpReturn |
| OpFunctionEnd |
| |
| [test] |
| ssbo 0:0 subdata uint 0 1 1 1 1 1 1 1 1 |
| ssbo 0:0 subdata uint 32 2 2 2 2 2 2 2 2 |
| ssbo 0:0 subdata uint 64 3 3 3 3 3 3 3 3 |
| ssbo 0:0 subdata uint 96 4 4 4 4 4 4 4 4 |
| ssbo 0:1 128 |
| |
| compute entrypoint main |
| compute 4 1 1 |
| |
| probe ssbo uint 0:1 0 == 1 1 1 1 1 1 1 1 |
| probe ssbo uint 0:1 32 == 2 2 2 2 2 2 2 2 |
| probe ssbo uint 0:1 64 == 3 3 3 3 3 3 3 3 |
| probe ssbo uint 0:1 96 == 4 4 4 4 4 4 4 4 |