Validation fixes in dEQP-VK.pipeline
authorMaciej Jesionowski <maciej.jesionowski@mobica.com>
Fri, 8 Apr 2016 09:17:04 +0000 (11:17 +0200)
committerMaciej Jesionowski <maciej.jesionowski@mobica.com>
Wed, 13 Apr 2016 10:10:48 +0000 (12:10 +0200)
- Corrected out of range minDepthBounds value
- Added missing image layout transitions
- timestamp, cache tests: pass data through geometry shader
- cache test: use correct initialLayout in attachment when starting
  a second render pass

external/vulkancts/modules/vulkan/pipeline/vktPipelineBlendTests.cpp
external/vulkancts/modules/vulkan/pipeline/vktPipelineCacheTests.cpp
external/vulkancts/modules/vulkan/pipeline/vktPipelineDepthTests.cpp
external/vulkancts/modules/vulkan/pipeline/vktPipelineImageSamplingInstance.cpp
external/vulkancts/modules/vulkan/pipeline/vktPipelineImageUtil.cpp
external/vulkancts/modules/vulkan/pipeline/vktPipelineInputAssemblyTests.cpp
external/vulkancts/modules/vulkan/pipeline/vktPipelineMultisampleTests.cpp
external/vulkancts/modules/vulkan/pipeline/vktPipelinePushConstantTests.cpp
external/vulkancts/modules/vulkan/pipeline/vktPipelineStencilTests.cpp
external/vulkancts/modules/vulkan/pipeline/vktPipelineTimestampTests.cpp
external/vulkancts/modules/vulkan/pipeline/vktPipelineVertexInputTests.cpp

index b92e355f966c8bec33d5e5b6e3e6a5979917e6b6..93ca41b2cd3088dcfb084a1dbd9ee9a0e8653a3c 100644 (file)
@@ -594,8 +594,8 @@ BlendTestInstance::BlendTestInstance (Context&                                                                      context,
                                0u,                                             // deUint32             writeMask;
                                0u                                              // deUint32             reference;
                        },
-                       -1.0f,                                                                                                          // float                        minDepthBounds;
-                       +1.0f                                                                                                           // float                        maxDepthBounds;
+                       0.0f,                                                                                                           // float                        minDepthBounds;
+                       1.0f                                                                                                            // float                        maxDepthBounds;
                };
 
                // The color blend attachment will be set up before creating the graphics pipeline.
@@ -735,9 +735,28 @@ BlendTestInstance::BlendTestInstance (Context&                                                                     context,
                        &attachmentClearValue                                                                   // const VkClearValue*  pClearValues;
                };
 
+               // Color image layout transition
+               const VkImageMemoryBarrier imageLayoutBarrier =
+               {
+                       VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,                                                                 // VkStructureType            sType;
+                       DE_NULL,                                                                                                                                // const void*                pNext;
+                       (VkAccessFlags)0,                                                                                                               // VkAccessFlags              srcAccessMask;
+                       VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT,                                                                   // VkAccessFlags              dstAccessMask;
+                       VK_IMAGE_LAYOUT_UNDEFINED,                                                                                              // VkImageLayout              oldLayout;
+                       VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,                                                               // VkImageLayout              newLayout;
+                       VK_QUEUE_FAMILY_IGNORED,                                                                                                // uint32_t                   srcQueueFamilyIndex;
+                       VK_QUEUE_FAMILY_IGNORED,                                                                                                // uint32_t                   dstQueueFamilyIndex;
+                       *m_colorImage,                                                                                                                  // VkImage                    image;
+                       { VK_IMAGE_ASPECT_COLOR_BIT, 0u, 1u, 0u, 1u }                                                   // VkImageSubresourceRange    subresourceRange;
+               };
+
                m_cmdBuffer = allocateCommandBuffer(vk, vkDevice, &cmdBufferAllocateInfo);
 
                VK_CHECK(vk.beginCommandBuffer(*m_cmdBuffer, &cmdBufferBeginInfo));
+
+               vk.cmdPipelineBarrier(*m_cmdBuffer, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, (VkDependencyFlags)0,
+                       0u, DE_NULL, 0u, DE_NULL, 1u, &imageLayoutBarrier);
+
                vk.cmdBeginRenderPass(*m_cmdBuffer, &renderPassBeginInfo, VK_SUBPASS_CONTENTS_INLINE);
 
                const VkDeviceSize quadOffset = (m_vertices.size() / BlendTest::QUAD_COUNT) * sizeof(Vertex4RGBA);
index b4f9c3bae924a81eaa5680ea34739b8210e9e534..031583c3ca4f31527beb00d402fa77ed727740ea 100644 (file)
@@ -397,8 +397,8 @@ Move<VkPipeline> SimpleGraphicsPipelineBuilder::buildPipeline (tcu::UVec2 render
                        0u,                     // deUint32     writeMask;
                        0u,                     // deUint32     reference;
                },
-               -1.0f,                                                      // float                                    minDepthBounds;
-               +1.0f,                                                      // float                                    maxDepthBounds;
+               0.0f,                                                      // float                                    minDepthBounds;
+               1.0f,                                                      // float                                    maxDepthBounds;
        };
 
        const VkPipelineTessellationStateCreateInfo* pTessCreateInfo = DE_NULL;
@@ -696,6 +696,7 @@ protected:
        de::MovePtr<Allocation>             m_depthImageAlloc;
        de::MovePtr<Allocation>             m_colorImageAlloc[PIPELINE_CACHE_NDX_COUNT];
        Move<VkImageView>                   m_depthAttachmentView;
+       VkImageMemoryBarrier                            m_imageLayoutBarriers[3];
 
        Move<VkBuffer>                      m_vertexBuffer;
        de::MovePtr<Allocation>                         m_vertexBufferMemory;
