Fix non-unique type declarations in tests
authorAndrey Tuganov <andreyt@google.com>
Wed, 20 Sep 2017 20:42:35 +0000 (16:42 -0400)
committerAndrey Tuganov <andreyt@google.com>
Mon, 2 Oct 2017 17:17:47 +0000 (13:17 -0400)
Multiple test code generators were generating incorrect SPIR-V code
(non-unique type declarations of non-aggregate types).

Affects: dEQP-VK.spirv_assembly.*
Components: Vulkan

VK-GL-CTS issue: 195

Change-Id: I55200a2b78c84c298db05f34892aa4cffbfff74c

external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsm16bitStorageTests.cpp
external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmConditionalBranchTests.cpp
external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmIndexingTests.cpp
external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmInstructionTests.cpp

index a724aa2..e6e0b2d 100644 (file)
@@ -1079,11 +1079,10 @@ void addGraphics16BitStorageUniformInt32To16Group (tcu::TestCaseGroup* testGroup
        const StringTemplate    vecPreMain(
                        "${itype16} = OpTypeInt 16 ${signed}\n"
                        " %c_i32_64 = OpConstant %i32 64\n"
-                       "%v4itype32 = OpTypeVector ${itype32} 4\n"
                        "%v4itype16 = OpTypeVector ${itype16} 4\n"
-                       " %up_v4i32 = OpTypePointer Uniform %v4itype32\n"
+                       " %up_v4i32 = OpTypePointer Uniform ${v4itype32}\n"
                        " %up_v4i16 = OpTypePointer Uniform %v4itype16\n"
-                       " %ra_v4i32 = OpTypeArray %v4itype32 %c_i32_64\n"
+                       " %ra_v4i32 = OpTypeArray ${v4itype32} %c_i32_64\n"
                        " %ra_v4i16 = OpTypeArray %v4itype16 %c_i32_64\n"
                        "   %SSBO32 = OpTypeStruct %ra_v4i32\n"
                        "   %SSBO16 = OpTypeStruct %ra_v4i16\n"
@@ -1122,7 +1121,7 @@ void addGraphics16BitStorageUniformInt32To16Group (tcu::TestCaseGroup* testGroup
                        "%write = OpLabel\n"
                        "   %30 = OpLoad %i32 %i\n"
                        "  %src = OpAccessChain %up_v4i32 %ssbo32 %c_i32_0 %30\n"
-                       "%val32 = OpLoad %v4itype32 %src\n"
+                       "%val32 = OpLoad ${v4itype32} %src\n"
                        "%val16 = ${convert} %v4itype16 %val32\n"
                        "  %dst = OpAccessChain %up_v4i16 %ssbo16 %c_i32_0 %30\n"
                        "         OpStore %dst %val16\n"
@@ -1163,6 +1162,7 @@ void addGraphics16BitStorageUniformInt32To16Group (tcu::TestCaseGroup* testGroup
                                specs["cap"]                                    = CAPABILITIES[capIdx].cap;
                                specs["indecor"]                                = CAPABILITIES[capIdx].decor;
                                specs["itype32"]                                = intFacts[factIdx].type32;
+                               specs["v4itype32"]                              = "%v4" + string(intFacts[factIdx].type32).substr(1);
                                specs["itype16"]                                = intFacts[factIdx].type16;
                                specs["signed"]                                 = intFacts[factIdx].isSigned;
                                specs["convert"]                                = intFacts[factIdx].opcode;
@@ -2792,10 +2792,9 @@ void addGraphics16BitStorageUniformInt16To32Group (tcu::TestCaseGroup* testGroup
                        "${itype16} = OpTypeInt 16 ${signed}\n"
                        "%c_i32_128 = OpConstant %i32 128\n"
                        "%v2itype16 = OpTypeVector ${itype16} 2\n"
-                       "%v2itype32 = OpTypeVector ${itype32} 2\n"
-                       " %up_v2i32 = OpTypePointer Uniform %v2itype32\n"
+                       " %up_v2i32 = OpTypePointer Uniform ${v2itype32}\n"
                        " %up_v2i16 = OpTypePointer Uniform %v2itype16\n"
-                       " %ra_v2i32 = OpTypeArray %v2itype32 %c_i32_128\n"
+                       " %ra_v2i32 = OpTypeArray ${v2itype32} %c_i32_128\n"
                        " %ra_v2i16 = OpTypeArray %v2itype16 %c_i32_128\n"
                        "   %SSBO32 = OpTypeStruct %ra_v2i32\n"
                        "   %SSBO16 = OpTypeStruct %ra_v2i16\n"
@@ -2835,7 +2834,7 @@ void addGraphics16BitStorageUniformInt16To32Group (tcu::TestCaseGroup* testGroup
                        "   %30 = OpLoad %i32 %i\n"
                        "  %src = OpAccessChain %up_v2i16 %ssbo16 %c_i32_0 %30\n"
                        "%val16 = OpLoad %v2itype16 %src\n"
-                       "%val32 = ${convert} %v2itype32 %val16\n"
+                       "%val32 = ${convert} ${v2itype32} %val16\n"
                        "  %dst = OpAccessChain %up_v2i32 %ssbo32 %c_i32_0 %30\n"
                        "         OpStore %dst %val32\n"
                        "         OpBranch %inc\n"
@@ -2874,6 +2873,7 @@ void addGraphics16BitStorageUniformInt16To32Group (tcu::TestCaseGroup* testGroup
                                specs["cap"]                                    = CAPABILITIES[capIdx].cap;
                                specs["indecor"]                                = CAPABILITIES[capIdx].decor;
                                specs["itype32"]                                = intFacts[factIdx].type32;
+                               specs["v2itype32"]                              = "%v2" + string(intFacts[factIdx].type32).substr(1);
                                specs["itype16"]                                = intFacts[factIdx].type16;
                                if (intFacts[factIdx].isSigned)
                                        specs["signed"]                         = "1";
index 320d53d..41f48fc 100644 (file)
@@ -148,7 +148,6 @@ void addGraphicsSameLabelsTest (tcu::TestCaseGroup* group)
 
                fragments["pre_main"]                           =
                        "          %c_u32_128 = OpConstant %u32 128\n"
-                       "                  %3 = OpTypeFunction %void\n"
                        "               %true = OpConstantTrue %bool\n"
                        "              %false = OpConstantFalse %bool\n"
                        " %_arr_uint_uint_128 = OpTypeArray %u32 %c_u32_128\n"
index eb02129..6029c0a 100644 (file)
@@ -133,21 +133,22 @@ void addComputeIndexingTests (tcu::TestCaseGroup* group)
                                        "                             OpDecorate %selector Binding 1\n"
                                        "                     %void = OpTypeVoid\n"
                                        "                        %3 = OpTypeFunction %void\n"
-                                       "                      %idx = OpTypeInt ${idxsize} ${idxsign}\n"
-                                       "                    %idx_0 = OpConstant %idx 0\n"
-                                       "                    %idx_1 = OpConstant %idx 1\n"
-                                       "                    %idx_2 = OpConstant %idx 2\n"
-                                       "                    %idx_3 = OpConstant %idx 3\n"
-                                       "                   %uint32 = OpTypeInt 32 0\n"
-                                       "     %_ptr_Function_uint32 = OpTypePointer Function %uint32\n"
-                                       "                 %v3uint32 = OpTypeVector %uint32 3\n"
+                                       "                      %u32 = OpTypeInt 32 0\n"
+                                       "                      %i32 = OpTypeInt 32 1\n"
+                                       "${intdecl:opt}"
+                                       "                    %idx_0 = OpConstant ${idx_int} 0\n"
+                                       "                    %idx_1 = OpConstant ${idx_int} 1\n"
+                                       "                    %idx_2 = OpConstant ${idx_int} 2\n"
+                                       "                    %idx_3 = OpConstant ${idx_int} 3\n"
+                                       "     %_ptr_Function_uint32 = OpTypePointer Function %u32\n"
+                                       "                 %v3uint32 = OpTypeVector %u32 3\n"
                                        "      %_ptr_Input_v3uint32 = OpTypePointer Input %v3uint32\n"
                                        "    %gl_GlobalInvocationID = OpVariable %_ptr_Input_v3uint32 Input\n"
-                                       "        %_ptr_Input_uint32 = OpTypePointer Input %uint32\n"
+                                       "        %_ptr_Input_uint32 = OpTypePointer Input %u32\n"
                                        "                    %float = OpTypeFloat 32\n"
-                                       "                 %uint_128 = OpConstant %uint32 128\n"
-                                       "                  %uint_32 = OpConstant %uint32 32\n"
-                                       "                   %uint_2 = OpConstant %uint32 2\n"
+                                       "                 %uint_128 = OpConstant %u32 128\n"
+                                       "                  %uint_32 = OpConstant %u32 32\n"
+                                       "                   %uint_2 = OpConstant %u32 2\n"
                                        "      %_arr_float_uint_128 = OpTypeArray %float %uint_128\n"
                                        "                   %Output = OpTypeStruct %_arr_float_uint_128\n"
                                        "      %_ptr_Uniform_Output = OpTypePointer Uniform %Output\n"
@@ -162,34 +163,34 @@ void addComputeIndexingTests (tcu::TestCaseGroup* group)
                                        "        %_ptr_buffer_Input = OpTypePointer ${inputstorageclass} %Input\n"
                                        "                %dataInput = OpVariable %_ptr_buffer_Input ${inputstorageclass}\n"
                                        "  %_ptr_buffer_InputStruct = OpTypePointer ${inputstorageclass} %InputStruct\n"
-                                       "                 %v4uint32 = OpTypeVector %uint32 4\n"
+                                       "                 %v4uint32 = OpTypeVector %u32 4\n"
                                        "     %_arr_v4uint_uint_128 = OpTypeArray %v4uint32 %uint_128\n"
                                        "             %DataSelector = OpTypeStruct %_arr_v4uint_uint_128\n"
                                        "%_ptr_Uniform_DataSelector = OpTypePointer Uniform %DataSelector\n"
                                        "                 %selector = OpVariable %_ptr_Uniform_DataSelector Uniform\n"
-                                       "      %_ptr_Uniform_uint32 = OpTypePointer Uniform %uint32\n"
+                                       "      %_ptr_Uniform_uint32 = OpTypePointer Uniform %u32\n"
                                        "       %_ptr_Uniform_float = OpTypePointer Uniform %float\n"
-                                       "       %_ptr_buffer_float  = OpTypePointer ${inputstorageclass} %float\n"
+                                       "       ${ptr_buffer_float:opt}\n"
 
                                        "                     %main = OpFunction %void None %3\n"
                                        "                        %5 = OpLabel\n"
                                        "                        %i = OpVariable %_ptr_Function_uint32 Function\n"
                                        "                       %14 = OpAccessChain %_ptr_Input_uint32 %gl_GlobalInvocationID %idx_0\n"
-                                       "                       %15 = OpLoad %uint32 %14\n"
+                                       "                       %15 = OpLoad %u32 %14\n"
                                        "                             OpStore %i %15\n"
-                                       "                   %uint_i = OpLoad %uint32 %i\n"
+                                       "                   %uint_i = OpLoad %u32 %i\n"
                                        "                       %39 = OpAccessChain %_ptr_Uniform_uint32 %selector %idx_0 %uint_i %idx_0\n"
-                                       "                       %40 = OpLoad %uint32 %39\n"
+                                       "                       %40 = OpLoad %u32 %39\n"
                                        "                       %43 = OpAccessChain %_ptr_Uniform_uint32 %selector %idx_0 %uint_i %idx_1\n"
-                                       "                       %44 = OpLoad %uint32 %43\n"
+                                       "                       %44 = OpLoad %u32 %43\n"
                                        "                       %47 = OpAccessChain %_ptr_Uniform_uint32 %selector %idx_0 %uint_i %idx_2\n"
-                                       "                       %48 = OpLoad %uint32 %47\n"
+                                       "                       %48 = OpLoad %u32 %47\n"
                                        "                       %51 = OpAccessChain %_ptr_Uniform_uint32 %selector %idx_0 %uint_i %idx_3\n"
-                                       "                       %52 = OpLoad %uint32 %51\n"
-                                       "                       %i0 = OpUConvert %idx %40\n"
-                                       "                       %i1 = OpUConvert %idx %44\n"
-                                       "                       %i2 = OpUConvert %idx %48\n"
-                                       "                       %i3 = OpUConvert %idx %52\n"
+                                       "                       %52 = OpLoad %u32 %51\n"
+                                       "                       %i0 = ${convert} ${idx_int} %40\n"
+                                       "                       %i1 = ${convert} ${idx_int} %44\n"
+                                       "                       %i2 = ${convert} ${idx_int} %48\n"
+                                       "                       %i3 = ${convert} ${idx_int} %52\n"
                                        "        %inputFirstElement = OpAccessChain %_ptr_buffer_InputStruct %dataInput %idx_0 %idx_0\n"
                                        "                       %54 = ${accesschain}\n"
                                        "                       %55 = OpLoad %float %54\n"
@@ -202,22 +203,23 @@ void addComputeIndexingTests (tcu::TestCaseGroup* group)
                                switch (chainOpIdx)
                                {
                                        case CHAIN_OP_ACCESS_CHAIN:
-                                               specs["accesschain"]                    = "OpAccessChain %_ptr_buffer_float %inputFirstElement %idx_0 %i0 %i1 %i2 %i3\n";
+                                               specs["accesschain"]                    = "OpAccessChain %_ptr_Uniform_float %inputFirstElement %idx_0 %i0 %i1 %i2 %i3\n";
                                                specs["inputdecoration"]                = "BufferBlock";
                                                specs["inputstorageclass"]              = "Uniform";
                                                break;
                                        case CHAIN_OP_IN_BOUNDS_ACCESS_CHAIN:
-                                               specs["accesschain"]                    = "OpInBoundsAccessChain %_ptr_buffer_float %inputFirstElement %idx_0 %i0 %i1 %i2 %i3\n";
+                                               specs["accesschain"]                    = "OpInBoundsAccessChain %_ptr_Uniform_float %inputFirstElement %idx_0 %i0 %i1 %i2 %i3\n";
                                                specs["inputdecoration"]                = "BufferBlock";
                                                specs["inputstorageclass"]              = "Uniform";
                                                break;
                                        default:
                                                DE_ASSERT(chainOpIdx == CHAIN_OP_PTR_ACCESS_CHAIN);
-                                               specs["accesschain"]                    = "OpPtrAccessChain %_ptr_buffer_float %inputFirstElement %idx_1 %idx_0 %i0 %i1 %i2 %i3\n";
+                                               specs["accesschain"]                    = "OpPtrAccessChain %_ptr_StorageBuffer_float %inputFirstElement %idx_1 %idx_0 %i0 %i1 %i2 %i3\n";
                                                specs["inputdecoration"]                = "Block";
                                                specs["inputstorageclass"]              = "StorageBuffer";
-                                               specs["variablepointercaps"]    = "OpCapability VariablePointersStorageBuffer";
-                                               specs["extensions"]                             = "OpExtension \"SPV_KHR_variable_pointers\"\n                             "
+                                               specs["variablepointercaps"]            = "OpCapability VariablePointersStorageBuffer";
+                                               specs["ptr_buffer_float"]               = "%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float";
+                                               specs["extensions"]                     = "OpExtension \"SPV_KHR_variable_pointers\"\n                             "
                                                                                                                  "OpExtension \"SPV_KHR_storage_buffer_storage_class\"";
                                                element = 1;
                                                vulkanFeatures.extVariablePointers = EXTVARIABLEPOINTERSFEATURES_VARIABLE_POINTERS_STORAGEBUFFER;
@@ -237,12 +239,25 @@ void addComputeIndexingTests (tcu::TestCaseGroup* group)
                                }
 
                                if (idxSize == 16)
+                               {
                                        specs["intcaps"] = "OpCapability Int16";
+                                       specs["convert"] = "OpSConvert";
+                                       specs["intdecl"] =      "                      %u16 = OpTypeInt 16 0\n"
+                                                               "                      %i16 = OpTypeInt 16 1\n";
+                               }
                                else if (idxSize == 64)
+                               {
                                        specs["intcaps"] = "OpCapability Int64";
+                                       specs["convert"] = "OpSConvert";
+                                       specs["intdecl"] =      "                      %u64 = OpTypeInt 64 0\n"
+                                                               "                      %i64 = OpTypeInt 64 1\n";
+                               } else {
+                                       specs["convert"] = "OpCopyObject";
+                               }
+
+                               specs["idx_uint"] = "%u" + de::toString(idxSize);
+                               specs["idx_int"] = (sign ? "%i" : "%u") + de::toString(idxSize);
 
-                               specs["idxsize"]                                = de::toString(idxSize);
-                               specs["idxsign"]                                = de::toString(sign);
                                spec.assembly                                   = shaderSource.specialize(specs);
                                spec.numWorkGroups                              = IVec3(numItems, 1, 1);
                                spec.requestedVulkanFeatures    = vulkanFeatures;
@@ -299,26 +314,20 @@ void addGraphicsIndexingTests (tcu::TestCaseGroup* group)
                                GraphicsResources                       resources;
 
                                const StringTemplate            preMain(
+                                       "${intdecl:opt}"
                                        "                %c_i32_128 = OpConstant %i32 128\n"
-                                       "                     %uint = OpTypeInt ${idxsize} 0\n"
-                                       "     %_ptr_Function_uint32 = OpTypePointer Function %u32\n"
-                                       "                 %v3uint32 = OpTypeVector %u32 3\n"
-                                       "      %_ptr_Input_v3uint32 = OpTypePointer Input %v3uint32\n"
-                                       "                   %uint_0 = OpConstant %uint 0\n"
-                                       "        %_ptr_Input_uint32 = OpTypePointer Input %u32\n"
+                                       "                   %uint_0 = OpConstant ${idx_uint} 0\n"
                                        "                 %uint_128 = OpConstant %u32 128\n"
                                        "                  %uint_32 = OpConstant %u32 32\n"
-                                       "                   %uint_1 = OpConstant %uint 1\n"
-                                       "                   %uint_2 = OpConstant %uint 2\n"
-                                       "                   %uint_3 = OpConstant %uint 3\n"
+                                       "                   %uint_1 = OpConstant ${idx_uint} 1\n"
+                                       "                   %uint_2 = OpConstant ${idx_uint} 2\n"
+                                       "                   %uint_3 = OpConstant ${idx_uint} 3\n"
                                        "      %_arr_float_uint_128 = OpTypeArray %f32 %uint_128\n"
                                        "                   %Output = OpTypeStruct %_arr_float_uint_128\n"
                                        "      %_ptr_Uniform_Output = OpTypePointer Uniform %Output\n"
                                        "               %dataOutput = OpVariable %_ptr_Uniform_Output Uniform\n"
-                                       "                      %int = OpTypeInt ${idxsize} ${idxsign}\n"
-                                       "                    %int_0 = OpConstant %int 0\n"
-                                       "                  %v4float = OpTypeVector %f32 4\n"
-                                       "              %mat4v4float = OpTypeMatrix %v4float 4\n"
+                                       "                    %int_0 = OpConstant ${idx_int} 0\n"
+                                       "              %mat4v4float = OpTypeMatrix %v4f32 4\n"
                                        " %_arr_mat4v4float_uint_32 = OpTypeArray %mat4v4float %uint_32\n"
                                        " %_arr__arr_mat4v4float_uint_32_uint_32 = OpTypeArray %_arr_mat4v4float_uint_32 %uint_32\n"
                                        "              %InputStruct = OpTypeStruct %_arr__arr_mat4v4float_uint_32_uint_32\n"
@@ -327,14 +336,13 @@ void addGraphicsIndexingTests (tcu::TestCaseGroup* group)
                                        "        %_ptr_buffer_Input = OpTypePointer ${inputstorageclass} %Input\n"
                                        "                %dataInput = OpVariable %_ptr_buffer_Input ${inputstorageclass}\n"
                                        "  %_ptr_buffer_InputStruct = OpTypePointer ${inputstorageclass} %InputStruct\n"
-                                       "                 %v4uint32 = OpTypeVector %u32 4\n"
-                                       "     %_arr_v4uint_uint_128 = OpTypeArray %v4uint32 %uint_128\n"
+                                       "     %_arr_v4uint_uint_128 = OpTypeArray %v4u32 %uint_128\n"
                                        "             %DataSelector = OpTypeStruct %_arr_v4uint_uint_128\n"
                                        "%_ptr_Uniform_DataSelector = OpTypePointer Uniform %DataSelector\n"
                                        "                 %selector = OpVariable %_ptr_Uniform_DataSelector Uniform\n"
                                        "      %_ptr_Uniform_uint32 = OpTypePointer Uniform %u32\n"
                                        "       %_ptr_Uniform_float = OpTypePointer Uniform %f32\n"
-                                       "        %_ptr_buffer_float = OpTypePointer ${inputstorageclass} %f32\n");
+                                       "       ${ptr_buffer_float:opt}\n");
 
 
                                const StringTemplate            decoration(
@@ -387,10 +395,10 @@ void addGraphicsIndexingTests (tcu::TestCaseGroup* group)
                                        "               %48 = OpLoad %u32 %47\n"
                                        "               %51 = OpAccessChain %_ptr_Uniform_uint32 %selector %int_0 %int_i %uint_3\n"
                                        "               %52 = OpLoad %u32 %51\n"
-                                       "               %i0 = OpUConvert %uint %40\n"
-                                       "               %i1 = OpUConvert %uint %44\n"
-                                       "               %i2 = OpUConvert %uint %48\n"
-                                       "               %i3 = OpUConvert %uint %52\n"
+                                       "               %i0 = ${convert} ${idx_uint} %40\n"
+                                       "               %i1 = ${convert} ${idx_uint} %44\n"
+                                       "               %i2 = ${convert} ${idx_uint} %48\n"
+                                       "               %i3 = ${convert} ${idx_uint} %52\n"
                                        "%inputFirstElement = OpAccessChain %_ptr_buffer_InputStruct %dataInput %uint_0 %uint_0\n"
                                        "               %54 = ${accesschain}\n"
                                        "               %55 = OpLoad %f32 %54\n"
@@ -416,33 +424,42 @@ void addGraphicsIndexingTests (tcu::TestCaseGroup* group)
                                {
                                        fragments["capability"] = "OpCapability Int16\n";
                                        features.push_back("shaderInt16");
+                                       specs["convert"] = "OpUConvert";
+                                       specs["intdecl"] =      "                      %u16 = OpTypeInt 16 0\n"
+                                                               "                      %i16 = OpTypeInt 16 1\n";
                                }
                                else if (idxSize == 64)
                                {
                                        fragments["capability"] = "OpCapability Int64\n";
                                        features.push_back("shaderInt64");
+                                       specs["convert"] = "OpUConvert";
+                                       specs["intdecl"] =      "                      %u64 = OpTypeInt 64 0\n"
+                                                               "                      %i64 = OpTypeInt 64 1\n";
+                               } else {
+                                       specs["convert"] = "OpCopyObject";
                                }
 
-                               specs["idxsize"] = de::toString(idxSize);
-                               specs["idxsign"] = de::toString(sign);
+                               specs["idx_uint"] = "%u" + de::toString(idxSize);
+                               specs["idx_int"] = (sign ? "%i" : "%u") + de::toString(idxSize);
 
                                switch (chainOpIdx)
                                {
                                        case CHAIN_OP_ACCESS_CHAIN:
-                                               specs["accesschain"]                            = "OpAccessChain %_ptr_buffer_float %inputFirstElement %int_0 %i0 %i1 %i2 %i3\n";
+                                               specs["accesschain"]                            = "OpAccessChain %_ptr_Uniform_float %inputFirstElement %int_0 %i0 %i1 %i2 %i3\n";
                                                specs["inputdecoration"]                        = "BufferBlock";
                                                specs["inputstorageclass"]                      = "Uniform";
                                                break;
                                        case CHAIN_OP_IN_BOUNDS_ACCESS_CHAIN:
-                                               specs["accesschain"]                            = "OpInBoundsAccessChain %_ptr_buffer_float %inputFirstElement %int_0 %i0 %i1 %i2 %i3\n";
+                                               specs["accesschain"]                            = "OpInBoundsAccessChain %_ptr_Uniform_float %inputFirstElement %int_0 %i0 %i1 %i2 %i3\n";
                                                specs["inputdecoration"]                        = "BufferBlock";
                                                specs["inputstorageclass"]                      = "Uniform";
                                                break;
                                        default:
                                                DE_ASSERT(chainOpIdx == CHAIN_OP_PTR_ACCESS_CHAIN);
-                                               specs["accesschain"]                            = "OpPtrAccessChain %_ptr_buffer_float %inputFirstElement %uint_1 %int_0 %i0 %i1 %i2 %i3\n";
+                                               specs["accesschain"]                            = "OpPtrAccessChain %_ptr_StorageBuffer_float %inputFirstElement %uint_1 %int_0 %i0 %i1 %i2 %i3\n";
                                                specs["inputdecoration"]                        = "Block";
                                                specs["inputstorageclass"]                      = "StorageBuffer";
+                                               specs["ptr_buffer_float"]                       = "%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %f32";
                                                fragments["capability"]                         += "OpCapability VariablePointersStorageBuffer";
                                                fragments["extension"]                          = "OpExtension \"SPV_KHR_variable_pointers\"\nOpExtension \"SPV_KHR_storage_buffer_storage_class\"";
                                                extensions.push_back                            ("VK_KHR_variable_pointers");
index 8bfe5fd..eede5ca 100644 (file)
@@ -6048,7 +6048,7 @@ tcu::TestCaseGroup* createOpUndefTests(tcu::TestContext& testCtx)
        const NameCodePair tests[] =
        {
                {"bool", "", "%bool"},
-               {"vec2uint32", "%type = OpTypeVector %u32 2", "%type"},
+               {"vec2uint32", "", "%v2u32"},
                {"image", "%type = OpTypeImage %f32 2D 0 0 0 1 Unknown", "%type"},
                {"sampler", "%type = OpTypeSampler", "%type"},
                {"sampledimage", "%img = OpTypeImage %f32 2D 0 0 0 1 Unknown\n" "%type = OpTypeSampledImage %img", "%type"},
@@ -7229,6 +7229,12 @@ const string getAsmTypeDeclaration (IntegerType type)
        return "OpTypeInt " + getBitWidthStr(type) + sign;
 }
 
+const string getAsmTypeName (IntegerType type)
+{
+       const string prefix = isSigned(type) ? "%i" : "%u";
+       return prefix + getBitWidthStr(type);
+}
+
 template<typename T>
 BufferSp getSpecializedBuffer (deInt64 number)
 {
@@ -7293,21 +7299,25 @@ struct ConvertCase
        , m_inputBuffer         (getBuffer(from, number))
        , m_outputBuffer        (getBuffer(to, number))
        {
-               m_asmTypes["inputType"]         = getAsmTypeDeclaration(from);
-               m_asmTypes["outputType"]        = getAsmTypeDeclaration(to);
+               m_asmTypes["inputType"]         = getAsmTypeName(from);
+               m_asmTypes["outputType"]        = getAsmTypeName(to);
 
                if (m_features == COMPUTE_TEST_USES_INT16)
                {
                        m_asmTypes["int_capabilities"] = "OpCapability Int16\n";
+                       m_asmTypes["int_additional_decl"] = "%i16        = OpTypeInt 16 1\n%u16        = OpTypeInt 16 0\n";
                }
                else if (m_features == COMPUTE_TEST_USES_INT64)
                {
                        m_asmTypes["int_capabilities"] = "OpCapability Int64\n";
+                       m_asmTypes["int_additional_decl"] = "%i64        = OpTypeInt 64 1\n%u64        = OpTypeInt 64 0\n";
                }
                else if (m_features == COMPUTE_TEST_USES_INT16_INT64)
                {
                        m_asmTypes["int_capabilities"] = string("OpCapability Int16\n") +
                                                                                                        "OpCapability Int64\n";
+                       m_asmTypes["int_additional_decl"] =     "%i16        = OpTypeInt 16 1\n%u16        = OpTypeInt 16 0\n"
+                                                               "%i64        = OpTypeInt 64 1\n%u64        = OpTypeInt 64 0\n";
                }
                else
                {
@@ -7359,23 +7369,21 @@ const string getConvertCaseShaderStr (const string& instruction, const ConvertCa
                "%voidf      = OpTypeFunction %void\n"
                "%u32        = OpTypeInt 32 0\n"
                "%i32        = OpTypeInt 32 1\n"
+               "${int_additional_decl}"
                "%uvec3      = OpTypeVector %u32 3\n"
                "%uvec3ptr   = OpTypePointer Input %uvec3\n"
-               // Custom types
-               "%in_type    = ${inputType}\n"
-               "%out_type   = ${outputType}\n"
                // Derived types
-               "%in_ptr     = OpTypePointer Uniform %in_type\n"
-               "%out_ptr    = OpTypePointer Uniform %out_type\n"
-               "%in_arr     = OpTypeRuntimeArray %in_type\n"
-               "%out_arr    = OpTypeRuntimeArray %out_type\n"
+               "%in_ptr     = OpTypePointer Uniform ${inputType}\n"
+               "%out_ptr    = OpTypePointer Uniform ${outputType}\n"
+               "%in_arr     = OpTypeRuntimeArray ${inputType}\n"
+               "%out_arr    = OpTypeRuntimeArray ${outputType}\n"
                "%in_buf     = OpTypeStruct %in_arr\n"
                "%out_buf    = OpTypeStruct %out_arr\n"
                "%in_bufptr  = OpTypePointer Uniform %in_buf\n"
                "%out_bufptr = OpTypePointer Uniform %out_buf\n"
                "%indata     = OpVariable %in_bufptr Uniform\n"
                "%outdata    = OpVariable %out_bufptr Uniform\n"
-               "%inputptr   = OpTypePointer Input %in_type\n"
+               "%inputptr   = OpTypePointer Input ${inputType}\n"
                "%id         = OpVariable %uvec3ptr Input\n"
                // Constants
                "%zero       = OpConstant %i32 0\n"
@@ -7386,8 +7394,8 @@ const string getConvertCaseShaderStr (const string& instruction, const ConvertCa
                "%x          = OpCompositeExtract %u32 %idval 0\n"
                "%inloc      = OpAccessChain %in_ptr %indata %zero %x\n"
                "%outloc     = OpAccessChain %out_ptr %outdata %zero %x\n"
-               "%inval      = OpLoad %in_type %inloc\n"
-               "%conv       = ${instruction} %out_type %inval\n"
+               "%inval      = OpLoad ${inputType} %inloc\n"
+               "%conv       = ${instruction} ${outputType} %inval\n"
                "              OpStore %outloc %conv\n"
                "              OpReturn\n"
                "              OpFunctionEnd\n"
@@ -7535,16 +7543,18 @@ void createVectorCompositeCases (vector<map<string, string> >& testCases, de::Ra
        // Vec2 to Vec4
        for (int width = 2; width <= 4; ++width)
        {
-               string randomConst = numberToString(getInt(rnd));
-               string widthStr = numberToString(width);
-               int index = rnd.getInt(0, width-1);
-
-               params["type"]                                  = "vec";
-               params["name"]                                  = params["type"] + "_" + widthStr;
-               params["compositeType"]                 = "%composite = OpTypeVector %custom " + widthStr +"\n";
-               params["filler"]                                = string("%filler    = OpConstant %custom ") + getRandomConstantString(type, rnd) + "\n";
-               params["compositeConstruct"]    = "%instance  = OpCompositeConstruct %composite" + repeatString(" %filler", width) + "\n";
-               params["indexes"]                               = numberToString(index);
+               const string randomConst = numberToString(getInt(rnd));
+               const string widthStr = numberToString(width);
+               const string composite_type = "${customType}vec" + widthStr;
+               const int index = rnd.getInt(0, width-1);
+
+               params["type"]                  = "vec";
+               params["name"]                  = params["type"] + "_" + widthStr;
+               params["compositeDecl"]         = composite_type + " = OpTypeVector ${customType} " + widthStr +"\n";
+               params["compositeType"]         = composite_type;
+               params["filler"]                = string("%filler    = OpConstant ${customType} ") + getRandomConstantString(type, rnd) + "\n";
+               params["compositeConstruct"]    = "%instance  = OpCompositeConstruct " + composite_type + repeatString(" %filler", width) + "\n";
+               params["indexes"]               = numberToString(index);
                testCases.push_back(params);
        }
 }
@@ -7560,14 +7570,14 @@ void createArrayCompositeCases (vector<map<string, string> >& testCases, de::Ran
                string widthStr = numberToString(width);
                int index = rnd.getInt(0, width-1);
 
-               params["type"]                                  = "array";
-               params["name"]                                  = params["type"] + "_" + widthStr;
-               params["compositeType"]                 = string("%arraywidth = OpConstant %u32 " + widthStr + "\n")
-                                                                                       +        "%composite = OpTypeArray %custom %arraywidth\n";
-
-               params["filler"]                                = string("%filler    = OpConstant %custom ") + getRandomConstantString(type, rnd) + "\n";
+               params["type"]                  = "array";
+               params["name"]                  = params["type"] + "_" + widthStr;
+               params["compositeDecl"]         = string("%arraywidth = OpConstant %u32 " + widthStr + "\n")
+                                                                                       +        "%composite = OpTypeArray ${customType} %arraywidth\n";
+               params["compositeType"]         = "%composite";
+               params["filler"]                = string("%filler    = OpConstant ${customType} ") + getRandomConstantString(type, rnd) + "\n";
                params["compositeConstruct"]    = "%instance  = OpCompositeConstruct %composite" + repeatString(" %filler", width) + "\n";
-               params["indexes"]                               = numberToString(index);
+               params["indexes"]               = numberToString(index);
                testCases.push_back(params);
        }
 }
@@ -7582,12 +7592,13 @@ void createStructCompositeCases (vector<map<string, string> >& testCases, de::Ra
                string randomConst = numberToString(getInt(rnd));
                int index = rnd.getInt(0, width-1);
 
-               params["type"]                                  = "struct";
-               params["name"]                                  = params["type"] + "_" + numberToString(width);
-               params["compositeType"]                 = "%composite = OpTypeStruct" + repeatString(" %custom", width) + "\n";
-               params["filler"]                                = string("%filler    = OpConstant %custom ") + getRandomConstantString(type, rnd) + "\n";
+               params["type"]                  = "struct";
+               params["name"]                  = params["type"] + "_" + numberToString(width);
+               params["compositeDecl"]         = "%composite = OpTypeStruct" + repeatString(" ${customType}", width) + "\n";
+               params["compositeType"]         = "%composite";
+               params["filler"]                = string("%filler    = OpConstant ${customType} ") + getRandomConstantString(type, rnd) + "\n";
                params["compositeConstruct"]    = "%instance  = OpCompositeConstruct %composite" + repeatString(" %filler", width) + "\n";
-               params["indexes"]                               = numberToString(index);
+               params["indexes"]               = numberToString(index);
                testCases.push_back(params);
        }
 }
@@ -7607,16 +7618,17 @@ void createMatrixCompositeCases (vector<map<string, string> >& testCases, de::Ra
                        int index_1 = rnd.getInt(0, width-1);
                        string columnStr = numberToString(column);
 
-                       params["type"]                                  = "matrix";
-                       params["name"]                                  = params["type"] + "_" + widthStr + "x" + columnStr;
-                       params["compositeType"]                 = string("%vectype   = OpTypeVector %custom " + widthStr + "\n")
+                       params["type"]          = "matrix";
+                       params["name"]          = params["type"] + "_" + widthStr + "x" + columnStr;
+                       params["compositeDecl"] = string("%vectype   = OpTypeVector ${customType} " + widthStr + "\n")
                                                                                                +        "%composite = OpTypeMatrix %vectype " + columnStr + "\n";
+                       params["compositeType"] = "%composite";
 
-                       params["filler"]                                = string("%filler    = OpConstant %custom ") + getRandomConstantString(type, rnd) + "\n"
+                       params["filler"]        = string("%filler    = OpConstant ${customType} ") + getRandomConstantString(type, rnd) + "\n"
                                                                                                +        "%fillerVec = OpConstantComposite %vectype" + repeatString(" %filler", width) + "\n";
 
                        params["compositeConstruct"]    = "%instance  = OpCompositeConstruct %composite" + repeatString(" %fillerVec", column) + "\n";
-                       params["indexes"]                               = numberToString(index_0) + " " + numberToString(index_1);
+                       params["indexes"]       = numberToString(index_0) + " " + numberToString(index_1);
                        testCases.push_back(params);
                }
        }
@@ -7645,15 +7657,37 @@ const string getAssemblyTypeDeclaration (const NumberType type)
        }
 }
 
+const string getAssemblyTypeName (const NumberType type)
+{
+       switch (type)
+       {
+               case NUMBERTYPE_INT32:          return "%i32";
+               case NUMBERTYPE_UINT32:         return "%u32";
+               case NUMBERTYPE_FLOAT32:        return "%f32";
+               default:                        DE_ASSERT(false); return "";
+       }
+}
+
 const string specializeCompositeInsertShaderTemplate (const NumberType type, const map<string, string>& params)
 {
        map<string, string>     parameters(params);
 
-       parameters["typeDeclaration"] = getAssemblyTypeDeclaration(type);
-
+       const string customType = getAssemblyTypeName(type);
+       map<string, string> substCustomType;
+       substCustomType["customType"] = customType;
+       parameters["compositeDecl"] = StringTemplate(parameters.at("compositeDecl")).specialize(substCustomType);
+       parameters["compositeType"] = StringTemplate(parameters.at("compositeType")).specialize(substCustomType);
+       parameters["compositeConstruct"] = StringTemplate(parameters.at("compositeConstruct")).specialize(substCustomType);
+       parameters["filler"] = StringTemplate(parameters.at("filler")).specialize(substCustomType);
+       parameters["customType"] = customType;
        parameters["compositeDecorator"] = (parameters["type"] == "array") ? "OpDecorate %composite ArrayStride 4\n" : "";
 
-       return StringTemplate (
+       if (parameters.at("compositeType") != "%u32vec3")
+       {
+               parameters["u32vec3Decl"] = "%u32vec3   = OpTypeVector %u32 3\n";
+       }
+
+       return StringTemplate(
                "OpCapability Shader\n"
                "OpCapability Matrix\n"
                "OpMemoryModel Logical GLSL450\n"
@@ -7680,19 +7714,20 @@ const string specializeCompositeInsertShaderTemplate (const NumberType type, con
                "%voidf     = OpTypeFunction %void\n"
                "%u32       = OpTypeInt 32 0\n"
                "%i32       = OpTypeInt 32 1\n"
-               "%uvec3     = OpTypeVector %u32 3\n"
-               "%uvec3ptr  = OpTypePointer Input %uvec3\n"
+               "%f32       = OpTypeFloat 32\n"
 
-               // Custom type
-               "%custom    = ${typeDeclaration}\n"
-               "${compositeType}"
+               // Composite declaration
+               "${compositeDecl}"
 
                // Constants
                "${filler}"
 
+               "${u32vec3Decl:opt}"
+               "%uvec3ptr  = OpTypePointer Input %u32vec3\n"
+
                // Inherited from custom
-               "%customptr = OpTypePointer Uniform %custom\n"
-               "%customarr = OpTypeRuntimeArray %custom\n"
+               "%customptr = OpTypePointer Uniform ${customType}\n"
+               "%customarr = OpTypeRuntimeArray ${customType}\n"
                "%buf       = OpTypeStruct %customarr\n"
                "%bufptr    = OpTypePointer Uniform %buf\n"
 
@@ -7704,19 +7739,19 @@ const string specializeCompositeInsertShaderTemplate (const NumberType type, con
 
                "%main      = OpFunction %void None %voidf\n"
                "%label     = OpLabel\n"
-               "%idval     = OpLoad %uvec3 %id\n"
+               "%idval     = OpLoad %u32vec3 %id\n"
                "%x         = OpCompositeExtract %u32 %idval 0\n"
 
                "%inloc     = OpAccessChain %customptr %indata %zero %x\n"
                "%outloc    = OpAccessChain %customptr %outdata %zero %x\n"
                // Read the input value
-               "%inval     = OpLoad %custom %inloc\n"
+               "%inval     = OpLoad ${customType} %inloc\n"
                // Create the composite and fill it
                "${compositeConstruct}"
                // Insert the input value to a place
-               "%instance2 = OpCompositeInsert %composite %inval %instance ${indexes}\n"
+               "%instance2 = OpCompositeInsert ${compositeType} %inval %instance ${indexes}\n"
                // Read back the value from the position
-               "%out_val   = OpCompositeExtract %custom %instance2 ${indexes}\n"
+               "%out_val   = OpCompositeExtract ${customType} %instance2 ${indexes}\n"
                // Store it in the output position
                "             OpStore %outloc %out_val\n"
                "             OpReturn\n"
@@ -7805,10 +7840,9 @@ const string specializeInBoundsShaderTemplate (const NumberType type, const Asse
        vector<string>          indexes         = de::splitString(fullIndex, ' ');
 
        map<string, string>     parameters      (params);
-       parameters["typeDeclaration"]   = getAssemblyTypeDeclaration(type);
-       parameters["structType"]                = repeatString(" %composite", structInfo.components);
+       parameters["structType"]        = repeatString(" ${compositeType}", structInfo.components);
        parameters["structConstruct"]   = repeatString(" %instance", structInfo.components);
-       parameters["insertIndexes"]             = fullIndex;
+       parameters["insertIndexes"]     = fullIndex;
 
        // In matrix cases the last two index is the CompositeExtract indexes
        const deUint32 extractIndexes = (parameters["type"] == "matrix") ? 2 : 1;
@@ -7833,7 +7867,25 @@ const string specializeInBoundsShaderTemplate (const NumberType type, const Asse
 
        parameters["compositeDecorator"] = (parameters["type"] == "array") ? "OpDecorate %composite ArrayStride 4\n" : "";
 
-       return StringTemplate (
+       const string customType = getAssemblyTypeName(type);
+       map<string, string> substCustomType;
+       substCustomType["customType"] = customType;
+       parameters["compositeDecl"] = StringTemplate(parameters.at("compositeDecl")).specialize(substCustomType);
+       parameters["compositeType"] = StringTemplate(parameters.at("compositeType")).specialize(substCustomType);
+       parameters["compositeConstruct"] = StringTemplate(parameters.at("compositeConstruct")).specialize(substCustomType);
+       parameters["filler"] = StringTemplate(parameters.at("filler")).specialize(substCustomType);
+       parameters["customType"] = customType;
+
+       const string compositeType = parameters.at("compositeType");
+       map<string, string> substCompositeType;
+       substCompositeType["compositeType"] = compositeType;
+       parameters["structType"] = StringTemplate(parameters.at("structType")).specialize(substCompositeType);
+       if (compositeType != "%u32vec3")
+       {
+               parameters["u32vec3Decl"] = "%u32vec3   = OpTypeVector %u32 3\n";
+       }
+
+       return StringTemplate(
                "OpCapability Shader\n"
                "OpCapability Matrix\n"
                "OpMemoryModel Logical GLSL450\n"
@@ -7856,23 +7908,24 @@ const string specializeInBoundsShaderTemplate (const NumberType type, const Asse
                // General types
                "%void      = OpTypeVoid\n"
                "%voidf     = OpTypeFunction %void\n"
+               "%i32       = OpTypeInt 32 1\n"
                "%u32       = OpTypeInt 32 0\n"
-               "%uvec3     = OpTypeVector %u32 3\n"
-               "%uvec3ptr  = OpTypePointer Input %uvec3\n"
-               // Custom type
-               "%custom    = ${typeDeclaration}\n"
+               "%f32       = OpTypeFloat 32\n"
                // Custom types
-               "${compositeType}"
+               "${compositeDecl}"
+               // %u32vec3 if not already declared in ${compositeDecl}
+               "${u32vec3Decl:opt}"
+               "%uvec3ptr  = OpTypePointer Input %u32vec3\n"
                // Inherited from composite
-               "%composite_p = OpTypePointer Function %composite\n"
+               "%composite_p = OpTypePointer Function ${compositeType}\n"
                "%struct_t  = OpTypeStruct${structType}\n"
                "%struct_p  = OpTypePointer Function %struct_t\n"
                // Constants
                "${filler}"
                "${accessChainConstDeclaration}"
                // Inherited from custom
-               "%customptr = OpTypePointer Uniform %custom\n"
-               "%customarr = OpTypeRuntimeArray %custom\n"
+               "%customptr = OpTypePointer Uniform ${customType}\n"
+               "%customarr = OpTypeRuntimeArray ${customType}\n"
                "%buf       = OpTypeStruct %customarr\n"
                "%bufptr    = OpTypePointer Uniform %buf\n"
                "%indata    = OpVariable %bufptr Uniform\n"
@@ -7883,13 +7936,13 @@ const string specializeInBoundsShaderTemplate (const NumberType type, const Asse
                "%main      = OpFunction %void None %voidf\n"
                "%label     = OpLabel\n"
                "%struct_v  = OpVariable %struct_p Function\n"
-               "%idval     = OpLoad %uvec3 %id\n"
+               "%idval     = OpLoad %u32vec3 %id\n"
                "%x         = OpCompositeExtract %u32 %idval 0\n"
                // Create the input/output type
                "%inloc     = OpInBoundsAccessChain %customptr %indata %zero %x\n"
                "%outloc    = OpInBoundsAccessChain %customptr %outdata %zero %x\n"
                // Read the input value
-               "%inval     = OpLoad %custom %inloc\n"
+               "%inval     = OpLoad ${customType} %inloc\n"
                // Create the composite and fill it
                "${compositeConstruct}"
                // Create the struct and fill it with the composite
@@ -7900,12 +7953,13 @@ const string specializeInBoundsShaderTemplate (const NumberType type, const Asse
                "             OpStore %struct_v %comp_obj\n"
                // Get deepest possible composite pointer
                "%inner_ptr = OpInBoundsAccessChain %composite_p %struct_v${accessChainIndexes}\n"
-               "%read_obj  = OpLoad %composite %inner_ptr\n"
+               "%read_obj  = OpLoad ${compositeType} %inner_ptr\n"
                // Read back the stored value
-               "%read_val  = OpCompositeExtract %custom %read_obj${extractIndexes}\n"
+               "%read_val  = OpCompositeExtract ${customType} %read_obj${extractIndexes}\n"
                "             OpStore %outloc %read_val\n"
                "             OpReturn\n"
-               "             OpFunctionEnd\n").specialize(parameters);
+               "             OpFunctionEnd\n"
+       ).specialize(parameters);
 }
 
 tcu::TestCaseGroup* createOpInBoundsAccessChainGroup (tcu::TestContext& testCtx)
@@ -7974,19 +8028,17 @@ const string specializeDefaultOutputShaderTemplate (const NumberType type, const
 {
        map<string, string> parameters(params);
 
-       parameters["typeDeclaration"] = getAssemblyTypeDeclaration(type);
+       parameters["customType"]        = getAssemblyTypeName(type);
 
        // Declare the const value, and use it in the initializer
        if (params.find("constValue") != params.end())
        {
-               parameters["constDeclaration"]          = "%const      = OpConstant %in_type " + params.at("constValue") + "\n";
-               parameters["variableInitializer"]       = "%const";
+               parameters["variableInitializer"]       = " %const";
        }
        // Uninitialized case
        else
        {
-               parameters["constDeclaration"]          = "";
-               parameters["variableInitializer"]       = "";
+               parameters["commentDecl"]       = ";";
        }
 
        return StringTemplate(
@@ -8011,33 +8063,31 @@ const string specializeDefaultOutputShaderTemplate (const NumberType type, const
                "%voidf      = OpTypeFunction %void\n"
                "%u32        = OpTypeInt 32 0\n"
                "%i32        = OpTypeInt 32 1\n"
+               "%f32        = OpTypeFloat 32\n"
                "%uvec3      = OpTypeVector %u32 3\n"
                "%uvec3ptr   = OpTypePointer Input %uvec3\n"
-               // Custom types
-               "%in_type    = ${typeDeclaration}\n"
-               // "%const      = OpConstant %in_type ${constValue}\n"
-               "${constDeclaration}\n"
+               "${commentDecl:opt}%const      = OpConstant ${customType} ${constValue:opt}\n"
                // Derived types
-               "%in_ptr     = OpTypePointer Uniform %in_type\n"
-               "%in_arr     = OpTypeRuntimeArray %in_type\n"
+               "%in_ptr     = OpTypePointer Uniform ${customType}\n"
+               "%in_arr     = OpTypeRuntimeArray ${customType}\n"
                "%in_buf     = OpTypeStruct %in_arr\n"
                "%in_bufptr  = OpTypePointer Uniform %in_buf\n"
                "%indata     = OpVariable %in_bufptr Uniform\n"
                "%outdata    = OpVariable %in_bufptr Uniform\n"
                "%id         = OpVariable %uvec3ptr Input\n"
-               "%var_ptr    = OpTypePointer Function %in_type\n"
+               "%var_ptr    = OpTypePointer Function ${customType}\n"
                // Constants
                "%zero       = OpConstant %i32 0\n"
                // Main function
                "%main       = OpFunction %void None %voidf\n"
                "%label      = OpLabel\n"
-               "%out_var    = OpVariable %var_ptr Function ${variableInitializer}\n"
+               "%out_var    = OpVariable %var_ptr Function${variableInitializer:opt}\n"
                "%idval      = OpLoad %uvec3 %id\n"
                "%x          = OpCompositeExtract %u32 %idval 0\n"
                "%inloc      = OpAccessChain %in_ptr %indata %zero %x\n"
                "%outloc     = OpAccessChain %in_ptr %outdata %zero %x\n"
 
-               "%outval     = OpLoad %in_type %out_var\n"
+               "%outval     = OpLoad ${customType} %out_var\n"
                "              OpStore %outloc %outval\n"
                "              OpReturn\n"
                "              OpFunctionEnd\n"