Refactor: Compatible compute and graphics VerifyIO
authorBoris Zanin <boris.zanin@mobica.com>
Wed, 4 Jul 2018 09:02:23 +0000 (11:02 +0200)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Thu, 22 Nov 2018 09:33:12 +0000 (04:33 -0500)
Refactoring:
 * Compatibilize VerifyIO function declaration
 * Add isCoreFeatureSupported
 * Graphic shader can run over whole area

Affects tests:
 * dEQP-VK.spirv_assembly.*

Components: Vulkan

VK-GL-CTS issue: 1095

Change-Id: Iba9bab9d40a06f1eba90572cc60f1c334c4b8474
(cherry picked from commit 9a41fa49a90f27544ff83fce678efbe3c58cc381)

18 files changed:
external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsm16bitStorageTests.cpp
external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsm8bitStorageTests.cpp
external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmComputeShaderCase.cpp
external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmComputeShaderTestUtil.cpp
external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmComputeShaderTestUtil.hpp
external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmConditionalBranchTests.cpp
external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmGraphicsShaderTestUtil.cpp
external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmGraphicsShaderTestUtil.hpp
external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmImageSamplerTests.cpp
external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmIndexingTests.cpp
external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmInstructionTests.cpp
external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmPointerParameterTests.cpp
external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmTypeTests.cpp
external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmUboMatrixPaddingTests.cpp
external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmUtils.cpp
external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmUtils.hpp
external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmVariableInitTests.cpp
external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmVariablePointersTests.cpp