@@ -743,13 +744,16 @@ void GraphicsCacheTest::initPrograms (SourceCollections& programCollection) cons
                        case VK_SHADER_STAGE_GEOMETRY_BIT:
                                programCollection.glslSources.add("dummy_geo") << glu::GeometrySource(
                                        "#version 450 \n"
-                                       "layout (triangles) in;\n"
-                                       "layout (triangle_strip, max_vertices = 3) out;\n"
+                                       "layout(triangles) in;\n"
+                                       "layout(triangle_strip, max_vertices = 3) out;\n"
+                                       "layout(location = 0) in highp vec4 in_vtxColor[];\n"
+                                       "layout(location = 0) out highp vec4 vtxColor;\n"
                                        "void main (void)\n"
                                        "{\n"
                                        "  for(int ndx=0; ndx<3; ndx++)\n"
                                        "  {\n"
                                        "    gl_Position = gl_in[ndx].gl_Position;\n"
+                                       "    vtxColor    = in_vtxColor[ndx];\n"
                                        "    EmitVertex();\n"
                                        "  }\n"
                                        "  EndPrimitive();\n"
@@ -843,7 +847,7 @@ GraphicsCacheTestInstance::GraphicsCacheTestInstance (Context&              cont
                        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_UNDEFINED,                          // VkImageLayout                   initialLayout;
+                       VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,           // VkImageLayout                   initialLayout;
                        VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,           // VkImageLayout                   finalLayout;
                };
 
@@ -856,7 +860,7 @@ GraphicsCacheTestInstance::GraphicsCacheTestInstance (Context&              cont
                        VK_ATTACHMENT_STORE_OP_DONT_CARE,                   // VkAttachmentStoreOp          storeOp;
                        VK_ATTACHMENT_LOAD_OP_DONT_CARE,                    // VkAttachmentLoadOp           stencilLoadOp;
                        VK_ATTACHMENT_STORE_OP_DONT_CARE,                   // VkAttachmentStoreOp          stencilStoreOp;
-                       VK_IMAGE_LAYOUT_UNDEFINED,                          // VkImageLayout                initialLayout;
+                       VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL,   // VkImageLayout                initialLayout;
                        VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL,   // VkImageLayout                finalLayout;
                };
 
@@ -938,6 +942,43 @@ GraphicsCacheTestInstance::GraphicsCacheTestInstance (Context&              cont
                                                                                                  &m_depthImageAlloc);
        }
 
+       // Set up image layout transition barriers
+       {
+               VkImageMemoryBarrier colorImageBarrier =
+               {
+                       VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,                         // VkStructureType                      sType;
+                       DE_NULL,                                                                                        // const void*                          pNext;
+                       0u,                                                                                                     // VkAccessFlags                        srcAccessMask;
+                       VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT,                           // VkAccessFlags                        dstAccessMask;
+                       VK_IMAGE_LAYOUT_UNDEFINED,                                                      // VkImageLayout                        oldLayout;
+                       VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,                       // VkImageLayout                        newLayout;
+                       VK_QUEUE_FAMILY_IGNORED,                                                        // deUint32                                     srcQueueFamilyIndex;
+                       VK_QUEUE_FAMILY_IGNORED,                                                        // deUint32                                     dstQueueFamilyIndex;
+                       *m_colorImage[PIPELINE_CACHE_NDX_NO_CACHE],                     // VkImage                                      image;
+                       { VK_IMAGE_ASPECT_COLOR_BIT, 0u, 1u, 0u, 1u },          // VkImageSubresourceRange      subresourceRange;
+               };
+
+               m_imageLayoutBarriers[0] = colorImageBarrier;
+
+               colorImageBarrier.image = *m_colorImage[PIPELINE_CACHE_NDX_CACHED];
+               m_imageLayoutBarriers[1] = colorImageBarrier;
+
+               const VkImageMemoryBarrier depthImageBarrier =
+               {
+                       VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,                         // VkStructureType                      sType;
+                       DE_NULL,                                                                                        // const void*                          pNext;
+                       0u,                                                                                                     // VkAccessFlags                        srcAccessMask;
+                       VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT,           // VkAccessFlags                        dstAccessMask;
+                       VK_IMAGE_LAYOUT_UNDEFINED,                                                      // VkImageLayout                        oldLayout;
+                       VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL,       // VkImageLayout                        newLayout;
+                       VK_QUEUE_FAMILY_IGNORED,                                                        // deUint32                                     srcQueueFamilyIndex;
+                       VK_QUEUE_FAMILY_IGNORED,                                                        // deUint32                                     dstQueueFamilyIndex;
+                       *m_depthImage,                                                                          // VkImage                                      image;
+                       { VK_IMAGE_ASPECT_DEPTH_BIT, 0u, 1u, 0u, 1u },          // VkImageSubresourceRange      subresourceRange;
+               };
+
+               m_imageLayoutBarriers[2] = depthImageBarrier;
+       }
        // Create color attachment view
        {
                VkImageViewCreateInfo colorAttachmentViewParams =
@@ -1105,8 +1146,13 @@ void GraphicsCacheTestInstance::prepareCommandBuffer (void)
 
        VK_CHECK(vk.beginCommandBuffer(*m_cmdBuffer, &cmdBufferBeginInfo));
 
+       vk.cmdPipelineBarrier(*m_cmdBuffer, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, (VkDependencyFlags)0,
+               0u, DE_NULL, 0u, DE_NULL, DE_LENGTH_OF_ARRAY(m_imageLayoutBarriers), m_imageLayoutBarriers);
+
        prepareRenderPass(*m_framebuffer[PIPELINE_CACHE_NDX_NO_CACHE], *m_pipeline[PIPELINE_CACHE_NDX_NO_CACHE]);
 
+       // After the first render pass, the images are in correct layouts
+
        prepareRenderPass(*m_framebuffer[PIPELINE_CACHE_NDX_CACHED], *m_pipeline[PIPELINE_CACHE_NDX_CACHED]);
 
        VK_CHECK(vk.endCommandBuffer(*m_cmdBuffer));
index 4c50283a372c1e2aaf0c38096ec6c9ebb211d8b4..62b3012feef82f1de48a3c53d91d3018afb261af 100644 (file)
@@ -35,6 +35,7 @@
 #include "vkQueryUtil.hpp"
 #include "vkRef.hpp"
 #include "vkRefUtil.hpp"
+#include "vkTypeUtil.hpp"
 #include "tcuImageCompare.hpp"
 #include "deUniquePtr.hpp"
 #include "deStringUtil.hpp"
@@ -140,6 +141,7 @@ private:
        const tcu::UVec2                                        m_renderSize;
        const VkFormat                                          m_colorFormat;
        const VkFormat                                          m_depthFormat;
+       VkImageSubresourceRange                         m_depthImageSubresourceRange;
 
        Move<VkImage>                                           m_colorImage;
        de::MovePtr<Allocation>                         m_colorImageAlloc;
@@ -292,6 +294,10 @@ DepthTestInstance::DepthTestInstance (Context&                             context,
                // Allocate and bind depth image memory
                m_depthImageAlloc = memAlloc.allocate(getImageMemoryRequirements(vk, vkDevice, *m_depthImage), MemoryRequirement::Any);
                VK_CHECK(vk.bindImageMemory(vkDevice, *m_depthImage, m_depthImageAlloc->getMemory(), m_depthImageAlloc->getOffset()));
+
+               const VkImageAspectFlags aspect = (mapVkFormat(m_depthFormat).order == tcu::TextureFormat::DS ? VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT
+                                                                                                                                                                                                         : VK_IMAGE_ASPECT_DEPTH_BIT);
+               m_depthImageSubresourceRange    = makeImageSubresourceRange(aspect, 0u, depthImageParams.mipLevels, 0u, depthImageParams.arrayLayers);
        }
 
        // Create color attachment view
@@ -322,7 +328,7 @@ DepthTestInstance::DepthTestInstance (Context&                              context,
                        VK_IMAGE_VIEW_TYPE_2D,                                                  // VkImageViewType                      viewType;
                        m_depthFormat,                                                                  // VkFormat                                     format;
                        componentMappingRGBA,                                                   // VkComponentMapping           components;
-                       { VK_IMAGE_ASPECT_DEPTH_BIT, 0u, 1u, 0u, 1u }   // VkImageSubresourceRange      subresourceRange;
+                       m_depthImageSubresourceRange,                                   // VkImageSubresourceRange      subresourceRange;
                };
 
                m_depthAttachmentView = createImageView(vk, vkDevice, &depthAttachmentViewParams);
@@ -624,8 +630,8 @@ DepthTestInstance::DepthTestInstance (Context&                              context,
                                0u,                                             // deUint32             writeMask;
                                0u,                                             // deUint32             reference;
                        },
-                       -1.0f,                                                                                                          // float                        minDepthBounds;
-                       +1.0f,                                                                                                          // float                        maxDepthBounds;
+                       0.0f,                                                                                                           // float                        minDepthBounds;
+                       1.0f,                                                                                                           // float                        maxDepthBounds;
                };
 
                const VkGraphicsPipelineCreateInfo graphicsPipelineParams =
