| [require] |
| |
| [compute shader spirv] |
| ; OpSelect among scalars. This is in SPIR-V 1.0 |
| OpCapability Shader |
| %1 = OpExtInstImport "GLSL.std.450" |
| OpMemoryModel Logical GLSL450 |
| OpEntryPoint GLCompute %main "main" %gl_GlobalInvocationID %_ %__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 %output_buffer "output_buffer" |
| OpMemberName %output_buffer 0 "out_SSBO" |
| OpName %_ "" |
| OpName %gl_GlobalInvocationID "gl_GlobalInvocationID" |
| OpName %input_buffer "input_buffer" |
| OpMemberName %input_buffer 0 "data_SSBO" |
| OpName %__0 "" |
| OpDecorate %_runtimearr_int ArrayStride 4 |
| OpMemberDecorate %output_buffer 0 Offset 0 |
| OpDecorate %output_buffer Block |
| OpDecorate %_ DescriptorSet 0 |
| OpDecorate %_ Binding 1 |
| OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId |
| OpDecorate %_runtimearr_int_0 ArrayStride 4 |
| OpMemberDecorate %input_buffer 0 Offset 0 |
| OpDecorate %input_buffer Block |
| OpDecorate %__0 DescriptorSet 0 |
| OpDecorate %__0 Binding 0 |
| %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 |
| %_runtimearr_int_0 = OpTypeRuntimeArray %int |
| %input_buffer = OpTypeStruct %_runtimearr_int_0 |
| %_ptr_StorageBuffer_input_buffer = OpTypePointer StorageBuffer %input_buffer |
| %__0 = OpVariable %_ptr_StorageBuffer_input_buffer StorageBuffer |
| %_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int |
| %bool = OpTypeBool |
| %int_1 = OpConstant %int 1 |
| %int_2 = OpConstant %int 2 |
| %main = OpFunction %void None %3 |
| %5 = OpLabel |
| %18 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_2 |
| %19 = OpLoad %uint %18 |
| %24 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_2 |
| %25 = OpLoad %uint %24 |
| %27 = OpAccessChain %_ptr_StorageBuffer_int %__0 %int_0 %25 |
| %28 = OpLoad %int %27 |
| %30 = OpIEqual %bool %28 %int_0 |
| %33 = OpSelect %int %30 %int_1 %int_2 |
| %34 = OpAccessChain %_ptr_StorageBuffer_int %_ %int_0 %19 |
| OpStore %34 %33 |
| OpReturn |
| OpFunctionEnd |
| [test] |
| ssbo 0:0 8 |
| ssbo 0:0 subdata int 0 0 1 |
| ssbo 0:1 8 |
| ssbo 0:1 subdata int 0 -1 -1 |
| |
| compute entrypoint main |
| compute 1 1 2 |
| |
| probe ssbo int 0:1 0 == 1 2 |