1# Test OpVectorShuffle with indices of -1 2# 3# Derived from the following OpenCL C: 4# 5# kernel void swizzle (global float4 *p, global float *res) 6# { 7# res[0] = p[0].x + p[0].y; 8# } 9 10[require] 11VariablePointerFeatures.variablePointers 12 13[compute shader spirv] 14; SPIR-V 15; Version: 1.0 16; Generator: Google Clspv; 0 17; Bound: 45 18; Schema: 0 19 OpCapability Shader 20 OpExtension "SPV_KHR_storage_buffer_storage_class" 21 OpMemoryModel Logical GLSL450 22 OpEntryPoint GLCompute %21 "main" 23 OpSource OpenCL_C 120 24 OpDecorate %_runtimearr_v4float ArrayStride 16 25 OpMemberDecorate %_struct_4 0 Offset 0 26 OpDecorate %_struct_4 Block 27 OpDecorate %_runtimearr_float ArrayStride 4 28 OpMemberDecorate %_struct_7 0 Offset 0 29 OpDecorate %_struct_7 Block 30 OpDecorate %gl_WorkGroupSize BuiltIn WorkgroupSize 31 OpDecorate %17 DescriptorSet 0 32 OpDecorate %17 Binding 0 33 OpDecorate %18 DescriptorSet 0 34 OpDecorate %18 Binding 1 35 OpDecorate %12 SpecId 0 36 OpDecorate %13 SpecId 1 37 OpDecorate %14 SpecId 2 38 %float = OpTypeFloat 32 39 %v4float = OpTypeVector %float 4 40%_runtimearr_v4float = OpTypeRuntimeArray %v4float 41 %_struct_4 = OpTypeStruct %_runtimearr_v4float 42%_ptr_StorageBuffer__struct_4 = OpTypePointer StorageBuffer %_struct_4 43%_runtimearr_float = OpTypeRuntimeArray %float 44 %_struct_7 = OpTypeStruct %_runtimearr_float 45%_ptr_StorageBuffer__struct_7 = OpTypePointer StorageBuffer %_struct_7 46 %uint = OpTypeInt 32 0 47 %v3uint = OpTypeVector %uint 3 48%_ptr_Private_v3uint = OpTypePointer Private %v3uint 49 %12 = OpSpecConstant %uint 1 50 %13 = OpSpecConstant %uint 1 51 %14 = OpSpecConstant %uint 1 52%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %12 %13 %14 53 %void = OpTypeVoid 54 %20 = OpTypeFunction %void 55%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float 56 %uint_0 = OpConstant %uint 0 57%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float 58 %29 = OpUndef %v4float 59 %uint_1 = OpConstant %uint 1 60 %uint_2 = OpConstant %uint 2 61 %16 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize 62 %17 = OpVariable %_ptr_StorageBuffer__struct_4 StorageBuffer 63 %18 = OpVariable %_ptr_StorageBuffer__struct_7 StorageBuffer 64 %21 = OpFunction %void None %20 65 %22 = OpLabel 66 %25 = OpAccessChain %_ptr_StorageBuffer_v4float %17 %uint_0 %uint_0 67 %27 = OpAccessChain %_ptr_StorageBuffer_float %18 %uint_0 %uint_0 68 %28 = OpLoad %v4float %25 69 %30 = OpVectorShuffle %v4float %28 %29 1 4294967295 4294967295 4294967295 70 %31 = OpFAdd %v4float %28 %30 71 %32 = OpCompositeExtract %float %31 0 72 OpStore %27 %32 73 OpReturn 74 OpFunctionEnd 75 76[test] 77# 'p'[] 78ssbo 0:0 subdata float 0 2.0 4.0 9.0 -3.0 79# The result buffer 'res' [] 80ssbo 0:1 subdata float 0 0.0 81 82compute 1 1 1 83 84probe ssbo float 0:1 0 == 6.0 85