@@ -737,9 +743,43 @@ DepthTestInstance::DepthTestInstance (Context&                             context,
                        attachmentClearValues                                                                   // const VkClearValue*  pClearValues;
                };
 
+               const VkImageMemoryBarrier imageLayoutBarriers[] =
+               {
+                       // color image layout transition
+                       {
+                               VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,                                                                 // VkStructureType            sType;
+                               DE_NULL,                                                                                                                                // const void*                pNext;
+                               (VkAccessFlags)0,                                                                                                               // VkAccessFlags              srcAccessMask;
+                               VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT,                                                                   // VkAccessFlags              dstAccessMask;
+                               VK_IMAGE_LAYOUT_UNDEFINED,                                                                                              // VkImageLayout              oldLayout;
+                               VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,                                                               // VkImageLayout              newLayout;
+                               VK_QUEUE_FAMILY_IGNORED,                                                                                                // uint32_t                   srcQueueFamilyIndex;
+                               VK_QUEUE_FAMILY_IGNORED,                                                                                                // uint32_t                   dstQueueFamilyIndex;
+                               *m_colorImage,                                                                                                                  // VkImage                    image;
+                               { VK_IMAGE_ASPECT_COLOR_BIT, 0u, 1u, 0u, 1u }                                                   // VkImageSubresourceRange    subresourceRange;
+                       },
+                       // depth image layout transition
+                       {
+                               VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,                                                                 // VkStructureType            sType;
+                               DE_NULL,                                                                                                                                // const void*                pNext;
+                               (VkAccessFlags)0,                                                                                                               // VkAccessFlags              srcAccessMask;
+                               VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT,                                                   // VkAccessFlags              dstAccessMask;
+                               VK_IMAGE_LAYOUT_UNDEFINED,                                                                                              // VkImageLayout              oldLayout;
+                               VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL,                                               // VkImageLayout              newLayout;
+                               VK_QUEUE_FAMILY_IGNORED,                                                                                                // uint32_t                   srcQueueFamilyIndex;
+                               VK_QUEUE_FAMILY_IGNORED,                                                                                                // uint32_t                   dstQueueFamilyIndex;
+                               *m_depthImage,                                                                                                                  // VkImage                    image;
+                               m_depthImageSubresourceRange,                                                                                   // VkImageSubresourceRange    subresourceRange;
+                       },
+               };
+
                m_cmdBuffer = allocateCommandBuffer(vk, vkDevice, &cmdBufferAllocateInfo);
 
                VK_CHECK(vk.beginCommandBuffer(*m_cmdBuffer, &cmdBufferBeginInfo));
