blob: 88d67242a9d328639c7818b0f0cffc804f9727f9 [file] [log] [blame]
[require]
VK_KHR_spirv_1_4
[compute shader spirv]
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main" %gid_var %sel_var %in_var %out_var
OpExecutionMode %main LocalSize 1 1 1
OpDecorate %gid_var BuiltIn GlobalInvocationId
OpDecorate %rta ArrayStride 16
OpDecorate %block Block
OpMemberDecorate %block 0 Offset 0
OpDecorate %sel_var DescriptorSet 0
OpDecorate %sel_var Binding 0
OpDecorate %in_var DescriptorSet 0
OpDecorate %in_var Binding 1
OpDecorate %out_var DescriptorSet 0
OpDecorate %out_var Binding 2
%void = OpTypeVoid
%bool = OpTypeBool
%bool4 = OpTypeVector %bool 4
%int = OpTypeInt 32 0
%int_0 = OpConstant %int 0
%int_1 = OpConstant %int 1
%int3 = OpTypeVector %int 3
%int4 = OpTypeVector %int 4
%int4_0 = OpConstantNull %int4
%rta = OpTypeRuntimeArray %int4
%block = OpTypeStruct %rta
%ptr_input_int3 = OpTypePointer Input %int3
%gid_var = OpVariable %ptr_input_int3 Input
%ptr_ssbo_block = OpTypePointer StorageBuffer %block
%ptr_ssbo_int4 = OpTypePointer StorageBuffer %int4
%sel_var = OpVariable %ptr_ssbo_block StorageBuffer
%in_var = OpVariable %ptr_ssbo_block StorageBuffer
%out_var = OpVariable %ptr_ssbo_block StorageBuffer
%void_fn = OpTypeFunction %void
%main = OpFunction %void None %void_fn
%entry = OpLabel
%gid = OpLoad %int3 %gid_var
%gid_x = OpCompositeExtract %int %gid 0
%in_gep0 = OpAccessChain %ptr_ssbo_int4 %in_var %int_0 %int_0
%in0 = OpLoad %int4 %in_gep0
%in_gep1 = OpAccessChain %ptr_ssbo_int4 %in_var %int_0 %int_1
%in1 = OpLoad %int4 %in_gep1
%sel_gep = OpAccessChain %ptr_ssbo_int4 %sel_var %int_0 %gid_x
%sel_ld = OpLoad %int4 %sel_gep
%eq_0 = OpIEqual %bool4 %sel_ld %int4_0
%select = OpSelect %int4 %eq_0 %in0 %in1
%out_gep = OpAccessChain %ptr_ssbo_int4 %out_var %int_0 %gid_x
OpStore %out_gep %select
OpReturn
OpFunctionEnd
[test]
ssbo 0:0 subdata uint 0 0 1 0 1 1 0 1 0
ssbo 0:1 subdata uint 0 1 1 1 1 2 2 2 2
ssbo 0:2 32
compute entrypoint main
compute 2 1 1
probe ssbo uint 0:2 0 == 1 2 1 2
probe ssbo uint 0:2 16 == 2 1 2 1