index b125671..c979538 100644 (file)
@@ -193,11 +193,11 @@ bool graphicsCheck16BitFloats (const std::vector<Resource>&       originalFloats,
        for (deUint32 outputNdx = 0; outputNdx < outputAllocs.size(); ++outputNdx)
        {
                vector<deUint8> originalBytes;
-               originalFloats[outputNdx].second->getBytes(originalBytes);
+               originalFloats[outputNdx].getBytes(originalBytes);
 
                const deUint16* returned        = static_cast<const deUint16*>(outputAllocs[outputNdx]->getHostPtr());
                const float*    original        = reinterpret_cast<const float*>(&originalBytes.front());
-               const deUint32  count           = static_cast<deUint32>(expectedOutputs[outputNdx].second->getByteSize() / sizeof(deUint16));
+               const deUint32  count           = static_cast<deUint32>(expectedOutputs[outputNdx].getByteSize() / sizeof(deUint16));
                const deUint32  inputStride     = static_cast<deUint32>(originalBytes.size() / sizeof(float)) / count;
 
                for (deUint32 numNdx = 0; numNdx < count; ++numNdx)
@@ -208,13 +208,13 @@ bool graphicsCheck16BitFloats (const std::vector<Resource>&       originalFloats,
        return true;
 }
 
-bool computeCheckBuffersFloats (const std::vector<BufferSp>&   originalFloats,
+bool computeCheckBuffersFloats (const std::vector<Resource>&   originalFloats,
                                                                const vector<AllocationSp>&             outputAllocs,
-                                                               const std::vector<BufferSp>&    /*expectedOutputs*/,
+                                                               const std::vector<Resource>&    /*expectedOutputs*/,
                                                                tcu::TestLog&                                   /*log*/)
 {
        std::vector<deUint8> result;
-       originalFloats.front()->getBytes(result);
+       originalFloats.front().getBytes(result);
 
        const deUint16 * results = reinterpret_cast<const deUint16 *>(&result[0]);
        const deUint16 * expected = reinterpret_cast<const deUint16 *>(outputAllocs.front()->getHostPtr());
@@ -234,9 +234,9 @@ bool computeCheckBuffersFloats (const std::vector<BufferSp>&        originalFloats,
 }
 
 template<RoundingModeFlags RoundingMode>
-bool computeCheck16BitFloats (const std::vector<BufferSp>&     originalFloats,
+bool computeCheck16BitFloats (const std::vector<Resource>&     originalFloats,
                                                          const vector<AllocationSp>&   outputAllocs,
-                                                         const std::vector<BufferSp>&  expectedOutputs,
+                                                         const std::vector<Resource>&  expectedOutputs,
                                                          tcu::TestLog&                                 log)
 {
        if (outputAllocs.size() != originalFloats.size())
@@ -245,11 +245,11 @@ bool computeCheck16BitFloats (const std::vector<BufferSp>&        originalFloats,
        for (deUint32 outputNdx = 0; outputNdx < outputAllocs.size(); ++outputNdx)
        {
                vector<deUint8> originalBytes;
-               originalFloats[outputNdx]->getBytes(originalBytes);
+               originalFloats[outputNdx].getBytes(originalBytes);
 
                const deUint16* returned        = static_cast<const deUint16*>(outputAllocs[outputNdx]->getHostPtr());
                const float*    original        = reinterpret_cast<const float*>(&originalBytes.front());
-               const deUint32  count           = static_cast<deUint32>(expectedOutputs[outputNdx]->getByteSize() / sizeof(deUint16));
+               const deUint32  count           = static_cast<deUint32>(expectedOutputs[outputNdx].getByteSize() / sizeof(deUint16));
                const deUint32  inputStride     = static_cast<deUint32>(originalBytes.size() / sizeof(float)) / count;
 
                for (deUint32 numNdx = 0; numNdx < count; ++numNdx)
@@ -275,33 +275,7 @@ bool check32BitFloats (const std::vector<Resource>&                /* originalFloats */,
        for (deUint32 outputNdx = 0; outputNdx < outputAllocs.size(); ++outputNdx)
        {
                vector<deUint8> expectedBytes;
-               expectedOutputs[outputNdx].second->getBytes(expectedBytes);
-
-               const float*    returnedAsFloat = static_cast<const float*>(outputAllocs[outputNdx]->getHostPtr());
-               const float*    expectedAsFloat = reinterpret_cast<const float*>(&expectedBytes.front());
-               const deUint32  count                   = static_cast<deUint32>(expectedBytes.size() / sizeof(float));
-
-               for (deUint32 numNdx = 0; numNdx < count; ++numNdx)
-                       if (!compare32BitFloat(expectedAsFloat[numNdx], returnedAsFloat[numNdx], log))
-                               return false;
-       }
-
-       return true;
-}
-
-// Overload for compute pipeline
-bool check32BitFloats (const std::vector<BufferSp>&            /* originalFloats */,
-                                          const std::vector<AllocationSp>& outputAllocs,
-                                          const std::vector<BufferSp>&         expectedOutputs,
-                                          tcu::TestLog&                                        log)
-{
-       if (outputAllocs.size() != expectedOutputs.size())
-               return false;
-
-       for (deUint32 outputNdx = 0; outputNdx < outputAllocs.size(); ++outputNdx)
-       {
-               vector<deUint8> expectedBytes;
-               expectedOutputs[outputNdx]->getBytes(expectedBytes);
+               expectedOutputs[outputNdx].getBytes(expectedBytes);
 
                const float*    returnedAsFloat = static_cast<const float*>(outputAllocs[outputNdx]->getHostPtr());
                const float*    expectedAsFloat = reinterpret_cast<const float*>(&expectedBytes.front());
@@ -1046,15 +1020,15 @@ bool compareStruct(const resultType* returned, const originType* original, tcu::
 }
 
 template<typename originType, typename resultType, ShaderTemplate funcOrigin, ShaderTemplate funcResult>
-bool computeCheckStruct (const std::vector<BufferSp>&  originalFloats,
+bool computeCheckStruct (const std::vector<Resource>&  originalFloats,
                                                 const vector<AllocationSp>&    outputAllocs,
-                                                const std::vector<BufferSp>&   /* expectedOutputs */,
+                                                const std::vector<Resource>&   /* expectedOutputs */,
                                                 tcu::TestLog&                                  log)
 {
        for (deUint32 outputNdx = 0; outputNdx < outputAllocs.size(); ++outputNdx)
        {
                vector<deUint8> originalBytes;
-               originalFloats[outputNdx]->getBytes(originalBytes);
+               originalFloats[outputNdx].getBytes(originalBytes);
 
                const resultType*       returned        = static_cast<const resultType*>(outputAllocs[outputNdx]->getHostPtr());
                const originType*       original        = reinterpret_cast<const originType*>(&originalBytes.front());
@@ -1074,7 +1048,7 @@ bool graphicsCheckStruct (const std::vector<Resource>&    originalFloats,
        for (deUint32 outputNdx = 0; outputNdx < static_cast<deUint32>(outputAllocs.size()); ++outputNdx)
        {
                vector<deUint8> originalBytes;
-               originalFloats[outputNdx].second->getBytes(originalBytes);
+               originalFloats[outputNdx].getBytes(originalBytes);
 
                const resultType*       returned        = static_cast<const resultType*>(outputAllocs[outputNdx]->getHostPtr());
                const originType*       original        = reinterpret_cast<const originType*>(&originalBytes.front());
@@ -1491,10 +1465,9 @@ void addCompute16bitStorageUniform16To32Group (tcu::TestCaseGroup* group)
                                spec.assembly                   = shaderTemplate.specialize(specs);
                                spec.numWorkGroups              = IVec3(cTypes[capIdx][tyIdx].count, 1, 1);
                                spec.verifyIO                   = check32BitFloats;
-                               spec.inputTypes[0]              = CAPABILITIES[capIdx].dtype;
 
-                               spec.inputs.push_back(BufferSp(new Float16Buffer(float16Data)));
-                               spec.outputs.push_back(BufferSp(new Float32Buffer(cTypes[capIdx][tyIdx].useConstantIndex ? float32DataConstIdx : float32Data)));
+                               spec.inputs.push_back(Resource(BufferSp(new Float16Buffer(float16Data)), CAPABILITIES[capIdx].dtype));
+                               spec.outputs.push_back(Resource(BufferSp(new Float32Buffer(cTypes[capIdx][tyIdx].useConstantIndex ? float32DataConstIdx : float32Data))));
                                spec.extensions.push_back("VK_KHR_16bit_storage");
                                spec.requestedVulkanFeatures = get16BitStorageFeatures(CAPABILITIES[capIdx].name);
 
@@ -1626,15 +1599,14 @@ void addCompute16bitStorageUniform16To32Group (tcu::TestCaseGroup* group)
 
                                spec.assembly                   = shaderTemplate.specialize(specs);
                                spec.numWorkGroups              = IVec3(cTypes[capIdx][tyIdx].count, 1, 1);
-                               spec.inputTypes[0]              = CAPABILITIES[capIdx].dtype;
 
-                               spec.inputs.push_back(BufferSp(new Int16Buffer(inputs)));
+                               spec.inputs.push_back(Resource(BufferSp(new Int16Buffer(inputs)), CAPABILITIES[capIdx].dtype));
                                if (cTypes[capIdx][tyIdx].useConstantIndex)
-                                       spec.outputs.push_back(BufferSp(new Int32Buffer(intDataConstIdx)));
+                                       spec.outputs.push_back(Resource(BufferSp(new Int32Buffer(intDataConstIdx))));
                                else if (cTypes[capIdx][tyIdx].isSigned)
-                                       spec.outputs.push_back(BufferSp(new Int32Buffer(sOutputs)));
+                                       spec.outputs.push_back(Resource(BufferSp(new Int32Buffer(sOutputs))));
                                else
-                                       spec.outputs.push_back(BufferSp(new Int32Buffer(uOutputs)));
+                                       spec.outputs.push_back(Resource(BufferSp(new Int32Buffer(uOutputs))));
                                spec.extensions.push_back("VK_KHR_16bit_storage");
                                spec.requestedVulkanFeatures = get16BitStorageFeatures(CAPABILITIES[capIdx].name);
 
@@ -1840,9 +1812,8 @@ void addCompute16bitStorageUniform16To32ChainAccessGroup (tcu::TestCaseGroup* gr
                                spec.numWorkGroups                                              = IVec3(1, 1, 1);
                                spec.extensions.push_back                               ("VK_KHR_16bit_storage");
                                spec.requestedVulkanFeatures                    = get16BitStorageFeatures(CAPABILITIES[capIdx].name);
-                               spec.inputTypes[0]                                              = CAPABILITIES[capIdx].dtype;
-                               spec.inputs.push_back(dataTypes[dataTypeIdx].inputs);
-                               spec.outputs.push_back(dataTypes[dataTypeIdx].outputs);
+                               spec.inputs.push_back(Resource(dataTypes[dataTypeIdx].inputs, CAPABILITIES[capIdx].dtype));
+                               spec.outputs.push_back(Resource(dataTypes[dataTypeIdx].outputs));
 
                                group->addChild(new SpvAsmComputeShaderCase(testCtx, testName.c_str(), testName.c_str(), spec, features));
                        }
@@ -2012,7 +1983,7 @@ void addCompute16bitStoragePushConstant16To32Group (tcu::TestCaseGroup* group)
                        spec.verifyIO                   = check32BitFloats;
                        spec.pushConstants              = BufferSp(new Float16Buffer(float16Data));
 
-                       spec.outputs.push_back(BufferSp(new Float32Buffer(cTypes[tyIdx].useConstantIndex ? float32DataConstIdx : float32Data)));
+                       spec.outputs.push_back(Resource(BufferSp(new Float32Buffer(cTypes[tyIdx].useConstantIndex ? float32DataConstIdx : float32Data))));
                        spec.extensions.push_back("VK_KHR_16bit_storage");
                        spec.requestedVulkanFeatures.ext16BitStorage = EXT16BITSTORAGEFEATURES_PUSH_CONSTANT;
 
@@ -2126,11 +2097,11 @@ void addCompute16bitStoragePushConstant16To32Group (tcu::TestCaseGroup* group)
                        spec.pushConstants              = BufferSp(new Int16Buffer(inputs));
 
                        if (cTypes[tyIdx].useConstantIndex)
-                               spec.outputs.push_back(BufferSp(new Int32Buffer(intDataConstIdx)));
+                               spec.outputs.push_back(Resource(BufferSp(new Int32Buffer(intDataConstIdx))));
                        else if (cTypes[tyIdx].isSigned)
-                               spec.outputs.push_back(BufferSp(new Int32Buffer(sOutputs)));
+                               spec.outputs.push_back(Resource(BufferSp(new Int32Buffer(sOutputs))));
                        else
-                               spec.outputs.push_back(BufferSp(new Int32Buffer(uOutputs)));
+                               spec.outputs.push_back(Resource(BufferSp(new Int32Buffer(uOutputs))));
                        spec.extensions.push_back("VK_KHR_16bit_storage");
                        spec.requestedVulkanFeatures.ext16BitStorage = EXT16BITSTORAGEFEATURES_PUSH_CONSTANT;
 
@@ -2334,10 +2305,10 @@ void addGraphics16BitStorageUniformInt32To16Group (tcu::TestCaseGroup* testGroup
                                                inputsPadded.push_back(0);
                                }
                                GraphicsResources       resources;
-                               resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Int32Buffer(inputsPadded))));
-                               resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Int16Buffer(outputs))));
+                               resources.inputs.push_back(Resource(BufferSp(new Int32Buffer(inputsPadded)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                               resources.outputs.push_back(Resource(BufferSp(new Int16Buffer(outputs)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
 
-                               resources.inputs.back().first   = CAPABILITIES[capIdx].dtype;
+                               resources.inputs.back().setDescriptorType(CAPABILITIES[capIdx].dtype);
 
                                createTestsForAllStages(name, defaultColors, defaultColors, fragments, resources, extensions, testGroup, get16BitStorageFeatures(CAPABILITIES[capIdx].name));
                        }
@@ -2345,8 +2316,8 @@ void addGraphics16BitStorageUniformInt32To16Group (tcu::TestCaseGroup* testGroup
        // Vector
        {
                GraphicsResources       resources;
-               resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Int32Buffer(inputs))));
-               resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Int16Buffer(outputs))));
+               resources.inputs.push_back(Resource(BufferSp(new Int32Buffer(inputs)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+               resources.outputs.push_back(Resource(BufferSp(new Int16Buffer(outputs)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
 
                for (deUint32 capIdx = 0; capIdx < DE_LENGTH_OF_ARRAY(CAPABILITIES); ++capIdx)
                        for (deUint32 factIdx = 0; factIdx < DE_LENGTH_OF_ARRAY(intFacts); ++factIdx)
@@ -2367,7 +2338,7 @@ void addGraphics16BitStorageUniformInt32To16Group (tcu::TestCaseGroup* testGroup
                                fragments["capability"]                 = capabilities.specialize(specs);
                                fragments["decoration"]                 = vecDecoration.specialize(specs);
 
-                               resources.inputs.back().first   = CAPABILITIES[capIdx].dtype;
+                               resources.inputs.back().setDescriptorType(CAPABILITIES[capIdx].dtype);
 
                                createTestsForAllStages(name, defaultColors, defaultColors, fragments, resources, extensions, testGroup, get16BitStorageFeatures(CAPABILITIES[capIdx].name));
                        }
@@ -2448,8 +2419,8 @@ void addCompute16bitStorageUniform16To16Group (tcu::TestCaseGroup* group)
        spec.numWorkGroups              = IVec3(numElements, numElements, 1);
        spec.verifyIO                   = computeCheckBuffersFloats;
        spec.coherentMemory             = true;
-       spec.inputs.push_back(BufferSp(new Float16Buffer(float16Data)));
-       spec.outputs.push_back(BufferSp(new Float16Buffer(float16DummyData)));
+       spec.inputs.push_back(Resource(BufferSp(new Float16Buffer(float16Data))));
+       spec.outputs.push_back(Resource(BufferSp(new Float16Buffer(float16DummyData))));
        spec.extensions.push_back("VK_KHR_16bit_storage");
        spec.requestedVulkanFeatures = get16BitStorageFeatures("uniform_buffer_block");
 
@@ -2548,7 +2519,7 @@ void addCompute16bitStorageUniform32To16Group (tcu::TestCaseGroup* group)
                {
                        const char*                             name;
                        const char*                             decor;
-                       ComputeVerifyIOFunc             func;
+                       VerifyIOFunc                    func;
                };
 
                const RndMode           rndModes[]              =
@@ -2632,12 +2603,11 @@ void addCompute16bitStorageUniform32To16Group (tcu::TestCaseGroup* group)
                                        spec.assembly                   = shaderTemplate.specialize(specs);
                                        spec.numWorkGroups              = IVec3(cTypes[capIdx][tyIdx].count, 1, 1);
                                        spec.verifyIO                   = rndModes[rndModeIdx].func;
-                                       spec.inputTypes[0]              = CAPABILITIES[capIdx].dtype;
 
-                                       spec.inputs.push_back(BufferSp(new Float32Buffer(float32Data)));
+                                       spec.inputs.push_back(Resource(BufferSp(new Float32Buffer(float32Data)), CAPABILITIES[capIdx].dtype));
                                        // We provided a custom verifyIO in the above in which inputs will be used for checking.
                                        // So put dummy data in the expected values.
-                                       spec.outputs.push_back(BufferSp(new Float16Buffer(float16DummyData)));
+                                       spec.outputs.push_back(Resource(BufferSp(new Float16Buffer(float16DummyData))));
                                        spec.extensions.push_back("VK_KHR_16bit_storage");
                                        spec.requestedVulkanFeatures = get16BitStorageFeatures(CAPABILITIES[capIdx].name);
 
@@ -2726,10 +2696,9 @@ void addCompute16bitStorageUniform32To16Group (tcu::TestCaseGroup* group)
 
                                spec.assembly                   = shaderTemplate.specialize(specs);
                                spec.numWorkGroups              = IVec3(cTypes[capIdx][tyIdx].count, 1, 1);
-                               spec.inputTypes[0]              = CAPABILITIES[capIdx].dtype;
 
-                               spec.inputs.push_back(BufferSp(new Int32Buffer(inputs)));
-                               spec.outputs.push_back(BufferSp(new Int16Buffer(outputs)));
+                               spec.inputs.push_back(Resource(BufferSp(new Int32Buffer(inputs)), CAPABILITIES[capIdx].dtype));
+                               spec.outputs.push_back(Resource(BufferSp(new Int16Buffer(outputs))));
                                spec.extensions.push_back("VK_KHR_16bit_storage");
                                spec.requestedVulkanFeatures = get16BitStorageFeatures(CAPABILITIES[capIdx].name);
 
@@ -2941,11 +2910,10 @@ void addCompute16bitStorageUniform16StructTo32StructGroup (tcu::TestCaseGroup* g
 
                        spec.assembly                   = shaderTemplate.specialize(specs);
                        spec.numWorkGroups              = IVec3(structData.structArraySize, structData.nestedArraySize, 1);
-                       spec.verifyIO                   = (VK_DESCRIPTOR_TYPE_STORAGE_BUFFER == CAPABILITIES[capIdx].dtype) ?  computeCheckStruct<deFloat16, float, SHADERTEMPLATE_STRIDE16BIT_STD430, SHADERTEMPLATE_STRIDE32BIT_STD430>
+                       spec.verifyIO                   = (VK_DESCRIPTOR_TYPE_STORAGE_BUFFER == CAPABILITIES[capIdx].dtype) ? computeCheckStruct<deFloat16, float, SHADERTEMPLATE_STRIDE16BIT_STD430, SHADERTEMPLATE_STRIDE32BIT_STD430>
                                                                                                                                                                                                                : computeCheckStruct<deFloat16, float, SHADERTEMPLATE_STRIDE16BIT_STD140, SHADERTEMPLATE_STRIDE32BIT_STD430>;
-                       spec.inputTypes[0]              = CAPABILITIES[capIdx].dtype;
-                       spec.inputs.push_back(BufferSp(new Float16Buffer(float16DData)));
-                       spec.outputs.push_back(BufferSp(new Float32Buffer(float32Data)));
+                       spec.inputs.push_back(Resource(BufferSp(new Float16Buffer(float16DData)), CAPABILITIES[capIdx].dtype));
+                       spec.outputs.push_back(Resource(BufferSp(new Float32Buffer(float32Data))));
                        spec.extensions.push_back("VK_KHR_16bit_storage");
                        spec.requestedVulkanFeatures = get16BitStorageFeatures(CAPABILITIES[capIdx].name);
 
@@ -3160,10 +3128,9 @@ void addCompute16bitStorageUniform32StructTo16StructGroup (tcu::TestCaseGroup* g
                        spec.assembly                   = shaderTemplate.specialize(specs);
                        spec.numWorkGroups              = IVec3(structData.structArraySize, structData.nestedArraySize, 1);
                        spec.verifyIO                   = (VK_DESCRIPTOR_TYPE_STORAGE_BUFFER == CAPABILITIES[capIdx].dtype) ? computeCheckStruct<float, deFloat16, SHADERTEMPLATE_STRIDE32BIT_STD430, SHADERTEMPLATE_STRIDE16BIT_STD430> : computeCheckStruct<float, deFloat16, SHADERTEMPLATE_STRIDE32BIT_STD140, SHADERTEMPLATE_STRIDE16BIT_STD430>;
-                       spec.inputTypes[0]              = CAPABILITIES[capIdx].dtype;
 
-                       spec.inputs.push_back(BufferSp(new Float32Buffer(float32DData)));
-                       spec.outputs.push_back(BufferSp(new Float16Buffer(float16Data)));
+                       spec.inputs.push_back(Resource(BufferSp(new Float32Buffer(float32DData)), CAPABILITIES[capIdx].dtype));
+                       spec.outputs.push_back(Resource(BufferSp(new Float16Buffer(float16Data))));
                        spec.extensions.push_back("VK_KHR_16bit_storage");
                        spec.requestedVulkanFeatures = get16BitStorageFeatures(CAPABILITIES[capIdx].name);
 
@@ -3379,9 +3346,8 @@ void addCompute16bitStructMixedTypesGroup (tcu::TestCaseGroup* group)
                spec.assembly                                   = shaderTemplate.specialize(specs);
                spec.numWorkGroups                              = IVec3(structData.structArraySize, structData.nestedArraySize, 1);
                spec.verifyIO                                   = isUniform ? computeCheckStruct<deInt16, deInt16, SHADERTEMPLATE_STRIDEMIX_STD140, SHADERTEMPLATE_STRIDEMIX_STD430> : computeCheckStruct<deInt16, deInt16, SHADERTEMPLATE_STRIDEMIX_STD430, SHADERTEMPLATE_STRIDEMIX_STD430>;
-               spec.inputTypes[0]                              = CAPABILITIES[capIdx].dtype;
-               spec.inputs.push_back                   (BufferSp(new Int16Buffer(inData)));
-               spec.outputs.push_back                  (BufferSp(new Int16Buffer(outData)));
+               spec.inputs.push_back                   (Resource(BufferSp(new Int16Buffer(inData)), CAPABILITIES[capIdx].dtype));
+               spec.outputs.push_back                  (Resource(BufferSp(new Int16Buffer(outData))));
                spec.extensions.push_back               ("VK_KHR_16bit_storage");
                spec.requestedVulkanFeatures    = get16BitStorageFeatures(CAPABILITIES[capIdx].name);
 
@@ -3416,7 +3382,7 @@ void addGraphics16BitStorageUniformFloat32To16Group (tcu::TestCaseGroup* testGro
        {
                const char*                             name;
                const char*                             decor;
-               GraphicsVerifyIOFunc    f;
+               VerifyIOFunc                    f;
        };
 
        getDefaultColors(defaultColors);
@@ -3500,9 +3466,9 @@ void addGraphics16BitStorageUniformFloat32To16Group (tcu::TestCaseGroup* testGro
                                string                          testName        = string(CAPABILITIES[capIdx].name) + "_scalar_float_" + rndModes[rndModeIdx].name;
 
                                GraphicsResources       resources;
-                               resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(arrayStrides[capIdx] == 4 ? float32Data : float32DataPadded))));
+                               resources.inputs.push_back(Resource(BufferSp(new Float32Buffer(arrayStrides[capIdx] == 4 ? float32Data : float32DataPadded)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
                                // We use a custom verifyIO to check the result via computing directly from inputs; the contents in outputs do not matter.
-                               resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float16Buffer(float16DummyData))));
+                               resources.outputs.push_back(Resource(BufferSp(new Float16Buffer(float16DummyData)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
 
                                specs["cap"]                                    = CAPABILITIES[capIdx].cap;
                                specs["indecor"]                                = CAPABILITIES[capIdx].decor;
@@ -3512,18 +3478,17 @@ void addGraphics16BitStorageUniformFloat32To16Group (tcu::TestCaseGroup* testGro
                                fragments["capability"]                 = capabilities.specialize(specs);
                                fragments["decoration"]                 = decoration.specialize(specs);
 
-                               resources.inputs.back().first   = CAPABILITIES[capIdx].dtype;
+                               resources.inputs.back().setDescriptorType(CAPABILITIES[capIdx].dtype);
                                resources.verifyIO                              = rndModes[rndModeIdx].f;
-
                                createTestsForAllStages(testName, defaultColors, defaultColors, fragments, resources, extensions, testGroup, get16BitStorageFeatures(CAPABILITIES[capIdx].name));
                        }
        }
 
        // Non-scalar cases can use the same resources.
        GraphicsResources       resources;
-       resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(float32Data))));
+       resources.inputs.push_back(Resource(BufferSp(new Float32Buffer(float32Data)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
        // We use a custom verifyIO to check the result via computing directly from inputs; the contents in outputs do not matter.
-       resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float16Buffer(float16DummyData))));
+       resources.outputs.push_back(Resource(BufferSp(new Float16Buffer(float16DummyData)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
 
        {  // vector cases
                fragments["pre_main"]                           =
@@ -3610,7 +3575,7 @@ void addGraphics16BitStorageUniformFloat32To16Group (tcu::TestCaseGroup* testGro
                                fragments["capability"]                 = capabilities.specialize(specs);
                                fragments["decoration"]                 = decoration.specialize(specs);
 
-                               resources.inputs.back().first   = CAPABILITIES[capIdx].dtype;
+                               resources.inputs.back().setDescriptorType(CAPABILITIES[capIdx].dtype);
                                resources.verifyIO                              = rndModes[rndModeIdx].f;
 
 
@@ -3723,7 +3688,7 @@ void addGraphics16BitStorageUniformFloat32To16Group (tcu::TestCaseGroup* testGro
                                fragments["capability"]                 = capabilities.specialize(specs);
                                fragments["decoration"]                 = decoration.specialize(specs);
 
-                               resources.inputs.back().first   = CAPABILITIES[capIdx].dtype;
+                               resources.inputs.back().setDescriptorType(CAPABILITIES[capIdx].dtype);
                                resources.verifyIO                              = rndModes[rndModeIdx].f;
 
 
@@ -4647,7 +4612,7 @@ void addGraphics16BitStoragePushConstantFloat16To32Group (tcu::TestCaseGroup* te
                                specs["arrayindex"] = "30";
 
                        resources.outputs.clear();
-                       resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(useConstIdx ? float32ConstIdxData : float32Data))));
+                       resources.outputs.push_back(Resource(BufferSp(new Float32Buffer(useConstIdx ? float32ConstIdxData : float32Data)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
 
                        fragments["pre_main"]           = preMain.specialize(specs);
                        fragments["testfun"]            = testFun.specialize(specs);
@@ -4716,7 +4681,7 @@ void addGraphics16BitStoragePushConstantFloat16To32Group (tcu::TestCaseGroup* te
                                specs["arrayindex"] = "30";
 
                        resources.outputs.clear();
-                       resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(useConstIdx ? float32ConstIdxData : float32Data))));
+                       resources.outputs.push_back(Resource(BufferSp(new Float32Buffer(useConstIdx ? float32ConstIdxData : float32Data)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
 
                        fragments["pre_main"]   = preMain.specialize(specs);
                        fragments["testfun"]    = testFun.specialize(specs);
@@ -4800,7 +4765,7 @@ void addGraphics16BitStoragePushConstantFloat16To32Group (tcu::TestCaseGroup* te
                        specs["store"] = store.specialize(specs);
 
                        resources.outputs.clear();
-                       resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(useConstIdx ? float32ConstIdxData : float32Data))));
+                       resources.outputs.push_back(Resource(BufferSp(new Float32Buffer(useConstIdx ? float32ConstIdxData : float32Data)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
 
                        fragments["pre_main"]           = preMain.specialize(specs);
                        fragments["testfun"]            = testFun.specialize(specs);
@@ -4960,7 +4925,7 @@ void addGraphics16BitStoragePushConstantInt16To32Group (tcu::TestCaseGroup* test
                                        testName += string("_const_idx_") + de::toString(constIdx);
 
                                resources.outputs.clear();
-                               resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Int32Buffer(useConstIdx ? constIdxData : sOutputs))));
+                               resources.outputs.push_back(Resource(BufferSp(new Int32Buffer(useConstIdx ? constIdxData : sOutputs)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
 
                                fragments["testfun"]    = testFun.specialize(specs);
                                fragments["pre_main"]   = preMain.specialize(specs);
@@ -5003,7 +4968,7 @@ void addGraphics16BitStoragePushConstantInt16To32Group (tcu::TestCaseGroup* test
                                        testName += string("_const_idx_") + de::toString(constIdx);
 
                                resources.outputs.clear();
-                               resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Int32Buffer(useConstIdx ? constIdxData : uOutputs))));
+                               resources.outputs.push_back(Resource(BufferSp(new Int32Buffer(useConstIdx ? constIdxData : uOutputs)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
 
                                fragments["testfun"]    = testFun.specialize(specs);
                                fragments["pre_main"]   = preMain.specialize(specs);
@@ -5076,7 +5041,7 @@ void addGraphics16BitStoragePushConstantInt16To32Group (tcu::TestCaseGroup* test
                                        testName += string("_const_idx_") + de::toString(constIdx);
 
                                resources.outputs.clear();
-                               resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Int32Buffer(useConstIdx ? constIdxData : sOutputs))));
+                               resources.outputs.push_back(Resource(BufferSp(new Int32Buffer(useConstIdx ? constIdxData : sOutputs)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
 
                                fragments["testfun"]    = testFun.specialize(specs);
                                fragments["pre_main"]   = preMain.specialize(specs);
@@ -5120,7 +5085,7 @@ void addGraphics16BitStoragePushConstantInt16To32Group (tcu::TestCaseGroup* test
                                        testName += string("_const_idx_") + de::toString(constIdx);
 
                                resources.outputs.clear();
-                               resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Int32Buffer(useConstIdx ? constIdxData : uOutputs))));
+                               resources.outputs.push_back(Resource(BufferSp(new Int32Buffer(useConstIdx ? constIdxData : uOutputs)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
 
                                fragments["testfun"]    = testFun.specialize(specs);
                                fragments["pre_main"]   = preMain.specialize(specs);
@@ -5377,7 +5342,7 @@ void addGraphics16BitStorageUniformInt16To32Group (tcu::TestCaseGroup* testGroup
                                                        inputsPadded.push_back(0);
                                        }
 
-                                       resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Int16Buffer(inputsPadded))));
+                                       resources.inputs.push_back(Resource(BufferSp(new Int16Buffer(inputsPadded)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
 
                                        vector<deInt32>         constIdxOutputs;
                                        if (useConstIdx)
@@ -5390,14 +5355,14 @@ void addGraphics16BitStorageUniformInt16To32Group (tcu::TestCaseGroup* testGroup
                                                }
                                        }
 
-                                       resources.inputs.back().first   = CAPABILITIES[capIdx].dtype;
+                                       resources.inputs.back().setDescriptorType(CAPABILITIES[capIdx].dtype);
                                        resources.outputs.clear();
                                        if (useConstIdx)
-                                               resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Int32Buffer(constIdxOutputs))));
+                                               resources.outputs.push_back(Resource(BufferSp(new Int32Buffer(constIdxOutputs)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
                                        else if (intFacts[factIdx].isSigned)
-                                               resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Int32Buffer(sOutputs))));
+                                               resources.outputs.push_back(Resource(BufferSp(new Int32Buffer(sOutputs)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
                                        else
-                                               resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Int32Buffer(uOutputs))));
+                                               resources.outputs.push_back(Resource(BufferSp(new Int32Buffer(uOutputs)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
 
                                        createTestsForAllStages(name, defaultColors, defaultColors, fragments, resources, extensions, testGroup, get16BitStorageFeatures(CAPABILITIES[capIdx].name));
                                }
@@ -5535,10 +5500,10 @@ void addGraphics16BitStorageUniformFloat16To32Group (tcu::TestCaseGroup* testGro
                                for (deUint32 numIdx = 0; numIdx < numDataPoints; ++numIdx)
                                        float32Data.push_back(deFloat16To32(float16Data[useConstIdx ? constIdx : numIdx]));
 
-                               resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float16Buffer(inputData))));
-                               resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(float32Data))));
+                               resources.inputs.push_back(Resource(BufferSp(new Float16Buffer(inputData)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                               resources.outputs.push_back(Resource(BufferSp(new Float32Buffer(float32Data)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
                                resources.verifyIO = check32BitFloats;
-                               resources.inputs.back().first   = CAPABILITIES[capIdx].dtype;
+                               resources.inputs.back().setDescriptorType(CAPABILITIES[capIdx].dtype);
 
                                if (useConstIdx)
                                        testName += string("_const_idx_") + de::toString(constIdx);
@@ -5653,10 +5618,10 @@ void addGraphics16BitStorageUniformFloat16To32Group (tcu::TestCaseGroup* testGro
                                for (deUint32 numIdx = 0; numIdx < numDataPoints; ++numIdx)
                                        float32Data.push_back(deFloat16To32(float16Data[constantIndices[constIndexIdx].useConstantIndex ? (constantIndices[constIndexIdx].constantIndex * 2 + numIdx % 2) : numIdx]));
 
-                               resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float16Buffer(inputData))));
-                               resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(float32Data))));
+                               resources.inputs.push_back(Resource(BufferSp(new Float16Buffer(inputData)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                               resources.outputs.push_back(Resource(BufferSp(new Float32Buffer(float32Data)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
                                resources.verifyIO = check32BitFloats;
-                               resources.inputs.back().first   = CAPABILITIES[capIdx].dtype;
+                               resources.inputs.back().setDescriptorType(CAPABILITIES[capIdx].dtype);
 
                                if (constantIndices[constIndexIdx].useConstantIndex)
                                        testName += string("_const_idx_") + de::toString(constantIndices[constIndexIdx].constantIndex);
@@ -5767,10 +5732,10 @@ void addGraphics16BitStorageUniformFloat16To32Group (tcu::TestCaseGroup* testGro
                                for (deUint32 numIdx = 0; numIdx < numDataPoints; ++numIdx)
                                        float32Data.push_back(deFloat16To32(float16Data[numIdx]));
 
-                               resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float16Buffer(float16Data))));
-                               resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(float32Data))));
+                               resources.inputs.push_back(Resource(BufferSp(new Float16Buffer(float16Data)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                               resources.outputs.push_back(Resource(BufferSp(new Float32Buffer(float32Data)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
                                resources.verifyIO = check32BitFloats;
-                               resources.inputs.back().first   = CAPABILITIES[capIdx].dtype;
+                               resources.inputs.back().setDescriptorType(CAPABILITIES[capIdx].dtype);
 
                                createTestsForAllStages(testName, defaultColors, defaultColors, fragments, resources, extensions, testGroup, get16BitStorageFeatures(CAPABILITIES[capIdx].name));
                }
@@ -6001,8 +5966,8 @@ void addGraphics16BitStorageUniformStructFloat16To32Group (tcu::TestCaseGroup* t
                        fragments["decoration"]                 = decoration.specialize(specs);
                        fragments["pre_main"]                   = preMain.specialize(specs);
 
-                       resources.inputs.push_back(std::make_pair(CAPABILITIES[capIdx].dtype, BufferSp(new Float16Buffer(float16Data))));
-                       resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(float32Data))));
+                       resources.inputs.push_back(Resource(BufferSp(new Float16Buffer(float16Data)), CAPABILITIES[capIdx].dtype));
+                       resources.outputs.push_back(Resource(BufferSp(new Float32Buffer(float32Data)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
                        resources.verifyIO = (VK_DESCRIPTOR_TYPE_STORAGE_BUFFER == CAPABILITIES[capIdx].dtype) ? graphicsCheckStruct<deFloat16, float, SHADERTEMPLATE_STRIDE16BIT_STD430, SHADERTEMPLATE_STRIDE32BIT_STD430> : graphicsCheckStruct<deFloat16, float, SHADERTEMPLATE_STRIDE16BIT_STD140, SHADERTEMPLATE_STRIDE32BIT_STD430>;
 
                        createTestsForAllStages(testName, defaultColors, defaultColors, fragments, resources, extensions, testGroup, get16BitStorageFeatures(CAPABILITIES[capIdx].name));
@@ -6235,8 +6200,8 @@ void addGraphics16BitStorageUniformStructFloat32To16Group (tcu::TestCaseGroup* t
                fragments["decoration"]                 = decoration.specialize(specs);
                fragments["pre_main"]                   = preMain.specialize(specs);
 
-               resources.inputs.push_back(std::make_pair( CAPABILITIES[capIdx].dtype, BufferSp(new Float32Buffer(float32Data))));
-               resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float16Buffer(float16Data))));
+               resources.inputs.push_back(Resource(BufferSp(new Float32Buffer(float32Data)), CAPABILITIES[capIdx].dtype));
+               resources.outputs.push_back(Resource(BufferSp(new Float16Buffer(float16Data)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
                resources.verifyIO                              =  (VK_DESCRIPTOR_TYPE_STORAGE_BUFFER == CAPABILITIES[capIdx].dtype) ? graphicsCheckStruct<float, deFloat16, SHADERTEMPLATE_STRIDE32BIT_STD430, SHADERTEMPLATE_STRIDE16BIT_STD430> : graphicsCheckStruct<float, deFloat16, SHADERTEMPLATE_STRIDE32BIT_STD140, SHADERTEMPLATE_STRIDE16BIT_STD430>;
 
                VulkanFeatures features;
@@ -6456,8 +6421,8 @@ void addGraphics16bitStructMixedTypesGroup (tcu::TestCaseGroup* group)
                fragments["testfun"]                    = testFun.specialize(specs);
 
                resources.verifyIO                              = isUniform ? graphicsCheckStruct<deInt16, deInt16, SHADERTEMPLATE_STRIDEMIX_STD140, SHADERTEMPLATE_STRIDEMIX_STD430> : graphicsCheckStruct<deInt16, deInt16, SHADERTEMPLATE_STRIDEMIX_STD430, SHADERTEMPLATE_STRIDEMIX_STD430>;
-               resources.inputs.push_back(std::make_pair( CAPABILITIES[capIdx].dtype, BufferSp(new Int16Buffer(inData))));
-               resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Int16Buffer(outData))));
+               resources.inputs.push_back(Resource(BufferSp(new Int16Buffer(inData)), CAPABILITIES[capIdx].dtype));
+               resources.outputs.push_back(Resource(BufferSp(new Int16Buffer(outData)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
 
                createTestsForAllStages(testName, defaultColors, defaultColors, fragments, resources, extensions, group, get16BitStorageFeatures(CAPABILITIES[capIdx].name));
        }
index 2e95eb8..6bb4fa5 100644 (file)
@@ -156,13 +156,13 @@ VulkanFeatures    get8BitStorageFeatures  (const char* cap)
        return features;
 }
 
-bool computeCheckBuffers (const std::vector<BufferSp>& originalInts,
+bool computeCheckBuffers (const std::vector<Resource>& originalInts,
                                                  const vector<AllocationSp>&   outputAllocs,
-                                                 const std::vector<BufferSp>&  /*expectedOutputs*/,
+                                                 const std::vector<Resource>&  /*expectedOutputs*/,
                                                  tcu::TestLog&                                 /*log*/)
 {
        std::vector<deUint8> result;
-       originalInts.front()->getBytes(result);
+       originalInts.front().getBytes(result);
        return deMemCmp(&result[0], outputAllocs.front()->getHostPtr(), result.size()) == 0;
 }
 
@@ -745,15 +745,15 @@ bool compareStruct(const resultType* returned, const originType* original)
 }
 
 template<typename originType, typename resultType, ShaderTemplate funcOrigin, ShaderTemplate funcResult>
-bool computeCheckStruct (const std::vector<BufferSp>&  originalFloats,
-                                                const vector<AllocationSp>&    outputAllocs,
-                                                const std::vector<BufferSp>&   /* expectedOutputs */,
-                                                tcu::TestLog&                                  /*log*/)
+bool checkStruct (const std::vector<Resource>& originalFloats,
+                                 const vector<AllocationSp>&   outputAllocs,
+                                 const std::vector<Resource>&  /* expectedOutputs */,
+                                 tcu::TestLog&                                 /* log */)
 {
        for (deUint32 outputNdx = 0; outputNdx < outputAllocs.size(); ++outputNdx)
        {
                vector<deUint8> originalBytes;
-               originalFloats[outputNdx]->getBytes(originalBytes);
+               originalFloats[outputNdx].getBytes(originalBytes);
 
                const resultType*       returned        = static_cast<const resultType*>(outputAllocs[outputNdx]->getHostPtr());
                const originType*       original        = reinterpret_cast<const originType*>(&originalBytes.front());
@@ -764,65 +764,11 @@ bool computeCheckStruct (const std::vector<BufferSp>&     originalFloats,
        return true;
 }
 
-template<typename originType, typename resultType, ShaderTemplate funcOrigin, ShaderTemplate funcResult>
-bool graphicsCheckStruct (const std::vector<Resource>& originalFloats,
-                                                          const vector<AllocationSp>&  outputAllocs,
-                                                          const std::vector<Resource>& /* expectedOutputs */,
-                                                          tcu::TestLog&                                /* log */)
-{
-       for (deUint32 outputNdx = 0; outputNdx < outputAllocs.size(); ++outputNdx)
-       {
-               vector<deUint8> originalBytes;
-               originalFloats[outputNdx].second->getBytes(originalBytes);
-
-               const resultType*       returned        = static_cast<const resultType*>(outputAllocs[outputNdx]->getHostPtr());
-               const originType*       original        = reinterpret_cast<const originType*>(&originalBytes.front());
-
-               if(!compareStruct<originType, resultType, funcOrigin, funcResult>(returned, original))
-                       return false;
-       }
-       return true;
-}
-
-template<typename originType, typename resultType, deUint32 compositCount>
-bool computeCheckUniformsArray (const std::vector<BufferSp>&   originalFloats,
-                                                               const vector<AllocationSp>&             outputAllocs,
-                                                               const std::vector<BufferSp>&    /* expectedOutputs */,
-                                                               tcu::TestLog&                                   /* log */)
-{
-       const deUint32  originTypeSize = static_cast<deUint32>(sizeof(originType));
-
-       DE_ASSERT((originTypeSize * compositCount) <= arrayStrideInBytesUniform); // one element of array can't be bigger then 16B
-
-       for (deUint32 outputNdx = 0; outputNdx < static_cast<deUint32>(outputAllocs.size()); ++outputNdx)
-       {
-               vector<deUint8> originalBytes;
-               originalFloats[outputNdx]->getBytes(originalBytes);
-               const int elemntsNumber = (static_cast<deUint32>(originalBytes.size()) / arrayStrideInBytesUniform) / compositCount;
-
-               const resultType*       returned = static_cast<const resultType*>(outputAllocs[outputNdx]->getHostPtr());
-               const originType*       original = reinterpret_cast<const originType*>(&originalBytes.front());
-
-               for (int ndx = 0; ndx < elemntsNumber; ++ndx)
-               {
-                       for (deUint32 ndxData = 0; ndxData < compositCount; ++ndxData)
-                       {
-                               if (static_cast<deInt8>(*original) != static_cast<deInt8>(*returned))
-                                       return false;
-                               original++;
-                               returned++;
-                       }
-                       original += arrayStrideInBytesUniform / originTypeSize - compositCount;
-               }
-       }
-       return true;
-}
-
 template<typename originType, typename resultType, deUint32 compositCount>
-bool graphicsCheckUniformsArray (const std::vector<Resource>&  originalFloats,
-                                                                const vector<AllocationSp>&    outputAllocs,
-                                                                const std::vector<Resource>&   /* expectedOutputs */,
-                                                                tcu::TestLog&                                  /* log */)
+bool checkUniformsArray (const std::vector<Resource>&  originalFloats,
+                                                const vector<AllocationSp>&    outputAllocs,
+                                                const std::vector<Resource>&   /* expectedOutputs */,
+                                                tcu::TestLog&                                  /* log */)
 {
        const deUint32  originTypeSize = static_cast<deUint32>(sizeof(originType));
 
@@ -831,7 +777,7 @@ bool graphicsCheckUniformsArray (const std::vector<Resource>&       originalFloats,
        for (deUint32 outputNdx = 0; outputNdx < static_cast<deUint32>(outputAllocs.size()); ++outputNdx)
        {
                vector<deUint8> originalBytes;
-               originalFloats[outputNdx].second->getBytes(originalBytes);
+               originalFloats[outputNdx].getBytes(originalBytes);
                const int elemntsNumber = (static_cast<int>(originalBytes.size()) / arrayStrideInBytesUniform) / compositCount;
 
                const resultType*       returned = static_cast<const resultType*>(outputAllocs[outputNdx]->getHostPtr());
@@ -853,10 +799,10 @@ bool graphicsCheckUniformsArray (const std::vector<Resource>&     originalFloats,
 }
 
 template<typename originType, typename resultType, int compositCount, int ndxConts>
-bool graphicsCheckUniformsArrayConstNdx(const std::vector<Resource>&   originalFloats,
-       const vector<AllocationSp>&     outputAllocs,
-       const std::vector<Resource>&    /* expectedOutputs */,
-       tcu::TestLog&                                   /* log */)
+bool checkUniformsArrayConstNdx (const std::vector<Resource>&  originalFloats,
+                                                                const vector<AllocationSp>&    outputAllocs,
+                                                                const std::vector<Resource>&   /* expectedOutputs */,
+                                                                tcu::TestLog&                                  /* log */)
 {
        const deUint32  originTypeSize = static_cast<deUint32>(sizeof(originType));
 
@@ -865,7 +811,7 @@ bool graphicsCheckUniformsArrayConstNdx(const std::vector<Resource>&        originalFlo
        for (deUint32 outputNdx = 0; outputNdx < static_cast<deUint32>(outputAllocs.size()); ++outputNdx)
        {
                vector<deUint8> originalBytes;
-               originalFloats[outputNdx].second->getBytes(originalBytes);
+               originalFloats[outputNdx].getBytes(originalBytes);
                const int elemntsNumber = (static_cast<int>(originalBytes.size()) / arrayStrideInBytesUniform) / compositCount;
 
                const resultType*       returned = static_cast<const resultType*>(outputAllocs[outputNdx]->getHostPtr());
@@ -1223,10 +1169,9 @@ void addCompute8bitStorage32To8Group (tcu::TestCaseGroup* group)
 
                        spec.assembly                   = shaderTemplate.specialize(specs);
                        spec.numWorkGroups              = IVec3(cTypes[tyIdx].count, 1, 1);
-                       spec.inputTypes[0]              = CAPABILITIES[STORAGE_BUFFER_TEST].dtype;
 
-                       spec.inputs.push_back(BufferSp(new Int32Buffer(inputs)));
-                       spec.outputs.push_back(BufferSp(new Int8Buffer(outputs)));
+                       spec.inputs.push_back(Resource(BufferSp(new Int32Buffer(inputs)), CAPABILITIES[STORAGE_BUFFER_TEST].dtype));
+                       spec.outputs.push_back(Resource(BufferSp(new Int8Buffer(outputs))));
                        spec.extensions.push_back("VK_KHR_8bit_storage");
                        spec.extensions.push_back("VK_KHR_storage_buffer_storage_class");
                        spec.requestedVulkanFeatures = get8BitStorageFeatures(CAPABILITIES[STORAGE_BUFFER_TEST].name);
@@ -1374,19 +1319,18 @@ void addCompute8bitUniform8To32Group (tcu::TestCaseGroup* group)
 
                        spec.assembly                   = shaderTemplate.specialize(specs);
                        spec.numWorkGroups              = IVec3(numElements / cTypes[tyIdx].componentsCount, 1, 1);
-                       spec.inputTypes[0]              = CAPABILITIES[UNIFORM_AND_STORAGEBUFFER_TEST].dtype;
 
-                       spec.inputs.push_back(BufferSp(new Int8Buffer(inputs)));
-                       spec.outputs.push_back(BufferSp(new Int32Buffer(outputs)));
+                       spec.inputs.push_back(Resource(BufferSp(new Int8Buffer(inputs)), CAPABILITIES[UNIFORM_AND_STORAGEBUFFER_TEST].dtype));
+                       spec.outputs.push_back(Resource(BufferSp(new Int32Buffer(outputs))));
 
                        spec.extensions.push_back("VK_KHR_8bit_storage");
                        spec.extensions.push_back("VK_KHR_storage_buffer_storage_class");
                        spec.requestedVulkanFeatures = get8BitStorageFeatures(CAPABILITIES[UNIFORM_AND_STORAGEBUFFER_TEST].name);
 
                        if (cTypes[tyIdx].componentsCount == 4)
-                               spec.verifyIO = computeCheckUniformsArray<deInt8, deInt32, 4>;
+                               spec.verifyIO = checkUniformsArray<deInt8, deInt32, 4>;
                        else
-                               spec.verifyIO = computeCheckUniformsArray<deInt8, deInt32, 1>;
+                               spec.verifyIO = checkUniformsArray<deInt8, deInt32, 1>;
 
                        group->addChild(new SpvAsmComputeShaderCase(testCtx, testName.c_str(), testName.c_str(), spec));
                }
@@ -1696,10 +1640,9 @@ void addCompute8bitStorage16To8Group (tcu::TestCaseGroup* group)
 
                        spec.assembly                   = shaderTemplate.specialize(specs);
                        spec.numWorkGroups              = IVec3(cTypes[tyIdx].count, 1, 1);
-                       spec.inputTypes[0]              = CAPABILITIES[STORAGE_BUFFER_TEST].dtype;
 
-                       spec.inputs.push_back(BufferSp(new Int16Buffer(inputs)));
-                       spec.outputs.push_back(BufferSp(new Int8Buffer(outputs)));
+                       spec.inputs.push_back(Resource(BufferSp(new Int16Buffer(inputs)), CAPABILITIES[STORAGE_BUFFER_TEST].dtype));
+                       spec.outputs.push_back(Resource(BufferSp(new Int8Buffer(outputs))));
                        spec.extensions.push_back("VK_KHR_16bit_storage");
                        spec.extensions.push_back("VK_KHR_8bit_storage");
                        spec.extensions.push_back("VK_KHR_storage_buffer_storage_class");
@@ -1852,19 +1795,18 @@ void addCompute8bitUniform8To16Group (tcu::TestCaseGroup* group)
 
                        spec.assembly                   = shaderTemplate.specialize(specs);
                        spec.numWorkGroups              = IVec3(numElements / cTypes[tyIdx].componentsCount, 1, 1);
-                       spec.inputTypes[0]              = CAPABILITIES[UNIFORM_AND_STORAGEBUFFER_TEST].dtype;
 
-                       spec.inputs.push_back(BufferSp(new Int8Buffer(inputs)));
-                       spec.outputs.push_back(BufferSp(new Int16Buffer(outputs)));
+                       spec.inputs.push_back(Resource(BufferSp(new Int8Buffer(inputs)), CAPABILITIES[UNIFORM_AND_STORAGEBUFFER_TEST].dtype));
+                       spec.outputs.push_back(Resource(BufferSp(new Int16Buffer(outputs))));
                        spec.extensions.push_back("VK_KHR_8bit_storage");
                        spec.extensions.push_back("VK_KHR_16bit_storage");
                        spec.extensions.push_back("VK_KHR_storage_buffer_storage_class");
                        spec.requestedVulkanFeatures = get8BitStorageFeatures(CAPABILITIES[UNIFORM_AND_STORAGEBUFFER_TEST].name);
 
                        if (cTypes[tyIdx].componentsCount == 4)
-                               spec.verifyIO = computeCheckUniformsArray<deInt8, deInt16, 4>;
+                               spec.verifyIO = checkUniformsArray<deInt8, deInt16, 4>;
                        else
-                               spec.verifyIO = computeCheckUniformsArray<deInt8, deInt16, 1>;
+                               spec.verifyIO = checkUniformsArray<deInt8, deInt16, 1>;
 
                        group->addChild(new SpvAsmComputeShaderCase(testCtx, testName.c_str(), testName.c_str(), spec));
                }
@@ -2326,10 +2268,9 @@ void addCompute8bitStorageUniform8StructTo32StructGroup (tcu::TestCaseGroup* gro
 
                spec.assembly                   = shaderTemplate.specialize(specs);
                spec.numWorkGroups              = IVec3(structData.structArraySize, structData.nestedArraySize, 1);
-               spec.verifyIO                   = computeCheckStruct<deInt8, deInt32, SHADERTEMPLATE_STRIDE8BIT_STD140, SHADERTEMPLATE_STRIDE32BIT_STD430>;
-               spec.inputTypes[0]              = CAPABILITIES[UNIFORM_AND_STORAGEBUFFER_TEST].dtype;
-               spec.inputs.push_back(BufferSp(new Int8Buffer(in8DData)));
-               spec.outputs.push_back(BufferSp(new Int32Buffer(int32Data)));
+               spec.verifyIO                   = checkStruct<deInt8, deInt32, SHADERTEMPLATE_STRIDE8BIT_STD140, SHADERTEMPLATE_STRIDE32BIT_STD430>;
+               spec.inputs.push_back(Resource(BufferSp(new Int8Buffer(in8DData)), CAPABILITIES[UNIFORM_AND_STORAGEBUFFER_TEST].dtype));
+               spec.outputs.push_back(Resource(BufferSp(new Int32Buffer(int32Data))));
                spec.extensions.push_back("VK_KHR_8bit_storage");
                spec.requestedVulkanFeatures = get8BitStorageFeatures(CAPABILITIES[UNIFORM_AND_STORAGEBUFFER_TEST].name);
 
@@ -2550,11 +2491,10 @@ void addCompute8bitStorageUniform32StructTo8StructGroup (tcu::TestCaseGroup* gro
 
                spec.assembly                   = shaderTemplate.specialize(specs);
                spec.numWorkGroups              = IVec3(structData.structArraySize, structData.nestedArraySize, 1);
-               spec.verifyIO                   = computeCheckStruct<deInt32, deInt8, SHADERTEMPLATE_STRIDE32BIT_STD140, SHADERTEMPLATE_STRIDE8BIT_STD430>;
-               spec.inputTypes[0]              = CAPABILITIES[UNIFORM_AND_STORAGEBUFFER_TEST].dtype;
+               spec.verifyIO                   = checkStruct<deInt32, deInt8, SHADERTEMPLATE_STRIDE32BIT_STD140, SHADERTEMPLATE_STRIDE8BIT_STD430>;
 
-               spec.inputs.push_back(BufferSp(new Int32Buffer(int32DData)));
-               spec.outputs.push_back(BufferSp(new Int8Buffer(int8Data)));
+               spec.inputs.push_back(Resource(BufferSp(new Int32Buffer(int32DData)), CAPABILITIES[UNIFORM_AND_STORAGEBUFFER_TEST].dtype));
+               spec.outputs.push_back(Resource(BufferSp(new Int8Buffer(int8Data))));
                spec.extensions.push_back("VK_KHR_8bit_storage");
                spec.extensions.push_back("VK_KHR_storage_buffer_storage_class");
                spec.requestedVulkanFeatures = get8BitStorageFeatures(CAPABILITIES[STORAGE_BUFFER_TEST].name);
@@ -2784,10 +2724,9 @@ void addCompute8bitStorage8bitStructMixedTypesGroup (tcu::TestCaseGroup* group)
 
                spec.assembly                                   = shaderTemplate.specialize(specs);
                spec.numWorkGroups                              = IVec3(structData.structArraySize, structData.nestedArraySize, 1);
-               spec.verifyIO                                   = isUniform ? computeCheckStruct<deInt8, deInt8, SHADERTEMPLATE_STRIDEMIX_STD140, SHADERTEMPLATE_STRIDEMIX_STD430> : computeCheckStruct<deInt8, deInt8, SHADERTEMPLATE_STRIDEMIX_STD430, SHADERTEMPLATE_STRIDEMIX_STD430>;
-               spec.inputTypes[0]                              = CAPABILITIES[capIdx].dtype;
-               spec.inputs.push_back                   (BufferSp(new Int8Buffer(inData)));
-               spec.outputs.push_back                  (BufferSp(new Int8Buffer(outData)));
+               spec.verifyIO                                   = isUniform ? checkStruct<deInt8, deInt8, SHADERTEMPLATE_STRIDEMIX_STD140, SHADERTEMPLATE_STRIDEMIX_STD430> : checkStruct<deInt8, deInt8, SHADERTEMPLATE_STRIDEMIX_STD430, SHADERTEMPLATE_STRIDEMIX_STD430>;
+               spec.inputs.push_back                   (Resource(BufferSp(new Int8Buffer(inData)), CAPABILITIES[capIdx].dtype));
+               spec.outputs.push_back                  (Resource(BufferSp(new Int8Buffer(outData))));
                spec.extensions.push_back               ("VK_KHR_8bit_storage");
                spec.extensions.push_back               ("VK_KHR_storage_buffer_storage_class");
                spec.requestedVulkanFeatures    = get8BitStorageFeatures(CAPABILITIES[capIdx].name);
@@ -2973,7 +2912,7 @@ void addGraphics8BitStorageUniformInt32To8Group (tcu::TestCaseGroup* testGroup)
                vector<deInt32> inputs = getInt32s(rnd, ((arrayStrideInBytesUniform / static_cast<deUint32>(sizeof(deInt32))) * numDataPoints) / categories[catIdx].numElements);
 
                if ( 0 != (arrayStrideInBytesUniform - static_cast<deUint32>(sizeof(deInt32)) * categories[catIdx].numElements))
-                       resources.verifyIO = graphicsCheckUniformsArray<deInt32, deInt8, 1>;
+                       resources.verifyIO = checkUniformsArray<deInt32, deInt8, 1>;
                else
                {
                        resources.verifyIO = DE_NULL;
@@ -2981,8 +2920,8 @@ void addGraphics8BitStorageUniformInt32To8Group (tcu::TestCaseGroup* testGroup)
                                outputs[numNdx] = static_cast<deInt8>(0xffff & inputs[numNdx]);
                }
 
-               resources.inputs.push_back(std::make_pair(CAPABILITIES[UNIFORM_AND_STORAGEBUFFER_TEST].dtype, BufferSp(new Int32Buffer(inputs))));
-               resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Int8Buffer(outputs))));
+               resources.inputs.push_back(Resource(BufferSp(new Int32Buffer(inputs)), CAPABILITIES[UNIFORM_AND_STORAGEBUFFER_TEST].dtype));
+               resources.outputs.push_back(Resource(BufferSp(new Int8Buffer(outputs)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
 
                for (deUint32 factIdx = 0; factIdx < DE_LENGTH_OF_ARRAY(intFacts); ++factIdx)
                {
@@ -3194,7 +3133,7 @@ void addGraphics8BitStorageUniformInt8To32Group (tcu::TestCaseGroup* testGroup)
        {
                resources.inputs.clear();
                vector<deInt8>  inputs = getInt8s(rnd, (arrayStrideInBytesUniform / static_cast<deUint32>(sizeof(deInt8))) * (numDataPoints / categories[catIdx].numElements));
-               resources.inputs.push_back(std::make_pair(CAPABILITIES[UNIFORM_AND_STORAGEBUFFER_TEST].dtype, BufferSp(new Int8Buffer(inputs))));
+               resources.inputs.push_back(Resource(BufferSp(new Int8Buffer(inputs)), CAPABILITIES[UNIFORM_AND_STORAGEBUFFER_TEST].dtype));
                for (deUint32 factIdx = 0; factIdx < DE_LENGTH_OF_ARRAY(intFacts); ++factIdx)
                        for (deUint32 constIndexIdx = 0; constIndexIdx < DE_LENGTH_OF_ARRAY(constantIndices); ++constIndexIdx)
                        {
@@ -3228,34 +3167,34 @@ void addGraphics8BitStorageUniformInt8To32Group (tcu::TestCaseGroup* testGroup)
                                        name += string("_const_idx_") + de::toString(constIdx);
 
                                resources.outputs.clear();
-                               resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Int32Buffer(outputs))));
+                               resources.outputs.push_back(Resource(BufferSp(new Int32Buffer(outputs)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
                                if (useConstIdx)
                                {
                                        switch(constantIndices[constIndexIdx].constantIndex)
                                        {
                                        case 0:
                                                if (categories[catIdx].numElements == 2)
-                                                       resources.verifyIO = graphicsCheckUniformsArrayConstNdx<deInt8, deInt32, 2, 0>;
+                                                       resources.verifyIO = checkUniformsArrayConstNdx<deInt8, deInt32, 2, 0>;
                                                else
-                                                       resources.verifyIO = graphicsCheckUniformsArrayConstNdx<deInt8, deInt32, 1, 0>;
+                                                       resources.verifyIO = checkUniformsArrayConstNdx<deInt8, deInt32, 1, 0>;
                                                break;
                                        case 4:
                                                if (categories[catIdx].numElements == 2)
-                                                       resources.verifyIO = graphicsCheckUniformsArrayConstNdx<deInt8, deInt32, 2, 4>;
+                                                       resources.verifyIO = checkUniformsArrayConstNdx<deInt8, deInt32, 2, 4>;
                                                else
-                                                       resources.verifyIO = graphicsCheckUniformsArrayConstNdx<deInt8, deInt32, 1, 4>;
+                                                       resources.verifyIO = checkUniformsArrayConstNdx<deInt8, deInt32, 1, 4>;
                                                break;
                                        case 5:
                                                if (categories[catIdx].numElements == 2)
-                                                       resources.verifyIO = graphicsCheckUniformsArrayConstNdx<deInt8, deInt32, 2, 5>;
+                                                       resources.verifyIO = checkUniformsArrayConstNdx<deInt8, deInt32, 2, 5>;
                                                else
-                                                       resources.verifyIO = graphicsCheckUniformsArrayConstNdx<deInt8, deInt32, 1, 5>;
+                                                       resources.verifyIO = checkUniformsArrayConstNdx<deInt8, deInt32, 1, 5>;
                                                break;
                                        case 6:
                                                if (categories[catIdx].numElements == 2)
-                                                       resources.verifyIO = graphicsCheckUniformsArrayConstNdx<deInt8, deInt32, 2, 6>;
+                                                       resources.verifyIO = checkUniformsArrayConstNdx<deInt8, deInt32, 2, 6>;
                                                else
-                                                       resources.verifyIO = graphicsCheckUniformsArrayConstNdx<deInt8, deInt32, 1, 6>;
+                                                       resources.verifyIO = checkUniformsArrayConstNdx<deInt8, deInt32, 1, 6>;
                                                break;
                                        default:
                                                DE_FATAL("Impossible");
@@ -3265,9 +3204,9 @@ void addGraphics8BitStorageUniformInt8To32Group (tcu::TestCaseGroup* testGroup)
                                else
                                {
                                        if (categories[catIdx].numElements == 2)
-                                               resources.verifyIO = graphicsCheckUniformsArray<deInt8, deInt32, 2>;
+                                               resources.verifyIO = checkUniformsArray<deInt8, deInt32, 2>;
                                        else
-                                               resources.verifyIO = graphicsCheckUniformsArray<deInt8, deInt32, 1>;
+                                               resources.verifyIO = checkUniformsArray<deInt8, deInt32, 1>;
                                }
 
                                createTestsForAllStages(name, defaultColors, defaultColors, fragments, resources, extensions, testGroup, get8BitStorageFeatures(CAPABILITIES[UNIFORM_AND_STORAGEBUFFER_TEST].name));
@@ -3423,7 +3362,7 @@ void addGraphics8BitStoragePushConstantInt8To32Group (tcu::TestCaseGroup* testGr
                                        testName += string("_const_idx_") + de::toString(constIdx);
 
                                resources.outputs.clear();
-                               resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Int32Buffer(useConstIdx ? constIdxData : sOutputs))));
+                               resources.outputs.push_back(Resource(BufferSp(new Int32Buffer(useConstIdx ? constIdxData : sOutputs)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
 
                                fragments["testfun"]    = testFun.specialize(specs);
                                fragments["pre_main"]   = preMain.specialize(specs);
@@ -3466,7 +3405,7 @@ void addGraphics8BitStoragePushConstantInt8To32Group (tcu::TestCaseGroup* testGr
                                        testName += string("_const_idx_") + de::toString(constIdx);
 
                                resources.outputs.clear();
-                               resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Int32Buffer(useConstIdx ? constIdxData : uOutputs))));
+                               resources.outputs.push_back(Resource(BufferSp(new Int32Buffer(useConstIdx ? constIdxData : uOutputs)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
 
                                fragments["testfun"]    = testFun.specialize(specs);
                                fragments["pre_main"]   = preMain.specialize(specs);
@@ -3538,7 +3477,7 @@ void addGraphics8BitStoragePushConstantInt8To32Group (tcu::TestCaseGroup* testGr
                                        testName += string("_const_idx_") + de::toString(constIdx);
 
                                resources.outputs.clear();
-                               resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Int32Buffer(useConstIdx ? constIdxData : sOutputs))));
+                               resources.outputs.push_back(Resource(BufferSp(new Int32Buffer(useConstIdx ? constIdxData : sOutputs)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
 
                                fragments["testfun"]    = testFun.specialize(specs);
                                fragments["pre_main"]   = preMain.specialize(specs);
@@ -3582,7 +3521,7 @@ void addGraphics8BitStoragePushConstantInt8To32Group (tcu::TestCaseGroup* testGr
                                        testName += string("_const_idx_") + de::toString(constIdx);
 
                                resources.outputs.clear();
-                               resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Int32Buffer(useConstIdx ? constIdxData : uOutputs))));
+                               resources.outputs.push_back(Resource(BufferSp(new Int32Buffer(useConstIdx ? constIdxData : uOutputs)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
 
                                fragments["testfun"]    = testFun.specialize(specs);
                                fragments["pre_main"]   = preMain.specialize(specs);
@@ -3778,18 +3717,18 @@ void addGraphics8BitStorageUniformInt16To8Group (tcu::TestCaseGroup* testGroup)
                switch (categories[catIdx].numElements)
                {
                case 1:
-                       resources.verifyIO = graphicsCheckUniformsArray<deInt16, deInt8, 1>;
+                       resources.verifyIO = checkUniformsArray<deInt16, deInt8, 1>;
                        break;
                case 4:
-                       resources.verifyIO = graphicsCheckUniformsArray<deInt16, deInt8, 4>;
+                       resources.verifyIO = checkUniformsArray<deInt16, deInt8, 4>;
                        break;
                default:
                        DE_FATAL("Impossible");
                        break;
                }
 
-               resources.inputs.push_back(std::make_pair(CAPABILITIES[UNIFORM_AND_STORAGEBUFFER_TEST].dtype, BufferSp(new Int16Buffer(inputs))));
-               resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Int8Buffer(outputs))));
+               resources.inputs.push_back(Resource(BufferSp(new Int16Buffer(inputs)), CAPABILITIES[UNIFORM_AND_STORAGEBUFFER_TEST].dtype));
+               resources.outputs.push_back(Resource(BufferSp(new Int8Buffer(outputs)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
 
                for (deUint32 factIdx = 0; factIdx < DE_LENGTH_OF_ARRAY(intFacts); ++factIdx)
                {
@@ -4007,7 +3946,7 @@ void addGraphics8BitStorageUniformInt8To16Group (tcu::TestCaseGroup* testGroup)
        {
                resources.inputs.clear();
                vector<deInt8>  inputs = getInt8s(rnd, (arrayStrideInBytesUniform / static_cast<deUint32>(sizeof(deInt8))) * (numDataPoints / categories[catIdx].numElements));
-               resources.inputs.push_back(std::make_pair(CAPABILITIES[UNIFORM_AND_STORAGEBUFFER_TEST].dtype, BufferSp(new Int8Buffer(inputs))));
+               resources.inputs.push_back(Resource(BufferSp(new Int8Buffer(inputs)), CAPABILITIES[UNIFORM_AND_STORAGEBUFFER_TEST].dtype));
                for (deUint32 factIdx = 0; factIdx < DE_LENGTH_OF_ARRAY(intFacts); ++factIdx)
                        for (deUint32 constIndexIdx = 0; constIndexIdx < DE_LENGTH_OF_ARRAY(constantIndices); ++constIndexIdx)
                        {
@@ -4041,34 +3980,34 @@ void addGraphics8BitStorageUniformInt8To16Group (tcu::TestCaseGroup* testGroup)
                                        name += string("_const_idx_") + de::toString(constIdx);
 
                                resources.outputs.clear();
-                               resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Int16Buffer(outputs))));
+                               resources.outputs.push_back(Resource(BufferSp(new Int16Buffer(outputs)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
                                if (useConstIdx)
                                {
                                        switch (constantIndices[constIndexIdx].constantIndex)
                                        {
                                        case 0:
                                                if (categories[catIdx].numElements == 2)
-                                                       resources.verifyIO = graphicsCheckUniformsArrayConstNdx<deInt8, deInt16, 2, 0>;
+                                                       resources.verifyIO = checkUniformsArrayConstNdx<deInt8, deInt16, 2, 0>;
                                                else
-                                                       resources.verifyIO = graphicsCheckUniformsArrayConstNdx<deInt8, deInt16, 1, 0>;
+                                                       resources.verifyIO = checkUniformsArrayConstNdx<deInt8, deInt16, 1, 0>;
                                                break;
                                        case 4:
                                                if (categories[catIdx].numElements == 2)
-                                                       resources.verifyIO = graphicsCheckUniformsArrayConstNdx<deInt8, deInt16, 2, 4>;
+                                                       resources.verifyIO = checkUniformsArrayConstNdx<deInt8, deInt16, 2, 4>;
                                                else
-                                                       resources.verifyIO = graphicsCheckUniformsArrayConstNdx<deInt8, deInt16, 1, 4>;
+                                                       resources.verifyIO = checkUniformsArrayConstNdx<deInt8, deInt16, 1, 4>;
                                                break;
                                        case 5:
                                                if (categories[catIdx].numElements == 2)
-                                                       resources.verifyIO = graphicsCheckUniformsArrayConstNdx<deInt8, deInt16, 2, 5>;
+                                                       resources.verifyIO = checkUniformsArrayConstNdx<deInt8, deInt16, 2, 5>;
                                                else
-                                                       resources.verifyIO = graphicsCheckUniformsArrayConstNdx<deInt8, deInt16, 1, 5>;
+                                                       resources.verifyIO = checkUniformsArrayConstNdx<deInt8, deInt16, 1, 5>;
                                                break;
                                        case 6:
                                                if (categories[catIdx].numElements == 2)
-                                                       resources.verifyIO = graphicsCheckUniformsArrayConstNdx<deInt8, deInt16, 2, 6>;
+                                                       resources.verifyIO = checkUniformsArrayConstNdx<deInt8, deInt16, 2, 6>;
                                                else
-                                                       resources.verifyIO = graphicsCheckUniformsArrayConstNdx<deInt8, deInt16, 1, 6>;
+                                                       resources.verifyIO = checkUniformsArrayConstNdx<deInt8, deInt16, 1, 6>;
                                                break;
                                        default:
                                                DE_FATAL("Impossible");
@@ -4078,9 +4017,9 @@ void addGraphics8BitStorageUniformInt8To16Group (tcu::TestCaseGroup* testGroup)
                                else
                                {
                                        if (categories[catIdx].numElements == 2)
-                                               resources.verifyIO = graphicsCheckUniformsArray<deInt8, deInt16, 2>;
+                                               resources.verifyIO = checkUniformsArray<deInt8, deInt16, 2>;
                                        else
-                                               resources.verifyIO = graphicsCheckUniformsArray<deInt8, deInt16, 1>;
+                                               resources.verifyIO = checkUniformsArray<deInt8, deInt16, 1>;
                                }
 
                                createTestsForAllStages(name, defaultColors, defaultColors, fragments, resources, extensions, testGroup, get8BitStorageFeatures(CAPABILITIES[UNIFORM_AND_STORAGEBUFFER_TEST].name));
@@ -4240,7 +4179,7 @@ void addGraphics8BitStoragePushConstantInt8To16Group (tcu::TestCaseGroup* testGr
                                        testName += string("_const_idx_") + de::toString(constIdx);
 
                                resources.outputs.clear();
-                               resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Int16Buffer(useConstIdx ? constIdxData : sOutputs))));
+                               resources.outputs.push_back(Resource(BufferSp(new Int16Buffer(useConstIdx ? constIdxData : sOutputs)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
 
                                fragments["testfun"]    = testFun.specialize(specs);
                                fragments["pre_main"]   = preMain.specialize(specs);
@@ -4283,7 +4222,7 @@ void addGraphics8BitStoragePushConstantInt8To16Group (tcu::TestCaseGroup* testGr
                                        testName += string("_const_idx_") + de::toString(constIdx);
 
                                resources.outputs.clear();
-                               resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Int16Buffer(useConstIdx ? constIdxData : uOutputs))));
+                               resources.outputs.push_back(Resource(BufferSp(new Int16Buffer(useConstIdx ? constIdxData : uOutputs)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
 
                                fragments["testfun"]    = testFun.specialize(specs);
                                fragments["pre_main"]   = preMain.specialize(specs);
@@ -4358,7 +4297,7 @@ void addGraphics8BitStoragePushConstantInt8To16Group (tcu::TestCaseGroup* testGr
                                        testName += string("_const_idx_") + de::toString(constIdx);
 
                                resources.outputs.clear();
-                               resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Int16Buffer(useConstIdx ? constIdxData : sOutputs))));
+                               resources.outputs.push_back(Resource(BufferSp(new Int16Buffer(useConstIdx ? constIdxData : sOutputs)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
 
                                fragments["testfun"]    = testFun.specialize(specs);
                                fragments["pre_main"]   = preMain.specialize(specs);
@@ -4403,7 +4342,7 @@ void addGraphics8BitStoragePushConstantInt8To16Group (tcu::TestCaseGroup* testGr
                                        testName += string("_const_idx_") + de::toString(constIdx);
 
                                resources.outputs.clear();
-                               resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Int16Buffer(useConstIdx ? constIdxData : uOutputs))));
+                               resources.outputs.push_back(Resource(BufferSp(new Int16Buffer(useConstIdx ? constIdxData : uOutputs)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
 
                                fragments["testfun"]    = testFun.specialize(specs);
                                fragments["pre_main"]   = preMain.specialize(specs);
@@ -4672,12 +4611,12 @@ void addGraphics8BitStorageUniformStruct8To32Group (tcu::TestCaseGroup* testGrou
                        fragments["pre_main"]                           = preMain.specialize(specs);
                        fragments["testfun"]                            = testFun.specialize(specs);
 
-                       resources.inputs.push_back(std::make_pair(CAPABILITIES[capIdx].dtype, BufferSp(new Int8Buffer(i8Data))));
-                       resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Int32Buffer(i32Data))));
+                       resources.inputs.push_back(Resource(BufferSp(new Int8Buffer(i8Data)), CAPABILITIES[capIdx].dtype));
+                       resources.outputs.push_back(Resource(BufferSp(new Int32Buffer(i32Data)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
                        if (isUniform)
-                               resources.verifyIO = graphicsCheckStruct<deInt8, deInt32, SHADERTEMPLATE_STRIDE8BIT_STD140, SHADERTEMPLATE_STRIDE32BIT_STD430>;
+                               resources.verifyIO = checkStruct<deInt8, deInt32, SHADERTEMPLATE_STRIDE8BIT_STD140, SHADERTEMPLATE_STRIDE32BIT_STD430>;
                        else
-                               resources.verifyIO = graphicsCheckStruct<deInt8, deInt32, SHADERTEMPLATE_STRIDE8BIT_STD430, SHADERTEMPLATE_STRIDE32BIT_STD430>;
+                               resources.verifyIO = checkStruct<deInt8, deInt32, SHADERTEMPLATE_STRIDE8BIT_STD430, SHADERTEMPLATE_STRIDE32BIT_STD430>;
 
                        createTestsForAllStages(testName, defaultColors, defaultColors, fragments, resources, extensions, testGroup, get8BitStorageFeatures(CAPABILITIES[capIdx].name));
                }
@@ -4942,12 +4881,12 @@ void addGraphics8BitStorageUniformStruct32To8Group (tcu::TestCaseGroup* testGrou
                        fragments["pre_main"]                   = preMain.specialize(specs);
                        fragments["testfun"]                    = testFun.specialize(specs);
 
-                       resources.inputs.push_back(std::make_pair( CAPABILITIES[capIdx].dtype, BufferSp(new Int32Buffer(i32Data))));
-                       resources.outputs.push_back(std::make_pair(CAPABILITIES[STORAGE_BUFFER_TEST].dtype, BufferSp(new Int8Buffer(i8Data))));
+                       resources.inputs.push_back(Resource(BufferSp(new Int32Buffer(i32Data)), CAPABILITIES[capIdx].dtype));
+                       resources.outputs.push_back(Resource(BufferSp(new Int8Buffer(i8Data)), CAPABILITIES[STORAGE_BUFFER_TEST].dtype));
                        if (isUniform)
-                               resources.verifyIO = graphicsCheckStruct<deInt32, deInt8, SHADERTEMPLATE_STRIDE32BIT_STD140, SHADERTEMPLATE_STRIDE8BIT_STD430>;
+                               resources.verifyIO = checkStruct<deInt32, deInt8, SHADERTEMPLATE_STRIDE32BIT_STD140, SHADERTEMPLATE_STRIDE8BIT_STD430>;
                        else
-                               resources.verifyIO = graphicsCheckStruct<deInt32, deInt8, SHADERTEMPLATE_STRIDE32BIT_STD430, SHADERTEMPLATE_STRIDE8BIT_STD430>;
+                               resources.verifyIO = checkStruct<deInt32, deInt8, SHADERTEMPLATE_STRIDE32BIT_STD430, SHADERTEMPLATE_STRIDE8BIT_STD430>;
 
                        createTestsForAllStages(testName, defaultColors, defaultColors, fragments, resources, extensions, testGroup, get8BitStorageFeatures(CAPABILITIES[STORAGE_BUFFER_TEST].name));
                }
@@ -5174,9 +5113,9 @@ void addGraphics8bitStorage8bitStructMixedTypesGroup (tcu::TestCaseGroup* group)
                fragments["pre_main"]                   = preMain.specialize(specs);
                fragments["testfun"]                    = testFun.specialize(specs);
 
-               resources.verifyIO                              = isUniform ? graphicsCheckStruct<deInt8, deInt8, SHADERTEMPLATE_STRIDEMIX_STD140, SHADERTEMPLATE_STRIDEMIX_STD430> : graphicsCheckStruct<deInt8, deInt8, SHADERTEMPLATE_STRIDEMIX_STD430, SHADERTEMPLATE_STRIDEMIX_STD430>;
-               resources.inputs.push_back(std::make_pair( CAPABILITIES[capIdx].dtype, BufferSp(new Int8Buffer(inData))));
-               resources.outputs.push_back(std::make_pair(CAPABILITIES[STORAGE_BUFFER_TEST].dtype, BufferSp(new Int8Buffer(outData))));
+               resources.verifyIO                              = isUniform ? checkStruct<deInt8, deInt8, SHADERTEMPLATE_STRIDEMIX_STD140, SHADERTEMPLATE_STRIDEMIX_STD430> : checkStruct<deInt8, deInt8, SHADERTEMPLATE_STRIDEMIX_STD430, SHADERTEMPLATE_STRIDEMIX_STD430>;
+               resources.inputs.push_back(Resource(BufferSp(new Int8Buffer(inData)), CAPABILITIES[capIdx].dtype));
+               resources.outputs.push_back(Resource(BufferSp(new Int8Buffer(outData)), CAPABILITIES[STORAGE_BUFFER_TEST].dtype));
 
                createTestsForAllStages(testName, defaultColors, defaultColors, fragments, resources, extensions, group, get8BitStorageFeatures(CAPABILITIES[capIdx].name));
        }
index f23cea3..35bb480 100644 (file)
@@ -26,6 +26,8 @@
 #include "deSharedPtr.hpp"
 #include "deSTLUtil.hpp"
 
+#include "vktSpvAsmUtils.hpp"
+
 #include "vkBuilderUtil.hpp"
 #include "vkMemUtil.hpp"
 #include "vkPlatform.hpp"
@@ -292,11 +294,12 @@ Move<VkDescriptorSet> createDescriptorSet (const DeviceInterface& vkdi, const Vk
 /*--------------------------------------------------------------------*//*!
  * \brief Create a compute pipeline based on the given shader
  *//*--------------------------------------------------------------------*/
-Move<VkPipeline> createComputePipeline (const DeviceInterface& vkdi, const VkDevice& device, VkPipelineLayout pipelineLayout, VkShaderModule shader, const char* entryPoint, const vector<deUint32>& specConstants)
+Move<VkPipeline> createComputePipeline (const DeviceInterface& vkdi, const VkDevice& device, VkPipelineLayout pipelineLayout, VkShaderModule shader, const char* entryPoint, const vkt::SpirVAssembly::SpecConstants& specConstants)
 {
-       const deUint32                                                  numSpecConstants                                = (deUint32)specConstants.size();
+       const deUint32                                                  numSpecConstants                                = (deUint32)specConstants.getValuesCount();
        vector<VkSpecializationMapEntry>                entries;
        VkSpecializationInfo                                    specInfo;
+       size_t                                                                  offset                                                  = 0;
 
        if (numSpecConstants != 0)
        {
@@ -304,15 +307,19 @@ Move<VkPipeline> createComputePipeline (const DeviceInterface& vkdi, const VkDev
 
                for (deUint32 ndx = 0; ndx < numSpecConstants; ++ndx)
                {
+                       const size_t valueSize  = specConstants.getValueSize(ndx);
+
                        entries[ndx].constantID = ndx;
-                       entries[ndx].offset             = ndx * (deUint32)sizeof(deUint32);
-                       entries[ndx].size               = sizeof(deUint32);
+                       entries[ndx].offset             = static_cast<deUint32>(offset);
+                       entries[ndx].size               = valueSize;
+
+                       offset                                  += valueSize;
                }
 
                specInfo.mapEntryCount          = numSpecConstants;
                specInfo.pMapEntries            = &entries[0];
                specInfo.dataSize                       = numSpecConstants * sizeof(deUint32);
-               specInfo.pData                          = specConstants.data();
+               specInfo.pData                          = specConstants.getValuesBuffer();
        }
 
        const VkPipelineShaderStageCreateInfo   pipelineShaderStageCreateInfo   =
@@ -432,6 +439,15 @@ tcu::TestStatus SpvAsmComputeShaderInstance::iterate (void)
                TCU_THROW(NotSupportedError, "shaderFloat64 feature is not supported");
        }
 
+       // Core features
+       {
+               const char* unsupportedFeature = DE_NULL;
+
+               if (!isCoreFeaturesSupported(m_context, m_shaderSpec.requestedVulkanFeatures.coreFeatures, &unsupportedFeature))
+                       TCU_THROW(NotSupportedError, std::string("At least following requested core feature is not supported: ") + unsupportedFeature);
+       }
+
+       // Extension features
        {
                // 8bit storage features
                {
@@ -463,12 +479,7 @@ tcu::TestStatus SpvAsmComputeShaderInstance::iterate (void)
 
        for (deUint32 inputNdx = 0; inputNdx < m_shaderSpec.inputs.size(); ++inputNdx)
        {
-               if (m_shaderSpec.inputTypes.count(inputNdx) != 0)
-                       descriptorTypes.push_back(m_shaderSpec.inputTypes.at(inputNdx));
-               else
-                       descriptorTypes.push_back(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER);
-
-               const VkDescriptorType  descType        = descriptorTypes[inputNdx];
+               const VkDescriptorType  descType        = m_shaderSpec.inputs[inputNdx].getDescriptorType();
 
                const bool                              hasImage        = (descType == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE)        ||
                                                                                          (descType == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE)        ||
@@ -478,10 +489,12 @@ tcu::TestStatus SpvAsmComputeShaderInstance::iterate (void)
                                                                                          (descType == VK_DESCRIPTOR_TYPE_SAMPLER)                      ||
                                                                                          (descType == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER);
 
+               descriptorTypes.push_back(descType);
+
                // Buffer
                if (!hasImage && !hasSampler)
                {
-                       const BufferSp&         input                   = m_shaderSpec.inputs[inputNdx];
+                       const BufferSp&         input                   = m_shaderSpec.inputs[inputNdx].getBuffer();
                        vector<deUint8>         inputBytes;
 
                        input->getBytes(inputBytes);
@@ -498,7 +511,7 @@ tcu::TestStatus SpvAsmComputeShaderInstance::iterate (void)
                // Image
                else if (hasImage)
                {
-                       const BufferSp&                         input                   = m_shaderSpec.inputs[inputNdx];
+                       const BufferSp&                         input                   = m_shaderSpec.inputs[inputNdx].getBuffer();
                        vector<deUint8>                         inputBytes;
 
                        input->getBytes(inputBytes);
@@ -678,10 +691,12 @@ tcu::TestStatus SpvAsmComputeShaderInstance::iterate (void)
 
        for (deUint32 outputNdx = 0; outputNdx < m_shaderSpec.outputs.size(); ++outputNdx)
        {
-               descriptorTypes.push_back(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER);
+               DE_ASSERT(m_shaderSpec.outputs[outputNdx].getDescriptorType() == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER);
+
+               descriptorTypes.push_back(m_shaderSpec.outputs[outputNdx].getDescriptorType());
 
                AllocationMp            alloc;
-               const BufferSp&         output          = m_shaderSpec.outputs[outputNdx];
+               const BufferSp&         output          = m_shaderSpec.outputs[outputNdx].getBuffer();
                vector<deUint8>         outputBytes;
 
                output->getBytes(outputBytes);
@@ -738,7 +753,7 @@ tcu::TestStatus SpvAsmComputeShaderInstance::iterate (void)
        // Invalidate output memory ranges before checking on host.
        for (size_t outputNdx = 0; outputNdx < m_shaderSpec.outputs.size(); ++outputNdx)
        {
-               invalidateMemory(vkdi, device, outputAllocs[outputNdx].get(), m_shaderSpec.outputs[outputNdx]->getByteSize(), m_shaderSpec.coherentMemory);
+               invalidateMemory(vkdi, device, outputAllocs[outputNdx].get(), m_shaderSpec.outputs[outputNdx].getByteSize(), m_shaderSpec.coherentMemory);
        }
 
        // Check output.
@@ -751,7 +766,7 @@ tcu::TestStatus SpvAsmComputeShaderInstance::iterate (void)
        {
                for (size_t outputNdx = 0; outputNdx < m_shaderSpec.outputs.size(); ++outputNdx)
                {
-                       const BufferSp& expectedOutput = m_shaderSpec.outputs[outputNdx];
+                       const BufferSp& expectedOutput = m_shaderSpec.outputs[outputNdx].getBuffer();;
                        vector<deUint8> expectedBytes;
 
                        expectedOutput->getBytes(expectedBytes);
index 860f28b..9593b38 100644 (file)
@@ -29,7 +29,7 @@ namespace SpirVAssembly
 {
 namespace
 {
-bool verifyOutputWithEpsilon (const std::vector<AllocationSp>& outputAllocs, const std::vector<BufferSp>& expectedOutputs, tcu::TestLog& log, const float epsilon)
+bool verifyOutputWithEpsilon (const std::vector<AllocationSp>& outputAllocs, const std::vector<Resource>& expectedOutputs, tcu::TestLog& log, const float epsilon)
 {
        DE_ASSERT(outputAllocs.size() != 0);
        DE_ASSERT(outputAllocs.size() == expectedOutputs.size());
@@ -37,7 +37,7 @@ bool verifyOutputWithEpsilon (const std::vector<AllocationSp>& outputAllocs, con
        for (size_t outputNdx = 0; outputNdx < outputAllocs.size(); ++outputNdx)
        {
                std::vector<deUint8>    expectedBytes;
-               expectedOutputs[outputNdx]->getBytes(expectedBytes);
+               expectedOutputs[outputNdx].getBytes(expectedBytes);
 
                std::vector<float>      expectedFloats  (expectedBytes.size() / sizeof (float));
                std::vector<float>      actualFloats    (expectedBytes.size() / sizeof (float));
@@ -123,7 +123,7 @@ const char* getComputeAsmInputOutputBufferTraits (void)
                "OpMemberDecorate %buf 0 Offset 0\n";
 }
 
-bool verifyOutput (const std::vector<BufferSp>&, const std::vector<AllocationSp>& outputAllocs, const std::vector<BufferSp>& expectedOutputs, tcu::TestLog& log)
+bool verifyOutput (const std::vector<Resource>&, const std::vector<AllocationSp>& outputAllocs, const std::vector<Resource>& expectedOutputs, tcu::TestLog& log)
 {
        const float     epsilon = 0.001f;
        return verifyOutputWithEpsilon(outputAllocs, expectedOutputs, log, epsilon);
index f574a8f..a61cdc0 100644 (file)
@@ -26,7 +26,6 @@
 #include "deDefs.h"
 #include "deFloat16.h"
 #include "deRandom.hpp"
-#include "deSharedPtr.hpp"
 #include "tcuTestLog.hpp"
 #include "tcuVector.hpp"
 #include "tcuTestLog.hpp"
@@ -72,23 +71,6 @@ static void fillRandomScalars (de::Random& rnd, deInt32 minValue, deInt32 maxVal
                dst[i] = rnd.getInt(minValue, maxValue);
 }
 
-typedef de::MovePtr<vk::Allocation>                    AllocationMp;
-typedef de::SharedPtr<vk::Allocation>          AllocationSp;
-
-/*--------------------------------------------------------------------*//*!
- * \brief Abstract class for an input/output storage buffer object
- *//*--------------------------------------------------------------------*/
-class BufferInterface
-{
-public:
-       virtual                         ~BufferInterface        (void)                          {}
-
-       virtual void            getBytes                        (std::vector<deUint8>& bytes) const = 0;
-       virtual size_t          getByteSize                     (void) const = 0;
-};
-
-typedef de::SharedPtr<BufferInterface>         BufferSp;
-
 /*--------------------------------------------------------------------*//*!
 * \brief Concrete class for an input/output storage buffer object used for OpAtomic tests
 *//*--------------------------------------------------------------------*/
@@ -171,7 +153,7 @@ public:
        }
 
        template <int OpAtomic>
-       static bool compareWithRetvals (const std::vector<BufferSp>& inputs, const std::vector<AllocationSp>& outputAllocs, const std::vector<BufferSp>& expectedOutputs, tcu::TestLog& log)
+       static bool compareWithRetvals (const std::vector<Resource>& inputs, const std::vector<AllocationSp>& outputAllocs, const std::vector<Resource>& expectedOutputs, tcu::TestLog& log)
        {
                if (outputAllocs.size() != 2 || inputs.size() != 1)
                        DE_FATAL("Wrong number of buffers to compare");
@@ -184,7 +166,7 @@ public:
                        {
                                // BUFFERTYPE_ATOMIC_RET for arithmetic operations must be verified manually by matching return values to inputs
                                std::vector<deUint8>    inputBytes;
-                               inputs[0]->getBytes(inputBytes);
+                               inputs[0].getBytes(inputBytes);
 
                                const deUint32*                 inputValues                     = reinterpret_cast<deUint32*>(&inputBytes.front());
                                const size_t                    inputValuesCount        = inputBytes.size() / sizeof(deUint32);
@@ -200,7 +182,7 @@ public:
                        }
                        else
                        {
-                               const BufferSp&                 expectedOutput = expectedOutputs[i];
+                               const BufferSp&                 expectedOutput = expectedOutputs[i].getBuffer();
                                std::vector<deUint8>    expectedBytes;
 
                                expectedOutput->getBytes(expectedBytes);
@@ -309,11 +291,6 @@ typedef Buffer<deUint32>   Uint32Buffer;
 typedef Buffer<deUint64>       Uint64Buffer;
 typedef Buffer<tcu::Vec4>      Vec4Buffer;
 
-typedef bool (*ComputeVerifyIOFunc) (const std::vector<BufferSp>&              inputs,
-                                                                        const std::vector<AllocationSp>&       outputAllocations,
-                                                                        const std::vector<BufferSp>&           expectedOutputs,
-                                                                        tcu::TestLog&                                          log);
-
 typedef bool (*ComputeVerifyBinaryFunc) (const ProgramBinary&  binary);
 
 /*--------------------------------------------------------------------*//*!
@@ -326,12 +303,10 @@ struct ComputeShaderSpec
 {
        std::string                                                             assembly;
        std::string                                                             entryPoint;
-       std::vector<BufferSp>                                   inputs;
-       // Mapping from input index (in the inputs field) to the descriptor type.
-       std::map<deUint32, VkDescriptorType>    inputTypes;
-       std::vector<BufferSp>                                   outputs;
+       std::vector<Resource>                                   inputs;
+       std::vector<Resource>                                   outputs;
        tcu::IVec3                                                              numWorkGroups;
-       std::vector<deUint32>                                   specConstants;
+       SpecConstants                                                   specConstants;
        BufferSp                                                                pushConstants;
        std::vector<std::string>                                extensions;
        VulkanFeatures                                                  requestedVulkanFeatures;
@@ -341,7 +316,7 @@ struct ComputeShaderSpec
        // and the contents of expectedOutputs. Otherwise the function pointed to by verifyIO will be called.
        // If true is returned, then the test case is assumed to have passed, if false is returned, then the test
        // case is assumed to have failed. Exact meaning of failure can be customized with failResult.
-       ComputeVerifyIOFunc                                             verifyIO;
+       VerifyIOFunc                                                    verifyIO;
        ComputeVerifyBinaryFunc                                 verifyBinary;
        SpirvVersion                                                    spirvVersion;
        bool                                                                    coherentMemory;
@@ -380,11 +355,15 @@ const char* getComputeAsmInputOutputBuffer                        (void);
  *//*--------------------------------------------------------------------*/
 const char* getComputeAsmInputOutputBufferTraits       (void);
 
-bool verifyOutput                                                                      (const std::vector<BufferSp>&,
-                                                                                                       const std::vector<AllocationSp>& outputAllocs,
-                                                                                                       const std::vector<BufferSp>&            expectedOutputs,
+bool verifyOutput                                                                      (const std::vector<Resource>&,
+                                                                                                       const std::vector<AllocationSp>&        outputAllocs,
+                                                                                                       const std::vector<Resource>&            expectedOutputs,
                                                                                                        tcu::TestLog&                                           log);
 
+                                                                                                       // Creates vertex-shader assembly by specializing a boilerplate StringTemplate
+
+std::string makeComputeShaderAssembly(const std::map<std::string, std::string>& fragments);
+
 } // SpirVAssembly
 } // vkt
 
index dffd2f4..8f08eda 100644 (file)
@@ -119,7 +119,7 @@ void addComputeSameLabelsTest (tcu::TestCaseGroup* group)
                spec.assembly                   = shaderSource.specialize(specs);
                spec.numWorkGroups              = IVec3(numItems, 1, 1);
 
-               spec.outputs.push_back(BufferSp(new Buffer<deUint32>(outputData)));
+               spec.outputs.push_back(Resource(BufferSp(new Buffer<deUint32>(outputData))));
 
                group->addChild(new SpvAsmComputeShaderCase(testCtx, testName.c_str(), "Tests both labels pointing to a same branch.", spec));
        }
@@ -136,7 +136,7 @@ void addGraphicsSameLabelsTest (tcu::TestCaseGroup* group)
        for (deUint32 numIdx = 0; numIdx < numItems; ++numIdx)
                outputData.push_back(numIdx);
 
-       resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Buffer<deUint32>(outputData))));
+       resources.outputs.push_back(Resource(BufferSp(new Buffer<deUint32>(outputData)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
 
        getDefaultColors(defaultColors);
 
index f77da05..8d4dd11 100644 (file)
@@ -266,6 +266,7 @@ InstanceContext::InstanceContext (const RGBA                                                (&inputs)[4],
        , interfaces                                    (interfaces_)
        , failResult                                    (QP_TEST_RESULT_FAIL)
        , failMessageTemplate                   ("${reason}")
+       , renderFullSquare                              (false)
 {
        inputColors[0]          = inputs[0];
        inputColors[1]          = inputs[1];
@@ -293,6 +294,7 @@ InstanceContext::InstanceContext (const InstanceContext& other)
        , interfaces                                    (other.interfaces)
        , failResult                                    (other.failResult)
        , failMessageTemplate                   (other.failMessageTemplate)
+       , renderFullSquare                              (other.renderFullSquare)
 {
        inputColors[0]          = other.inputColors[0];
        inputColors[1]          = other.inputColors[1];
@@ -2200,8 +2202,10 @@ bool compare32BitFloat (float expected, float returned, tcu::TestLog& log)
 
 Move<VkBuffer> createBufferForResource (const DeviceInterface& vk, const VkDevice vkDevice, const Resource& resource, deUint32 queueFamilyIndex)
 {
+       const vk::VkDescriptorType resourceType = resource.getDescriptorType();
+
        vector<deUint8> resourceBytes;
-       resource.second->getBytes(resourceBytes);
+       resource.getBytes(resourceBytes);
 
        const VkBufferCreateInfo        resourceBufferParams    =
        {
@@ -2209,7 +2213,7 @@ Move<VkBuffer> createBufferForResource (const DeviceInterface& vk, const VkDevic
                DE_NULL,                                                                                                                        // pNext
                (VkBufferCreateFlags)0,                                                                                         // flags
                (VkDeviceSize)resourceBytes.size(),                                                                     // size
-               (VkBufferUsageFlags)getMatchingBufferUsageFlagBit(resource.first),      // usage
+               (VkBufferUsageFlags)getMatchingBufferUsageFlagBit(resourceType),        // usage
                VK_SHARING_MODE_EXCLUSIVE,                                                                                      // sharingMode
                1u,                                                                                                                                     // queueFamilyCount
                &queueFamilyIndex,                                                                                                      // pQueueFamilyIndices
@@ -2232,7 +2236,7 @@ Move<VkImage> createImageForResource (const DeviceInterface& vk, const VkDevice
                1u,                                                                                                                                     //      deUint32                        arraySize;
                VK_SAMPLE_COUNT_1_BIT,                                                                                          //      deUint32                        samples;
                VK_IMAGE_TILING_OPTIMAL,                                                                                        //      VkImageTiling           tiling;
-               getMatchingImageUsageFlags(resource.first),                                                     //      VkImageUsageFlags       usage;
+               getMatchingImageUsageFlags(resource.getDescriptorType()),                       //      VkImageUsageFlags       usage;
                VK_SHARING_MODE_EXCLUSIVE,                                                                                      //      VkSharingMode           sharingMode;
                1u,                                                                                                                                     //      deUint32                        queueFamilyCount;
                &queueFamilyIndex,                                                                                                      //      const deUint32*         pQueueFamilyIndices;
@@ -2356,6 +2360,7 @@ TestStatus runAndVerifyDefaultPipeline (Context& context, InstanceContext instan
        const deUint32                                                          numResources                    = static_cast<deUint32>(instance.resources.inputs.size() + instance.resources.outputs.size());
        const bool                                                                      needInterface                   = !instance.interfaces.empty();
        const VkPhysicalDeviceFeatures&                         features                                = context.getDeviceFeatures();
+       const Vec4                                                                      defaulClearColor                (0.125f, 0.25f, 0.75f, 1.0f);
 
        supportsGeometry                = features.geometryShader == VK_TRUE;
        supportsTessellation    = features.tessellationShader == VK_TRUE;
@@ -2412,16 +2417,27 @@ TestStatus runAndVerifyDefaultPipeline (Context& context, InstanceContext instan
                }
        }
 
-       // 8bit storage features
+       // Core features
        {
-               if (!is8BitStorageFeaturesSupported(context, instance.requestedFeatures.ext8BitStorage))
-                       TCU_THROW(NotSupportedError, "Requested 8bit storage features not supported");
+               const char* unsupportedFeature = DE_NULL;
+
+               if (!isCoreFeaturesSupported(context, instance.requestedFeatures.coreFeatures, &unsupportedFeature))
+                       TCU_THROW(NotSupportedError, std::string("At least following requested core feature is not supported: ") + unsupportedFeature);
        }
 
-       // 16bit storage features
+       // Extension features
        {
-               if (!is16BitStorageFeaturesSupported(context, instance.requestedFeatures.ext16BitStorage))
-                       TCU_THROW(NotSupportedError, "Requested 16bit storage features not supported");
+               // 16bit storage features
+               {
+                       if (!is16BitStorageFeaturesSupported(context, instance.requestedFeatures.ext16BitStorage))
+                               TCU_THROW(NotSupportedError, "Requested 16bit storage features not supported");
+               }
+
+               // 8bit storage features
+               {
+                       if (!is8BitStorageFeaturesSupported(context, instance.requestedFeatures.ext8BitStorage))
+                               TCU_THROW(NotSupportedError, "Requested 8bit storage features not supported");
+               }
        }
 
        // fragment stores and atomics feature
@@ -2454,27 +2470,60 @@ TestStatus runAndVerifyDefaultPipeline (Context& context, InstanceContext instan
        const Vec4                                                              vertexData[]                    =
        {
                // Upper left corner:
-               Vec4(-1.0f, -1.0f, 0.0f, 1.0f), instance.inputColors[0].toVec(),
-               Vec4(-0.5f, -1.0f, 0.0f, 1.0f), instance.inputColors[0].toVec(),
-               Vec4(-1.0f, -0.5f, 0.0f, 1.0f), instance.inputColors[0].toVec(),
+               Vec4(-1.0f, -1.0f, 0.0f, 1.0f), instance.inputColors[0].toVec(),        //1
+               Vec4(-0.5f, -1.0f, 0.0f, 1.0f), instance.inputColors[0].toVec(),        //2
+               Vec4(-1.0f, -0.5f, 0.0f, 1.0f), instance.inputColors[0].toVec(),        //3
 
                // Upper right corner:
-               Vec4(+0.5f, -1.0f, 0.0f, 1.0f), instance.inputColors[1].toVec(),
-               Vec4(+1.0f, -1.0f, 0.0f, 1.0f), instance.inputColors[1].toVec(),
-               Vec4(+1.0f, -0.5f, 0.0f, 1.0f), instance.inputColors[1].toVec(),
+               Vec4(+0.5f, -1.0f, 0.0f, 1.0f), instance.inputColors[1].toVec(),        //4
+               Vec4(+1.0f, -1.0f, 0.0f, 1.0f), instance.inputColors[1].toVec(),        //5
+               Vec4(+1.0f, -0.5f, 0.0f, 1.0f), instance.inputColors[1].toVec(),        //6
 
                // Lower left corner:
-               Vec4(-1.0f, +0.5f, 0.0f, 1.0f), instance.inputColors[2].toVec(),
-               Vec4(-0.5f, +1.0f, 0.0f, 1.0f), instance.inputColors[2].toVec(),
-               Vec4(-1.0f, +1.0f, 0.0f, 1.0f), instance.inputColors[2].toVec(),
+               Vec4(-1.0f, +0.5f, 0.0f, 1.0f), instance.inputColors[2].toVec(),        //7
+               Vec4(-0.5f, +1.0f, 0.0f, 1.0f), instance.inputColors[2].toVec(),        //8
+               Vec4(-1.0f, +1.0f, 0.0f, 1.0f), instance.inputColors[2].toVec(),        //9
 
                // Lower right corner:
-               Vec4(+1.0f, +0.5f, 0.0f, 1.0f), instance.inputColors[3].toVec(),
-               Vec4(+1.0f, +1.0f, 0.0f, 1.0f), instance.inputColors[3].toVec(),
-               Vec4(+0.5f, +1.0f, 0.0f, 1.0f), instance.inputColors[3].toVec()
+               Vec4(+1.0f, +0.5f, 0.0f, 1.0f), instance.inputColors[3].toVec(),        //10
+               Vec4(+1.0f, +1.0f, 0.0f, 1.0f), instance.inputColors[3].toVec(),        //11
+               Vec4(+0.5f, +1.0f, 0.0f, 1.0f), instance.inputColors[3].toVec(),        //12
+
+               // The rest is used only renderFullSquare specified. Fills area already filled with clear color
+               // Left 1
+               Vec4(-1.0f, -0.5f, 0.0f, 1.0f), defaulClearColor,                                       //3
+               Vec4(-0.5f, -1.0f, 0.0f, 1.0f), defaulClearColor,                                       //2
+               Vec4(-1.0f, +0.5f, 0.0f, 1.0f), defaulClearColor,                                       //7
+
+               // Left 2
+               Vec4(-1.0f, +0.5f, 0.0f, 1.0f), defaulClearColor,                                       //7
+               Vec4(-0.5f, -1.0f, 0.0f, 1.0f), defaulClearColor,                                       //2
+               Vec4(-0.5f, +1.0f, 0.0f, 1.0f), defaulClearColor,                                       //8
+
+               // Left-Center
+               Vec4(-0.5f, +1.0f, 0.0f, 1.0f), defaulClearColor,                                       //8
+               Vec4(-0.5f, -1.0f, 0.0f, 1.0f), defaulClearColor,                                       //2
+               Vec4(+0.5f, -1.0f, 0.0f, 1.0f), defaulClearColor,                                       //4
+
+               // Right-Center
+               Vec4(+0.5f, -1.0f, 0.0f, 1.0f), defaulClearColor,                                       //4
+               Vec4(+0.5f, +1.0f, 0.0f, 1.0f), defaulClearColor,                                       //12
+               Vec4(-0.5f, +1.0f, 0.0f, 1.0f), defaulClearColor,                                       //8
+
+               // Right 2
+               Vec4(+0.5f, -1.0f, 0.0f, 1.0f), defaulClearColor,                                       //4
+               Vec4(+1.0f, -0.5f, 0.0f, 1.0f), defaulClearColor,                                       //6
+               Vec4(+0.5f, +1.0f, 0.0f, 1.0f), defaulClearColor,                                       //12
+
+               // Right 1
+               Vec4(+0.5f, +1.0f, 0.0f, 1.0f), defaulClearColor,                                       //12
+               Vec4(+1.0f, -0.5f, 0.0f, 1.0f), defaulClearColor,                                       //6
+               Vec4(+1.0f, +0.5f, 0.0f, 1.0f), defaulClearColor,                                       //10
        };
+
        const size_t                                                    singleVertexDataSize    = 2 * sizeof(Vec4);
-       const size_t                                                    vertexCount                             = sizeof(vertexData) / singleVertexDataSize;
+       const size_t                                                    vertexCount                             = instance.renderFullSquare ? sizeof(vertexData) / singleVertexDataSize : 4*3;
+       const size_t                                                    vertexDataSize                  = vertexCount * singleVertexDataSize;
 
        Move<VkBuffer>                                                  vertexInputBuffer;
        de::MovePtr<Allocation>                                 vertexInputMemory;
@@ -2489,7 +2538,7 @@ TestStatus runAndVerifyDefaultPipeline (Context& context, InstanceContext instan
                VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,   //      VkStructureType         sType;
                DE_NULL,                                                                //      const void*                     pNext;
                0u,                                                                             //      VkBufferCreateFlags     flags;
-               (VkDeviceSize)sizeof(vertexData),               //      VkDeviceSize            size;
+               (VkDeviceSize)vertexDataSize,                   //      VkDeviceSize            size;
                VK_BUFFER_USAGE_VERTEX_BUFFER_BIT,              //      VkBufferUsageFlags      usage;
                VK_SHARING_MODE_EXCLUSIVE,                              //      VkSharingMode           sharingMode;
                1u,                                                                             //      deUint32                        queueFamilyCount;
@@ -2744,13 +2793,13 @@ TestStatus runAndVerifyDefaultPipeline (Context& context, InstanceContext instan
                {
                        const Resource& resource        = instance.resources.inputs[inputNdx];
 
-                       const bool              hasImage        = (resource.first == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE)  ||
-                                                                                 (resource.first == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE)  ||
-                                                                                 (resource.first == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER);
+                       const bool              hasImage        = (resource.getDescriptorType() == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE)    ||
+                                                                                 (resource.getDescriptorType() == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE)    ||
+                                                                                 (resource.getDescriptorType() == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER);
 
-                       const bool              hasSampler      = (resource.first == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE)  ||
-                                                                                 (resource.first == VK_DESCRIPTOR_TYPE_SAMPLER)                ||
-                                                                                 (resource.first == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER);
+                       const bool              hasSampler      = (resource.getDescriptorType() == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE)    ||
+                                                                                 (resource.getDescriptorType() == VK_DESCRIPTOR_TYPE_SAMPLER)                  ||
+                                                                                 (resource.getDescriptorType() == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER);
 
                        // Resource is a buffer
                        if (!hasImage && !hasSampler)
@@ -2772,7 +2821,7 @@ TestStatus runAndVerifyDefaultPipeline (Context& context, InstanceContext instan
                                        };
 
                                        vector<deUint8>                                 resourceBytes;
-                                       resource.second->getBytes(resourceBytes);
+                                       resource.getBytes(resourceBytes);
 
                                        deMemcpy(resourceMemory->getHostPtr(), &resourceBytes.front(), resourceBytes.size());
                                        VK_CHECK(vk.flushMappedMemoryRanges(device, 1u, &range));
@@ -2801,7 +2850,7 @@ TestStatus runAndVerifyDefaultPipeline (Context& context, InstanceContext instan
                                        };
 
                                        vector<deUint8>                                 resourceBytes;
-                                       resource.second->getBytes(resourceBytes);
+                                       resource.getBytes(resourceBytes);
 
                                        deMemcpy(resourceMemory->getHostPtr(), &resourceBytes.front(), resourceBytes.size());
                                        VK_CHECK(vk.flushMappedMemoryRanges(device, 1u, &range));
@@ -2822,7 +2871,7 @@ TestStatus runAndVerifyDefaultPipeline (Context& context, InstanceContext instan
                        const VkDescriptorSetLayoutBinding      binding                         =
                        {
                                inputNdx,                                                                                       // binding
-                               resource.first,                                                                         // descriptorType
+                               resource.getDescriptorType(),                                           // descriptorType
                                1u,                                                                                                     // descriptorCount
                                VK_SHADER_STAGE_ALL_GRAPHICS,                                           // stageFlags
                                DE_NULL,                                                                                        // pImmutableSamplers
@@ -2832,7 +2881,7 @@ TestStatus runAndVerifyDefaultPipeline (Context& context, InstanceContext instan
                        // Note: the following code doesn't check and unify descriptors of the same type.
                        const VkDescriptorPoolSize              poolSize                                =
                        {
-                               resource.first,                                                                         // type
+                               resource.getDescriptorType(),                                           // type
                                1u,                                                                                                     // descriptorCount
                        };
                        poolSizes.push_back(poolSize);
@@ -2859,7 +2908,7 @@ TestStatus runAndVerifyDefaultPipeline (Context& context, InstanceContext instan
                                VK_WHOLE_SIZE,                                                                          //      VkDeviceSize    size;
                        };
 
-                       resource.second->getBytes(resourceBytes);
+                       resource.getBytes(resourceBytes);
                        deMemset((deUint8*)resourceMemory->getHostPtr(), 0xff, resourceBytes.size());
                        VK_CHECK(vk.flushMappedMemoryRanges(device, 1u, &range));
 
@@ -2870,7 +2919,7 @@ TestStatus runAndVerifyDefaultPipeline (Context& context, InstanceContext instan
                        const VkDescriptorSetLayoutBinding      binding                         =
                        {
                                numInResources  + outputNdx,                                            // binding
-                               resource.first,                                                                         // descriptorType
+                               resource.getDescriptorType(),                                           // descriptorType
                                1u,                                                                                                     // descriptorCount
                                VK_SHADER_STAGE_ALL_GRAPHICS,                                           // stageFlags
                                DE_NULL,                                                                                        // pImmutableSamplers
@@ -2880,7 +2929,7 @@ TestStatus runAndVerifyDefaultPipeline (Context& context, InstanceContext instan
                        // Note: the following code doesn't check and unify descriptors of the same type.
                        const VkDescriptorPoolSize              poolSize                                =
                        {
-                               resource.first,                                                                         // type
+                               resource.getDescriptorType(),                                           // type
                                1u,                                                                                                     // descriptorCount
                        };
                        poolSizes.push_back(poolSize);
@@ -2935,18 +2984,18 @@ TestStatus runAndVerifyDefaultPipeline (Context& context, InstanceContext instan
                {
                        const Resource& resource        = instance.resources.inputs[inputNdx];
 
-                       const bool              hasImage        = (resource.first == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE)  ||
-                                                                                 (resource.first == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE)  ||
-                                                                                 (resource.first == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER);
+                       const bool              hasImage        = (resource.getDescriptorType() == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE)    ||
+                                                                                 (resource.getDescriptorType() == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE)    ||
+                                                                                 (resource.getDescriptorType() == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER);
 
-                       const bool              hasSampler      = (resource.first == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE)  ||
-                                                                                 (resource.first == VK_DESCRIPTOR_TYPE_SAMPLER)                ||
-                                                                                 (resource.first == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER);
+                       const bool              hasSampler      = (resource.getDescriptorType() == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE)    ||
+                                                                                 (resource.getDescriptorType() == VK_DESCRIPTOR_TYPE_SAMPLER)                  ||
+                                                                                 (resource.getDescriptorType() == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER);
 
                        // Create image view and sampler
                        if (hasImage || hasSampler)
                        {
-                               if (resource.first != VK_DESCRIPTOR_TYPE_SAMPLER)
+                               if (resource.getDescriptorType() != VK_DESCRIPTOR_TYPE_SAMPLER)
                                {
                                        const VkImageViewCreateInfo     imgViewParams   =
                                        {
@@ -3006,7 +3055,7 @@ TestStatus runAndVerifyDefaultPipeline (Context& context, InstanceContext instan
                        }
 
                        // Create descriptor buffer and image infos
-                       switch (resource.first)
+                       switch (resource.getDescriptorType())
                        {
                                case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER:
                                case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER:
@@ -3066,7 +3115,7 @@ TestStatus runAndVerifyDefaultPipeline (Context& context, InstanceContext instan
                                inputNdx,                                                                                                               // binding
                                0,                                                                                                                              // dstArrayElement
                                1u,                                                                                                                             // descriptorCount
-                               instance.resources.inputs[inputNdx].first,                                              // descriptorType
+                               instance.resources.inputs[inputNdx].getDescriptorType(),                // descriptorType
                                ( (hasImage | hasSampler)       ? &dImageInfos.back()   : DE_NULL),     // pImageInfo
                                (!(hasImage | hasSampler)       ? &dBufferInfos.back()  : DE_NULL),     // pBufferInfo
                                DE_NULL,                                                                                                                // pTexelBufferView
@@ -3085,16 +3134,16 @@ TestStatus runAndVerifyDefaultPipeline (Context& context, InstanceContext instan
                        dBufferInfos.push_back(bufInfo);
 
                        const VkWriteDescriptorSet                      writeSpec                       = {
-                               VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,                         // sType
-                               DE_NULL,                                                                                        // pNext
-                               rawSet,                                                                                         // dstSet
-                               numInResources + outputNdx,                                                     // binding
-                               0,                                                                                                      // dstArrayElement
-                               1u,                                                                                                     // descriptorCount
-                               instance.resources.outputs[outputNdx].first,            // descriptorType
-                               DE_NULL,                                                                                        // pImageInfo
-                               &dBufferInfos.back(),                                                           // pBufferInfo
-                               DE_NULL,                                                                                        // pTexelBufferView
+                               VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,                                         // sType
+                               DE_NULL,                                                                                                        // pNext
+                               rawSet,                                                                                                         // dstSet
+                               numInResources + outputNdx,                                                                     // binding
+                               0,                                                                                                                      // dstArrayElement
+                               1u,                                                                                                                     // descriptorCount
+                               instance.resources.outputs[outputNdx].getDescriptorType(),      // descriptorType
+                               DE_NULL,                                                                                                        // pImageInfo
+                               &dBufferInfos.back(),                                                                           // pBufferInfo
+                               DE_NULL,                                                                                                        // pTexelBufferView
                        };
                        writeSpecs.push_back(writeSpec);
                }
@@ -3183,26 +3232,31 @@ TestStatus runAndVerifyDefaultPipeline (Context& context, InstanceContext instan
 
                if (stageIt != instance.specConstants.end())
                {
-                       const size_t                                            numSpecConstants        = stageIt->second.size();
+                       const size_t                                            numSpecConstants        = stageIt->second.getValuesCount();
                        vector<VkSpecializationMapEntry>        entries;
                        VkSpecializationInfo                            specInfo;
+                       size_t                                                          offset                          = 0;
 
                        entries.resize(numSpecConstants);
 
-                       // Only support 32-bit integers as spec constants now. And their constant IDs are numbered sequentially starting from 0.
+                       // Constant IDs are numbered sequentially starting from 0.
                        for (size_t ndx = 0; ndx < numSpecConstants; ++ndx)
                        {
+                               const size_t valueSize  = stageIt->second.getValueSize(ndx);
+
                                entries[ndx].constantID = (deUint32)ndx;
-                               entries[ndx].offset             = deUint32(ndx * sizeof(deInt32));
-                               entries[ndx].size               = sizeof(deInt32);
+                               entries[ndx].offset             = static_cast<deUint32>(offset);
+                               entries[ndx].size               = valueSize;
+
+                               offset                                  += valueSize;
                        }
 
                        specConstantEntries.push_back(entries);
 
                        specInfo.mapEntryCount  = (deUint32)numSpecConstants;
                        specInfo.pMapEntries    = specConstantEntries.back().data();
-                       specInfo.dataSize               = numSpecConstants * sizeof(deInt32);
-                       specInfo.pData                  = stageIt->second.data();
+                       specInfo.dataSize               = offset;
+                       specInfo.pData                  = stageIt->second.getValuesBuffer();
                        specializationInfos.push_back(specInfo);
 
                        stageInfo->pSpecializationInfo = &specializationInfos.back();
@@ -3524,7 +3578,7 @@ TestStatus runAndVerifyDefaultPipeline (Context& context, InstanceContext instan
 
        {
                vector<VkClearValue>                    clearValue;
-               clearValue.push_back(makeClearValueColorF32(0.125f, 0.25f, 0.75f, 1.0f));
+               clearValue.push_back(makeClearValueColorF32(defaulClearColor[0], defaulClearColor[1], defaulClearColor[2], defaulClearColor[3]));
                if (needInterface)
                {
                        clearValue.push_back(makeClearValueColorU32(0, 0, 0, 0));
@@ -3658,11 +3712,11 @@ TestStatus runAndVerifyDefaultPipeline (Context& context, InstanceContext instan
                        DE_NULL,                                                                //      const void*             pNext;
                        vertexBufferMemory->getMemory(),                //      VkDeviceMemory  mem;
                        0,                                                                              //      VkDeviceSize    offset;
-                       (VkDeviceSize)sizeof(vertexData),               //      VkDeviceSize    size;
+                       (VkDeviceSize)vertexDataSize,                   //      VkDeviceSize    size;
                };
                void*                                           vertexBufPtr    = vertexBufferMemory->getHostPtr();
 
-               deMemcpy(vertexBufPtr, &vertexData[0], sizeof(vertexData));
+               deMemcpy(vertexBufPtr, &vertexData[0], vertexDataSize);
                VK_CHECK(vk.flushMappedMemoryRanges(device, 1u, &range));
        }
 
@@ -3880,7 +3934,7 @@ TestStatus runAndVerifyDefaultPipeline (Context& context, InstanceContext instan
        // Check the contents in output resources match with expected.
        for (deUint32 outputNdx = 0; outputNdx < numOutResources; ++outputNdx)
        {
-               const BufferSp& expected = instance.resources.outputs[outputNdx].second;
+               const BufferSp& expected = instance.resources.outputs[outputNdx].getBuffer();
 
                if (instance.resources.verifyIO != DE_NULL)
                {
@@ -3980,7 +4034,7 @@ void createTestForStage (vk::VkShaderStageFlagBits        stage,
                                                 const RGBA                                     (&inputColors)[4],
                                                 const RGBA                                     (&outputColors)[4],
                                                 const map<string, string>&     testCodeFragments,
-                                                const vector<deInt32>&         specConstants,
+                                                const SpecConstants&           specConstants,
                                                 const PushConstants&           pushConstants,
                                                 const GraphicsResources&       resources,
                                                 const GraphicsInterfaces&      interfaces,
@@ -3989,7 +4043,8 @@ void createTestForStage (vk::VkShaderStageFlagBits        stage,
                                                 VulkanFeatures                         vulkanFeatures,
                                                 tcu::TestCaseGroup*            tests,
                                                 const qpTestResult                     failResult,
-                                                const string&                          failMessageTemplate)
+                                                const string&                          failMessageTemplate,
+                                                const bool                                     renderFullSquare)
 {
        const StageData&                                stageData                       = getStageData(stage);
        DE_ASSERT(stageData.getPipelineFn || stageData.initProgramsFn);
@@ -4010,6 +4065,7 @@ void createTestForStage (vk::VkShaderStageFlagBits        stage,
        if (!failMessageTemplate.empty())
                ctx.failMessageTemplate = failMessageTemplate;
 
+       ctx.renderFullSquare = renderFullSquare;
        addFunctionCaseWithPrograms<InstanceContext>(tests, name, "", stageData.initProgramsFn, runAndVerifyDefaultPipeline, ctx);
 }
 
@@ -4017,7 +4073,7 @@ void createTestsForAllStages (const std::string&                  name,
                                                          const RGBA                                    (&inputColors)[4],
                                                          const RGBA                                    (&outputColors)[4],
                                                          const map<string, string>&    testCodeFragments,
-                                                         const vector<deInt32>&                specConstants,
+                                                         const SpecConstants&                  specConstants,
                                                          const PushConstants&                  pushConstants,
                                                          const GraphicsResources&              resources,
                                                          const GraphicsInterfaces&             interfaces,
@@ -4055,7 +4111,7 @@ void addTessCtrlTest (tcu::TestCaseGroup* group, const char* name, const map<str
        getDefaultColors(defaultColors);
 
        createTestForStage(VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT, name,
-                                          defaultColors, defaultColors, fragments, vector<deInt32>(), PushConstants(), GraphicsResources(),
+                                          defaultColors, defaultColors, fragments, SpecConstants(), PushConstants(), GraphicsResources(),
                                           GraphicsInterfaces(), vector<string>(), vector<string>(), VulkanFeatures(), group);
 }
 
index ad83216..b53d2f9 100644 (file)
@@ -56,8 +56,7 @@ typedef vk::Unique<vk::VkShaderModule>                                                                ModuleHandleUp;
 typedef de::SharedPtr<ModuleHandleUp>                                                          ModuleHandleSp;
 typedef std::pair<std::string, vk::VkShaderStageFlagBits>                      EntryToStage;
 typedef std::map<std::string, std::vector<EntryToStage> >                      ModuleMap;
-typedef std::map<vk::VkShaderStageFlagBits, std::vector<deInt32> >     StageToSpecConstantMap;
-typedef std::pair<vk::VkDescriptorType, BufferSp>                                      Resource;
+typedef std::map<vk::VkShaderStageFlagBits, SpecConstants >                    StageToSpecConstantMap;
 
 enum NumberType
 {
@@ -76,11 +75,6 @@ typedef enum RoundingModeFlags_e
        ROUNDINGMODE_RTZ = 0x2, // Round to zero
 } RoundingModeFlags;
 
-typedef bool (*GraphicsVerifyIOFunc) (const std::vector<Resource>&             inputs,
-                                                                         const std::vector<AllocationSp>&      outputAllocations,
-                                                                         const std::vector<Resource>&          expectedOutputs,
-                                                                         tcu::TestLog&                                         log);
-
 typedef bool (*GraphicsVerifyBinaryFunc) (const ProgramBinary& binary);
 
 // Resources used by graphics-pipeline-based tests.
@@ -100,7 +94,7 @@ struct GraphicsResources
        // be called. If true is returned, then the test case is assumed to
        // have passed, if false is returned, then the test case is assumed
        // to have failed.
-       GraphicsVerifyIOFunc            verifyIO;
+       VerifyIOFunc                            verifyIO;
        GraphicsVerifyBinaryFunc        verifyBinary;
        SpirvVersion                            spirvVersion;
 
@@ -287,6 +281,7 @@ struct InstanceContext
        GraphicsInterfaces                                              interfaces;
        qpTestResult                                                    failResult;
        std::string                                                             failMessageTemplate;    //!< ${reason} in the template will be replaced with a detailed failure message
+       bool                                                                    renderFullSquare;               // Forces to render whole render area, though with background color
 
        InstanceContext (const tcu::RGBA                                                        (&inputs)[4],
                                         const tcu::RGBA                                                        (&outputs)[4],
@@ -423,7 +418,7 @@ void createTestForStage (vk::VkShaderStageFlagBits                                  stage,
                                                 const tcu::RGBA                                                        (&inputColors)[4],
                                                 const tcu::RGBA                                                        (&outputColors)[4],
                                                 const std::map<std::string, std::string>&      testCodeFragments,
-                                                const std::vector<deInt32>&                            specConstants,
+                                                const SpecConstants&                                           specConstants,
                                                 const PushConstants&                                           pushConstants,
                                                 const GraphicsResources&                                       resources,
                                                 const GraphicsInterfaces&                                      interfaces,
@@ -432,13 +427,14 @@ void createTestForStage (vk::VkShaderStageFlagBits                                        stage,
                                                 VulkanFeatures                                                         vulkanFeatures,
                                                 tcu::TestCaseGroup*                                            tests,
                                                 const qpTestResult                                                     failResult                      = QP_TEST_RESULT_FAIL,
-                                                const std::string&                                                     failMessageTemplate = std::string());
+                                                const std::string&                                                     failMessageTemplate = std::string(),
+                                                const bool                                                                     renderFullSquare        = false);
 
 void createTestsForAllStages (const std::string&                                               name,
                                                          const tcu::RGBA                                                       (&inputColors)[4],
                                                          const tcu::RGBA                                                       (&outputColors)[4],
                                                          const std::map<std::string, std::string>&     testCodeFragments,
-                                                         const std::vector<deInt32>&                           specConstants,
+                                                         const SpecConstants&                                          specConstants,
                                                          const PushConstants&                                          pushConstants,
                                                          const GraphicsResources&                                      resources,
                                                          const GraphicsInterfaces&                                     interfaces,
@@ -457,7 +453,7 @@ inline void createTestsForAllStages (const std::string&                                                     name,
                                                                         const qpTestResult                                                     failResult                      = QP_TEST_RESULT_FAIL,
                                                                         const std::string&                                                     failMessageTemplate     = std::string())
 {
-       std::vector<deInt32>            noSpecConstants;
+       SpecConstants                           noSpecConstants;
        PushConstants                           noPushConstants;
        GraphicsResources                       noResources;
        GraphicsInterfaces                      noInterfaces;
@@ -474,7 +470,7 @@ inline void createTestsForAllStages (const std::string&                                                     name,
                                                                         const tcu::RGBA                                                        (&inputColors)[4],
                                                                         const tcu::RGBA                                                        (&outputColors)[4],
                                                                         const std::map<std::string, std::string>&      testCodeFragments,
-                                                                        const std::vector<deInt32>&                            specConstants,
+                                                                        const SpecConstants&                                           specConstants,
                                                                         tcu::TestCaseGroup*                                            tests,
                                                                         const qpTestResult                                                     failResult                      = QP_TEST_RESULT_FAIL,
                                                                         const std::string&                                                     failMessageTemplate     = std::string())
@@ -502,7 +498,7 @@ inline void createTestsForAllStages (const std::string&                                                     name,
                                                                         const qpTestResult                                                     failResult                      = QP_TEST_RESULT_FAIL,
                                                                         const std::string&                                                     failMessageTemplate     = std::string())
 {
-       std::vector<deInt32>            noSpecConstants;
+       SpecConstants                           noSpecConstants;
        PushConstants                           noPushConstants;
        GraphicsInterfaces                      noInterfaces;
        std::vector<std::string>        noFeatures;
@@ -525,7 +521,7 @@ inline void createTestsForAllStages (const std::string&                                                     name,
                                                                         const qpTestResult                                                     failResult                      = QP_TEST_RESULT_FAIL,
                                                                         const std::string&                                                     failMessageTemplate     = std::string())
 {
-       std::vector<deInt32>            noSpecConstants;
+       SpecConstants                           noSpecConstants;
        PushConstants                           noPushConstants;
        GraphicsInterfaces                      noInterfaces;
 
@@ -547,7 +543,7 @@ inline void createTestsForAllStages (const std::string& name,
                                                                         const std::string&                                                     failMessageTemplate     = std::string())
 {
        GraphicsResources                       noResources;
-       std::vector<deInt32>            noSpecConstants;
+       SpecConstants                           noSpecConstants;
        std::vector<std::string>        noFeatures;
        PushConstants                           noPushConstants;
 
@@ -569,7 +565,7 @@ inline void createTestsForAllStages (const std::string& name,
                                                                         const qpTestResult                                                     failResult                      = QP_TEST_RESULT_FAIL,
                                                                         const std::string&                                                     failMessageTemplate     = std::string())
 {
-       std::vector<deInt32>                    noSpecConstants;
+       SpecConstants                                   noSpecConstants;
        GraphicsInterfaces                              noInterfaces;
        std::vector<std::string>                noFeatures;
 
index d252700..754dc0f 100644 (file)
@@ -725,16 +725,15 @@ void addComputeImageSamplerTest (tcu::TestCaseGroup* group)
                                ComputeShaderSpec       spec;
 
                                spec.numWorkGroups      = IVec3(numDataPoints, 1, 1);
-                               spec.inputTypes[0]      = getVkDescriptorType((DescriptorType)descNdx);
 
-                               spec.inputs.push_back(BufferSp(new Vec4Buffer(inputData)));
+                               spec.inputs.push_back(Resource(BufferSp(new Vec4Buffer(inputData)), getVkDescriptorType((DescriptorType)descNdx)));
 
                                // Separate sampler for sampled images
                                if ((DescriptorType)descNdx == DESCRIPTOR_TYPE_SAMPLED_IMAGE)
                                {
                                        vector<tcu::Vec4> dummyData;
-                                       spec.inputTypes[1] = VK_DESCRIPTOR_TYPE_SAMPLER;
-                                       spec.inputs.push_back(BufferSp(new Vec4Buffer(dummyData)));
+                                       spec.inputs.push_back(Resource(BufferSp(new Vec4Buffer(dummyData))));
+                                       spec.inputs[1].setDescriptorType(VK_DESCRIPTOR_TYPE_SAMPLER);
                                }
 
                                // Second combined image sampler with different image data
@@ -743,8 +742,8 @@ void addComputeImageSamplerTest (tcu::TestCaseGroup* group)
                                        for (size_t i = 0; i < inputData.size(); i++)
                                                inputData[i] = tcu::Vec4(1.0f) - inputData[i];
 
-                                       spec.inputTypes[1] = getVkDescriptorType((DescriptorType)descNdx);
                                        spec.inputs.push_back(BufferSp(new Vec4Buffer(inputData)));
+                                       spec.inputs[1].setDescriptorType(getVkDescriptorType((DescriptorType)descNdx));
                                }
 
                                // Shader is expected to pass the input image data to the output buffer
@@ -961,7 +960,7 @@ void addGraphicsImageSamplerTest (tcu::TestCaseGroup* group)
        const deUint32                          numDataPoints           = 64;
        RGBA                                            defaultColors[4];
 
-       std::vector<deInt32>            noSpecConstants;
+       SpecConstants                           noSpecConstants;
        PushConstants                           noPushConstants;
        GraphicsInterfaces                      noInterfaces;
        std::vector<std::string>        noFeatures;
@@ -989,13 +988,13 @@ void addGraphicsImageSamplerTest (tcu::TestCaseGroup* group)
 
                                GraphicsResources                               resources;
 
-                               resources.inputs.push_back(std::make_pair(getVkDescriptorType((DescriptorType)descNdx), BufferSp(new Vec4Buffer(inputData))));
+                               resources.inputs.push_back(Resource(BufferSp(new Vec4Buffer(inputData)), getVkDescriptorType((DescriptorType)descNdx)));
 
                                // Separate sampler for sampled images
                                if ((DescriptorType)descNdx == DESCRIPTOR_TYPE_SAMPLED_IMAGE)
                                {
                                        vector<tcu::Vec4> dummyData;
-                                       resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_SAMPLER, BufferSp(new Vec4Buffer(dummyData))));
+                                       resources.inputs.push_back(Resource(BufferSp(new Vec4Buffer(dummyData)), VK_DESCRIPTOR_TYPE_SAMPLER));
                                }
 
                                // Second combined image sampler with different image data
@@ -1004,11 +1003,11 @@ void addGraphicsImageSamplerTest (tcu::TestCaseGroup* group)
                                        for (size_t i = 0; i < inputData.size(); i++)
                                                inputData[i] = tcu::Vec4(1.0f) - inputData[i];
 
-                                       resources.inputs.push_back(std::make_pair(getVkDescriptorType((DescriptorType)descNdx), BufferSp(new Vec4Buffer(inputData))));
+                                       resources.inputs.push_back(Resource(BufferSp(new Vec4Buffer(inputData)), getVkDescriptorType((DescriptorType)descNdx)));
                                }
 
                                // Shader is expected to pass the input image data to output buffer
-                               resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,                   BufferSp(new Vec4Buffer(inputData))));
+                               resources.outputs.push_back(Resource(BufferSp(new Vec4Buffer(inputData)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
 
                                getDefaultColors(defaultColors);
 
@@ -1052,7 +1051,7 @@ bool verifyDepthCompareResult (const std::vector<Resource>&               originalFloats,
                return false;
 
        vector<deUint8> expectedBytes;
-       expectedOutputs[0].second->getBytes(expectedBytes);
+       expectedOutputs[0].getBytes(expectedBytes);
 
        const float*    returnedAsFloat = static_cast<const float*>(outputAllocs[0]->getHostPtr());
        const float*    expectedAsFloat = reinterpret_cast<const float*>(&expectedBytes.front());
@@ -1079,7 +1078,7 @@ void addGraphicsDepthPropertyTest (tcu::TestCaseGroup* group)
        RGBA                                            defaultColors[4];
        vector<Vec4>                            inputDataVec4;
 
-       std::vector<deInt32>            noSpecConstants;
+       SpecConstants                           noSpecConstants;
        PushConstants                           noPushConstants;
        GraphicsInterfaces                      noInterfaces;
        std::vector<std::string>        noFeatures;
@@ -1123,13 +1122,13 @@ void addGraphicsDepthPropertyTest (tcu::TestCaseGroup* group)
                                if (hasDpethComponent)
                                        inputData.resize(numDataPoints / 4u);
 
-                               resources.inputs.push_back(std::make_pair(getVkDescriptorType((DescriptorType)descNdx), BufferSp(new Vec4Buffer(inputData))));
+                               resources.inputs.push_back(Resource(BufferSp(new Vec4Buffer(inputData)), getVkDescriptorType((DescriptorType)descNdx)));
 
                                // Separate sampler for sampled images
                                if ((DescriptorType)descNdx == DESCRIPTOR_TYPE_SAMPLED_IMAGE)
                                {
                                        vector<Vec4> dummyData;
-                                       resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_SAMPLER, BufferSp(new Vec4Buffer(dummyData))));
+                                       resources.inputs.push_back(Resource(BufferSp(new Vec4Buffer(dummyData)), VK_DESCRIPTOR_TYPE_SAMPLER));
                                }
 
                                // Second combined image sampler with different image data
@@ -1138,11 +1137,11 @@ void addGraphicsDepthPropertyTest (tcu::TestCaseGroup* group)
                                        for (size_t i = 0; i < inputData.size(); i++)
                                                inputData[i] = Vec4(1.0f) - inputData[i];
 
-                                       resources.inputs.push_back(std::make_pair(getVkDescriptorType((DescriptorType)descNdx), BufferSp(new Vec4Buffer(inputData))));
+                                       resources.inputs.push_back(Resource(BufferSp(new Vec4Buffer(inputData)), getVkDescriptorType((DescriptorType)descNdx)));
                                }
 
                                // Read image without depth reference: shader is expected to pass the input image data to output buffer
-                               resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Vec4Buffer(inputData))));
+                               resources.outputs.push_back(Resource(BufferSp(new Vec4Buffer(inputData)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
 
                                // Read image with depth reference: shader is expected to pass the depth comparison result to output buffer
                                if (hasDpethComponent)
index 27ac74e..4ef50d6 100644 (file)
@@ -263,8 +263,8 @@ void addComputeIndexingStructTests (tcu::TestCaseGroup* group)
                                spec.assembly                                   = shaderSource.specialize(specs);
                                spec.numWorkGroups                              = IVec3(numItems, 1, 1);
                                spec.requestedVulkanFeatures    = vulkanFeatures;
-                               spec.inputTypes[0]                              = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
-                               spec.inputTypes[1]                              = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
+                               spec.inputs[0].setDescriptorType(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER);
+                               spec.inputs[1].setDescriptorType(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER);
 
                                spec.outputs.push_back(BufferSp(new Float32Buffer(outputData)));
 
@@ -308,7 +308,7 @@ void addGraphicsIndexingStructTests (tcu::TestCaseGroup* group)
                                VulkanFeatures                          vulkanFeatures;
                                vector<string>                          extensions;
                                vector<string>                          features;
-                               vector<deInt32>                         noSpecConstants;
+                               SpecConstants                           noSpecConstants;
                                PushConstants                           noPushConstants;
                                GraphicsInterfaces                      noInterfaces;
                                map<string, string>                     specs;
@@ -422,8 +422,8 @@ void addGraphicsIndexingStructTests (tcu::TestCaseGroup* group)
 
                                        "                     OpFunctionEnd\n");
 
-                               resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(inputData))));
-                               resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Buffer<UVec4>(indexSelectorData))));
+                               resources.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputData)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                               resources.inputs.push_back(Resource(BufferSp(new Buffer<UVec4>(indexSelectorData)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
 
                                if (idxSize == 16)
                                {
@@ -481,7 +481,7 @@ void addGraphicsIndexingStructTests (tcu::TestCaseGroup* group)
                                        outputData.push_back(inputData[element * sizeof(InputData) / 4 + vec.x() * (32 * 4 * 4) + vec.y() * 4 * 4 + vec.z() * 4 + vec.w()]);
                                }
 
-                               resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(outputData))));
+                               resources.outputs.push_back(Resource(BufferSp(new Float32Buffer(outputData)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
 
                                fragments["pre_main"]   = preMain.specialize(specs);
                                fragments["decoration"] = decoration.specialize(specs);
index e01dda2..77b677b 100644 (file)
@@ -369,7 +369,7 @@ tcu::TestCaseGroup* createOpNopGroup (tcu::TestContext& testCtx)
        return group.release();
 }
 
-bool compareFUnord (const std::vector<BufferSp>& inputs, const vector<AllocationSp>& outputAllocs, const std::vector<BufferSp>& expectedOutputs, TestLog& log)
+bool compareFUnord (const std::vector<Resource>& inputs, const vector<AllocationSp>& outputAllocs, const std::vector<Resource>& expectedOutputs, TestLog& log)
 {
        if (outputAllocs.size() != 1)
                return false;
@@ -378,9 +378,9 @@ bool compareFUnord (const std::vector<BufferSp>& inputs, const vector<Allocation
        vector<deUint8> input2Bytes;
        vector<deUint8> expectedBytes;
 
-       inputs[0]->getBytes(input1Bytes);
-       inputs[1]->getBytes(input2Bytes);
-       expectedOutputs[0]->getBytes(expectedBytes);
+       inputs[0].getBytes(input1Bytes);
+       inputs[1].getBytes(input2Bytes);
+       expectedOutputs[0].getBytes(expectedBytes);
 
        const deInt32* const    expectedOutputAsInt             = reinterpret_cast<const deInt32*>(&expectedBytes.front());
        const deInt32* const    outputAsInt                             = static_cast<const deInt32*>(outputAllocs[0]->getHostPtr());
@@ -958,13 +958,13 @@ tcu::TestCaseGroup* createOpNoLineGroup (tcu::TestContext& testCtx)
 
 // Compare instruction for the contraction compute case.
 // Returns true if the output is what is expected from the test case.
-bool compareNoContractCase(const std::vector<BufferSp>&, const vector<AllocationSp>& outputAllocs, const std::vector<BufferSp>& expectedOutputs, TestLog&)
+bool compareNoContractCase(const std::vector<Resource>&, const vector<AllocationSp>& outputAllocs, const std::vector<Resource>& expectedOutputs, TestLog&)
 {
        if (outputAllocs.size() != 1)
                return false;
 
        // Only size is needed because we are not comparing the exact values.
-       size_t byteSize = expectedOutputs[0]->getByteSize();
+       size_t byteSize = expectedOutputs[0].getByteSize();
 
        const float*    outputAsFloat   = static_cast<const float*>(outputAllocs[0]->getHostPtr());
 
@@ -1068,13 +1068,13 @@ tcu::TestCaseGroup* createNoContractionGroup (tcu::TestContext& testCtx)
        return group.release();
 }
 
-bool compareFRem(const std::vector<BufferSp>&, const vector<AllocationSp>& outputAllocs, const std::vector<BufferSp>& expectedOutputs, TestLog&)
+bool compareFRem(const std::vector<Resource>&, const vector<AllocationSp>& outputAllocs, const std::vector<Resource>& expectedOutputs, TestLog&)
 {
        if (outputAllocs.size() != 1)
                return false;
 
        vector<deUint8> expectedBytes;
-       expectedOutputs[0]->getBytes(expectedBytes);
+       expectedOutputs[0].getBytes(expectedBytes);
 
        const float*    expectedOutputAsFloat   = reinterpret_cast<const float*>(&expectedBytes.front());
        const float*    outputAsFloat                   = static_cast<const float*>(outputAllocs[0]->getHostPtr());
@@ -1169,12 +1169,12 @@ tcu::TestCaseGroup* createOpFRemGroup (tcu::TestContext& testCtx)
        return group.release();
 }
 
-bool compareNMin (const std::vector<BufferSp>&, const vector<AllocationSp>& outputAllocs, const std::vector<BufferSp>& expectedOutputs, TestLog&)
+bool compareNMin (const std::vector<Resource>&, const vector<AllocationSp>& outputAllocs, const std::vector<Resource>& expectedOutputs, TestLog&)
 {
        if (outputAllocs.size() != 1)
                return false;
 
-       const BufferSp&                 expectedOutput                  (expectedOutputs[0]);
+       const BufferSp&                 expectedOutput                  (expectedOutputs[0].getBuffer());
        std::vector<deUint8>    data;
        expectedOutput->getBytes(data);
 
@@ -1293,12 +1293,12 @@ tcu::TestCaseGroup* createOpNMinGroup (tcu::TestContext& testCtx)
        return group.release();
 }
 
-bool compareNMax (const std::vector<BufferSp>&, const vector<AllocationSp>& outputAllocs, const std::vector<BufferSp>& expectedOutputs, TestLog&)
+bool compareNMax (const std::vector<Resource>&, const vector<AllocationSp>& outputAllocs, const std::vector<Resource>& expectedOutputs, TestLog&)
 {
        if (outputAllocs.size() != 1)
                return false;
 
-       const BufferSp&                 expectedOutput                  = expectedOutputs[0];
+       const BufferSp&                 expectedOutput                  = expectedOutputs[0].getBuffer();
        std::vector<deUint8>    data;
        expectedOutput->getBytes(data);
 
@@ -1416,12 +1416,12 @@ tcu::TestCaseGroup* createOpNMaxGroup (tcu::TestContext& testCtx)
        return group.release();
 }
 
-bool compareNClamp (const std::vector<BufferSp>&, const vector<AllocationSp>& outputAllocs, const std::vector<BufferSp>& expectedOutputs, TestLog&)
+bool compareNClamp (const std::vector<Resource>&, const vector<AllocationSp>& outputAllocs, const std::vector<Resource>& expectedOutputs, TestLog&)
 {
        if (outputAllocs.size() != 1)
                return false;
 
-       const BufferSp&                 expectedOutput                  = expectedOutputs[0];
+       const BufferSp&                 expectedOutput                  = expectedOutputs[0].getBuffer();
        std::vector<deUint8>    data;
        expectedOutput->getBytes(data);
 
@@ -2781,8 +2781,8 @@ tcu::TestCaseGroup* createSpecConstantGroup (tcu::TestContext& testCtx)
                spec.inputs.push_back(BufferSp(new Int32Buffer(inputInts)));
                spec.outputs.push_back(BufferSp(new Int32Buffer(cases[caseNdx].expectedOutput)));
                spec.numWorkGroups = IVec3(numElements, 1, 1);
-               spec.specConstants.push_back(cases[caseNdx].scActualValue0);
-               spec.specConstants.push_back(cases[caseNdx].scActualValue1);
+               spec.specConstants.append(cases[caseNdx].scActualValue0);
+               spec.specConstants.append(cases[caseNdx].scActualValue1);
 
                group->addChild(new SpvAsmComputeShaderCase(testCtx, cases[caseNdx].caseName, cases[caseNdx].caseName, spec, features));
        }
@@ -2845,9 +2845,9 @@ tcu::TestCaseGroup* createSpecConstantGroup (tcu::TestContext& testCtx)
        spec.inputs.push_back(BufferSp(new Int32Buffer(inputInts)));
        spec.outputs.push_back(BufferSp(new Int32Buffer(outputInts3)));
        spec.numWorkGroups = IVec3(numElements, 1, 1);
-       spec.specConstants.push_back(123);
-       spec.specConstants.push_back(56);
-       spec.specConstants.push_back(-77);
+       spec.specConstants.append<deInt32>(123);
+       spec.specConstants.append<deInt32>(56);
+       spec.specConstants.append<deInt32>(-77);
 
        group->addChild(new SpvAsmComputeShaderCase(testCtx, "vector_related", "VectorShuffle, CompositeExtract, & CompositeInsert", spec));
 
@@ -4381,13 +4381,13 @@ float constructNormalizedFloat (deInt32 exponent, deUint32 significand)
 
 // Compare instruction for the OpQuantizeF16 compute exact case.
 // Returns true if the output is what is expected from the test case.
-bool compareOpQuantizeF16ComputeExactCase (const std::vector<BufferSp>&, const vector<AllocationSp>& outputAllocs, const std::vector<BufferSp>& expectedOutputs, TestLog&)
+bool compareOpQuantizeF16ComputeExactCase (const std::vector<Resource>&, const vector<AllocationSp>& outputAllocs, const std::vector<Resource>& expectedOutputs, TestLog&)
 {
        if (outputAllocs.size() != 1)
                return false;
 
        // Only size is needed because we cannot compare Nans.
-       size_t byteSize = expectedOutputs[0]->getByteSize();
+       size_t byteSize = expectedOutputs[0].getByteSize();
 
        const float*    outputAsFloat   = static_cast<const float*>(outputAllocs[0]->getHostPtr());
 
@@ -4422,13 +4422,13 @@ bool compareOpQuantizeF16ComputeExactCase (const std::vector<BufferSp>&, const v
 }
 
 // Checks that every output from a test-case is a float NaN.
-bool compareNan (const std::vector<BufferSp>&, const vector<AllocationSp>& outputAllocs, const std::vector<BufferSp>& expectedOutputs, TestLog&)
+bool compareNan (const std::vector<Resource>&, const vector<AllocationSp>& outputAllocs, const std::vector<Resource>& expectedOutputs, TestLog&)
 {
        if (outputAllocs.size() != 1)
                return false;
 
        // Only size is needed because we cannot compare Nans.
-       size_t byteSize = expectedOutputs[0]->getByteSize();
+       size_t byteSize = expectedOutputs[0].getByteSize();
 
        const float* const      output_as_float = static_cast<const float*>(outputAllocs[0]->getHostPtr());
 
@@ -4721,10 +4721,10 @@ tcu::TestCaseGroup* createSpecConstantOpQuantizeToF16Group (tcu::TestContext& te
                spec.assembly           = shader;
                spec.numWorkGroups      = IVec3(numCases, 1, 1);
 
-               spec.specConstants.push_back(bitwiseCast<deUint32>(std::numeric_limits<float>::infinity()));
-               spec.specConstants.push_back(bitwiseCast<deUint32>(-std::numeric_limits<float>::infinity()));
-               spec.specConstants.push_back(bitwiseCast<deUint32>(std::ldexp(1.0f, 16)));
-               spec.specConstants.push_back(bitwiseCast<deUint32>(std::ldexp(-1.0f, 32)));
+               spec.specConstants.append<deInt32>(bitwiseCast<deUint32>(std::numeric_limits<float>::infinity()));
+               spec.specConstants.append<deInt32>(bitwiseCast<deUint32>(-std::numeric_limits<float>::infinity()));
+               spec.specConstants.append<deInt32>(bitwiseCast<deUint32>(std::ldexp(1.0f, 16)));
+               spec.specConstants.append<deInt32>(bitwiseCast<deUint32>(std::ldexp(-1.0f, 32)));
 
                outputs.push_back(std::numeric_limits<float>::infinity());
                outputs.push_back(-std::numeric_limits<float>::infinity());
@@ -4752,7 +4752,7 @@ tcu::TestCaseGroup* createSpecConstantOpQuantizeToF16Group (tcu::TestContext& te
                outputs.push_back(-std::numeric_limits<float>::quiet_NaN());
 
                for (deUint8 idx = 0; idx < numCases; ++idx)
-                       spec.specConstants.push_back(bitwiseCast<deUint32>(outputs[idx]));
+                       spec.specConstants.append<deInt32>(bitwiseCast<deUint32>(outputs[idx]));
 
                spec.inputs.push_back(BufferSp(new Float32Buffer(inputs)));
                spec.outputs.push_back(BufferSp(new Float32Buffer(outputs)));
@@ -4770,12 +4770,12 @@ tcu::TestCaseGroup* createSpecConstantOpQuantizeToF16Group (tcu::TestContext& te
                spec.assembly           = shader;
                spec.numWorkGroups      = IVec3(numCases, 1, 1);
 
-               spec.specConstants.push_back(bitwiseCast<deUint32>(0.f));
-               spec.specConstants.push_back(bitwiseCast<deUint32>(-0.f));
-               spec.specConstants.push_back(bitwiseCast<deUint32>(std::ldexp(1.0f, -16)));
-               spec.specConstants.push_back(bitwiseCast<deUint32>(std::ldexp(-1.0f, -32)));
-               spec.specConstants.push_back(bitwiseCast<deUint32>(std::ldexp(1.0f, -127)));
-               spec.specConstants.push_back(bitwiseCast<deUint32>(-std::ldexp(1.0f, -128)));
+               spec.specConstants.append<deInt32>(bitwiseCast<deUint32>(0.f));
+               spec.specConstants.append<deInt32>(bitwiseCast<deUint32>(-0.f));
+               spec.specConstants.append<deInt32>(bitwiseCast<deUint32>(std::ldexp(1.0f, -16)));
+               spec.specConstants.append<deInt32>(bitwiseCast<deUint32>(std::ldexp(-1.0f, -32)));
+               spec.specConstants.append<deInt32>(bitwiseCast<deUint32>(std::ldexp(1.0f, -127)));
+               spec.specConstants.append<deInt32>(bitwiseCast<deUint32>(-std::ldexp(1.0f, -128)));
 
                outputs.push_back(0.f);
                outputs.push_back(-0.f);
@@ -4803,7 +4803,7 @@ tcu::TestCaseGroup* createSpecConstantOpQuantizeToF16Group (tcu::TestContext& te
                for (deUint8 idx = 0; idx < 6; ++idx)
                {
                        const float f = static_cast<float>(idx * 10 - 30) / 4.f;
-                       spec.specConstants.push_back(bitwiseCast<deUint32>(f));
+                       spec.specConstants.append<deInt32>(bitwiseCast<deUint32>(f));
                        outputs.push_back(f);
                }
 
@@ -4830,7 +4830,7 @@ tcu::TestCaseGroup* createSpecConstantOpQuantizeToF16Group (tcu::TestContext& te
                outputs.push_back(constructNormalizedFloat(1, 0xFFE000));
 
                for (deUint8 idx = 0; idx < numCases; ++idx)
-                       spec.specConstants.push_back(bitwiseCast<deUint32>(outputs[idx]));
+                       spec.specConstants.append<deInt32>(bitwiseCast<deUint32>(outputs[idx]));
 
                spec.inputs.push_back(BufferSp(new Float32Buffer(inputs)));
                spec.outputs.push_back(BufferSp(new Float32Buffer(outputs)));
@@ -6411,7 +6411,7 @@ tcu::TestCaseGroup* createSpecConstantTests (tcu::TestContext& testCtx)
        {
                map<string, string>                     specializations;
                map<string, string>                     fragments;
-               vector<deInt32>                         specConstants;
+               SpecConstants                           specConstants;
                vector<string>                          features;
                PushConstants                           noPushConstants;
                GraphicsResources                       noResources;
@@ -6446,8 +6446,8 @@ tcu::TestCaseGroup* createSpecConstantTests (tcu::TestContext& testCtx)
                fragments["pre_main"]                           = tcu::StringTemplate(typesAndConstants1).specialize(specializations);
                fragments["testfun"]                            = tcu::StringTemplate(function1).specialize(specializations);
 
-               specConstants.push_back(cases[caseNdx].scActualValue0);
-               specConstants.push_back(cases[caseNdx].scActualValue1);
+               specConstants.append(cases[caseNdx].scActualValue0);
+               specConstants.append(cases[caseNdx].scActualValue1);
 
                createTestsForAllStages(
                        cases[caseNdx].caseName, inputColors, cases[caseNdx].expectedColors, fragments, specConstants,
@@ -6495,15 +6495,15 @@ tcu::TestCaseGroup* createSpecConstantTests (tcu::TestContext& testCtx)
                "             OpFunctionEnd\n";
 
        map<string, string>     fragments;
-       vector<deInt32>         specConstants;
+       SpecConstants           specConstants;
 
        fragments["decoration"] = decorations2;
        fragments["pre_main"]   = typesAndConstants2;
        fragments["testfun"]    = function2;
 
-       specConstants.push_back(56789);
-       specConstants.push_back(-2);
-       specConstants.push_back(56788);
+       specConstants.append<deInt32>(56789);
+       specConstants.append<deInt32>(-2);
+       specConstants.append<deInt32>(56788);
 
        createTestsForAllStages("vector_related", inputColors, outputColors2, fragments, specConstants, group.get());
 
@@ -7160,7 +7160,7 @@ void createOpQuantizeSingleOptionTests(tcu::TestCaseGroup* testCtx)
        {
                map<string, string>                                                             codeSpecialization;
                map<string, string>                                                             fragments;
-               vector<deInt32>                                                                 passConstants;
+               SpecConstants                                                                   passConstants;
                deInt32                                                                                 specConstant;
 
                codeSpecialization["condition"]                                 = tests[idx].condition;
@@ -7169,7 +7169,7 @@ void createOpQuantizeSingleOptionTests(tcu::TestCaseGroup* testCtx)
                fragments["pre_main"]                                                   = specConstants;
 
                memcpy(&specConstant, &tests[idx].valueAsFloat, sizeof(float));
-               passConstants.push_back(specConstant);
+               passConstants.append(specConstant);
 
                createTestsForAllStages(string("spec_const_") + tests[idx].name, inputColors, expectedColors, fragments, passConstants, testCtx);
        }
@@ -7275,7 +7275,7 @@ void createOpQuantizeTwoPossibilityTests(tcu::TestCaseGroup* testCtx)
        for(size_t idx = 0; idx < (sizeof(tests)/sizeof(tests[0])); ++idx) {
                map<string, string>                                                                     fragments;
                map<string, string>                                                                     constantSpecialization;
-               vector<deInt32>                                                                         passConstants;
+               SpecConstants                                                                           passConstants;
                deInt32                                                                                         specConstant;
 
                constantSpecialization["output1"]                                       = tests[idx].possibleOutput1;
@@ -7285,7 +7285,7 @@ void createOpQuantizeTwoPossibilityTests(tcu::TestCaseGroup* testCtx)
                fragments["pre_main"]                                                           = specConstants.specialize(constantSpecialization);
 
                memcpy(&specConstant, &tests[idx].inputAsFloat, sizeof(float));
-               passConstants.push_back(specConstant);
+               passConstants.append(specConstant);
 
                createTestsForAllStages(string("spec_const_") + tests[idx].name, inputColors, expectedColors, fragments, passConstants, testCtx);
        }
@@ -8565,15 +8565,15 @@ tcu::TestCaseGroup* createConvertGraphicsTests (tcu::TestContext& testCtx, const
                vector<string>          features                = getFeatureStringVector(test->m_features);
                GraphicsResources       resources;
                vector<string>          extensions;
-               vector<deInt32>         noSpecConstants;
+               SpecConstants           noSpecConstants;
                PushConstants           noPushConstants;
-               VulkanFeatures          vulkanFeatures;
+               VulkanFeatures          vulkanFeatures;
                GraphicsInterfaces      noInterfaces;
                tcu::RGBA                       defaultColors[4];
 
                getDefaultColors                        (defaultColors);
-               resources.inputs.push_back      (std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, test->m_inputBuffer));
-               resources.outputs.push_back     (std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, test->m_outputBuffer));
+               resources.inputs.push_back      (Resource(test->m_inputBuffer, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+               resources.outputs.push_back     (Resource(test->m_outputBuffer, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
                extensions.push_back            ("VK_KHR_storage_buffer_storage_class");
 
                if (test->m_features == COMPUTE_TEST_USES_INT16 || test->m_features == COMPUTE_TEST_USES_INT16_INT64 || usesInt16(test->m_fromType, test->m_toType))
@@ -9204,7 +9204,7 @@ const string specializeDefaultOutputShaderTemplate (const NumberType type, const
        ).specialize(parameters);
 }
 
-bool compareFloats (const std::vector<BufferSp>&, const vector<AllocationSp>& outputAllocs, const std::vector<BufferSp>& expectedOutputs, TestLog& log)
+bool compareFloats (const std::vector<Resource>&, const vector<AllocationSp>& outputAllocs, const std::vector<Resource>& expectedOutputs, TestLog& log)
 {
        DE_ASSERT(outputAllocs.size() != 0);
        DE_ASSERT(outputAllocs.size() == expectedOutputs.size());
@@ -9218,7 +9218,7 @@ bool compareFloats (const std::vector<BufferSp>&, const vector<AllocationSp>& ou
                float                   expected;
                float                   actual;
 
-               expectedOutputs[outputNdx]->getBytes(expectedBytes);
+               expectedOutputs[outputNdx].getBytes(expectedBytes);
                memcpy(&expected, &expectedBytes.front(), expectedBytes.size());
                memcpy(&actual, outputAllocs[outputNdx]->getHostPtr(), expectedBytes.size());
 
@@ -9234,7 +9234,7 @@ bool compareFloats (const std::vector<BufferSp>&, const vector<AllocationSp>& ou
 }
 
 // Checks if the driver crash with uninitialized cases
-bool passthruVerify (const std::vector<BufferSp>&, const vector<AllocationSp>& outputAllocs, const std::vector<BufferSp>& expectedOutputs, TestLog&)
+bool passthruVerify (const std::vector<Resource>&, const vector<AllocationSp>& outputAllocs, const std::vector<Resource>& expectedOutputs, TestLog&)
 {
        DE_ASSERT(outputAllocs.size() != 0);
        DE_ASSERT(outputAllocs.size() == expectedOutputs.size());
@@ -9243,7 +9243,7 @@ bool passthruVerify (const std::vector<BufferSp>&, const vector<AllocationSp>& o
        for (size_t outputNdx = 0; outputNdx < outputAllocs.size(); ++outputNdx)
        {
                vector<deUint8> expectedBytes;
-               expectedOutputs[outputNdx]->getBytes(expectedBytes);
+               expectedOutputs[outputNdx].getBytes(expectedBytes);
 
                const size_t    width                   = expectedBytes.size();
                vector<char>    data                    (width);
index af80b97..0f37402 100644 (file)
@@ -752,7 +752,7 @@ void addGraphicsPointerParamToParamTest (tcu::TestCaseGroup* group)
        getDefaultColors(defaultColors);
        expectedOutput.push_back(7.0f);
        requiredFeatures.coreFeatures.vertexPipelineStoresAndAtomics = DE_TRUE;
-       resources.outputs.push_back(std::make_pair(vk::VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(expectedOutput))));
+       resources.outputs.push_back(Resource(BufferSp(new Float32Buffer(expectedOutput)), vk::VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
 
        createTestsForAllStages("global_to_param", defaultColors, defaultColors, fragments, resources, extensions, group, requiredFeatures);
 }
@@ -847,7 +847,7 @@ void addGraphicsPointerParamToGlobalTest (tcu::TestCaseGroup* group)
        getDefaultColors(defaultColors);
        expectedOutput.push_back(7.0f);
        requiredFeatures.coreFeatures.vertexPipelineStoresAndAtomics = DE_TRUE;
-       resources.outputs.push_back(std::make_pair(vk::VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(expectedOutput))));
+       resources.outputs.push_back(Resource(BufferSp(new Float32Buffer(expectedOutput)), vk::VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
 
        createTestsForAllStages("param_to_global", defaultColors, defaultColors, fragments, resources, extensions, group, requiredFeatures);
 }
@@ -955,7 +955,7 @@ void addGraphicsPointerBufferMemoryTest (tcu::TestCaseGroup* group)
                expectedOutput.push_back(2.0f);
 
        requiredFeatures.coreFeatures.vertexPipelineStoresAndAtomics = DE_TRUE;
-       resources.outputs.push_back(std::make_pair(vk::VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(expectedOutput))));
+       resources.outputs.push_back(Resource(BufferSp(new Float32Buffer(expectedOutput)), vk::VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
 
        createTestsForAllStages("buffer_memory", defaultColors, defaultColors, fragments, resources, extensions, group, requiredFeatures);
 }
@@ -1064,7 +1064,7 @@ void addGraphicsPointerBufferMemoryVariablePointersTest (tcu::TestCaseGroup* gro
 
        extensions.push_back("VK_KHR_variable_pointers");
        requiredFeatures.coreFeatures.vertexPipelineStoresAndAtomics = DE_TRUE;
-       resources.outputs.push_back(std::make_pair(vk::VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(expectedOutput))));
+       resources.outputs.push_back(Resource(BufferSp(new Float32Buffer(expectedOutput)), vk::VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
 
        createTestsForAllStages("buffer_memory_variable_pointers", defaultColors, defaultColors, fragments, resources, extensions, group, requiredFeatures);
 }
index 9cf9398..2a17e56 100644 (file)
@@ -1378,14 +1378,14 @@ bool SpvAsmTypeTests<T>::verifyResult (const vector<Resource>&          inputs,
        vector<deUint8> inputBytes[4];
        vector<deUint8> expectedBytes;
 
-       expectedOutputs[0].second->getBytes(expectedBytes);
+       expectedOutputs[0].getBytes(expectedBytes);
        const deUint32 count    = static_cast<deUint32>(expectedBytes.size() / sizeof(T));
        const T* obtained               = static_cast<const T *>(outputAllocations[0]->getHostPtr());
        const T* expected               = reinterpret_cast<const T*>(&expectedBytes.front());
 
        for (deUint32 ndxCount = 0; ndxCount < inputs.size(); ndxCount++)
        {
-               inputs[ndxCount].second->getBytes(inputBytes[ndxCount]);
+               inputs[ndxCount].getBytes(inputBytes[ndxCount]);
                input[ndxCount] = reinterpret_cast<const T*>(&inputBytes[ndxCount].front());
        }
 
@@ -2146,8 +2146,7 @@ void SpvAsmTypeInt16Tests::getDataset (vector<deInt16>&   input,
 void SpvAsmTypeInt16Tests::pushResource (vector<Resource>&     resource,
                                                                                 vector<deInt16>&       data)
 {
-       resource.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
-                                          BufferSp(new Int16Buffer(data))));
+       resource.push_back(Resource(BufferSp(new Int16Buffer(data)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
 }
 
 class SpvAsmTypeInt32Tests : public SpvAsmTypeTests<deInt32>
@@ -2198,8 +2197,7 @@ void SpvAsmTypeInt32Tests::getDataset (vector<deInt32>&   input,
 void SpvAsmTypeInt32Tests::pushResource (vector<Resource>&     resource,
                                                                                 vector<deInt32>&       data)
 {
-       resource.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
-                                         BufferSp(new Int32Buffer(data))));
+       resource.push_back(Resource(BufferSp(new Int32Buffer(data)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
 }
 
 class SpvAsmTypeInt64Tests : public SpvAsmTypeTests<deInt64>
@@ -2250,8 +2248,7 @@ void SpvAsmTypeInt64Tests::getDataset (vector<deInt64>&   input,
 void SpvAsmTypeInt64Tests::pushResource        (vector<Resource>&      resource,
                                                                                 vector<deInt64>&       data)
 {
-       resource.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
-                                          BufferSp(new Int64Buffer(data))));
+       resource.push_back(Resource(BufferSp(new Int64Buffer(data)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
 }
 
 class SpvAsmTypeUint16Tests : public SpvAsmTypeTests<deUint16>
@@ -2301,8 +2298,7 @@ void SpvAsmTypeUint16Tests::getDataset (vector<deUint16>& input,
 void SpvAsmTypeUint16Tests::pushResource (vector<Resource>&    resource,
                                                                                  vector<deUint16>&     data)
 {
-       resource.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
-                                          BufferSp(new Uint16Buffer(data))));
+       resource.push_back(Resource(BufferSp(new Uint16Buffer(data)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
 }
 
 class SpvAsmTypeUint32Tests : public SpvAsmTypeTests<deUint32>
@@ -2352,8 +2348,7 @@ void SpvAsmTypeUint32Tests::getDataset (vector<deUint32>& input,
 void SpvAsmTypeUint32Tests::pushResource (vector<Resource>&    resource,
                                                                                  vector<deUint32>&     data)
 {
-       resource.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
-                                          BufferSp(new Uint32Buffer(data))));
+       resource.push_back(Resource(BufferSp(new Uint32Buffer(data)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
 }
 
 class SpvAsmTypeUint64Tests : public SpvAsmTypeTests<deUint64>
@@ -2403,8 +2398,7 @@ void SpvAsmTypeUint64Tests::getDataset (vector<deUint64>& input,
 void SpvAsmTypeUint64Tests::pushResource (vector<Resource>&    resource,
                                                                                  vector<deUint64>&     data)
 {
-       resource.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
-                                          BufferSp(new Uint64Buffer(data))));
+       resource.push_back(Resource(BufferSp(new Uint64Buffer(data)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
 }
 
 template <class T>
index 50e553a..59d6af6 100644 (file)
@@ -134,11 +134,10 @@ void addComputeUboMatrixPaddingTest (tcu::TestCaseGroup* group)
 
                spec.assembly                   = shaderSource;
                spec.numWorkGroups              = IVec3(numElements, 1, 1);
-               spec.inputTypes[0]              = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
 
-               spec.inputs.push_back(BufferSp(new Vec4Buffer(inputData)));
+               spec.inputs.push_back(Resource(BufferSp(new Vec4Buffer(inputData)), VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER));
                // Shader is expected to pass the input data by treating the input vec4 as mat2x2
-               spec.outputs.push_back(BufferSp(new Vec4Buffer(inputData)));
+               spec.outputs.push_back(Resource(BufferSp(new Vec4Buffer(inputData))));
 
                group->addChild(new SpvAsmComputeShaderCase(testCtx, "mat2x2", "Tests mat2x2 member in UBO struct without padding (treated as vec4).", spec));
        }
@@ -152,7 +151,7 @@ void addGraphicsUboMatrixPaddingTest (tcu::TestCaseGroup* group)
        RGBA                                            defaultColors[4];
        GraphicsResources                       resources;
 
-       std::vector<deInt32>            noSpecConstants;
+       SpecConstants                           noSpecConstants;
        PushConstants                           noPushConstants;
        GraphicsInterfaces                      noInterfaces;
        std::vector<std::string>        noFeatures;
@@ -163,9 +162,9 @@ void addGraphicsUboMatrixPaddingTest (tcu::TestCaseGroup* group)
        for (deUint32 numIdx = 0; numIdx < numDataPoints; ++numIdx)
                inputData[numIdx] = tcu::Vec4(rnd.getFloat(), rnd.getFloat(), rnd.getFloat(), rnd.getFloat());
 
-       resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, BufferSp(new Vec4Buffer(inputData))));
+       resources.inputs.push_back(Resource(BufferSp(new Vec4Buffer(inputData)), VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER));
        // Shader is expected to pass the input data by treating the input vec4 as mat2x2
-       resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Vec4Buffer(inputData))));
+       resources.outputs.push_back(Resource(BufferSp(new Vec4Buffer(inputData)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
 
        getDefaultColors(defaultColors);
 
@@ -246,7 +245,7 @@ void addGraphicsUboMatrixPaddingTest (tcu::TestCaseGroup* group)
 
                "                         OpFunctionEnd\n";
 
-       resources.inputs.back().first   = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
+       resources.inputs.back().setDescriptorType(VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER);
 
        vulkanFeatures.coreFeatures.vertexPipelineStoresAndAtomics = DE_TRUE;
        vulkanFeatures.coreFeatures.fragmentStoresAndAtomics = DE_FALSE;
index cde9004..cb9e5e6 100644 (file)
@@ -51,6 +51,74 @@ bool is8BitStorageFeaturesSupported (const Context& context, Extension8BitStorag
        return true;
 }
 
+#define IS_CORE_FEATURE_AVAILABLE(CHECKED, AVAILABLE, FEATURE) \
+       if ((CHECKED.FEATURE != DE_FALSE) && (AVAILABLE.FEATURE == DE_FALSE)) { *missingFeature = #FEATURE; return false; }
+
+bool isCoreFeaturesSupported (const Context&                                           context,
+                                                         const vk::VkPhysicalDeviceFeatures&   toCheck,
+                                                         const char**                                                  missingFeature)
+{
+       const VkPhysicalDeviceFeatures& availableFeatures       = context.getDeviceFeatures();
+
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, robustBufferAccess);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, fullDrawIndexUint32);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, imageCubeArray);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, independentBlend);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, geometryShader);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, tessellationShader);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, sampleRateShading);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, dualSrcBlend);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, logicOp);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, multiDrawIndirect);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, drawIndirectFirstInstance);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, depthClamp);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, depthBiasClamp);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, fillModeNonSolid);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, depthBounds);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, wideLines);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, largePoints);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, alphaToOne);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, multiViewport);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, samplerAnisotropy);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, textureCompressionETC2);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, textureCompressionASTC_LDR);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, textureCompressionBC);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, occlusionQueryPrecise);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, pipelineStatisticsQuery);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, vertexPipelineStoresAndAtomics);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, fragmentStoresAndAtomics);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, shaderTessellationAndGeometryPointSize);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, shaderImageGatherExtended);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, shaderStorageImageExtendedFormats);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, shaderStorageImageMultisample);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, shaderStorageImageReadWithoutFormat);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, shaderStorageImageWriteWithoutFormat);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, shaderUniformBufferArrayDynamicIndexing);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, shaderSampledImageArrayDynamicIndexing);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, shaderStorageBufferArrayDynamicIndexing);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, shaderStorageImageArrayDynamicIndexing);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, shaderClipDistance);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, shaderCullDistance);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, shaderFloat64);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, shaderInt64);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, shaderInt16);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, shaderResourceResidency);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, shaderResourceMinLod);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, sparseBinding);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, sparseResidencyBuffer);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, sparseResidencyImage2D);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, sparseResidencyImage3D);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, sparseResidency2Samples);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, sparseResidency4Samples);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, sparseResidency8Samples);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, sparseResidency16Samples);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, sparseResidencyAliased);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, variableMultisampleRate);
+       IS_CORE_FEATURE_AVAILABLE(toCheck, availableFeatures, inheritedQueries);
+
+       return true;
+}
+
 bool is16BitStorageFeaturesSupported (const Context& context, Extension16BitStorageFeatures toCheck)
 {
        const VkPhysicalDevice16BitStorageFeatures& extensionFeatures = context.get16BitStorageFeatures();
index 8154144..345d6de 100644 (file)
 #include "vkTypeUtil.hpp"
 #include "vktTestCase.hpp"
 
+#include "deMemory.h"
+#include "deUniquePtr.hpp"
+#include "deSharedPtr.hpp"
+
 #include <string>
 #include <vector>
 
@@ -36,6 +40,97 @@ namespace vkt
 {
 namespace SpirVAssembly
 {
+/*--------------------------------------------------------------------*//*!
+ * \brief Abstract class for an input/output storage buffer object
+ *//*--------------------------------------------------------------------*/
+class BufferInterface
+{
+public:
+       virtual                         ~BufferInterface        (void)                          {}
+
+       virtual void            getBytes                        (std::vector<deUint8>& bytes) const = 0;
+       virtual size_t          getByteSize                     (void) const = 0;
+};
+
+typedef de::SharedPtr<BufferInterface> BufferSp;
+typedef de::MovePtr<vk::Allocation>            AllocationMp;
+typedef de::SharedPtr<vk::Allocation>  AllocationSp;
+
+class Resource
+{
+public:
+       Resource(const BufferSp& buffer_, vk::VkDescriptorType descriptorType_ = vk::VK_DESCRIPTOR_TYPE_STORAGE_BUFFER)
+               : buffer(buffer_)
+               , descriptorType(descriptorType_)
+       {
+       }
+
+       virtual const BufferSp&                 getBuffer                       () const                                                        { return buffer; }
+       virtual void                                    getBytes                        (std::vector<deUint8>& bytes) const     { buffer->getBytes(bytes); }
+       virtual size_t                                  getByteSize                     (void) const                                            { return buffer->getByteSize(); }
+
+       virtual void                                    setDescriptorType       (vk::VkDescriptorType type)             { descriptorType = type; }
+       virtual vk::VkDescriptorType    getDescriptorType       ()      const                                           { return descriptorType; }
+
+private:
+       BufferSp                                buffer;
+       vk::VkDescriptorType    descriptorType;
+};
+
+typedef bool (*VerifyIOFunc) (const std::vector<Resource>&             inputs,
+                                                         const std::vector<AllocationSp>&      outputAllocations,
+                                                         const std::vector<Resource>&          expectedOutputs,
+                                                         tcu::TestLog&                                         log);
+
+struct SpecConstants
+{
+public:
+                                                       SpecConstants (void)
+                                                       {}
+
+       bool                                    empty (void) const
+                                                       {
+                                                               return valuesBuffer.empty();
+                                                       }
+
+       size_t                                  getValuesCount (void) const
+                                                       {
+                                                               return sizesBuffer.size();
+                                                       }
+
+       size_t                                  getValueSize (const size_t valueIndex) const
+                                                       {
+                                                               return sizesBuffer[valueIndex];
+                                                       }
+
+       const void*                             getValuesBuffer (void) const
+                                                       {
+                                                               if (valuesBuffer.size() == 0)
+                                                                       return DE_NULL;
+                                                               else
+                                                                       return static_cast<const void*>(&valuesBuffer[0]);
+                                                       }
+
+       template<typename T>
+       void                                    append (const T value)
+                                                       {
+                                                               append(&value, sizeof(value));
+                                                       }
+
+       void                                    append (const void* buf, const size_t byteSize)
+                                                       {
+                                                               DE_ASSERT(byteSize > 0);
+
+                                                               valuesBuffer.resize(valuesBuffer.size() + byteSize);
+                                                               deMemcpy(&valuesBuffer[valuesBuffer.size() - byteSize], buf, byteSize);
+
+                                                               sizesBuffer.push_back(byteSize);
+                                                       }
+
+private:
+       std::vector<deUint8>    valuesBuffer;
+       std::vector<size_t>             sizesBuffer;
+};
 
 enum Extension8BitStorageFeatureBits
 {
@@ -63,17 +158,19 @@ typedef deUint32 ExtensionVariablePointersFeatures;
 
 struct VulkanFeatures
 {
-       Extension8BitStorageFeatures            ext8BitStorage;
+       vk::VkPhysicalDeviceFeatures            coreFeatures;
        Extension16BitStorageFeatures           ext16BitStorage;
        ExtensionVariablePointersFeatures       extVariablePointers;
-       vk::VkPhysicalDeviceFeatures            coreFeatures;
+       Extension8BitStorageFeatures            ext8BitStorage;
 
        VulkanFeatures                          (void)
-               : ext8BitStorage                (0)
+               : coreFeatures                  (vk::VkPhysicalDeviceFeatures())
                , ext16BitStorage               (0)
                , extVariablePointers   (0)
-               , coreFeatures                  (vk::VkPhysicalDeviceFeatures())
-       {}
+               , ext8BitStorage                (0)
+       {
+               deMemset(&coreFeatures, 0, sizeof(coreFeatures));
+       }
 };
 
 // Returns true if the given 8bit storage extension features in `toCheck` are all supported.
@@ -81,6 +178,11 @@ bool is8BitStorageFeaturesSupported (const Context&                                         context,
                                                                          Extension8BitStorageFeatures          toCheck);
 
 // Returns true if the given 16bit storage extension features in `toCheck` are all supported.
+bool isCoreFeaturesSupported (const Context&                                           context,
+                                                         const vk::VkPhysicalDeviceFeatures&   toCheck,
+                                                         const char**                                                  missingFeature);
+
+// Returns true if the given 16bit storage extension features in `toCheck` are all supported.
 bool is16BitStorageFeaturesSupported (const Context&                           context,
                                                                          Extension16BitStorageFeatures toCheck);
 
index d06bfa6..6413713 100644 (file)
@@ -235,7 +235,7 @@ void addGraphicsVariableInitPrivateTest (tcu::TestCaseGroup* group)
        for (deUint32 numIdx = 0; numIdx < numFloats; ++numIdx)
                expectedOutput.push_back(1.0f);
 
-       resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(expectedOutput))));
+       resources.outputs.push_back(Resource(BufferSp(new Float32Buffer(expectedOutput)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
        extensions.push_back("VK_KHR_storage_buffer_storage_class");
 
        for (int paramIdx = 0; paramIdx < DE_LENGTH_OF_ARRAY(params); paramIdx++)
@@ -552,7 +552,7 @@ void addGraphicsVariableInitOutputTest (tcu::TestCaseGroup* group)
        map<string, string>             fragments;
        RGBA                                    defaultColors[4];
        tcu::TestCaseGroup*             outputGroup                     = new tcu::TestCaseGroup(testCtx, "output", "Tests OpVariable initialization in output storage class.");
-       vector<deInt32>                 noSpecConstants;
+       SpecConstants                   noSpecConstants;
        PushConstants                   noPushConstants;
        GraphicsInterfaces              noInterfaces;
        vector<string>                  extensions;
@@ -586,7 +586,7 @@ void addGraphicsVariableInitOutputTest (tcu::TestCaseGroup* group)
                for (deUint32 numIdx = 0; numIdx < numComponents; ++numIdx)
                        expectedOutput.push_back(1.0f);
 
-               resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(expectedOutput))));
+               resources.outputs.push_back(Resource(BufferSp(new Float32Buffer(expectedOutput)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
 
                {
                        const InstanceContext& instanceContext = createInstanceContext(pipelineStages,
index a3ddc81..51d7a32 100644 (file)
@@ -328,16 +328,13 @@ void addVariablePointersComputeGroup (tcu::TestCaseGroup* group)
                        specs["ExtraSetupComputations"] = "";
                        specs["VarPtrName"]                             = "%mux_output_var_ptr";
                        specs["ResultStrategy"]                 = "%mux_output_var_ptr  = OpSelect %sb_f32ptr %is_neg" + muxInput1 + muxInput2 + "\n";
-                       spec.inputTypes[0]                              = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
-                       spec.inputTypes[1]                              = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
-                       spec.inputTypes[2]                              = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
                        spec.assembly                                   = shaderTemplate.specialize(specs);
                        spec.numWorkGroups                              = IVec3(numMuxes, 1, 1);
                        spec.requestedVulkanFeatures    = requiredFeatures;
-                       spec.inputs.push_back(BufferSp(new Float32Buffer(inputAFloats)));
-                       spec.inputs.push_back(BufferSp(new Float32Buffer(inputBFloats)));
-                       spec.inputs.push_back(BufferSp(new Float32Buffer(inputSFloats)));
-                       spec.outputs.push_back(BufferSp(new Float32Buffer(expectedOutput)));
+                       spec.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputAFloats)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                       spec.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputBFloats)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                       spec.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputSFloats)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                       spec.outputs.push_back(Resource(BufferSp(new Float32Buffer(expectedOutput))));
                        spec.extensions.push_back("VK_KHR_variable_pointers");
                        group->addChild(new SpvAsmComputeShaderCase(testCtx, name.c_str(), name.c_str(), spec));
                }
@@ -352,16 +349,13 @@ void addVariablePointersComputeGroup (tcu::TestCaseGroup* group)
                        specs["ExtraSetupComputations"] = "";
                        specs["VarPtrName"]                             = "%mux_output_var_ptr";
                        specs["ResultStrategy"]                 = "%mux_output_var_ptr = OpFunctionCall %sb_f32ptr %choose_input_func %is_neg" + muxInput1 + muxInput2 + "\n";
-                       spec.inputTypes[0]                              = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
-                       spec.inputTypes[1]                              = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
-                       spec.inputTypes[2]                              = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
                        spec.assembly                                   = shaderTemplate.specialize(specs);
                        spec.numWorkGroups                              = IVec3(numMuxes, 1, 1);
                        spec.requestedVulkanFeatures    = requiredFeatures;
-                       spec.inputs.push_back(BufferSp(new Float32Buffer(inputAFloats)));
-                       spec.inputs.push_back(BufferSp(new Float32Buffer(inputBFloats)));
-                       spec.inputs.push_back(BufferSp(new Float32Buffer(inputSFloats)));
-                       spec.outputs.push_back(BufferSp(new Float32Buffer(expectedOutput)));
+                       spec.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputAFloats)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                       spec.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputBFloats)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                       spec.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputSFloats)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                       spec.outputs.push_back(Resource(BufferSp(new Float32Buffer(expectedOutput))));
                        spec.extensions.push_back("VK_KHR_variable_pointers");
                        group->addChild(new SpvAsmComputeShaderCase(testCtx, name.c_str(), name.c_str(), spec));
                }
@@ -384,16 +378,13 @@ void addVariablePointersComputeGroup (tcu::TestCaseGroup* group)
                                "                                                     OpBranch %end_label\n"
                                "%end_label                                     = OpLabel\n"
                                "%mux_output_var_ptr            = OpPhi %sb_f32ptr" + muxInput1 + "%take_mux_input_1" + muxInput2 + "%take_mux_input_2\n";
-                       spec.inputTypes[0]                              = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
-                       spec.inputTypes[1]                              = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
-                       spec.inputTypes[2]                              = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
                        spec.assembly                                   = shaderTemplate.specialize(specs);
                        spec.numWorkGroups                              = IVec3(numMuxes, 1, 1);
                        spec.requestedVulkanFeatures    = requiredFeatures;
-                       spec.inputs.push_back(BufferSp(new Float32Buffer(inputAFloats)));
-                       spec.inputs.push_back(BufferSp(new Float32Buffer(inputBFloats)));
-                       spec.inputs.push_back(BufferSp(new Float32Buffer(inputSFloats)));
-                       spec.outputs.push_back(BufferSp(new Float32Buffer(expectedOutput)));
+                       spec.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputAFloats)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                       spec.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputBFloats)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                       spec.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputSFloats)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                       spec.outputs.push_back(Resource(BufferSp(new Float32Buffer(expectedOutput))));
                        spec.extensions.push_back("VK_KHR_variable_pointers");
                        group->addChild(new SpvAsmComputeShaderCase(testCtx, name.c_str(), name.c_str(), spec));
                }
@@ -411,16 +402,13 @@ void addVariablePointersComputeGroup (tcu::TestCaseGroup* group)
                                "%mux_input_1_copy                      = OpCopyObject %sb_f32ptr" + muxInput1 + "\n"
                                "%mux_input_2_copy                      = OpCopyObject %sb_f32ptr" + muxInput2 + "\n"
                                "%mux_output_var_ptr            = OpSelect %sb_f32ptr %is_neg %mux_input_1_copy %mux_input_2_copy\n";
-                       spec.inputTypes[0]                              = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
-                       spec.inputTypes[1]                              = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
-                       spec.inputTypes[2]                              = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
                        spec.assembly                                   = shaderTemplate.specialize(specs);
                        spec.numWorkGroups                              = IVec3(numMuxes, 1, 1);
                        spec.requestedVulkanFeatures    = requiredFeatures;
-                       spec.inputs.push_back(BufferSp(new Float32Buffer(inputAFloats)));
-                       spec.inputs.push_back(BufferSp(new Float32Buffer(inputBFloats)));
-                       spec.inputs.push_back(BufferSp(new Float32Buffer(inputSFloats)));
-                       spec.outputs.push_back(BufferSp(new Float32Buffer(expectedOutput)));
+                       spec.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputAFloats)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                       spec.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputBFloats)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                       spec.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputSFloats)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                       spec.outputs.push_back(Resource(BufferSp(new Float32Buffer(expectedOutput))));
                        spec.extensions.push_back("VK_KHR_variable_pointers");
                        group->addChild(new SpvAsmComputeShaderCase(testCtx, name.c_str(), name.c_str(), spec));
                }
@@ -444,16 +432,13 @@ void addVariablePointersComputeGroup (tcu::TestCaseGroup* group)
                                        "%opselect_result                       = OpSelect %sb_f32ptr %is_neg" + muxInput1 + muxInput2 + "\n"
                                        "                                                         OpStore %mux_output_copy %opselect_result\n"
                                        "%mux_output_var_ptr            = OpLoad %sb_f32ptr %mux_output_copy\n";
-                               spec.inputTypes[0]                              = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
-                               spec.inputTypes[1]                              = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
-                               spec.inputTypes[2]                              = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
                                spec.assembly                                   = shaderTemplate.specialize(specs);
                                spec.numWorkGroups                              = IVec3(numMuxes, 1, 1);
                                spec.requestedVulkanFeatures    = requiredFeatures;
-                               spec.inputs.push_back(BufferSp(new Float32Buffer(inputAFloats)));
-                               spec.inputs.push_back(BufferSp(new Float32Buffer(inputBFloats)));
-                               spec.inputs.push_back(BufferSp(new Float32Buffer(inputSFloats)));
-                               spec.outputs.push_back(BufferSp(new Float32Buffer(expectedOutput)));
+                               spec.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputAFloats)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                               spec.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputBFloats)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                               spec.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputSFloats)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                               spec.outputs.push_back(Resource(BufferSp(new Float32Buffer(expectedOutput))));
                                spec.extensions.push_back("VK_KHR_variable_pointers");
                                group->addChild(new SpvAsmComputeShaderCase(testCtx, name.c_str(), description.c_str(), spec));
                        }
@@ -481,16 +466,13 @@ void addVariablePointersComputeGroup (tcu::TestCaseGroup* group)
                                        "%a_2i_ptr              = OpPtrAccessChain %sb_f32ptr %a_ptr %two_i\n"
                                        "%a_2i_plus_1_ptr       = OpPtrAccessChain %sb_f32ptr %a_ptr %two_i_plus_1\n"
                                        "%mux_output_var_ptr    = OpSelect %sb_f32ptr %is_neg " + in_1 + in_2 + "\n";
-                       spec.inputTypes[0]                              = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
-                       spec.inputTypes[1]                              = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
-                       spec.inputTypes[2]                              = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
                        spec.assembly                                   = shaderTemplate.specialize(specs);
                        spec.numWorkGroups                              = IVec3(numMuxes, 1, 1);
                        spec.requestedVulkanFeatures    = requiredFeatures;
-                       spec.inputs.push_back(BufferSp(new Float32Buffer(inputAFloats)));
-                       spec.inputs.push_back(BufferSp(new Float32Buffer(inputBFloats)));
-                       spec.inputs.push_back(BufferSp(new Float32Buffer(inputSFloats)));
-                       spec.outputs.push_back(BufferSp(new Float32Buffer(expectedOutput)));
+                       spec.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputAFloats)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                       spec.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputBFloats)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                       spec.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputSFloats)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                       spec.outputs.push_back(Resource(BufferSp(new Float32Buffer(expectedOutput))));
                        spec.extensions.push_back("VK_KHR_variable_pointers");
                        group->addChild(new SpvAsmComputeShaderCase(testCtx, name.c_str(), name.c_str(), spec));
                }
@@ -508,16 +490,13 @@ void addVariablePointersComputeGroup (tcu::TestCaseGroup* group)
                                                                                          "               %val = OpLoad %f32 %mux_output_var_ptr\n"
                                                                                          "        %val_plus_1 = OpFAdd %f32 %val %fone\n"
                                                                                          "                                              OpStore %mux_output_var_ptr %val_plus_1\n";
-                       spec.inputTypes[0]                              = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
-                       spec.inputTypes[1]                              = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
-                       spec.inputTypes[2]                              = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
                        spec.assembly                                   = shaderTemplate.specialize(specs);
                        spec.numWorkGroups                              = IVec3(numMuxes, 1, 1);
                        spec.requestedVulkanFeatures    = requiredFeatures;
-                       spec.inputs.push_back(BufferSp(new Float32Buffer(inputAFloats)));
-                       spec.inputs.push_back(BufferSp(new Float32Buffer(inputBFloats)));
-                       spec.inputs.push_back(BufferSp(new Float32Buffer(inputSFloats)));
-                       spec.outputs.push_back(BufferSp(new Float32Buffer(expectedIncrOutput)));
+                       spec.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputAFloats)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                       spec.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputBFloats)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                       spec.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputSFloats)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                       spec.outputs.push_back(Resource(BufferSp(new Float32Buffer(expectedIncrOutput))));
                        spec.extensions.push_back("VK_KHR_variable_pointers");
                        group->addChild(new SpvAsmComputeShaderCase(testCtx, name.c_str(), name.c_str(), spec));
                }
@@ -552,16 +531,13 @@ void addVariablePointersComputeGroup (tcu::TestCaseGroup* group)
                                        "                                                 OpStore %loc_AW_i %inval_a_i\n"
                                        "                                                 OpStore %loc_BW_i %inval_b_i\n"
                                        "%output_var_ptr                = OpSelect %f32_wrkgrp_ptr %is_neg %loc_AW_i %loc_BW_i\n";
-                       spec.inputTypes[0]                              = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
-                       spec.inputTypes[1]                              = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
-                       spec.inputTypes[2]                              = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
                        spec.assembly                                   = shaderTemplate.specialize(specs);
                        spec.numWorkGroups                              = IVec3(numMuxes, 1, 1);
                        spec.requestedVulkanFeatures    = requiredFeatures;
-                       spec.inputs.push_back(BufferSp(new Float32Buffer(inputAFloats)));
-                       spec.inputs.push_back(BufferSp(new Float32Buffer(inputBFloats)));
-                       spec.inputs.push_back(BufferSp(new Float32Buffer(inputSFloats)));
-                       spec.outputs.push_back(BufferSp(new Float32Buffer(expectedOutput)));
+                       spec.inputs.push_back (Resource(BufferSp(new Float32Buffer(inputAFloats)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                       spec.inputs.push_back (Resource(BufferSp(new Float32Buffer(inputBFloats)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                       spec.inputs.push_back (Resource(BufferSp(new Float32Buffer(inputSFloats)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                       spec.outputs.push_back(Resource(BufferSp(new Float32Buffer(expectedOutput))));
                        spec.extensions.push_back("VK_KHR_variable_pointers");
                        group->addChild(new SpvAsmComputeShaderCase(testCtx, name.c_str(), name.c_str(), spec));
                }
@@ -918,16 +894,13 @@ void addComplexTypesVariablePointersComputeGroup (tcu::TestCaseGroup* group)
                                                                                                                + baseANameAtLevel[indexLevel] + " "
                                                                                                                + baseBNameAtLevel[indexLevel] + "\n";
                                        expectedOutput[0]                               = selectedInput[baseOffset];
-                                       spec.inputTypes[0]                              = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
-                                       spec.inputTypes[1]                              = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
-                                       spec.inputTypes[2]                              = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
                                        spec.assembly                                   = shaderTemplate.specialize(specs);
                                        spec.numWorkGroups                              = IVec3(1, 1, 1);
                                        spec.requestedVulkanFeatures    = requiredFeatures;
-                                       spec.inputs.push_back(BufferSp(new Float32Buffer(inputA)));
-                                       spec.inputs.push_back(BufferSp(new Float32Buffer(inputB)));
-                                       spec.inputs.push_back(BufferSp(new Float32Buffer(inputC)));
-                                       spec.outputs.push_back(BufferSp(new Float32Buffer(expectedOutput)));
+                                       spec.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputA)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                                       spec.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputB)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                                       spec.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputC)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                                       spec.outputs.push_back(Resource(BufferSp(new Float32Buffer(expectedOutput))));
                                        spec.extensions.push_back("VK_KHR_variable_pointers");
                                        group->addChild(new SpvAsmComputeShaderCase(testCtx, name.c_str(), name.c_str(), spec));
                                }
@@ -951,16 +924,13 @@ void addComplexTypesVariablePointersComputeGroup (tcu::TestCaseGroup* group)
                                                                                                                + baseANameAtLevel[indexLevel] + " "
                                                                                                                + baseBNameAtLevel[indexLevel] + "\n";
                                        expectedOutput[0]                               = selectedInput[baseOffset];
-                                       spec.inputTypes[0]                              = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
-                                       spec.inputTypes[1]                              = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
-                                       spec.inputTypes[2]                              = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
                                        spec.assembly                                   = shaderTemplate.specialize(specs);
                                        spec.numWorkGroups                              = IVec3(1, 1, 1);
                                        spec.requestedVulkanFeatures    = requiredFeatures;
-                                       spec.inputs.push_back(BufferSp(new Float32Buffer(inputA)));
-                                       spec.inputs.push_back(BufferSp(new Float32Buffer(inputB)));
-                                       spec.inputs.push_back(BufferSp(new Float32Buffer(inputC)));
-                                       spec.outputs.push_back(BufferSp(new Float32Buffer(expectedOutput)));
+                                       spec.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputA)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                                       spec.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputB)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                                       spec.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputC)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                                       spec.outputs.push_back(Resource(BufferSp(new Float32Buffer(expectedOutput))));
                                        spec.extensions.push_back("VK_KHR_variable_pointers");
                                        group->addChild(new SpvAsmComputeShaderCase(testCtx, name.c_str(), name.c_str(), spec));
                                }
@@ -993,16 +963,13 @@ void addComplexTypesVariablePointersComputeGroup (tcu::TestCaseGroup* group)
                                                                                                                + baseBNameAtLevel[indexLevel]
                                                                                                                + " %take_input_b\n";
                                        expectedOutput[0]                               = selectedInput[baseOffset];
-                                       spec.inputTypes[0]                              = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
-                                       spec.inputTypes[1]                              = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
-                                       spec.inputTypes[2]                              = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
                                        spec.assembly                                   = shaderTemplate.specialize(specs);
                                        spec.numWorkGroups                              = IVec3(1, 1, 1);
                                        spec.requestedVulkanFeatures    = requiredFeatures;
-                                       spec.inputs.push_back(BufferSp(new Float32Buffer(inputA)));
-                                       spec.inputs.push_back(BufferSp(new Float32Buffer(inputB)));
-                                       spec.inputs.push_back(BufferSp(new Float32Buffer(inputC)));
-                                       spec.outputs.push_back(BufferSp(new Float32Buffer(expectedOutput)));
+                                       spec.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputA)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                                       spec.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputB)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                                       spec.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputC)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                                       spec.outputs.push_back(Resource(BufferSp(new Float32Buffer(expectedOutput))));
                                        spec.extensions.push_back("VK_KHR_variable_pointers");
                                        group->addChild(new SpvAsmComputeShaderCase(testCtx, name.c_str(), name.c_str(), spec));
                                }
@@ -1024,16 +991,13 @@ void addComplexTypesVariablePointersComputeGroup (tcu::TestCaseGroup* group)
                                                                                "%in_b_copy = OpCopyObject " + pointerTypeAtLevel[indexLevel] + " " + baseBNameAtLevel[indexLevel] + "\n"
                                                                                "%var_ptr       = OpSelect " + pointerTypeAtLevel[indexLevel] + " " + spirvSelectInputA + " %in_a_copy %in_b_copy\n";
                                        expectedOutput[0]                               = selectedInput[baseOffset];
-                                       spec.inputTypes[0]                              = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
-                                       spec.inputTypes[1]                              = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
-                                       spec.inputTypes[2]                              = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
                                        spec.assembly                                   = shaderTemplate.specialize(specs);
                                        spec.numWorkGroups                              = IVec3(1, 1, 1);
                                        spec.requestedVulkanFeatures    = requiredFeatures;
-                                       spec.inputs.push_back(BufferSp(new Float32Buffer(inputA)));
-                                       spec.inputs.push_back(BufferSp(new Float32Buffer(inputB)));
-                                       spec.inputs.push_back(BufferSp(new Float32Buffer(inputC)));
-                                       spec.outputs.push_back(BufferSp(new Float32Buffer(expectedOutput)));
+                                       spec.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputA)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                                       spec.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputB)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                                       spec.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputC)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                                       spec.outputs.push_back(Resource(BufferSp(new Float32Buffer(expectedOutput))));
                                        spec.extensions.push_back("VK_KHR_variable_pointers");
                                        group->addChild(new SpvAsmComputeShaderCase(testCtx, name.c_str(), name.c_str(), spec));
                                }
@@ -1056,16 +1020,13 @@ void addComplexTypesVariablePointersComputeGroup (tcu::TestCaseGroup* group)
                                                                                                                + baseANameAtLevel[indexLevel] + " "
                                                                                                                + baseBNameAtLevel[indexLevel] + "\n";
                                        expectedOutput[0]                               = selectedInput[baseOffset];
-                                       spec.inputTypes[0]                              = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
-                                       spec.inputTypes[1]                              = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
-                                       spec.inputTypes[2]                              = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
                                        spec.assembly                                   = shaderTemplate.specialize(specs);
                                        spec.numWorkGroups                              = IVec3(1, 1, 1);
                                        spec.requestedVulkanFeatures    = requiredFeatures;
-                                       spec.inputs.push_back(BufferSp(new Float32Buffer(inputA)));
-                                       spec.inputs.push_back(BufferSp(new Float32Buffer(inputB)));
-                                       spec.inputs.push_back(BufferSp(new Float32Buffer(inputC)));
-                                       spec.outputs.push_back(BufferSp(new Float32Buffer(expectedOutput)));
+                                       spec.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputA)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                                       spec.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputB)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                                       spec.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputC)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                                       spec.outputs.push_back(Resource(BufferSp(new Float32Buffer(expectedOutput))));
                                        spec.extensions.push_back("VK_KHR_variable_pointers");
                                        group->addChild(new SpvAsmComputeShaderCase(testCtx, name.c_str(), name.c_str(), spec));
                                }
@@ -1179,12 +1140,11 @@ void addNullptrVariablePointersComputeGroup (tcu::TestCaseGroup* group)
                                                        "%loaded_f32     = OpLoad  %f32         %loaded_f32_ptr \n"
                                                        "                  OpStore %output_loc  %loaded_f32     \n";
 
-               spec.inputTypes[0]                              = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
                spec.assembly                                   = shaderTemplate.specialize(specs);
                spec.numWorkGroups                              = IVec3(1, 1, 1);
                spec.requestedVulkanFeatures    = requiredFeatures;
-               spec.inputs.push_back(BufferSp(new Float32Buffer(input)));
-               spec.outputs.push_back(BufferSp(new Float32Buffer(expectedOutput)));
+               spec.inputs.push_back(Resource(BufferSp(new Float32Buffer(input)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+               spec.outputs.push_back(Resource(BufferSp(new Float32Buffer(expectedOutput))));
                spec.extensions.push_back("VK_KHR_variable_pointers");
                group->addChild(new SpvAsmComputeShaderCase(testCtx, name.c_str(), name.c_str(), spec));
        }
@@ -1199,12 +1159,11 @@ void addNullptrVariablePointersComputeGroup (tcu::TestCaseGroup* group)
                                                        "%loaded_var = OpLoad %f32 %selected_ptr\n"
                                                        "OpStore %output_loc %loaded_var\n";
 
-               spec.inputTypes[0]                              = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
                spec.assembly                                   = shaderTemplate.specialize(specs);
                spec.numWorkGroups                              = IVec3(1, 1, 1);
                spec.requestedVulkanFeatures    = requiredFeatures;
-               spec.inputs.push_back(BufferSp(new Float32Buffer(input)));
-               spec.outputs.push_back(BufferSp(new Float32Buffer(expectedOutput)));
+               spec.inputs.push_back(Resource(BufferSp(new Float32Buffer(input)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+               spec.outputs.push_back(Resource(BufferSp(new Float32Buffer(expectedOutput))));
                spec.extensions.push_back("VK_KHR_variable_pointers");
                group->addChild(new SpvAsmComputeShaderCase(testCtx, name.c_str(), name.c_str(), spec));
        }
@@ -1397,10 +1356,10 @@ void addVariablePointersGraphicsGroup (tcu::TestCaseGroup* testGroup)
                        fragments["pre_main"]                   = preMain.specialize(specs);
                        fragments["testfun"]                    = testFunction.specialize(specs);
 
-                       resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(inputAFloats))));
-                       resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(inputBFloats))));
-                       resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(inputSFloats))));
-                       resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(expectedOutput))));
+                       resources.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputAFloats)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                       resources.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputBFloats)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                       resources.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputSFloats)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                       resources.outputs.push_back(Resource(BufferSp(new Float32Buffer(expectedOutput)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
                        createTestsForAllStages(name.c_str(), defaultColors, defaultColors, fragments, resources, extensions, testGroup, requiredFeatures);
                }
                { // Variable Pointer Reads (using OpFunctionCall)
@@ -1419,10 +1378,10 @@ void addVariablePointersGraphicsGroup (tcu::TestCaseGroup* testGroup)
                        fragments["pre_main"]                   = preMain.specialize(specs);
                        fragments["testfun"]                    = testFunction.specialize(specs);
 
-                       resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(inputAFloats))));
-                       resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(inputBFloats))));
-                       resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(inputSFloats))));
-                       resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(expectedOutput))));
+                       resources.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputAFloats)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                       resources.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputBFloats)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                       resources.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputSFloats)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                       resources.outputs.push_back(Resource(BufferSp(new Float32Buffer(expectedOutput)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
                        createTestsForAllStages(name.c_str(), defaultColors, defaultColors, fragments, resources, extensions, testGroup, requiredFeatures);
                }
                { // Variable Pointer Reads (using OpPhi)
@@ -1449,10 +1408,10 @@ void addVariablePointersGraphicsGroup (tcu::TestCaseGroup* testGroup)
                        fragments["pre_main"]                   = preMain.specialize(specs);
                        fragments["testfun"]                    = testFunction.specialize(specs);
 
-                       resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(inputAFloats))));
-                       resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(inputBFloats))));
-                       resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(inputSFloats))));
-                       resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(expectedOutput))));
+                       resources.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputAFloats)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                       resources.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputBFloats)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                       resources.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputSFloats)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                       resources.outputs.push_back(Resource(BufferSp(new Float32Buffer(expectedOutput)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
                        createTestsForAllStages(name.c_str(), defaultColors, defaultColors, fragments, resources, extensions, testGroup, requiredFeatures);
                }
                { // Variable Pointer Reads (using OpCopyObject)
@@ -1474,10 +1433,10 @@ void addVariablePointersGraphicsGroup (tcu::TestCaseGroup* testGroup)
                        fragments["pre_main"]                   = preMain.specialize(specs);
                        fragments["testfun"]                    = testFunction.specialize(specs);
 
-                       resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(inputAFloats))));
-                       resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(inputBFloats))));
-                       resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(inputSFloats))));
-                       resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(expectedOutput))));
+                       resources.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputAFloats)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                       resources.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputBFloats)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                       resources.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputSFloats)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                       resources.outputs.push_back(Resource(BufferSp(new Float32Buffer(expectedOutput)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
                        createTestsForAllStages(name.c_str(), defaultColors, defaultColors, fragments, resources, extensions, testGroup, requiredFeatures);
                }
                { // Test storing into Private variables.
@@ -1504,10 +1463,10 @@ void addVariablePointersGraphicsGroup (tcu::TestCaseGroup* testGroup)
                                fragments["pre_main"]                   = preMain.specialize(specs);
                                fragments["testfun"]                    = testFunction.specialize(specs);
 
-                               resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(inputAFloats))));
-                               resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(inputBFloats))));
-                               resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(inputSFloats))));
-                               resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(expectedOutput))));
+                               resources.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputAFloats)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                               resources.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputBFloats)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                               resources.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputSFloats)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                               resources.outputs.push_back(Resource(BufferSp(new Float32Buffer(expectedOutput)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
                                createTestsForAllStages(name.c_str(), defaultColors, defaultColors, fragments, resources, extensions, testGroup, requiredFeatures);
                        }
                }
@@ -1539,10 +1498,10 @@ void addVariablePointersGraphicsGroup (tcu::TestCaseGroup* testGroup)
                        fragments["testfun"]                    = testFunction.specialize(specs);
                        fragments["capability"]                 = cap;
 
-                       resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(inputAFloats))));
-                       resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(inputBFloats))));
-                       resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(inputSFloats))));
-                       resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(expectedOutput))));
+                       resources.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputAFloats)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                       resources.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputBFloats)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                       resources.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputSFloats)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                       resources.outputs.push_back(Resource(BufferSp(new Float32Buffer(expectedOutput)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
                        createTestsForAllStages(name.c_str(), defaultColors, defaultColors, fragments, resources, extensions, testGroup, requiredFeatures);
                }
                {   // Variable Pointer Writes
@@ -1564,10 +1523,10 @@ void addVariablePointersGraphicsGroup (tcu::TestCaseGroup* testGroup)
                        fragments["pre_main"]                   = preMain.specialize(specs);
                        fragments["testfun"]                    = testFunction.specialize(specs);
 
-                       resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(inputAFloats))));
-                       resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(inputBFloats))));
-                       resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(inputSFloats))));
-                       resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(expectedIncrOutput))));
+                       resources.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputAFloats)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                       resources.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputBFloats)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                       resources.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputSFloats)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                       resources.outputs.push_back(Resource(BufferSp(new Float32Buffer(expectedIncrOutput)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
                        createTestsForAllStages(name.c_str(), defaultColors, defaultColors, fragments, resources, extensions, testGroup, requiredFeatures);
                }
        }
@@ -1873,8 +1832,8 @@ void addTwoInputBufferReadOnlyVariablePointersGraphicsGroup (tcu::TestCaseGroup*
                                fragments["decoration"]                 = decoration.specialize(specs);
                                fragments["pre_main"]                   = preMain.specialize(specs);
                                fragments["testfun"]                    = testFunction.specialize(specs);
-                               resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(inputA))));
-                               resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(inputB))));
+                               resources.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputA)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                               resources.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputB)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
                                getExpectedOutputColor(defaultColors, expectedColors, selectedInput[baseOffset]);
                                createTestsForAllStages(name.c_str(), defaultColors, expectedColors, fragments, resources, extensions, testGroup, requiredFeatures);
                        }