+
+               vk.cmdPipelineBarrier(*m_cmdBuffer, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, (VkDependencyFlags)0,
+                       0u, DE_NULL, 0u, DE_NULL, DE_LENGTH_OF_ARRAY(imageLayoutBarriers), imageLayoutBarriers);
+
                vk.cmdBeginRenderPass(*m_cmdBuffer, &renderPassBeginInfo, VK_SUBPASS_CONTENTS_INLINE);
 
                const VkDeviceSize              quadOffset              = (m_vertices.size() / DepthTest::QUAD_COUNT) * sizeof(Vertex4RGBA);
index 166b5e8185315114d2b358be840ecf8f24f76809..f7730a43a21b29226a6021f7c53bf7d559a20838 100644 (file)
@@ -785,8 +785,8 @@ ImageSamplingInstance::ImageSamplingInstance (Context&                                                      context,
                                0u,                                             // deUint32             writeMask;
                                0u                                              // deUint32             reference;
                        },
-                       -1.0f,                                                                                                          // float                        minDepthBounds;
-                       +1.0f                                                                                                           // float                        maxDepthBounds;
+                       0.0f,                                                                                                           // float                        minDepthBounds;
+                       1.0f                                                                                                            // float                        maxDepthBounds;
                };
 
                const VkGraphicsPipelineCreateInfo graphicsPipelineParams =
@@ -890,9 +890,27 @@ ImageSamplingInstance::ImageSamplingInstance (Context&                                                     context,
                        &attachmentClearValue                                                                   // const VkClearValue*  pClearValues;
                };
 
+               const VkImageMemoryBarrier preAttachmentBarrier =
+               {
+                       VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,                 // VkStructureType                      sType;
+                       DE_NULL,                                                                                // const void*                          pNext;
+                       0u,                                                                                             // VkAccessFlags                        srcAccessMask;
+                       VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT,                   // VkAccessFlags                        dstAccessMask;
+                       VK_IMAGE_LAYOUT_UNDEFINED,                                              // VkImageLayout                        oldLayout;
+                       VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,               // VkImageLayout                        newLayout;
+                       VK_QUEUE_FAMILY_IGNORED,                                                // deUint32                                     srcQueueFamilyIndex;
+                       VK_QUEUE_FAMILY_IGNORED,                                                // deUint32                                     dstQueueFamilyIndex;
+                       *m_colorImage,                                                                  // VkImage                                      image;
+                       { VK_IMAGE_ASPECT_COLOR_BIT, 0u, 1u, 0u, 1u }   // VkImageSubresourceRange      subresourceRange;
+               };
+
                m_cmdBuffer = allocateCommandBuffer(vk, vkDevice, &cmdBufferAllocateInfo);
 
                VK_CHECK(vk.beginCommandBuffer(*m_cmdBuffer, &cmdBufferBeginInfo));
+
+               vk.cmdPipelineBarrier(*m_cmdBuffer, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, (VkDependencyFlags)0,
+                       0u, DE_NULL, 0u, DE_NULL, 1u, &preAttachmentBarrier);
+
                vk.cmdBeginRenderPass(*m_cmdBuffer, &renderPassBeginInfo, VK_SUBPASS_CONTENTS_INLINE);
 
                vk.cmdBindPipeline(*m_cmdBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, *m_graphicsPipeline);
index 5d473d951db61915f9a6f4a0105f8dd1098dd1eb..26362583833e729378a6739ccf3ac44e68d909ba 100644 (file)
@@ -414,7 +414,7 @@ void uploadTestTexture (const DeviceInterface&                      vk,
                VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,                 // VkStructureType                      sType;
                DE_NULL,                                                                                // const void*                          pNext;
                0u,                                                                                             // VkAccessFlags                        srcAccessMask;
-               0u,                                                                                             // VkAccessFlags                        dstAccessMask;
+               VK_ACCESS_TRANSFER_WRITE_BIT,                                   // VkAccessFlags                        dstAccessMask;
                VK_IMAGE_LAYOUT_UNDEFINED,                                              // VkImageLayout                        oldLayout;
                VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,                   // VkImageLayout                        newLayout;
                VK_QUEUE_FAMILY_IGNORED,                                                // deUint32                                     srcQueueFamilyIndex;
index 8afbb5e2fb039728177e8550407a61602506fcb4..61f5e40c62bf65950b77fb2e1238e9174d3b4c53 100644 (file)
@@ -1253,8 +1253,8 @@ InputAssemblyInstance::InputAssemblyInstance (Context&                                                    context,
                                0u,                                             // deUint32             writeMask;
                                0u,                                             // deUint32             reference;
                        },
-                       -1.0f,                                                                                                          // float                        minDepthBounds;
-                       +1.0f                                                                                                           // float                        maxDepthBounds;
+                       0.0f,                                                                                                           // float                        minDepthBounds;
+                       1.0f                                                                                                            // float                        maxDepthBounds;
                };
 
                const VkGraphicsPipelineCreateInfo graphicsPipelineParams =
@@ -1399,9 +1399,27 @@ InputAssemblyInstance::InputAssemblyInstance (Context&                                                   context,
                        &attachmentClearValue                                                                   // const VkClearValue*  pClearValues;
                };
 
