Add create functions for common Vulkan types.
[platform/upstream/VK-GL-CTS.git] / external / vulkancts / modules / vulkan / sparse_resources / vktSparseResourcesShaderIntrinsicsBase.cpp
index 4f5ff4b..1f73b6c 100644 (file)
@@ -55,6 +55,34 @@ std::string getOpTypeImageComponent (const tcu::TextureFormat& format)
        }
 }
 
+std::string getImageComponentTypeName (const tcu::TextureFormat& format)
+{
+       switch (tcu::getTextureChannelClass(format.type))
+       {
+               case tcu::TEXTURECHANNELCLASS_UNSIGNED_INTEGER:
+                       return "%type_uint";
+               case tcu::TEXTURECHANNELCLASS_SIGNED_INTEGER:
+                       return "%type_int";
+               default:
+                       DE_ASSERT(0);
+                       return "";
+       }
+}
+
+std::string getImageComponentVec4TypeName (const tcu::TextureFormat& format)
+{
+       switch (tcu::getTextureChannelClass(format.type))
+       {
+               case tcu::TEXTURECHANNELCLASS_UNSIGNED_INTEGER:
+                       return "%type_uvec4";
+               case tcu::TEXTURECHANNELCLASS_SIGNED_INTEGER:
+                       return "%type_ivec4";
+               default:
+                       DE_ASSERT(0);
+                       return "";
+       }
+}
+
 std::string getOpTypeImageSparse (const ImageType                      imageType,
                                                                  const tcu::TextureFormat&     format,
                                                                  const std::string&            componentType,
@@ -260,7 +288,7 @@ tcu::TestStatus SparseShaderIntrinsicsInstanceBase::iterate (void)
        const Unique<VkImage> imageSparse(createImage(deviceInterface, getDevice(), &imageSparseInfo));
 
        // Create sparse image memory bind semaphore
-       const Unique<VkSemaphore> memoryBindSemaphore(makeSemaphore(deviceInterface, getDevice()));
+       const Unique<VkSemaphore> memoryBindSemaphore(createSemaphore(deviceInterface, getDevice()));
 
        const deUint32                    imageSparseSizeInBytes                = getImageSizeInBytes(imageSparseInfo.extent, imageSparseInfo.arrayLayers, m_format, imageSparseInfo.mipLevels, BUFFER_IMAGE_COPY_OFFSET_GRANULARITY);
        const deUint32                    imageSizeInPixels                             = getImageSizeInBytes(imageSparseInfo.extent, imageSparseInfo.arrayLayers, m_format, imageSparseInfo.mipLevels) / tcu::getPixelSize(m_format);
@@ -444,7 +472,7 @@ tcu::TestStatus SparseShaderIntrinsicsInstanceBase::iterate (void)
 
        // Create command buffer for compute and transfer oparations
        const Unique<VkCommandPool>       commandPool(makeCommandPool(deviceInterface, getDevice(), extractQueue.queueFamilyIndex));
-       const Unique<VkCommandBuffer> commandBuffer(makeCommandBuffer(deviceInterface, getDevice(), *commandPool));
+       const Unique<VkCommandBuffer> commandBuffer(allocateCommandBuffer(deviceInterface, getDevice(), *commandPool, VK_COMMAND_BUFFER_LEVEL_PRIMARY));
 
        std::vector <VkBufferImageCopy> bufferImageSparseCopy(imageSparseInfo.mipLevels);