@@ -1896,8 +1855,8 @@ void addTwoInputBufferReadOnlyVariablePointersGraphicsGroup (tcu::TestCaseGroup*
                                fragments["decoration"]                 = decoration.specialize(specs);
                                fragments["pre_main"]                   = preMain.specialize(specs);
                                fragments["testfun"]                    = testFunction.specialize(specs);
-                               resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(inputA))));
-                               resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(inputB))));
+                               resources.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputA)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                               resources.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputB)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
                                getExpectedOutputColor(defaultColors, expectedColors, selectedInput[baseOffset]);
                                createTestsForAllStages(name.c_str(), defaultColors, expectedColors, fragments, resources, extensions, testGroup, requiredFeatures);
                        }
@@ -1929,8 +1888,8 @@ void addTwoInputBufferReadOnlyVariablePointersGraphicsGroup (tcu::TestCaseGroup*
                                fragments["decoration"]                 = decoration.specialize(specs);
                                fragments["pre_main"]                   = preMain.specialize(specs);
                                fragments["testfun"]                    = testFunction.specialize(specs);
-                               resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(inputA))));
-                               resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(inputB))));
+                               resources.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputA)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                               resources.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputB)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
                                getExpectedOutputColor(defaultColors, expectedColors, selectedInput[baseOffset]);
                                createTestsForAllStages(name.c_str(), defaultColors, expectedColors, fragments, resources, extensions, testGroup, requiredFeatures);
                        }