+               const VkImageMemoryBarrier attachmentLayoutBarrier =
+               {
+                       VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,                 // VkStructureType                      sType;
+                       DE_NULL,                                                                                // const void*                          pNext;
+                       0u,                                                                                             // VkAccessFlags                        srcAccessMask;
+                       VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT,                   // VkAccessFlags                        dstAccessMask;
+                       VK_IMAGE_LAYOUT_UNDEFINED,                                              // VkImageLayout                        oldLayout;
+                       VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,               // VkImageLayout                        newLayout;
+                       VK_QUEUE_FAMILY_IGNORED,                                                // deUint32                                     srcQueueFamilyIndex;
+                       VK_QUEUE_FAMILY_IGNORED,                                                // deUint32                                     dstQueueFamilyIndex;
+                       *m_colorImage,                                                                  // VkImage                                      image;
+                       { VK_IMAGE_ASPECT_COLOR_BIT, 0u, 1u, 0u, 1u },  // VkImageSubresourceRange      subresourceRange;
+               };
+
                m_cmdBuffer = allocateCommandBuffer(vk, vkDevice, &cmdBufferAllocateInfo);
 
                VK_CHECK(vk.beginCommandBuffer(*m_cmdBuffer, &cmdBufferBeginInfo));
+
+               vk.cmdPipelineBarrier(*m_cmdBuffer, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, (VkDependencyFlags)0,
+                       0u, DE_NULL, 0u, DE_NULL, 1u, &attachmentLayoutBarrier);
+
                vk.cmdBeginRenderPass(*m_cmdBuffer, &renderPassBeginInfo, VK_SUBPASS_CONTENTS_INLINE);
 
                const VkDeviceSize vertexBufferOffset = 0;
index b744a4ebd5ee879858eb94060140bff0517f25ff..aadec96dc1a9c7a6d617114590d67e230996e85f 100644 (file)
@@ -1644,8 +1644,8 @@ MultisampleRenderer::MultisampleRenderer (Context&                                                                                context,
                                0u,                                             // deUint32             writeMask;
                                0u,                                             // deUint32             reference;
                        },
-                       -1.0f,                                                                                                          // float                        minDepthBounds;
-                       +1.0f,                                                                                                          // float                        maxDepthBounds;
+                       0.0f,                                                                                                           // float                        minDepthBounds;
+                       1.0f,                                                                                                           // float                        maxDepthBounds;
                };
 
                const VkGraphicsPipelineCreateInfo graphicsPipelineParams =
@@ -1756,9 +1756,43 @@ MultisampleRenderer::MultisampleRenderer (Context&                                                                               context,
                        clearValues                                                                                             // const VkClearValue*  pClearValues;
                };
 
+               const VkImageMemoryBarrier imageLayoutBarriers[] =
+               {
+                       // color attachment image
+                       {
+                               VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,                 // VkStructureType                      sType;
+                               DE_NULL,                                                                                // const void*                          pNext;
+                               0u,                                                                                             // VkAccessFlags                        srcAccessMask;
+                               VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT,                   // VkAccessFlags                        dstAccessMask;
+                               VK_IMAGE_LAYOUT_UNDEFINED,                                              // VkImageLayout                        oldLayout;
+                               VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,               // VkImageLayout                        newLayout;
+                               VK_QUEUE_FAMILY_IGNORED,                                                // deUint32                                     srcQueueFamilyIndex;
+                               VK_QUEUE_FAMILY_IGNORED,                                                // deUint32                                     dstQueueFamilyIndex;
+                               *m_colorImage,                                                                  // VkImage                                      image;
+                               { VK_IMAGE_ASPECT_COLOR_BIT, 0u, 1u, 0u, 1u },  // VkImageSubresourceRange      subresourceRange;
+                       },
+                       // resolve attachment image
+                       {
+                               VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,                 // VkStructureType                      sType;
+                               DE_NULL,                                                                                // const void*                          pNext;
+                               0u,                                                                                             // VkAccessFlags                        srcAccessMask;
+                               VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT,                   // VkAccessFlags                        dstAccessMask;
+                               VK_IMAGE_LAYOUT_UNDEFINED,                                              // VkImageLayout                        oldLayout;
+                               VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,               // VkImageLayout                        newLayout;
+                               VK_QUEUE_FAMILY_IGNORED,                                                // deUint32                                     srcQueueFamilyIndex;
+                               VK_QUEUE_FAMILY_IGNORED,                                                // deUint32                                     dstQueueFamilyIndex;
+                               *m_resolveImage,                                                                // VkImage                                      image;
+                               { VK_IMAGE_ASPECT_COLOR_BIT, 0u, 1u, 0u, 1u },  // VkImageSubresourceRange      subresourceRange;
+                       },
+               };
+
                m_cmdBuffer = allocateCommandBuffer(vk, vkDevice, &cmdBufferAllocateInfo);
 
                VK_CHECK(vk.beginCommandBuffer(*m_cmdBuffer, &cmdBufferBeginInfo));
+
+               vk.cmdPipelineBarrier(*m_cmdBuffer, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, (VkDependencyFlags)0,
+                       0u, DE_NULL, 0u, DE_NULL, DE_LENGTH_OF_ARRAY(imageLayoutBarriers), imageLayoutBarriers);
+
                vk.cmdBeginRenderPass(*m_cmdBuffer, &renderPassBeginInfo, VK_SUBPASS_CONTENTS_INLINE);
 
                VkDeviceSize vertexBufferOffset = 0u;
index 5b670b7027f4004c53f8e583ad00a15fdf1bd07d..1e3e9676e6738995f1ec38e37484be11d5e01d93 100644 (file)
@@ -874,8 +874,8 @@ PushConstantGraphicsTestInstance::PushConstantGraphicsTestInstance (Context&
                                0u,                                             // deUint32             stencilWriteMask;
                                0u,                                             // deUint32             stencilReference;
                        },
-                       -1.0f,                                                                                                          // float                        minDepthBounds;
-                       +1.0f,                                                                                                          // float                        maxDepthBounds;
+                       0.0f,                                                                                                           // float                        minDepthBounds;
+                       1.0f,                                                                                                           // float                        maxDepthBounds;
                };
 
                const VkPipelineTessellationStateCreateInfo tessellationStateParams =
@@ -985,9 +985,27 @@ PushConstantGraphicsTestInstance::PushConstantGraphicsTestInstance (Context&
                        attachmentClearValues                                                                   // const VkClearValue*  pClearValues;
                };
 
