| [require] |
| VK_KHR_spirv_1_4 |
| |
| [compute shader spirv] |
| ; Compute shader with push constnat. |
| ; |
| ; #version 430 |
| ; |
| ; layout(push_constant) uniform pushConstants { |
| ; int in_val; |
| ; } u_pushConstants; |
| ; |
| ; layout(std430, binding = 0) buffer output_buffer |
| ; { |
| ; int out_SSBO[]; |
| ; }; |
| ; |
| ; void main() { |
| ; out_SSBO[gl_GlobalInvocationID.z] = u_pushConstants.in_val; |
| ; } |
| OpCapability Shader |
| %1 = OpExtInstImport "GLSL.std.450" |
| OpMemoryModel Logical GLSL450 |
| OpEntryPoint GLCompute %main "main" %_ %gl_GlobalInvocationID %u_pushConstants |
| OpExecutionMode %main LocalSize 1 1 1 |
| OpSource GLSL 430 |
| OpName %main "main" |
| OpName %output_buffer "output_buffer" |
| OpMemberName %output_buffer 0 "out_SSBO" |
| OpName %_ "" |
| OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" |
| OpName %pushConstants "pushConstants" |
| OpMemberName %pushConstants 0 "in_val" |
| OpName %u_pushConstants "u_pushConstants" |
| OpDecorate %_runtimearr_int ArrayStride 4 |
| OpMemberDecorate %output_buffer 0 Offset 0 |
| OpDecorate %output_buffer Block |
| OpDecorate %_ DescriptorSet 0 |
| OpDecorate %_ Binding 0 |
| OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId |
| OpMemberDecorate %pushConstants 0 Offset 0 |
| OpDecorate %pushConstants Block |
| %void = OpTypeVoid |
| %3 = OpTypeFunction %void |
| %int = OpTypeInt 32 1 |
| %_runtimearr_int = OpTypeRuntimeArray %int |
| %output_buffer = OpTypeStruct %_runtimearr_int |
| %_ptr_StorageBuffer_output_buffer = OpTypePointer StorageBuffer %output_buffer |
| %_ = OpVariable %_ptr_StorageBuffer_output_buffer StorageBuffer |
| %int_0 = OpConstant %int 0 |
| %uint = OpTypeInt 32 0 |
| %v3uint = OpTypeVector %uint 3 |
| %_ptr_Input_v3uint = OpTypePointer Input %v3uint |
| %gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint Input |
| %uint_2 = OpConstant %uint 2 |
| %_ptr_Input_uint = OpTypePointer Input %uint |
| %pushConstants = OpTypeStruct %int |
| %_ptr_PushConstant_pushConstants = OpTypePointer PushConstant %pushConstants |
| %u_pushConstants = OpVariable %_ptr_PushConstant_pushConstants PushConstant |
| %_ptr_PushConstant_int = OpTypePointer PushConstant %int |
| %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int |
| %main = OpFunction %void None %3 |
| %5 = OpLabel |
| %18 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_2 |
| %19 = OpLoad %uint %18 |
| %24 = OpAccessChain %_ptr_PushConstant_int %u_pushConstants %int_0 |
| %25 = OpLoad %int %24 |
| %27 = OpAccessChain %_ptr_StorageBuffer_int %_ %int_0 %19 |
| OpStore %27 %25 |
| OpReturn |
| OpFunctionEnd |
| [test] |
| uniform int 0 1 |
| ssbo 0:0 subdata int 0 -1 -1 |
| |
| compute entrypoint main |
| compute 1 1 1 |
| |
| probe ssbo int 0:0 0 == 1 -1 |