@@ -1956,8 +1915,8 @@ void addTwoInputBufferReadOnlyVariablePointersGraphicsGroup (tcu::TestCaseGroup*
                                fragments["decoration"]                 = decoration.specialize(specs);
                                fragments["pre_main"]                   = preMain.specialize(specs);
                                fragments["testfun"]                    = testFunction.specialize(specs);
-                               resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(inputA))));
-                               resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(inputB))));
+                               resources.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputA)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                               resources.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputB)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
                                getExpectedOutputColor(defaultColors, expectedColors, selectedInput[baseOffset]);
                                createTestsForAllStages(name.c_str(), defaultColors, expectedColors, fragments, resources, extensions, testGroup, requiredFeatures);
                        }
@@ -1980,8 +1939,8 @@ void addTwoInputBufferReadOnlyVariablePointersGraphicsGroup (tcu::TestCaseGroup*
                                fragments["decoration"]                 = decoration.specialize(specs);
                                fragments["pre_main"]                   = preMain.specialize(specs);
                                fragments["testfun"]                    = testFunction.specialize(specs);
-                               resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(inputA))));
-                               resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(inputB))));
+                               resources.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputA)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
+                               resources.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputB)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
                                getExpectedOutputColor(defaultColors, expectedColors, selectedInput[baseOffset]);
                                createTestsForAllStages(name.c_str(), defaultColors, expectedColors, fragments, resources, extensions, testGroup, requiredFeatures);
                        }