+               const VkImageMemoryBarrier attachmentLayoutBarrier =
+               {
+                       VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,                 // VkStructureType                      sType;
+                       DE_NULL,                                                                                // const void*                          pNext;
+                       0u,                                                                                             // VkAccessFlags                        srcAccessMask;
+                       VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT,                   // VkAccessFlags                        dstAccessMask;
+                       VK_IMAGE_LAYOUT_UNDEFINED,                                              // VkImageLayout                        oldLayout;
+                       VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,               // VkImageLayout                        newLayout;
+                       VK_QUEUE_FAMILY_IGNORED,                                                // deUint32                                     srcQueueFamilyIndex;
+                       VK_QUEUE_FAMILY_IGNORED,                                                // deUint32                                     dstQueueFamilyIndex;
+                       *m_colorImage,                                                                  // VkImage                                      image;
+                       { VK_IMAGE_ASPECT_COLOR_BIT, 0u, 1u, 0u, 1u },  // VkImageSubresourceRange      subresourceRange;
+               };
+
                m_cmdBuffer = allocateCommandBuffer(vk, vkDevice, &cmdBufferAllocateInfo);
 
                VK_CHECK(vk.beginCommandBuffer(*m_cmdBuffer, &cmdBufferBeginInfo));
+
+               vk.cmdPipelineBarrier(*m_cmdBuffer, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, (VkDependencyFlags)0,
+                       0u, DE_NULL, 0u, DE_NULL, 1u, &attachmentLayoutBarrier);
+
                vk.cmdBeginRenderPass(*m_cmdBuffer, &renderPassBeginInfo, VK_SUBPASS_CONTENTS_INLINE);
 
                // update push constant
index ef405e82124815d2ec4314c3322f7eff669f2295..87a3a15a93f7271224892fa2412f10128883f015 100644 (file)
@@ -35,6 +35,7 @@
 #include "vkQueryUtil.hpp"
 #include "vkRef.hpp"
 #include "vkRefUtil.hpp"
+#include "vkTypeUtil.hpp"
 #include "tcuImageCompare.hpp"
 #include "deMemory.h"
 #include "deRandom.hpp"
@@ -143,6 +144,7 @@ private:
        const tcu::UVec2                                        m_renderSize;
        const VkFormat                                          m_colorFormat;
        const VkFormat                                          m_stencilFormat;
+       VkImageSubresourceRange                         m_stencilImageSubresourceRange;
 
        VkImageCreateInfo                                       m_colorImageCreateInfo;
        Move<VkImage>                                           m_colorImage;
@@ -379,6 +381,10 @@ StencilTestInstance::StencilTestInstance (Context&                                 context,
                // Allocate and bind stencil image memory
                m_stencilImageAlloc = memAlloc.allocate(getImageMemoryRequirements(vk, vkDevice, *m_stencilImage), MemoryRequirement::Any);
                VK_CHECK(vk.bindImageMemory(vkDevice, *m_stencilImage, m_stencilImageAlloc->getMemory(), m_stencilImageAlloc->getOffset()));
+
+               const VkImageAspectFlags aspect = (mapVkFormat(m_stencilFormat).order == tcu::TextureFormat::DS ? VK_IMAGE_ASPECT_STENCIL_BIT | VK_IMAGE_ASPECT_DEPTH_BIT
+                                                                                                                                                                                                               : VK_IMAGE_ASPECT_STENCIL_BIT);
+               m_stencilImageSubresourceRange  = makeImageSubresourceRange(aspect, 0u, stencilImageParams.mipLevels, 0u, stencilImageParams.arrayLayers);
        }
 
        // Create color attachment view
@@ -409,7 +415,7 @@ StencilTestInstance::StencilTestInstance (Context&                                  context,
                        VK_IMAGE_VIEW_TYPE_2D,                                                          // VkImageViewType                      viewType;
                        m_stencilFormat,                                                                        // VkFormat                                     format;
                        componentMappingRGBA,                                                           // VkComponentMapping           components;
-                       { VK_IMAGE_ASPECT_STENCIL_BIT, 0u, 1u, 0u, 1u },        // VkImageSubresourceRange      subresourceRange;
+                       m_stencilImageSubresourceRange,                                         // VkImageSubresourceRange      subresourceRange;
                };
 
                m_stencilAttachmentView = createImageView(vk, vkDevice, &stencilAttachmentViewParams);
@@ -689,8 +695,8 @@ StencilTestInstance::StencilTestInstance (Context&                                  context,
                        true,                                                                                                           // VkBool32                                                                     stencilTestEnable;
                        m_stencilOpStateFront,                                                                          // VkStencilOpState                                                     front;
                        m_stencilOpStateBack,                                                                           // VkStencilOpState                                                     back;
-                       -1.0f,                                                                                                          // float                                                                        minDepthBounds;
-                       +1.0f                                                                                                           // float                                                                        maxDepthBounds;
+                       0.0f,                                                                                                           // float                                                                        minDepthBounds;
+                       1.0f                                                                                                            // float                                                                        maxDepthBounds;
                };
 
                const VkGraphicsPipelineCreateInfo graphicsPipelineParams =
@@ -825,9 +831,43 @@ StencilTestInstance::StencilTestInstance (Context&                                 context,
                        attachmentClearValues                                                                   // const VkClearValue*  pClearValues;
                };
 
