VK_KHR_dedicated_allocation: Extend pipeline.image
[platform/upstream/VK-GL-CTS.git] / external / vulkancts / modules / vulkan / pipeline / vktPipelineSpecConstantUtil.cpp
index 7549257..0e70995 100644 (file)
@@ -29,355 +29,8 @@ namespace vkt
 {
 namespace pipeline
 {
-
 using namespace vk;
 
-VkBufferCreateInfo makeBufferCreateInfo (const VkDeviceSize                    bufferSize,
-                                                                                const VkBufferUsageFlags       usage)
-{
-       const VkBufferCreateInfo bufferCreateInfo =
-       {
-               VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,   // VkStructureType              sType;
-               DE_NULL,                                                                // const void*                  pNext;
-               (VkBufferCreateFlags)0,                                 // VkBufferCreateFlags  flags;
-               bufferSize,                                                             // VkDeviceSize                 size;
-               usage,                                                                  // VkBufferUsageFlags   usage;
-               VK_SHARING_MODE_EXCLUSIVE,                              // VkSharingMode                sharingMode;
-               0u,                                                                             // deUint32                             queueFamilyIndexCount;
-               DE_NULL,                                                                // const deUint32*              pQueueFamilyIndices;
-       };
-       return bufferCreateInfo;
-}
-
-VkBufferMemoryBarrier makeBufferMemoryBarrier (const VkAccessFlags     srcAccessMask,
-                                                                                          const VkAccessFlags  dstAccessMask,
-                                                                                          const VkBuffer               buffer,
-                                                                                          const VkDeviceSize   offset,
-                                                                                          const VkDeviceSize   bufferSizeBytes)
-{
-       const VkBufferMemoryBarrier barrier =
-       {
-               VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER,        // VkStructureType      sType;
-               DE_NULL,                                                                        // const void*          pNext;
-               srcAccessMask,                                                          // VkAccessFlags        srcAccessMask;
-               dstAccessMask,                                                          // VkAccessFlags        dstAccessMask;
-               VK_QUEUE_FAMILY_IGNORED,                                        // deUint32                     srcQueueFamilyIndex;
-               VK_QUEUE_FAMILY_IGNORED,                                        // deUint32                     destQueueFamilyIndex;
-               buffer,                                                                         // VkBuffer                     buffer;
-               offset,                                                                         // VkDeviceSize         offset;
-               bufferSizeBytes,                                                        // VkDeviceSize         size;
-       };
-       return barrier;
-}
-
-VkImageMemoryBarrier makeImageMemoryBarrier    (const VkAccessFlags                    srcAccessMask,
-                                                                                        const VkAccessFlags                    dstAccessMask,
-                                                                                        const VkImageLayout                    oldLayout,
-                                                                                        const VkImageLayout                    newLayout,
-                                                                                        const VkImage                                  image,
-                                                                                        const VkImageSubresourceRange  subresourceRange)
-{
-       const VkImageMemoryBarrier barrier =
-       {
-               VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,                 // VkStructureType                      sType;
-               DE_NULL,                                                                                // const void*                          pNext;
-               srcAccessMask,                                                                  // VkAccessFlags                        outputMask;
-               dstAccessMask,                                                                  // VkAccessFlags                        inputMask;
-               oldLayout,                                                                              // VkImageLayout                        oldLayout;
-               newLayout,                                                                              // VkImageLayout                        newLayout;
-               VK_QUEUE_FAMILY_IGNORED,                                                // deUint32                                     srcQueueFamilyIndex;
-               VK_QUEUE_FAMILY_IGNORED,                                                // deUint32                                     destQueueFamilyIndex;
-               image,                                                                                  // VkImage                                      image;
-               subresourceRange,                                                               // VkImageSubresourceRange      subresourceRange;
-       };
-       return barrier;
-}
-
-Move<VkCommandPool> makeCommandPool (const DeviceInterface& vk, const VkDevice device, const deUint32 queueFamilyIndex)
-{
-       const VkCommandPoolCreateInfo info =
-       {
-               VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO,                     // VkStructureType                      sType;
-               DE_NULL,                                                                                        // const void*                          pNext;
-               VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT,        // VkCommandPoolCreateFlags     flags;
-               queueFamilyIndex,                                                                       // deUint32                                     queueFamilyIndex;
-       };
-       return createCommandPool(vk, device, &info);
-}
-
-Move<VkCommandBuffer> makeCommandBuffer (const DeviceInterface& vk, const VkDevice device, const VkCommandPool commandPool)
-{
-       const VkCommandBufferAllocateInfo info =
-       {
-               VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO,         // VkStructureType              sType;
-               DE_NULL,                                                                                        // const void*                  pNext;
-               commandPool,                                                                            // VkCommandPool                commandPool;
-               VK_COMMAND_BUFFER_LEVEL_PRIMARY,                                        // VkCommandBufferLevel level;
-               1u,                                                                                                     // deUint32                             commandBufferCount;
-       };
-       return allocateCommandBuffer(vk, device, &info);
-}
-
-Move<VkDescriptorSet> makeDescriptorSet (const DeviceInterface&                        vk,
-                                                                                const VkDevice                                 device,
-                                                                                const VkDescriptorPool                 descriptorPool,
-                                                                                const VkDescriptorSetLayout    setLayout)
-{
-       const VkDescriptorSetAllocateInfo info =
-       {
-               VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO,         // VkStructureType                              sType;
-               DE_NULL,                                                                                        // const void*                                  pNext;
-               descriptorPool,                                                                         // VkDescriptorPool                             descriptorPool;
-               1u,                                                                                                     // deUint32                                             descriptorSetCount;
-               &setLayout,                                                                                     // const VkDescriptorSetLayout* pSetLayouts;
-       };
-       return allocateDescriptorSet(vk, device, &info);
-}
-
-Move<VkPipelineLayout> makePipelineLayout (const DeviceInterface&              vk,
-                                                                                  const VkDevice                               device,
-                                                                                  const VkDescriptorSetLayout  descriptorSetLayout)
-{
-       const VkPipelineLayoutCreateInfo info =
-       {
-               VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO,          // VkStructureType                              sType;
-               DE_NULL,                                                                                        // const void*                                  pNext;
-               (VkPipelineLayoutCreateFlags)0,                                         // VkPipelineLayoutCreateFlags  flags;
-               1u,                                                                                                     // deUint32                                             setLayoutCount;
-               &descriptorSetLayout,                                                           // const VkDescriptorSetLayout* pSetLayouts;
-               0u,                                                                                                     // deUint32                                             pushConstantRangeCount;
-               DE_NULL,                                                                                        // const VkPushConstantRange*   pPushConstantRanges;
-       };
-       return createPipelineLayout(vk, device, &info);
-}
-
-Move<VkPipeline> makeComputePipeline (const DeviceInterface&           vk,
-                                                                         const VkDevice                                device,
-                                                                         const VkPipelineLayout                pipelineLayout,
-                                                                         const VkShaderModule                  shaderModule,
-                                                                         const VkSpecializationInfo*   specInfo)
-{
-       const VkPipelineShaderStageCreateInfo shaderStageInfo =
-       {
-               VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO,    // VkStructureType                                      sType;
-               DE_NULL,                                                                                                // const void*                                          pNext;
-               (VkPipelineShaderStageCreateFlags)0,                                    // VkPipelineShaderStageCreateFlags     flags;
-               VK_SHADER_STAGE_COMPUTE_BIT,                                                    // VkShaderStageFlagBits                        stage;
-               shaderModule,                                                                                   // VkShaderModule                                       module;
-               "main",                                                                                                 // const char*                                          pName;
-               specInfo,                                                                                               // const VkSpecializationInfo*          pSpecializationInfo;
-       };
-       const VkComputePipelineCreateInfo pipelineInfo =
-       {
-               VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO,         // VkStructureType                                      sType;
-               DE_NULL,                                                                                        // const void*                                          pNext;
-               (VkPipelineCreateFlags)0,                                                       // VkPipelineCreateFlags                        flags;
-               shaderStageInfo,                                                                        // VkPipelineShaderStageCreateInfo      stage;
-               pipelineLayout,                                                                         // VkPipelineLayout                                     layout;
-               DE_NULL,                                                                                        // VkPipeline                                           basePipelineHandle;
-               0,                                                                                                      // deInt32                                                      basePipelineIndex;
-       };
-       return createComputePipeline(vk, device, DE_NULL , &pipelineInfo);
-}
-
-VkImageCreateInfo makeImageCreateInfo (const tcu::IVec2& size, const VkFormat format, const VkImageUsageFlags usage)
-{
-       const VkImageCreateInfo imageInfo =
-       {
-               VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,            // VkStructureType          sType;
-               DE_NULL,                                                                        // const void*              pNext;
-               (VkImageCreateFlags)0,                                          // VkImageCreateFlags       flags;
-               VK_IMAGE_TYPE_2D,                                                       // VkImageType              imageType;
-               format,                                                                         // VkFormat                 format;
-               makeExtent3D(size.x(), size.y(), 1),            // VkExtent3D               extent;
-               1u,                                                                                     // uint32_t                 mipLevels;
-               1u,                                                                                     // uint32_t                 arrayLayers;
-               VK_SAMPLE_COUNT_1_BIT,                                          // VkSampleCountFlagBits    samples;
-               VK_IMAGE_TILING_OPTIMAL,                                        // VkImageTiling            tiling;
-               usage,                                                                          // VkImageUsageFlags        usage;
-               VK_SHARING_MODE_EXCLUSIVE,                                      // VkSharingMode            sharingMode;
-               0u,                                                                                     // uint32_t                 queueFamilyIndexCount;
-               DE_NULL,                                                                        // const uint32_t*          pQueueFamilyIndices;
-               VK_IMAGE_LAYOUT_UNDEFINED,                                      // VkImageLayout            initialLayout;
-       };
-       return imageInfo;
-}
-
-Move<VkImageView> makeImageView (const DeviceInterface&                        vk,
-                                                                const VkDevice                                 vkDevice,
-                                                                const VkImage                                  image,
-                                                                const VkImageViewType                  viewType,
-                                                                const VkFormat                                 format)
-{
-       const VkImageViewCreateInfo imageViewParams =
-       {
-               VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,               // VkStructureType                      sType;
-               DE_NULL,                                                                                // const void*                          pNext;
-               (VkImageViewCreateFlags)0,                                              // VkImageViewCreateFlags       flags;
-               image,                                                                                  // VkImage                                      image;
-               viewType,                                                                               // VkImageViewType                      viewType;
-               format,                                                                                 // VkFormat                                     format;
-               makeComponentMappingRGBA(),                                             // VkComponentMapping           components;
-               makeImageSubresourceRange(VK_IMAGE_ASPECT_COLOR_BIT, 0u, 1u, 0u, 1u),   // VkImageSubresourceRange      subresourceRange;
-       };
-       return createImageView(vk, vkDevice, &imageViewParams);
-}
-
-void beginCommandBuffer (const DeviceInterface& vk, const VkCommandBuffer commandBuffer)
-{
-       const VkCommandBufferBeginInfo info =
-       {
-               VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO,    // VkStructureType                          sType;
-               DE_NULL,                                                                                // const void*                              pNext;
-               VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT,    // VkCommandBufferUsageFlags                flags;
-               DE_NULL,                                                                                // const VkCommandBufferInheritanceInfo*    pInheritanceInfo;
-       };
-       VK_CHECK(vk.beginCommandBuffer(commandBuffer, &info));
-}
-
-void endCommandBuffer (const DeviceInterface& vk, const VkCommandBuffer commandBuffer)
-{
-       VK_CHECK(vk.endCommandBuffer(commandBuffer));
-}
-
-void submitCommandsAndWait (const DeviceInterface&     vk,
-                                                       const VkDevice                  device,
-                                                       const VkQueue                   queue,
-                                                       const VkCommandBuffer   commandBuffer)
-{
-       const VkFenceCreateInfo fenceInfo =
-       {
-               VK_STRUCTURE_TYPE_FENCE_CREATE_INFO,    // VkStructureType              sType;
-               DE_NULL,                                                                // const void*                  pNext;
-               (VkFenceCreateFlags)0,                                  // VkFenceCreateFlags   flags;
-       };
-       const Unique<VkFence> fence(createFence(vk, device, &fenceInfo));
-
-       const VkSubmitInfo submitInfo =
-       {
-               VK_STRUCTURE_TYPE_SUBMIT_INFO,          // VkStructureType                sType;
-               DE_NULL,                                                        // const void*                    pNext;
-               0u,                                                                     // uint32_t                       waitSemaphoreCount;
-               DE_NULL,                                                        // const VkSemaphore*             pWaitSemaphores;
-               DE_NULL,                                                        // const VkPipelineStageFlags*    pWaitDstStageMask;
-               1u,                                                                     // uint32_t                       commandBufferCount;
-               &commandBuffer,                                         // const VkCommandBuffer*         pCommandBuffers;
-               0u,                                                                     // uint32_t                       signalSemaphoreCount;
-               DE_NULL,                                                        // const VkSemaphore*             pSignalSemaphores;
-       };
-       VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo, *fence));
-       VK_CHECK(vk.waitForFences(device, 1u, &fence.get(), DE_TRUE, ~0ull));
-}
-
-void beginRenderPass (const DeviceInterface&   vk,
-                                         const VkCommandBuffer         commandBuffer,
-                                         const VkRenderPass            renderPass,
-                                         const VkFramebuffer           framebuffer,
-                                         const VkRect2D&                       renderArea,
-                                         const tcu::Vec4&                      clearColor)
-{
-       const VkClearValue clearValue = makeClearValueColor(clearColor);
-
-       const VkRenderPassBeginInfo renderPassBeginInfo = {
-               VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO,               // VkStructureType         sType;
-               DE_NULL,                                                                                // const void*             pNext;
-               renderPass,                                                                             // VkRenderPass            renderPass;
-               framebuffer,                                                                    // VkFramebuffer           framebuffer;
-               renderArea,                                                                             // VkRect2D                renderArea;
-               1u,                                                                                             // uint32_t                clearValueCount;
-               &clearValue,                                                                    // const VkClearValue*     pClearValues;
-       };
-
-       vk.cmdBeginRenderPass(commandBuffer, &renderPassBeginInfo, VK_SUBPASS_CONTENTS_INLINE);
-}
-
-void endRenderPass (const DeviceInterface&     vk,
-                                       const VkCommandBuffer   commandBuffer)
-{
-       vk.cmdEndRenderPass(commandBuffer);
-}
-
-Move<VkRenderPass> makeRenderPass (const DeviceInterface&      vk,
-                                                                  const VkDevice                       device,
-                                                                  const VkFormat                       colorFormat)
-{
-       const VkAttachmentDescription colorAttachmentDescription =
-       {
-               (VkAttachmentDescriptionFlags)0,                                        // VkAttachmentDescriptionFlags         flags;
-               colorFormat,                                                                            // VkFormat                                                     format;
-               VK_SAMPLE_COUNT_1_BIT,                                                          // VkSampleCountFlagBits                        samples;
-               VK_ATTACHMENT_LOAD_OP_CLEAR,                                            // VkAttachmentLoadOp                           loadOp;
-               VK_ATTACHMENT_STORE_OP_STORE,                                           // VkAttachmentStoreOp                          storeOp;
-               VK_ATTACHMENT_LOAD_OP_DONT_CARE,                                        // VkAttachmentLoadOp                           stencilLoadOp;
-               VK_ATTACHMENT_STORE_OP_DONT_CARE,                                       // VkAttachmentStoreOp                          stencilStoreOp;
-               VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,                       // VkImageLayout                                        initialLayout;
-               VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL                        // VkImageLayout                                        finalLayout;
-       };
-
-       const VkAttachmentReference colorAttachmentReference =
-       {
-               0u,                                                                                                     // deUint32                     attachment;
-               VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL                        // VkImageLayout        layout;
-       };
-
-       const VkAttachmentReference depthAttachmentReference =
-       {
-               VK_ATTACHMENT_UNUSED,                                                           // deUint32                     attachment;
-               VK_IMAGE_LAYOUT_UNDEFINED                                                       // VkImageLayout        layout;
-       };
-
-       const VkSubpassDescription subpassDescription =
-       {
-               (VkSubpassDescriptionFlags)0,                                           // VkSubpassDescriptionFlags            flags;
-               VK_PIPELINE_BIND_POINT_GRAPHICS,                                        // VkPipelineBindPoint                          pipelineBindPoint;
-               0u,                                                                                                     // deUint32                                                     inputAttachmentCount;
-               DE_NULL,                                                                                        // const VkAttachmentReference*         pInputAttachments;
-               1u,                                                                                                     // deUint32                                                     colorAttachmentCount;
-               &colorAttachmentReference,                                                      // const VkAttachmentReference*         pColorAttachments;
-               DE_NULL,                                                                                        // const VkAttachmentReference*         pResolveAttachments;
-               &depthAttachmentReference,                                                      // const VkAttachmentReference*         pDepthStencilAttachment;
-               0u,                                                                                                     // deUint32                                                     preserveAttachmentCount;
-               DE_NULL                                                                                         // const deUint32*                                      pPreserveAttachments;
-       };
-
-       const VkRenderPassCreateInfo renderPassInfo =
-       {
-               VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO,                      // VkStructureType                                      sType;
-               DE_NULL,                                                                                        // const void*                                          pNext;
-               (VkRenderPassCreateFlags)0,                                                     // VkRenderPassCreateFlags                      flags;
-               1u,                                                                                                     // deUint32                                                     attachmentCount;
-               &colorAttachmentDescription,                                            // const VkAttachmentDescription*       pAttachments;
-               1u,                                                                                                     // deUint32                                                     subpassCount;
-               &subpassDescription,                                                            // const VkSubpassDescription*          pSubpasses;
-               0u,                                                                                                     // deUint32                                                     dependencyCount;
-               DE_NULL                                                                                         // const VkSubpassDependency*           pDependencies;
-       };
-
-       return createRenderPass(vk, device, &renderPassInfo);
-}
-
-Move<VkFramebuffer> makeFramebuffer (const DeviceInterface&            vk,
-                                                                        const VkDevice                         device,
-                                                                        const VkRenderPass                     renderPass,
-                                                                        const VkImageView                      colorAttachment,
-                                                                        const deUint32                         width,
-                                                                        const deUint32                         height)
-{
-       const VkFramebufferCreateInfo framebufferInfo = {
-               VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO,              // VkStructureType                             sType;
-               DE_NULL,                                                                                // const void*                                 pNext;
-               (VkFramebufferCreateFlags)0,                                    // VkFramebufferCreateFlags                    flags;
-               renderPass,                                                                             // VkRenderPass                                renderPass;
-               1u,                                                                                             // uint32_t                                    attachmentCount;
-               &colorAttachment,                                                               // const VkImageView*                          pAttachments;
-               width,                                                                                  // uint32_t                                    width;
-               height,                                                                                 // uint32_t                                    height;
-               1u,                                                                                             // uint32_t                                    layers;
-       };
-
-       return createFramebuffer(vk, device, &framebufferInfo);
-}
-
 GraphicsPipelineBuilder& GraphicsPipelineBuilder::setShader (const DeviceInterface&                    vk,
                                                                                                                         const VkDevice                                 device,
                                                                                                                         const VkShaderStageFlagBits    stage,
@@ -615,6 +268,110 @@ Move<VkPipeline> GraphicsPipelineBuilder::build (const DeviceInterface&   vk,
        return createGraphicsPipeline(vk, device, DE_NULL, &graphicsPipelineInfo);
 }
 
+Move<VkRenderPass> makeRenderPass (const DeviceInterface&      vk,
+                                                                  const VkDevice                       device,
+                                                                  const VkFormat                       colorFormat)
+{
+       const VkAttachmentDescription colorAttachmentDescription =
+       {
+               (VkAttachmentDescriptionFlags)0,                                        // VkAttachmentDescriptionFlags         flags;
+               colorFormat,                                                                            // VkFormat                                                     format;
+               VK_SAMPLE_COUNT_1_BIT,                                                          // VkSampleCountFlagBits                        samples;
+               VK_ATTACHMENT_LOAD_OP_CLEAR,                                            // VkAttachmentLoadOp                           loadOp;
+               VK_ATTACHMENT_STORE_OP_STORE,                                           // VkAttachmentStoreOp                          storeOp;
+               VK_ATTACHMENT_LOAD_OP_DONT_CARE,                                        // VkAttachmentLoadOp                           stencilLoadOp;
+               VK_ATTACHMENT_STORE_OP_DONT_CARE,                                       // VkAttachmentStoreOp                          stencilStoreOp;
+               VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,                       // VkImageLayout                                        initialLayout;
+               VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL                        // VkImageLayout                                        finalLayout;
+       };
+
+       const VkAttachmentReference colorAttachmentReference =
+       {
+               0u,                                                                                                     // deUint32                     attachment;
+               VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL                        // VkImageLayout        layout;
+       };
+
+       const VkAttachmentReference depthAttachmentReference =
+       {
+               VK_ATTACHMENT_UNUSED,                                                           // deUint32                     attachment;
+               VK_IMAGE_LAYOUT_UNDEFINED                                                       // VkImageLayout        layout;
+       };
+
+       const VkSubpassDescription subpassDescription =
+       {
+               (VkSubpassDescriptionFlags)0,                                           // VkSubpassDescriptionFlags            flags;
+               VK_PIPELINE_BIND_POINT_GRAPHICS,                                        // VkPipelineBindPoint                          pipelineBindPoint;
+               0u,                                                                                                     // deUint32                                                     inputAttachmentCount;
+               DE_NULL,                                                                                        // const VkAttachmentReference*         pInputAttachments;
+               1u,                                                                                                     // deUint32                                                     colorAttachmentCount;
+               &colorAttachmentReference,                                                      // const VkAttachmentReference*         pColorAttachments;
+               DE_NULL,                                                                                        // const VkAttachmentReference*         pResolveAttachments;
+               &depthAttachmentReference,                                                      // const VkAttachmentReference*         pDepthStencilAttachment;
+               0u,                                                                                                     // deUint32                                                     preserveAttachmentCount;
+               DE_NULL                                                                                         // const deUint32*                                      pPreserveAttachments;
+       };
+
+       const VkRenderPassCreateInfo renderPassInfo =
+       {
+               VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO,                      // VkStructureType                                      sType;
+               DE_NULL,                                                                                        // const void*                                          pNext;
+               (VkRenderPassCreateFlags)0,                                                     // VkRenderPassCreateFlags                      flags;
+               1u,                                                                                                     // deUint32                                                     attachmentCount;
+               &colorAttachmentDescription,                                            // const VkAttachmentDescription*       pAttachments;
+               1u,                                                                                                     // deUint32                                                     subpassCount;
+               &subpassDescription,                                                            // const VkSubpassDescription*          pSubpasses;
+               0u,                                                                                                     // deUint32                                                     dependencyCount;
+               DE_NULL                                                                                         // const VkSubpassDependency*           pDependencies;
+       };
+
+       return createRenderPass(vk, device, &renderPassInfo);
+}
+
+void beginRenderPass (const DeviceInterface&   vk,
+                                         const VkCommandBuffer         commandBuffer,
+                                         const VkRenderPass            renderPass,
+                                         const VkFramebuffer           framebuffer,
+                                         const VkRect2D&                       renderArea,
+                                         const tcu::Vec4&                      clearColor)
+{
+       const VkClearValue clearValue = makeClearValueColor(clearColor);
+
+       const VkRenderPassBeginInfo renderPassBeginInfo = {
+               VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO,               // VkStructureType         sType;
+               DE_NULL,                                                                                // const void*             pNext;
+               renderPass,                                                                             // VkRenderPass            renderPass;
+               framebuffer,                                                                    // VkFramebuffer           framebuffer;
+               renderArea,                                                                             // VkRect2D                renderArea;
+               1u,                                                                                             // uint32_t                clearValueCount;
+               &clearValue,                                                                    // const VkClearValue*     pClearValues;
+       };
+
+       vk.cmdBeginRenderPass(commandBuffer, &renderPassBeginInfo, VK_SUBPASS_CONTENTS_INLINE);
+}
+
+VkImageCreateInfo makeImageCreateInfo (const tcu::IVec2& size, const VkFormat format, const VkImageUsageFlags usage)
+{
+       const VkImageCreateInfo imageInfo =
+       {
+               VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,            // VkStructureType          sType;
+               DE_NULL,                                                                        // const void*              pNext;
+               (VkImageCreateFlags)0,                                          // VkImageCreateFlags       flags;
+               VK_IMAGE_TYPE_2D,                                                       // VkImageType              imageType;
+               format,                                                                         // VkFormat                 format;
+               makeExtent3D(size.x(), size.y(), 1),            // VkExtent3D               extent;
+               1u,                                                                                     // uint32_t                 mipLevels;
+               1u,                                                                                     // uint32_t                 arrayLayers;
+               VK_SAMPLE_COUNT_1_BIT,                                          // VkSampleCountFlagBits    samples;
+               VK_IMAGE_TILING_OPTIMAL,                                        // VkImageTiling            tiling;
+               usage,                                                                          // VkImageUsageFlags        usage;
+               VK_SHARING_MODE_EXCLUSIVE,                                      // VkSharingMode            sharingMode;
+               0u,                                                                                     // uint32_t                 queueFamilyIndexCount;
+               DE_NULL,                                                                        // const uint32_t*          pQueueFamilyIndices;
+               VK_IMAGE_LAYOUT_UNDEFINED,                                      // VkImageLayout            initialLayout;
+       };
+       return imageInfo;
+}
+
 void requireFeatures (const InstanceInterface& vki, const VkPhysicalDevice physDevice, const FeatureFlags flags)
 {
        const VkPhysicalDeviceFeatures features = getPhysicalDeviceFeatures(vki, physDevice);