@@ -2280,7 +2239,7 @@ void addSingleInputBufferReadOnlyVariablePointersGraphicsGroup (tcu::TestCaseGro
                                fragments["decoration"]                 = decoration.specialize(specs);
                                fragments["pre_main"]                   = preMain.specialize(specs);
                                fragments["testfun"]                    = testFunction.specialize(specs);
-                               resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(inputBuffer))));
+                               resources.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputBuffer)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
                                getExpectedOutputColor(defaultColors, expectedColors, inputBuffer[baseOffset]);
                                createTestsForAllStages(name.c_str(), defaultColors, expectedColors, fragments, resources, extensions, testGroup, requiredFeatures);
                        }
@@ -2308,7 +2267,7 @@ void addSingleInputBufferReadOnlyVariablePointersGraphicsGroup (tcu::TestCaseGro
                                fragments["decoration"]                 = decoration.specialize(specs);
                                fragments["pre_main"]                   = preMain.specialize(specs);
                                fragments["testfun"]                    = testFunction.specialize(specs);
-                               resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(inputBuffer))));
+                               resources.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputBuffer)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
                                getExpectedOutputColor(defaultColors, expectedColors, inputBuffer[baseOffset]);
                                createTestsForAllStages(name.c_str(), defaultColors, expectedColors, fragments, resources, extensions, testGroup, requiredFeatures);
                        }