+               const VkImageMemoryBarrier imageLayoutBarriers[] =
+               {
+                       // color image layout transition
+                       {
+                               VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,                                                                 // VkStructureType            sType;
+                               DE_NULL,                                                                                                                                // const void*                pNext;
+                               (VkAccessFlags)0,                                                                                                               // VkAccessFlags              srcAccessMask;
+                               VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT,                                                                   // VkAccessFlags              dstAccessMask;
+                               VK_IMAGE_LAYOUT_UNDEFINED,                                                                                              // VkImageLayout              oldLayout;
+                               VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,                                                               // VkImageLayout              newLayout;
+                               VK_QUEUE_FAMILY_IGNORED,                                                                                                // uint32_t                   srcQueueFamilyIndex;
+                               VK_QUEUE_FAMILY_IGNORED,                                                                                                // uint32_t                   dstQueueFamilyIndex;
+                               *m_colorImage,                                                                                                                  // VkImage                    image;
+                               { VK_IMAGE_ASPECT_COLOR_BIT, 0u, 1u, 0u, 1u }                                                   // VkImageSubresourceRange    subresourceRange;
+                       },
+                       // stencil image layout transition
+                       {
+                               VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,                                                                 // VkStructureType            sType;
+                               DE_NULL,                                                                                                                                // const void*                pNext;
+                               (VkAccessFlags)0,                                                                                                               // VkAccessFlags              srcAccessMask;
+                               VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT,                                                   // VkAccessFlags              dstAccessMask;
+                               VK_IMAGE_LAYOUT_UNDEFINED,                                                                                              // VkImageLayout              oldLayout;
+                               VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL,                                               // VkImageLayout              newLayout;
+                               VK_QUEUE_FAMILY_IGNORED,                                                                                                // uint32_t                   srcQueueFamilyIndex;
+                               VK_QUEUE_FAMILY_IGNORED,                                                                                                // uint32_t                   dstQueueFamilyIndex;
+                               *m_stencilImage,                                                                                                                // VkImage                    image;
+                               m_stencilImageSubresourceRange,                                                                                 // VkImageSubresourceRange    subresourceRange;
+                       },
+               };
+
                m_cmdBuffer = allocateCommandBuffer(vk, vkDevice, &cmdBufferAllocateInfo);
 
                VK_CHECK(vk.beginCommandBuffer(*m_cmdBuffer, &cmdBufferBeginInfo));
+
+               vk.cmdPipelineBarrier(*m_cmdBuffer, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, (VkDependencyFlags)0,
+                       0u, DE_NULL, 0u, DE_NULL, DE_LENGTH_OF_ARRAY(imageLayoutBarriers), imageLayoutBarriers);
+
                vk.cmdBeginRenderPass(*m_cmdBuffer, &renderPassBeginInfo, VK_SUBPASS_CONTENTS_INLINE);
 
                const VkDeviceSize              quadOffset              = (m_vertices.size() / StencilTest::QUAD_COUNT) * sizeof(Vertex4RGBA);
index 53a6c2778e35f67cacd2c17ff77c976ed96de8bf..744c84aac8fcc50620269be9892c0c4b36be513d 100644 (file)
@@ -543,8 +543,8 @@ Move<VkPipeline> SimpleGraphicsPipelineBuilder::buildPipeline(tcu::UVec2 renderS
                        0u,                     // deUint32     writeMask;
                        0u,                     // deUint32     reference;
                },
-               -1.0f,                                                      // float                                    minDepthBounds;
-               +1.0f,                                                      // float                                    maxDepthBounds;
+               0.0f,                                                      // float                                    minDepthBounds;
+               1.0f,                                                      // float                                    maxDepthBounds;
        };
 
        const VkPipelineTessellationStateCreateInfo*    pTessCreateInfo         = DE_NULL;
@@ -983,6 +983,7 @@ protected:
        Move<VkImageView>                   m_depthAttachmentView;
        Move<VkRenderPass>                  m_renderPass;
        Move<VkFramebuffer>                 m_framebuffer;
+       VkImageMemoryBarrier                            m_imageLayoutBarriers[2];
 
        de::MovePtr<Allocation>             m_vertexBufferAlloc;
        Move<VkBuffer>                      m_vertexBuffer;
@@ -1145,6 +1146,39 @@ void BasicGraphicsTestInstance::buildFrameBuffer(tcu::UVec2 renderSize, VkFormat
                                                                                                  &m_depthImageAlloc);
        }
 
