yes
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
[require]
|
||||
VK_KHR_spirv_1_4
|
||||
|
||||
[compute shader spirv]
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main" %gid_var %in_var %out_var
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpDecorate %gid_var BuiltIn GlobalInvocationId
|
||||
OpDecorate %int_array ArrayStride 4
|
||||
OpDecorate %rta ArrayStride 4
|
||||
OpDecorate %rta_array ArrayStride 16
|
||||
OpDecorate %struct Block
|
||||
OpMemberDecorate %struct 0 Offset 0
|
||||
OpDecorate %out_struct Block
|
||||
OpMemberDecorate %out_struct 0 Offset 0
|
||||
OpDecorate %in_var DescriptorSet 0
|
||||
OpDecorate %in_var Binding 0
|
||||
OpDecorate %out_var DescriptorSet 0
|
||||
OpDecorate %out_var Binding 1
|
||||
%void = OpTypeVoid
|
||||
%bool = OpTypeBool
|
||||
%int = OpTypeInt 32 0
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_1 = OpConstant %int 1
|
||||
%int_2 = OpConstant %int 2
|
||||
%int_3 = OpConstant %int 3
|
||||
%int_4 = OpConstant %int 4
|
||||
%int3 = OpTypeVector %int 3
|
||||
%int_array = OpTypeArray %int %int_4
|
||||
%const_array1 = OpConstantComposite %int_array %int_0 %int_1 %int_2 %int_3
|
||||
%const_array2 = OpConstantComposite %int_array %int_3 %int_2 %int_1 %int_0
|
||||
%rta_array = OpTypeRuntimeArray %int_array
|
||||
%out_struct = OpTypeStruct %rta_array
|
||||
%rta = OpTypeRuntimeArray %int
|
||||
%struct = OpTypeStruct %rta
|
||||
%ptr_input_int3 = OpTypePointer Input %int3
|
||||
%gid_var = OpVariable %ptr_input_int3 Input
|
||||
%ptr_ssbo_struct = OpTypePointer StorageBuffer %struct
|
||||
%ptr_ssbo_out_struct = OpTypePointer StorageBuffer %out_struct
|
||||
%ptr_ssbo_array = OpTypePointer StorageBuffer %int_array
|
||||
%ptr_ssbo_int = OpTypePointer StorageBuffer %int
|
||||
%in_var = OpVariable %ptr_ssbo_struct StorageBuffer
|
||||
%out_var = OpVariable %ptr_ssbo_out_struct 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_gep = OpAccessChain %ptr_ssbo_int %in_var %int_0 %gid_x
|
||||
%ld = OpLoad %int %in_gep
|
||||
%eq_0 = OpIEqual %bool %ld %int_0
|
||||
%select = OpSelect %int_array %eq_0 %const_array1 %const_array2
|
||||
%out_gep = OpAccessChain %ptr_ssbo_array %out_var %int_0 %gid_x
|
||||
OpStore %out_gep %select
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
||||
[test]
|
||||
ssbo 0:0 subdata uint 0 0 1 1 0
|
||||
ssbo 0:1 64
|
||||
|
||||
compute entrypoint main
|
||||
compute 4 1 1
|
||||
|
||||
probe ssbo uint 0:1 0 == 0 1 2 3 3 2 1 0 3 2 1 0 0 1 2 3
|
||||
@@ -0,0 +1,74 @@
|
||||
[require]
|
||||
VK_KHR_spirv_1_4
|
||||
|
||||
[compute shader spirv]
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main" %gid_var %in_var %out_var
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpDecorate %gid_var BuiltIn GlobalInvocationId
|
||||
OpDecorate %int_array ArrayStride 8
|
||||
OpDecorate %rta ArrayStride 4
|
||||
OpDecorate %rta_array ArrayStride 32
|
||||
OpDecorate %struct Block
|
||||
OpMemberDecorate %struct 0 Offset 0
|
||||
OpDecorate %out_struct Block
|
||||
OpMemberDecorate %out_struct 0 Offset 0
|
||||
OpDecorate %in_var DescriptorSet 0
|
||||
OpDecorate %in_var Binding 0
|
||||
OpDecorate %out_var DescriptorSet 0
|
||||
OpDecorate %out_var Binding 1
|
||||
%void = OpTypeVoid
|
||||
%bool = OpTypeBool
|
||||
%int = OpTypeInt 32 0
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_1 = OpConstant %int 1
|
||||
%int_2 = OpConstant %int 2
|
||||
%int_3 = OpConstant %int 3
|
||||
%int_4 = OpConstant %int 4
|
||||
%int3 = OpTypeVector %int 3
|
||||
%int_array = OpTypeArray %int %int_4
|
||||
%const_array1 = OpConstantComposite %int_array %int_0 %int_1 %int_2 %int_3
|
||||
%const_array2 = OpConstantComposite %int_array %int_3 %int_2 %int_1 %int_0
|
||||
%rta_array = OpTypeRuntimeArray %int_array
|
||||
%out_struct = OpTypeStruct %rta_array
|
||||
%rta = OpTypeRuntimeArray %int
|
||||
%struct = OpTypeStruct %rta
|
||||
%ptr_input_int3 = OpTypePointer Input %int3
|
||||
%gid_var = OpVariable %ptr_input_int3 Input
|
||||
%ptr_ssbo_struct = OpTypePointer StorageBuffer %struct
|
||||
%ptr_ssbo_out_struct = OpTypePointer StorageBuffer %out_struct
|
||||
%ptr_ssbo_array = OpTypePointer StorageBuffer %int_array
|
||||
%ptr_ssbo_int = OpTypePointer StorageBuffer %int
|
||||
%in_var = OpVariable %ptr_ssbo_struct StorageBuffer
|
||||
%out_var = OpVariable %ptr_ssbo_out_struct 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_gep = OpAccessChain %ptr_ssbo_int %in_var %int_0 %gid_x
|
||||
%ld = OpLoad %int %in_gep
|
||||
%eq_0 = OpIEqual %bool %ld %int_0
|
||||
%select = OpSelect %int_array %eq_0 %const_array1 %const_array2
|
||||
%out_gep = OpAccessChain %ptr_ssbo_array %out_var %int_0 %gid_x
|
||||
OpStore %out_gep %select
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
||||
[test]
|
||||
ssbo 0:0 subdata uint 0 0 1
|
||||
ssbo 0:1 64
|
||||
|
||||
compute entrypoint main
|
||||
compute 2 1 1
|
||||
|
||||
probe ssbo uint 0:1 0 == 0
|
||||
probe ssbo uint 0:1 8 == 1
|
||||
probe ssbo uint 0:1 16 == 2
|
||||
probe ssbo uint 0:1 24 == 3
|
||||
probe ssbo uint 0:1 32 == 3
|
||||
probe ssbo uint 0:1 40 == 2
|
||||
probe ssbo uint 0:1 48 == 1
|
||||
probe ssbo uint 0:1 56 == 0
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
[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 %inner ArrayStride 4
|
||||
OpMemberDecorate %outer 0 Offset 0
|
||||
OpMemberDecorate %outer 1 Offset 8
|
||||
OpDecorate %rta ArrayStride 4
|
||||
OpDecorate %rta_out ArrayStride 16
|
||||
OpDecorate %block Block
|
||||
OpMemberDecorate %block 0 Offset 0
|
||||
OpDecorate %out_block Block
|
||||
OpMemberDecorate %out_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
|
||||
%int = OpTypeInt 32 0
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_1 = OpConstant %int 1
|
||||
%int_2 = OpConstant %int 2
|
||||
%int3 = OpTypeVector %int 3
|
||||
%inner = OpTypeArray %int %int_2
|
||||
%outer = OpTypeStruct %inner %inner
|
||||
%rta_out = OpTypeRuntimeArray %outer
|
||||
%out_block = OpTypeStruct %rta_out
|
||||
%rta = OpTypeRuntimeArray %int
|
||||
%block = OpTypeStruct %rta
|
||||
%ptr_input_int3 = OpTypePointer Input %int3
|
||||
%gid_var = OpVariable %ptr_input_int3 Input
|
||||
%ptr_ssbo_block = OpTypePointer StorageBuffer %block
|
||||
%ptr_ssbo_int = OpTypePointer StorageBuffer %int
|
||||
%ptr_ssbo_out_block = OpTypePointer StorageBuffer %out_block
|
||||
%ptr_ssbo_outer = OpTypePointer StorageBuffer %outer
|
||||
%sel_var = OpVariable %ptr_ssbo_block StorageBuffer
|
||||
%in_var = OpVariable %ptr_ssbo_out_block StorageBuffer
|
||||
%out_var = OpVariable %ptr_ssbo_out_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_outer %in_var %int_0 %int_0
|
||||
%in0 = OpLoad %outer %in_gep0
|
||||
%in_gep1 = OpAccessChain %ptr_ssbo_outer %in_var %int_0 %int_1
|
||||
%in1 = OpLoad %outer %in_gep1
|
||||
%sel_gep = OpAccessChain %ptr_ssbo_int %sel_var %int_0 %gid_x
|
||||
%sel_val = OpLoad %int %sel_gep
|
||||
%eq_0 = OpIEqual %bool %sel_val %int_0
|
||||
%select = OpSelect %outer %eq_0 %in0 %in1
|
||||
%out_gep = OpAccessChain %ptr_ssbo_outer %out_var %int_0 %gid_x
|
||||
OpStore %out_gep %select
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
||||
[test]
|
||||
ssbo 0:0 subdata uint 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 == 2 2 2 2
|
||||
probe ssbo uint 0:2 16 == 1 1 1 1
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
[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
|
||||
OpMemberDecorate %inner 0 Offset 0
|
||||
OpMemberDecorate %inner 1 Offset 4
|
||||
OpMemberDecorate %outer 0 Offset 0
|
||||
OpMemberDecorate %outer 1 Offset 8
|
||||
OpDecorate %rta ArrayStride 4
|
||||
OpDecorate %rta_out ArrayStride 16
|
||||
OpDecorate %block Block
|
||||
OpMemberDecorate %block 0 Offset 0
|
||||
OpDecorate %out_block Block
|
||||
OpMemberDecorate %out_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
|
||||
%int = OpTypeInt 32 0
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_1 = OpConstant %int 1
|
||||
%int3 = OpTypeVector %int 3
|
||||
%inner = OpTypeStruct %int %int
|
||||
%outer = OpTypeStruct %inner %inner
|
||||
%rta_out = OpTypeRuntimeArray %outer
|
||||
%out_block = OpTypeStruct %rta_out
|
||||
%rta = OpTypeRuntimeArray %int
|
||||
%block = OpTypeStruct %rta
|
||||
%ptr_input_int3 = OpTypePointer Input %int3
|
||||
%gid_var = OpVariable %ptr_input_int3 Input
|
||||
%ptr_ssbo_block = OpTypePointer StorageBuffer %block
|
||||
%ptr_ssbo_int = OpTypePointer StorageBuffer %int
|
||||
%ptr_ssbo_out_block = OpTypePointer StorageBuffer %out_block
|
||||
%ptr_ssbo_outer = OpTypePointer StorageBuffer %outer
|
||||
%sel_var = OpVariable %ptr_ssbo_block StorageBuffer
|
||||
%in_var = OpVariable %ptr_ssbo_out_block StorageBuffer
|
||||
%out_var = OpVariable %ptr_ssbo_out_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_outer %in_var %int_0 %int_0
|
||||
%in0 = OpLoad %outer %in_gep0
|
||||
%in_gep1 = OpAccessChain %ptr_ssbo_outer %in_var %int_0 %int_1
|
||||
%in1 = OpLoad %outer %in_gep1
|
||||
%sel_gep = OpAccessChain %ptr_ssbo_int %sel_var %int_0 %gid_x
|
||||
%sel_val = OpLoad %int %sel_gep
|
||||
%eq_0 = OpIEqual %bool %sel_val %int_0
|
||||
%select = OpSelect %outer %eq_0 %in0 %in1
|
||||
%out_gep = OpAccessChain %ptr_ssbo_outer %out_var %int_0 %gid_x
|
||||
OpStore %out_gep %select
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
||||
[test]
|
||||
ssbo 0:0 subdata uint 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 == 2 2 2 2
|
||||
probe ssbo uint 0:2 16 == 1 1 1 1
|
||||
@@ -0,0 +1,78 @@
|
||||
[require]
|
||||
VK_KHR_spirv_1_4
|
||||
|
||||
[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
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
[require]
|
||||
VK_KHR_spirv_1_4
|
||||
VariablePointerFeatures.variablePointersStorageBuffer
|
||||
VariablePointerFeatures.variablePointers
|
||||
|
||||
[compute shader spirv]
|
||||
OpCapability Shader
|
||||
OpCapability VariablePointers
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main" %gid_var %sel_var %in1_var %in2_var %out_var
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpDecorate %gid_var BuiltIn GlobalInvocationId
|
||||
OpMemberDecorate %inner 0 Offset 0
|
||||
OpMemberDecorate %inner 1 Offset 4
|
||||
OpMemberDecorate %outer 0 Offset 0
|
||||
OpMemberDecorate %outer 1 Offset 8
|
||||
OpDecorate %rta ArrayStride 4
|
||||
OpDecorate %rta_struct ArrayStride 16
|
||||
OpDecorate %block Block
|
||||
OpMemberDecorate %block 0 Offset 0
|
||||
OpDecorate %data_block Block
|
||||
OpMemberDecorate %data_block 0 Offset 0
|
||||
OpDecorate %sel_var DescriptorSet 0
|
||||
OpDecorate %sel_var Binding 0
|
||||
OpDecorate %in1_var DescriptorSet 0
|
||||
OpDecorate %in1_var Binding 1
|
||||
OpDecorate %in2_var DescriptorSet 0
|
||||
OpDecorate %in2_var Binding 2
|
||||
OpDecorate %out_var DescriptorSet 0
|
||||
OpDecorate %out_var Binding 3
|
||||
%void = OpTypeVoid
|
||||
%bool = OpTypeBool
|
||||
%int = OpTypeInt 32 0
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_1 = OpConstant %int 1
|
||||
%int3 = OpTypeVector %int 3
|
||||
%inner = OpTypeStruct %int %int
|
||||
%outer = OpTypeStruct %inner %inner
|
||||
%rta_struct = OpTypeRuntimeArray %outer
|
||||
%rta = OpTypeRuntimeArray %int
|
||||
%data_block = OpTypeStruct %rta_struct
|
||||
%block = OpTypeStruct %rta
|
||||
%ptr_input_int3 = OpTypePointer Input %int3
|
||||
%gid_var = OpVariable %ptr_input_int3 Input
|
||||
%ptr_ssbo_block = OpTypePointer StorageBuffer %block
|
||||
%ptr_ssbo_int = OpTypePointer StorageBuffer %int
|
||||
%ptr_ssbo_data_block = OpTypePointer StorageBuffer %data_block
|
||||
%ptr_ssbo_outer = OpTypePointer StorageBuffer %outer
|
||||
%sel_var = OpVariable %ptr_ssbo_block StorageBuffer
|
||||
%in1_var = OpVariable %ptr_ssbo_data_block StorageBuffer
|
||||
%in2_var = OpVariable %ptr_ssbo_data_block StorageBuffer
|
||||
%out_var = OpVariable %ptr_ssbo_data_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_outer %in1_var %int_0 %int_0
|
||||
%in_gep1 = OpAccessChain %ptr_ssbo_outer %in2_var %int_0 %int_0
|
||||
%sel_gep = OpAccessChain %ptr_ssbo_int %sel_var %int_0 %gid_x
|
||||
%sel_val = OpLoad %int %sel_gep
|
||||
%eq_0 = OpIEqual %bool %sel_val %int_0
|
||||
%select = OpSelect %ptr_ssbo_outer %eq_0 %in_gep0 %in_gep1
|
||||
%out_gep = OpAccessChain %ptr_ssbo_outer %out_var %int_0 %gid_x
|
||||
%ld = OpLoad %outer %select
|
||||
OpStore %out_gep %ld
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
||||
[test]
|
||||
ssbo 0:0 subdata uint 0 1 0
|
||||
ssbo 0:1 subdata uint 0 1 1 1 1
|
||||
ssbo 0:2 subdata uint 0 2 2 2 2
|
||||
ssbo 0:3 32
|
||||
|
||||
compute entrypoint main
|
||||
compute 2 1 1
|
||||
|
||||
probe ssbo uint 0:3 0 == 2 2 2 2
|
||||
probe ssbo uint 0:3 16 == 1 1 1 1
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
[require]
|
||||
VK_KHR_spirv_1_4
|
||||
VariablePointerFeatures.variablePointersStorageBuffer
|
||||
|
||||
[compute shader spirv]
|
||||
OpCapability Shader
|
||||
OpCapability VariablePointersStorageBuffer
|
||||
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
|
||||
OpMemberDecorate %inner 0 Offset 0
|
||||
OpMemberDecorate %inner 1 Offset 4
|
||||
OpMemberDecorate %outer 0 Offset 0
|
||||
OpMemberDecorate %outer 1 Offset 8
|
||||
OpDecorate %rta ArrayStride 4
|
||||
OpDecorate %rta_struct ArrayStride 16
|
||||
OpDecorate %block Block
|
||||
OpMemberDecorate %block 0 Offset 0
|
||||
OpDecorate %data_block Block
|
||||
OpMemberDecorate %data_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
|
||||
%int = OpTypeInt 32 0
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_1 = OpConstant %int 1
|
||||
%int3 = OpTypeVector %int 3
|
||||
%inner = OpTypeStruct %int %int
|
||||
%outer = OpTypeStruct %inner %inner
|
||||
%rta_struct = OpTypeRuntimeArray %outer
|
||||
%rta = OpTypeRuntimeArray %int
|
||||
%data_block = OpTypeStruct %rta_struct
|
||||
%block = OpTypeStruct %rta
|
||||
%ptr_input_int3 = OpTypePointer Input %int3
|
||||
%gid_var = OpVariable %ptr_input_int3 Input
|
||||
%ptr_ssbo_block = OpTypePointer StorageBuffer %block
|
||||
%ptr_ssbo_int = OpTypePointer StorageBuffer %int
|
||||
%ptr_ssbo_data_block = OpTypePointer StorageBuffer %data_block
|
||||
%ptr_ssbo_outer = OpTypePointer StorageBuffer %outer
|
||||
%sel_var = OpVariable %ptr_ssbo_block StorageBuffer
|
||||
%in_var = OpVariable %ptr_ssbo_data_block StorageBuffer
|
||||
%out_var = OpVariable %ptr_ssbo_data_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_outer %in_var %int_0 %int_0
|
||||
%in_gep1 = OpAccessChain %ptr_ssbo_outer %in_var %int_0 %int_1
|
||||
%sel_gep = OpAccessChain %ptr_ssbo_int %sel_var %int_0 %gid_x
|
||||
%sel_val = OpLoad %int %sel_gep
|
||||
%eq_0 = OpIEqual %bool %sel_val %int_0
|
||||
%select = OpSelect %ptr_ssbo_outer %eq_0 %in_gep0 %in_gep1
|
||||
%out_gep = OpAccessChain %ptr_ssbo_outer %out_var %int_0 %gid_x
|
||||
OpCopyMemory %out_gep %select
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
||||
[test]
|
||||
ssbo 0:0 subdata uint 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 == 2 2 2 2
|
||||
probe ssbo uint 0:2 16 == 1 1 1 1
|
||||
@@ -0,0 +1,129 @@
|
||||
[require]
|
||||
VK_KHR_spirv_1_4
|
||||
|
||||
[compute shader spirv]
|
||||
; Test OpSelect with a scalar condition and composite result type.
|
||||
; Generated from the following GLSL with minor modification.
|
||||
;
|
||||
;#version 430
|
||||
;
|
||||
;struct S {int a; int b; int c;};
|
||||
;
|
||||
;layout(std430, binding = 0) buffer input_buffer
|
||||
;{
|
||||
; S data_SSBO[];
|
||||
;};
|
||||
;
|
||||
;layout(std430, binding = 1) buffer output_buffer
|
||||
;{
|
||||
; S out_SSBO[];
|
||||
;};
|
||||
;
|
||||
;void main() {
|
||||
; S one = { 1, 1, 1 };
|
||||
; S two = { 2, 2, 2 };
|
||||
;
|
||||
; out_SSBO[gl_GlobalInvocationID.z] = (data_SSBO[gl_GlobalInvocationID.z].a == 0 ? one : two);
|
||||
;}
|
||||
;
|
||||
; Applying the no signed wrap decoration
|
||||
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 %S "S"
|
||||
OpMemberName %S 0 "a"
|
||||
OpMemberName %S 1 "b"
|
||||
OpMemberName %S 2 "c"
|
||||
OpName %one "one"
|
||||
OpName %two "two"
|
||||
OpName %S_0 "S"
|
||||
OpMemberName %S_0 0 "a"
|
||||
OpMemberName %S_0 1 "b"
|
||||
OpMemberName %S_0 2 "c"
|
||||
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 ""
|
||||
OpMemberDecorate %S_0 0 Offset 0
|
||||
OpMemberDecorate %S_0 1 Offset 4
|
||||
OpMemberDecorate %S_0 2 Offset 8
|
||||
OpDecorate %_runtimearr_S_0 ArrayStride 12
|
||||
OpMemberDecorate %output_buffer 0 Offset 0
|
||||
OpDecorate %output_buffer Block
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 1
|
||||
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
|
||||
OpDecorate %_runtimearr_S_0_0 ArrayStride 12
|
||||
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
|
||||
%S = OpTypeStruct %int %int %int
|
||||
%_ptr_Function_S = OpTypePointer Function %S
|
||||
%int_1 = OpConstant %int 1
|
||||
%11 = OpConstantComposite %S %int_1 %int_1 %int_1
|
||||
%int_2 = OpConstant %int 2
|
||||
%14 = OpConstantComposite %S %int_2 %int_2 %int_2
|
||||
%S_0 = OpTypeStruct %int %int %int
|
||||
%_runtimearr_S_0 = OpTypeRuntimeArray %S_0
|
||||
%output_buffer = OpTypeStruct %_runtimearr_S_0
|
||||
%_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_S_0_0 = OpTypeRuntimeArray %S_0
|
||||
%input_buffer = OpTypeStruct %_runtimearr_S_0_0
|
||||
%_ptr_StorageBuffer_input_buffer = OpTypePointer StorageBuffer %input_buffer
|
||||
%__0 = OpVariable %_ptr_StorageBuffer_input_buffer StorageBuffer
|
||||
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
|
||||
%bool = OpTypeBool
|
||||
%_ptr_StorageBuffer_S_0 = OpTypePointer StorageBuffer %S_0
|
||||
%one = OpConstantComposite %S %int_1 %int_1 %int_1
|
||||
%two = OpConstantComposite %S %int_2 %int_2 %int_2
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%27 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_2
|
||||
%28 = OpLoad %uint %27
|
||||
%36 = OpAccessChain %_ptr_StorageBuffer_int %__0 %int_0 %28 %int_0
|
||||
%37 = OpLoad %int %36
|
||||
%39 = OpIEqual %bool %37 %int_0
|
||||
%sel = OpSelect %S %39 %one %two
|
||||
%48 = OpAccessChain %_ptr_StorageBuffer_S_0 %_ %int_0 %28
|
||||
%49 = OpCompositeExtract %int %sel 0
|
||||
%50 = OpAccessChain %_ptr_StorageBuffer_int %48 %int_0
|
||||
OpStore %50 %49
|
||||
%51 = OpCompositeExtract %int %sel 1
|
||||
%52 = OpAccessChain %_ptr_StorageBuffer_int %48 %int_1
|
||||
OpStore %52 %51
|
||||
%53 = OpCompositeExtract %int %sel 2
|
||||
%54 = OpAccessChain %_ptr_StorageBuffer_int %48 %int_2
|
||||
OpStore %54 %53
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
[test]
|
||||
ssbo 0:0 24
|
||||
ssbo 0:0 subdata int 0 0 0 0 1 1 1
|
||||
ssbo 0:1 8
|
||||
ssbo 0:1 subdata int 0 -1 -1 -1 -1 -1 -1
|
||||
|
||||
compute entrypoint main
|
||||
compute 1 1 2
|
||||
|
||||
probe ssbo int 0:1 0 == 1 1 1 2 2 2
|
||||
@@ -0,0 +1,64 @@
|
||||
[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
|
||||
@@ -0,0 +1,128 @@
|
||||
[require]
|
||||
VK_KHR_spirv_1_4
|
||||
|
||||
[compute shader spirv]
|
||||
; Test OpSelect with a scalar condition and vector result type.
|
||||
; Generated from the following GLSL with minor modification.
|
||||
;
|
||||
; #version 430
|
||||
;
|
||||
;
|
||||
; layout(std430, binding = 0) buffer input_buffer
|
||||
; {
|
||||
; vec4 data_SSBO[];
|
||||
; };
|
||||
;
|
||||
; layout(std430, binding = 1) buffer output_buffer
|
||||
; {
|
||||
; vec4 out_SSBO[];
|
||||
; };
|
||||
;
|
||||
; void main() {
|
||||
; bool cond = data_SSBO[gl_GlobalInvocationID.z].x == 0.0;
|
||||
; vec4 a = {1.0, 3.0, 5.0, 7.0};
|
||||
; vec4 b = {2.0, 4.0, 6.0, 8.0};
|
||||
; out_SSBO[gl_GlobalInvocationID.z] = (cond ? a : b);
|
||||
; }
|
||||
|
||||
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 %cond "cond"
|
||||
OpName %input_buffer "input_buffer"
|
||||
OpMemberName %input_buffer 0 "data_SSBO"
|
||||
OpName %_ ""
|
||||
OpName %gl_GlobalInvocationID "gl_GlobalInvocationID"
|
||||
OpName %a "a"
|
||||
OpName %b "b"
|
||||
OpName %output_buffer "output_buffer"
|
||||
OpMemberName %output_buffer 0 "out_SSBO"
|
||||
OpName %__0 ""
|
||||
OpDecorate %_runtimearr_v4float ArrayStride 16
|
||||
OpMemberDecorate %input_buffer 0 Offset 0
|
||||
OpDecorate %input_buffer Block
|
||||
OpDecorate %_ DescriptorSet 0
|
||||
OpDecorate %_ Binding 0
|
||||
OpDecorate %gl_GlobalInvocationID BuiltIn GlobalInvocationId
|
||||
OpDecorate %_runtimearr_v4float_0 ArrayStride 16
|
||||
OpMemberDecorate %output_buffer 0 Offset 0
|
||||
OpDecorate %output_buffer Block
|
||||
OpDecorate %__0 DescriptorSet 0
|
||||
OpDecorate %__0 Binding 1
|
||||
%void = OpTypeVoid
|
||||
%3 = OpTypeFunction %void
|
||||
%bool = OpTypeBool
|
||||
%_ptr_Function_bool = OpTypePointer Function %bool
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_runtimearr_v4float = OpTypeRuntimeArray %v4float
|
||||
%input_buffer = OpTypeStruct %_runtimearr_v4float
|
||||
%_ptr_StorageBuffer_input_buffer = OpTypePointer StorageBuffer %input_buffer
|
||||
%_ = OpVariable %_ptr_StorageBuffer_input_buffer StorageBuffer
|
||||
%int = OpTypeInt 32 1
|
||||
%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
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%float_3 = OpConstant %float 3
|
||||
%float_5 = OpConstant %float 5
|
||||
%float_7 = OpConstant %float 7
|
||||
%37 = OpConstantComposite %v4float %float_1 %float_3 %float_5 %float_7
|
||||
%float_2 = OpConstant %float 2
|
||||
%float_4 = OpConstant %float 4
|
||||
%float_6 = OpConstant %float 6
|
||||
%float_8 = OpConstant %float 8
|
||||
%43 = OpConstantComposite %v4float %float_2 %float_4 %float_6 %float_8
|
||||
%_runtimearr_v4float_0 = OpTypeRuntimeArray %v4float
|
||||
%output_buffer = OpTypeStruct %_runtimearr_v4float_0
|
||||
%_ptr_StorageBuffer_output_buffer = OpTypePointer StorageBuffer %output_buffer
|
||||
%__0 = OpVariable %_ptr_StorageBuffer_output_buffer StorageBuffer
|
||||
%v4bool = OpTypeVector %bool 4
|
||||
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
|
||||
%main = OpFunction %void None %3
|
||||
%5 = OpLabel
|
||||
%cond = OpVariable %_ptr_Function_bool Function
|
||||
%a = OpVariable %_ptr_Function_v4float Function
|
||||
%b = OpVariable %_ptr_Function_v4float Function
|
||||
%23 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_2
|
||||
%24 = OpLoad %uint %23
|
||||
%27 = OpAccessChain %_ptr_StorageBuffer_float %_ %int_0 %24 %uint_0
|
||||
%28 = OpLoad %float %27
|
||||
%30 = OpFOrdEqual %bool %28 %float_0
|
||||
OpStore %cond %30
|
||||
OpStore %a %37
|
||||
OpStore %b %43
|
||||
%48 = OpAccessChain %_ptr_Input_uint %gl_GlobalInvocationID %uint_2
|
||||
%49 = OpLoad %uint %48
|
||||
%50 = OpLoad %bool %cond
|
||||
%51 = OpLoad %v4float %a
|
||||
%52 = OpLoad %v4float %b
|
||||
%55 = OpSelect %v4float %50 %51 %52
|
||||
%57 = OpAccessChain %_ptr_StorageBuffer_v4float %__0 %int_0 %49
|
||||
OpStore %57 %55
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
[test]
|
||||
ssbo 0:0 24
|
||||
ssbo 0:0 subdata float 0 0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0
|
||||
ssbo 0:1 8
|
||||
ssbo 0:1 subdata float 0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0 -1.0
|
||||
|
||||
compute entrypoint main
|
||||
compute 1 1 2
|
||||
|
||||
probe ssbo float 0:1 0 == 1.0 3.0 5.0 7.0 2.0 4.0 6.0 8.0
|
||||
@@ -0,0 +1,85 @@
|
||||
[require]
|
||||
VK_KHR_spirv_1_4
|
||||
VK_KHR_workgroup_memory_explicit_layout
|
||||
VariablePointerFeatures.variablePointersStorageBuffer
|
||||
VariablePointerFeatures.variablePointers
|
||||
|
||||
[compute shader spirv]
|
||||
OpCapability Shader
|
||||
OpCapability VariablePointers
|
||||
OpCapability WorkgroupMemoryExplicitLayoutKHR
|
||||
OpExtension "SPV_KHR_workgroup_memory_explicit_layout"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main" %gid_var %sel_var %wg1_var %wg2_var %out_var
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpDecorate %gid_var BuiltIn GlobalInvocationId
|
||||
OpMemberDecorate %inner 0 Offset 0
|
||||
OpMemberDecorate %inner 1 Offset 4
|
||||
OpMemberDecorate %outer 0 Offset 0
|
||||
OpMemberDecorate %outer 1 Offset 8
|
||||
OpDecorate %rta ArrayStride 4
|
||||
OpDecorate %rta_struct ArrayStride 16
|
||||
OpDecorate %block Block
|
||||
OpMemberDecorate %block 0 Offset 0
|
||||
OpDecorate %data_block Block
|
||||
OpMemberDecorate %data_block 0 Offset 0
|
||||
OpDecorate %sel_var DescriptorSet 0
|
||||
OpDecorate %sel_var Binding 0
|
||||
OpDecorate %out_var DescriptorSet 0
|
||||
OpDecorate %out_var Binding 1
|
||||
%void = OpTypeVoid
|
||||
%bool = OpTypeBool
|
||||
%int = OpTypeInt 32 0
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_1 = OpConstant %int 1
|
||||
%int_2 = OpConstant %int 2
|
||||
%int3 = OpTypeVector %int 3
|
||||
%inner = OpTypeStruct %int %int
|
||||
%outer = OpTypeStruct %inner %inner
|
||||
%rta_struct = OpTypeRuntimeArray %outer
|
||||
%rta = OpTypeRuntimeArray %int
|
||||
%data_block = OpTypeStruct %rta_struct
|
||||
%block = OpTypeStruct %rta
|
||||
%ptr_input_int3 = OpTypePointer Input %int3
|
||||
%gid_var = OpVariable %ptr_input_int3 Input
|
||||
%ptr_ssbo_block = OpTypePointer StorageBuffer %block
|
||||
%ptr_ssbo_int = OpTypePointer StorageBuffer %int
|
||||
%ptr_ssbo_data_block = OpTypePointer StorageBuffer %data_block
|
||||
%ptr_ssbo_outer = OpTypePointer StorageBuffer %outer
|
||||
%sel_var = OpVariable %ptr_ssbo_block StorageBuffer
|
||||
%ptr_wg_outer = OpTypePointer Workgroup %outer
|
||||
%wg1_var = OpVariable %ptr_wg_outer Workgroup
|
||||
%wg2_var = OpVariable %ptr_wg_outer Workgroup
|
||||
%out_var = OpVariable %ptr_ssbo_data_block StorageBuffer
|
||||
%inner_const0 = OpConstantComposite %inner %int_1 %int_1
|
||||
%inner_const1 = OpConstantComposite %inner %int_2 %int_2
|
||||
%outer_const0 = OpConstantComposite %outer %inner_const0 %inner_const0
|
||||
%outer_const1 = OpConstantComposite %outer %inner_const1 %inner_const1
|
||||
%void_fn = OpTypeFunction %void
|
||||
%main = OpFunction %void None %void_fn
|
||||
%entry = OpLabel
|
||||
%gid = OpLoad %int3 %gid_var
|
||||
%gid_x = OpCompositeExtract %int %gid 0
|
||||
OpStore %wg1_var %outer_const0
|
||||
OpStore %wg2_var %outer_const1
|
||||
%sel_gep = OpAccessChain %ptr_ssbo_int %sel_var %int_0 %gid_x
|
||||
%sel_val = OpLoad %int %sel_gep
|
||||
%eq_0 = OpIEqual %bool %sel_val %int_0
|
||||
%select = OpSelect %ptr_wg_outer %eq_0 %wg1_var %wg2_var
|
||||
%out_gep = OpAccessChain %ptr_ssbo_outer %out_var %int_0 %gid_x
|
||||
%ld = OpLoad %outer %select
|
||||
OpStore %out_gep %ld
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
||||
[test]
|
||||
ssbo 0:0 subdata uint 0 1 0
|
||||
ssbo 0:1 32
|
||||
|
||||
compute entrypoint main
|
||||
compute 2 1 1
|
||||
|
||||
probe ssbo uint 0:1 0 == 2 2 2 2
|
||||
probe ssbo uint 0:1 16 == 1 1 1 1
|
||||
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
[require]
|
||||
VK_KHR_spirv_1_4
|
||||
VK_KHR_workgroup_memory_explicit_layout
|
||||
VariablePointerFeatures.variablePointersStorageBuffer
|
||||
VariablePointerFeatures.variablePointers
|
||||
|
||||
[compute shader spirv]
|
||||
OpCapability Shader
|
||||
OpCapability VariablePointers
|
||||
OpCapability WorkgroupMemoryExplicitLayoutKHR
|
||||
OpExtension "SPV_KHR_workgroup_memory_explicit_layout"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %main "main" %gid_var %sel_var %wg_var %out_var
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpDecorate %gid_var BuiltIn GlobalInvocationId
|
||||
OpMemberDecorate %inner 0 Offset 0
|
||||
OpMemberDecorate %inner 1 Offset 4
|
||||
OpMemberDecorate %outer 0 Offset 0
|
||||
OpMemberDecorate %outer 1 Offset 8
|
||||
OpDecorate %rta ArrayStride 4
|
||||
OpDecorate %rta_struct ArrayStride 16
|
||||
OpDecorate %block Block
|
||||
OpMemberDecorate %block 0 Offset 0
|
||||
OpDecorate %data_block Block
|
||||
OpMemberDecorate %data_block 0 Offset 0
|
||||
OpDecorate %sel_var DescriptorSet 0
|
||||
OpDecorate %sel_var Binding 0
|
||||
OpDecorate %out_var DescriptorSet 0
|
||||
OpDecorate %out_var Binding 1
|
||||
%void = OpTypeVoid
|
||||
%bool = OpTypeBool
|
||||
%int = OpTypeInt 32 0
|
||||
%int_0 = OpConstant %int 0
|
||||
%int_1 = OpConstant %int 1
|
||||
%int_2 = OpConstant %int 2
|
||||
%int3 = OpTypeVector %int 3
|
||||
%inner = OpTypeStruct %int %int
|
||||
%outer = OpTypeStruct %inner %inner
|
||||
%rta_struct = OpTypeRuntimeArray %outer
|
||||
%rta = OpTypeRuntimeArray %int
|
||||
%data_block = OpTypeStruct %rta_struct
|
||||
%block = OpTypeStruct %rta
|
||||
%ptr_input_int3 = OpTypePointer Input %int3
|
||||
%gid_var = OpVariable %ptr_input_int3 Input
|
||||
%ptr_ssbo_block = OpTypePointer StorageBuffer %block
|
||||
%ptr_ssbo_int = OpTypePointer StorageBuffer %int
|
||||
%ptr_ssbo_data_block = OpTypePointer StorageBuffer %data_block
|
||||
%ptr_ssbo_outer = OpTypePointer StorageBuffer %outer
|
||||
%wg_data = OpTypeArray %outer %int_2
|
||||
%ptr_wg_data = OpTypePointer Workgroup %wg_data
|
||||
%ptr_wg_outer = OpTypePointer Workgroup %outer
|
||||
%sel_var = OpVariable %ptr_ssbo_block StorageBuffer
|
||||
%wg_var = OpVariable %ptr_wg_data Workgroup
|
||||
%out_var = OpVariable %ptr_ssbo_data_block StorageBuffer
|
||||
%inner_const0 = OpConstantComposite %inner %int_1 %int_1
|
||||
%inner_const1 = OpConstantComposite %inner %int_2 %int_2
|
||||
%outer_const0 = OpConstantComposite %outer %inner_const0 %inner_const0
|
||||
%outer_const1 = OpConstantComposite %outer %inner_const1 %inner_const1
|
||||
%void_fn = OpTypeFunction %void
|
||||
%main = OpFunction %void None %void_fn
|
||||
%entry = OpLabel
|
||||
%gid = OpLoad %int3 %gid_var
|
||||
%gid_x = OpCompositeExtract %int %gid 0
|
||||
%wg_gep0 = OpAccessChain %ptr_wg_outer %wg_var %int_0
|
||||
%wg_gep1 = OpAccessChain %ptr_wg_outer %wg_var %int_1
|
||||
OpStore %wg_gep0 %outer_const0
|
||||
OpStore %wg_gep1 %outer_const1
|
||||
%sel_gep = OpAccessChain %ptr_ssbo_int %sel_var %int_0 %gid_x
|
||||
%sel_val = OpLoad %int %sel_gep
|
||||
%eq_0 = OpIEqual %bool %sel_val %int_0
|
||||
%select = OpSelect %ptr_wg_outer %eq_0 %wg_gep0 %wg_gep1
|
||||
%out_gep = OpAccessChain %ptr_ssbo_outer %out_var %int_0 %gid_x
|
||||
%ld = OpLoad %outer %select
|
||||
OpStore %out_gep %ld
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
||||
[test]
|
||||
ssbo 0:0 subdata uint 0 1 0
|
||||
ssbo 0:1 32
|
||||
|
||||
compute entrypoint main
|
||||
compute 2 1 1
|
||||
|
||||
probe ssbo uint 0:1 0 == 2 2 2 2
|
||||
probe ssbo uint 0:1 16 == 1 1 1 1
|
||||
|
||||
Reference in New Issue
Block a user