@@ -2346,7 +2305,7 @@ void addSingleInputBufferReadOnlyVariablePointersGraphicsGroup (tcu::TestCaseGro
                                fragments["decoration"]                 = decoration.specialize(specs);
                                fragments["pre_main"]                   = preMain.specialize(specs);
                                fragments["testfun"]                    = testFunction.specialize(specs);
-                               resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(inputBuffer))));
+                               resources.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputBuffer)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
                                getExpectedOutputColor(defaultColors, expectedColors, inputBuffer[baseOffset]);
                                createTestsForAllStages(name.c_str(), defaultColors, expectedColors, fragments, resources, extensions, testGroup, requiredFeatures);
                        }
@@ -2379,7 +2338,7 @@ void addSingleInputBufferReadOnlyVariablePointersGraphicsGroup (tcu::TestCaseGro
                                fragments["decoration"]                 = decoration.specialize(specs);
                                fragments["pre_main"]                   = preMain.specialize(specs);
                                fragments["testfun"]                    = testFunction.specialize(specs);
-                               resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(inputBuffer))));
+                               resources.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputBuffer)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
                                getExpectedOutputColor(defaultColors, expectedColors, inputBuffer[baseOffset]);
                                createTestsForAllStages(name.c_str(), defaultColors, expectedColors, fragments, resources, extensions, testGroup, requiredFeatures);
                        }