+       // Set up image layout transition barriers
+       {
+               const VkImageMemoryBarrier colorImageBarrier =
+               {
+                       VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,                         // VkStructureType                      sType;
+                       DE_NULL,                                                                                        // const void*                          pNext;
+                       0u,                                                                                                     // VkAccessFlags                        srcAccessMask;
+                       VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT,                           // VkAccessFlags                        dstAccessMask;
+                       VK_IMAGE_LAYOUT_UNDEFINED,                                                      // VkImageLayout                        oldLayout;
+                       VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,                       // VkImageLayout                        newLayout;
+                       VK_QUEUE_FAMILY_IGNORED,                                                        // deUint32                                     srcQueueFamilyIndex;
+                       VK_QUEUE_FAMILY_IGNORED,                                                        // deUint32                                     dstQueueFamilyIndex;
+                       *m_colorImage,                                                                          // VkImage                                      image;
+                       { VK_IMAGE_ASPECT_COLOR_BIT, 0u, 1u, 0u, 1u },          // VkImageSubresourceRange      subresourceRange;
+               };
+               const VkImageMemoryBarrier depthImageBarrier =
+               {
+                       VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,                         // VkStructureType                      sType;
+                       DE_NULL,                                                                                        // const void*                          pNext;
+                       0u,                                                                                                     // VkAccessFlags                        srcAccessMask;
+                       VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT,           // VkAccessFlags                        dstAccessMask;
+                       VK_IMAGE_LAYOUT_UNDEFINED,                                                      // VkImageLayout                        oldLayout;
+                       VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL,       // VkImageLayout                        newLayout;
+                       VK_QUEUE_FAMILY_IGNORED,                                                        // deUint32                                     srcQueueFamilyIndex;
+                       VK_QUEUE_FAMILY_IGNORED,                                                        // deUint32                                     dstQueueFamilyIndex;
+                       *m_depthImage,                                                                          // VkImage                                      image;
+                       { VK_IMAGE_ASPECT_DEPTH_BIT, 0u, 1u, 0u, 1u },          // VkImageSubresourceRange      subresourceRange;
+               };
+
+               m_imageLayoutBarriers[0] = colorImageBarrier;
+               m_imageLayoutBarriers[1] = depthImageBarrier;
+       }
+
        // Create color attachment view
        {
                const VkImageViewCreateInfo colorAttachmentViewParams =
@@ -1262,6 +1296,9 @@ void BasicGraphicsTestInstance::configCommandBuffer(void)
 
        VK_CHECK(vk.beginCommandBuffer(*m_cmdBuffer, &cmdBufferBeginInfo));
 
+       vk.cmdPipelineBarrier(*m_cmdBuffer, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, (VkDependencyFlags)0,
+               0u, DE_NULL, 0u, DE_NULL, DE_LENGTH_OF_ARRAY(m_imageLayoutBarriers), m_imageLayoutBarriers);
+
        vk.cmdResetQueryPool(*m_cmdBuffer, *m_queryPool, 0u, TimestampTest::ENTRY_COUNT);
 
        vk.cmdBeginRenderPass(*m_cmdBuffer, &renderPassBeginInfo, VK_SUBPASS_CONTENTS_INLINE);
@@ -1331,13 +1368,16 @@ void AdvGraphicsTest::initPrograms(SourceCollections& programCollection) const
 
        programCollection.glslSources.add("dummy_geo") << glu::GeometrySource(
                "#version 450 \n"
-               "layout (triangles) in;\n"
-               "layout (triangle_strip, max_vertices = 3) out;\n"
+               "layout(triangles) in;\n"
+               "layout(triangle_strip, max_vertices = 3) out;\n"
+               "layout(location = 0) in highp vec4 in_vtxColor[];\n"
+               "layout(location = 0) out highp vec4 vtxColor;\n"
                "void main (void)\n"
                "{\n"
                "  for(int ndx=0; ndx<3; ndx++)\n"
                "  {\n"
                "    gl_Position = gl_in[ndx].gl_Position;\n"
+               "    vtxColor    = in_vtxColor[ndx];\n"
                "    EmitVertex();\n"
                "  }\n"
                "  EndPrimitive();\n"
@@ -1508,6 +1548,9 @@ void AdvGraphicsTestInstance::configCommandBuffer(void)
 
        VK_CHECK(vk.beginCommandBuffer(*m_cmdBuffer, &cmdBufferBeginInfo));
 
+       vk.cmdPipelineBarrier(*m_cmdBuffer, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, (VkDependencyFlags)0,
+               0u, DE_NULL, 0u, DE_NULL, DE_LENGTH_OF_ARRAY(m_imageLayoutBarriers), m_imageLayoutBarriers);
+
        vk.cmdResetQueryPool(*m_cmdBuffer, *m_queryPool, 0u, TimestampTest::ENTRY_COUNT);
 
        vk.cmdBeginRenderPass(*m_cmdBuffer, &renderPassBeginInfo, VK_SUBPASS_CONTENTS_INLINE);
index c5c25077cb426037a108ae8285b00443d5e761ad..167860e3a65314c8233d9f3b8f94b06bb9212964 100644 (file)
@@ -948,8 +948,8 @@ VertexInputInstance::VertexInputInstance (Context&                                                                                          context,
                                0u,                                             // deUint32             writeMask;
                                0u,                                             // deUint32             reference;
                        },
-                       -1.0f,                                                                                                          // float                        minDepthBounds;
-                       +1.0f,                                                                                                          // float                        maxDepthBounds;
+                       0.0f,                                                                                                           // float                        minDepthBounds;
+                       1.0f,                                                                                                           // float                        maxDepthBounds;
                };
 
                const VkGraphicsPipelineCreateInfo graphicsPipelineParams =
@@ -1053,9 +1053,27 @@ VertexInputInstance::VertexInputInstance (Context&                                                                                               context,
                        &attachmentClearValue                                                                   // const VkClearValue*  pClearValues;
                };
 
+               const VkImageMemoryBarrier attachmentLayoutBarrier =
+               {
+                       VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,                 // VkStructureType                      sType;
+                       DE_NULL,                                                                                // const void*                          pNext;
+                       0u,                                                                                             // VkAccessFlags                        srcAccessMask;
+                       VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT,                   // VkAccessFlags                        dstAccessMask;
+                       VK_IMAGE_LAYOUT_UNDEFINED,                                              // VkImageLayout                        oldLayout;
+                       VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,               // VkImageLayout                        newLayout;
+                       VK_QUEUE_FAMILY_IGNORED,                                                // deUint32                                     srcQueueFamilyIndex;
+                       VK_QUEUE_FAMILY_IGNORED,                                                // deUint32                                     dstQueueFamilyIndex;
+                       *m_colorImage,                                                                  // VkImage                                      image;
+                       { VK_IMAGE_ASPECT_COLOR_BIT, 0u, 1u, 0u, 1u },  // VkImageSubresourceRange      subresourceRange;
+               };
+
                m_cmdBuffer = allocateCommandBuffer(vk, vkDevice, &cmdBufferAllocateInfo);
 
                VK_CHECK(vk.beginCommandBuffer(*m_cmdBuffer, &cmdBufferBeginInfo));
+
+               vk.cmdPipelineBarrier(*m_cmdBuffer, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, (VkDependencyFlags)0,
+                       0u, DE_NULL, 0u, DE_NULL, 1u, &attachmentLayoutBarrier);
+
                vk.cmdBeginRenderPass(*m_cmdBuffer, &renderPassBeginInfo, VK_SUBPASS_CONTENTS_INLINE);
 
                vk.cmdBindPipeline(*m_cmdBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, *m_graphicsPipeline);