@@ -2408,7 +2367,7 @@ void addSingleInputBufferReadOnlyVariablePointersGraphicsGroup (tcu::TestCaseGro
                                fragments["decoration"]                 = decoration.specialize(specs);
                                fragments["pre_main"]                   = preMain.specialize(specs);
                                fragments["testfun"]                    = testFunction.specialize(specs);
-                               resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(inputBuffer))));
+                               resources.inputs.push_back(Resource(BufferSp(new Float32Buffer(inputBuffer)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
                                getExpectedOutputColor(defaultColors, expectedColors, inputBuffer[baseOffset]);
                                createTestsForAllStages(name.c_str(), defaultColors, expectedColors, fragments, resources, extensions, testGroup, requiredFeatures);
                        }
@@ -2501,7 +2460,7 @@ void addNullptrVariablePointersGraphicsGroup (tcu::TestCaseGroup* testGroup)
                fragments["decoration"]                 = decoration.specialize(specs);
                fragments["pre_main"]                   = preMain.specialize(specs);
                fragments["testfun"]                    = testFunction.specialize(specs);
-               resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(input))));
+               resources.inputs.push_back(Resource(BufferSp(new Float32Buffer(input)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
                createTestsForAllStages("opvariable_initialized_null", defaultColors, expectedColors, fragments, resources, extensions, testGroup, requiredFeatures);
        }
        // Use OpSelect to choose between nullptr and a valid pointer. Since we can't dereference nullptr,
@@ -2514,7 +2473,7 @@ void addNullptrVariablePointersGraphicsGroup (tcu::TestCaseGroup* testGroup)
                fragments["decoration"]                 = decoration.specialize(specs);
                fragments["pre_main"]                   = preMain.specialize(specs);
                fragments["testfun"]                    = testFunction.specialize(specs);
-               resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Float32Buffer(input))));
+               resources.inputs.push_back(Resource(BufferSp(new Float32Buffer(input)), VK_DESCRIPTOR_TYPE_STORAGE_BUFFER));
                createTestsForAllStages("opselect_null_or_valid_ptr", defaultColors, expectedColors, fragments, resources, extensions, testGroup, requiredFeatures);
        }
 }