Added pipeline depth tests for Vulkan.
authorDae Kim <dae.kimpark@imgtec.com>
Wed, 2 Sep 2015 12:11:26 +0000 (13:11 +0100)
committerDae Kim <dae.kimpark@imgtec.com>
Wed, 2 Sep 2015 12:11:26 +0000 (13:11 +0100)
15 files changed:
external/vulkancts/modules/vulkan/CMakeLists.txt
external/vulkancts/modules/vulkan/pipeline/CMakeLists.txt [new file with mode: 0644]
external/vulkancts/modules/vulkan/pipeline/vktPipelineClearUtil.cpp [new file with mode: 0644]
external/vulkancts/modules/vulkan/pipeline/vktPipelineClearUtil.hpp [new file with mode: 0644]
external/vulkancts/modules/vulkan/pipeline/vktPipelineDepthTests.cpp [new file with mode: 0644]
external/vulkancts/modules/vulkan/pipeline/vktPipelineDepthTests.hpp [new file with mode: 0644]
external/vulkancts/modules/vulkan/pipeline/vktPipelineImageUtil.cpp [new file with mode: 0644]
external/vulkancts/modules/vulkan/pipeline/vktPipelineImageUtil.hpp [new file with mode: 0644]
external/vulkancts/modules/vulkan/pipeline/vktPipelineReferenceRenderer.cpp [new file with mode: 0644]
external/vulkancts/modules/vulkan/pipeline/vktPipelineReferenceRenderer.hpp [new file with mode: 0644]
external/vulkancts/modules/vulkan/pipeline/vktPipelineTests.cpp [new file with mode: 0644]
external/vulkancts/modules/vulkan/pipeline/vktPipelineTests.hpp [new file with mode: 0644]
external/vulkancts/modules/vulkan/pipeline/vktPipelineVertexUtil.cpp [new file with mode: 0644]
external/vulkancts/modules/vulkan/pipeline/vktPipelineVertexUtil.hpp [new file with mode: 0644]
external/vulkancts/modules/vulkan/vktTestPackage.cpp

index 9b79ced..cc4b7a8 100644 (file)
@@ -1,9 +1,11 @@
 # dEQP-VK
 
 add_subdirectory(api)
+add_subdirectory(pipeline)
 
 include_directories(
        api
+       pipeline
        )
 
 set(DEQP_VK_COMMON_SRCS
@@ -22,6 +24,7 @@ set(DEQP_VK_COMMON_LIBS
        vkutil
        glutil
        deqp-vk-api
+       deqp-vk-pipeline
        )
 
 if (DE_OS_IS_WIN32 OR DE_OS_IS_UNIX OR DE_OS_IS_OSX)
diff --git a/external/vulkancts/modules/vulkan/pipeline/CMakeLists.txt b/external/vulkancts/modules/vulkan/pipeline/CMakeLists.txt
new file mode 100644 (file)
index 0000000..c4f5547
--- /dev/null
@@ -0,0 +1,29 @@
+
+include_directories(
+       ..
+       )
+
+set(DEQP_VK_PIPELINE_SRCS
+       vktPipelineClearUtil.cpp
+       vktPipelineClearUtil.hpp
+       vktPipelineDepthTests.cpp
+       vktPipelineDepthTests.hpp
+       vktPipelineImageUtil.cpp
+       vktPipelineImageUtil.hpp
+       vktPipelineReferenceRenderer.cpp
+       vktPipelineReferenceRenderer.hpp
+       vktPipelineTests.cpp
+       vktPipelineTests.hpp
+       vktPipelineVertexUtil.cpp
+       vktPipelineVertexUtil.hpp
+       )
+
+set(DEQP_VK_PIPELINE_LIBS
+       tcutil
+       vkutil
+       referencerenderer
+       )
+
+add_library(deqp-vk-pipeline STATIC ${DEQP_VK_PIPELINE_SRCS})
+target_link_libraries(deqp-vk-pipeline ${DEQP_VK_PIPELINE_LIBS})
+
diff --git a/external/vulkancts/modules/vulkan/pipeline/vktPipelineClearUtil.cpp b/external/vulkancts/modules/vulkan/pipeline/vktPipelineClearUtil.cpp
new file mode 100644 (file)
index 0000000..de7ac1c
--- /dev/null
@@ -0,0 +1,142 @@
+/*------------------------------------------------------------------------
+ * Vulkan Conformance Tests
+ * ------------------------
+ *
+ * Copyright (c) 2015 The Khronos Group Inc.
+ * Copyright (c) 2015 Imagination Technologies Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and/or associated documentation files (the
+ * "Materials"), to deal in the Materials without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Materials, and to
+ * permit persons to whom the Materials are furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice(s) and this permission notice shall be included
+ * in all copies or substantial portions of the Materials.
+ *
+ * The Materials are Confidential Information as defined by the
+ * Khronos Membership Agreement until designated non-confidential by Khronos,
+ * at which point this condition clause shall be removed.
+ *
+ * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ *
+ *//*!
+ * \file
+ * \brief Utilities for clear values.
+ *//*--------------------------------------------------------------------*/
+
+#include "vktPipelineClearUtil.hpp"
+#include "vkImageUtil.hpp"
+#include "tcuTextureUtil.hpp"
+
+namespace vkt
+{
+namespace pipeline
+{
+
+using namespace vk;
+
+tcu::Vec4 defaultClearColorFloat (const tcu::TextureFormat& format)
+{
+       const tcu::TextureFormatInfo    formatInfo      = tcu::getTextureFormatInfo(format);
+       return (defaultClearColorUnorm() - formatInfo.lookupBias) / formatInfo.lookupScale;
+}
+
+tcu::IVec4 defaultClearColorInt (const tcu::TextureFormat& format)
+{
+       const tcu::TextureFormatInfo    formatInfo      = tcu::getTextureFormatInfo(format);
+       const tcu::Vec4                                 color           = (defaultClearColorUnorm() - formatInfo.lookupBias) / formatInfo.lookupScale;
+
+       const tcu::IVec4                                result          ((deInt32)deFloatRound(color.x()), (deInt32)deFloatRound(color.y()),
+                                                                                                (deInt32)deFloatRound(color.z()), (deInt32)deFloatRound(color.w()));
+
+       return result;
+}
+
+tcu::UVec4 defaultClearColorUint (const tcu::TextureFormat& format)
+{
+       const tcu::TextureFormatInfo    formatInfo      = tcu::getTextureFormatInfo(format);
+       const tcu::Vec4                                 color           = (defaultClearColorUnorm() - formatInfo.lookupBias) / formatInfo.lookupScale;
+
+       const   tcu::UVec4                              result          ((deUint32)deFloatRound(color.x()), (deUint32)deFloatRound(color.y()),
+                                                                                                (deUint32)deFloatRound(color.z()), (deUint32)deFloatRound(color.w()));
+
+       return result;
+}
+
+tcu::Vec4 defaultClearColorUnorm (void)
+{
+       return tcu::Vec4(0.39f, 0.58f, 0.93f, 1.0f);
+}
+
+float defaultClearDepth (void)
+{
+       return 1.0f;
+}
+
+deUint32 defaultClearStencil (void)
+{
+       return 0;
+}
+
+VkClearDepthStencilValue defaultClearDepthStencilValue (void)
+{
+       VkClearDepthStencilValue clearDepthStencilValue;
+       clearDepthStencilValue.depth    = defaultClearDepth();
+       clearDepthStencilValue.stencil  = defaultClearStencil();
+
+       return clearDepthStencilValue;
+}
+
+VkClearValue defaultClearValue (VkFormat clearFormat)
+{
+       VkClearValue clearValue;
+
+       if (isDepthStencilFormat(clearFormat))
+       {
+               const VkClearDepthStencilValue dsValue = defaultClearDepthStencilValue();
+               clearValue.ds.stencil   = dsValue.stencil;
+               clearValue.ds.depth             = dsValue.depth;
+       }
+       else
+       {
+               const tcu::TextureFormat tcuClearFormat = mapVkFormat(clearFormat);
+               if (isUintFormat(clearFormat))
+               {
+                       const tcu::UVec4 defaultColor   = defaultClearColorUint(tcuClearFormat);
+                       clearValue.color.u32[0]                 = defaultColor.x();
+                       clearValue.color.u32[1]                 = defaultColor.y();
+                       clearValue.color.u32[2]                 = defaultColor.z();
+                       clearValue.color.u32[3]                 = defaultColor.w();
+               }
+               else if (isIntFormat(clearFormat))
+               {
+                       const tcu::IVec4 defaultColor   = defaultClearColorInt(tcuClearFormat);
+                       clearValue.color.s32[0]                 = defaultColor.x();
+                       clearValue.color.s32[1]                 = defaultColor.y();
+                       clearValue.color.s32[2]                 = defaultColor.z();
+                       clearValue.color.s32[3]                 = defaultColor.w();
+               }
+               else
+               {
+                       const tcu::Vec4 defaultColor    = defaultClearColorFloat(tcuClearFormat);
+                       clearValue.color.f32[0]                 = defaultColor.x();
+                       clearValue.color.f32[1]                 = defaultColor.y();
+                       clearValue.color.f32[2]                 = defaultColor.z();
+                       clearValue.color.f32[3]                 = defaultColor.w();
+               }
+       }
+
+       return clearValue;
+}
+
+} // pipeline
+} // vkt
diff --git a/external/vulkancts/modules/vulkan/pipeline/vktPipelineClearUtil.hpp b/external/vulkancts/modules/vulkan/pipeline/vktPipelineClearUtil.hpp
new file mode 100644 (file)
index 0000000..f43eb2d
--- /dev/null
@@ -0,0 +1,61 @@
+/*------------------------------------------------------------------------
+ * Vulkan Conformance Tests
+ * ------------------------
+ *
+ * Copyright (c) 2015 The Khronos Group Inc.
+ * Copyright (c) 2015 Imagination Technologies Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and/or associated documentation files (the
+ * "Materials"), to deal in the Materials without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Materials, and to
+ * permit persons to whom the Materials are furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice(s) and this permission notice shall be included
+ * in all copies or substantial portions of the Materials.
+ *
+ * The Materials are Confidential Information as defined by the
+ * Khronos Membership Agreement until designated non-confidential by Khronos,
+ * at which point this condition clause shall be removed.
+ *
+ * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ *
+ *//*!
+ * \file
+ * \brief Utilities for clear values.
+ *//*--------------------------------------------------------------------*/
+
+#ifndef _VKTPIPELINECLEARUTIL_HPP
+#define _VKTPIPELINECLEARUTIL_HPP
+
+#include "tcuTexture.hpp"
+#include "tcuVectorUtil.hpp"
+#include "vkDefs.hpp"
+
+namespace vkt
+{
+namespace pipeline
+{
+
+tcu::Vec4                                              defaultClearColorFloat                  (const tcu::TextureFormat& format);
+tcu::IVec4                                             defaultClearColorInt                    (const tcu::TextureFormat& format);
+tcu::UVec4                                             defaultClearColorUint                   (const tcu::TextureFormat& format);
+tcu::Vec4                                              defaultClearColorUnorm                  (void);
+float                                                  defaultClearDepth                               (void);
+deUint32                                               defaultClearStencil                             (void);
+
+vk::VkClearDepthStencilValue   defaultClearDepthStencilValue   (void);
+vk::VkClearValue                               defaultClearValue                               (vk::VkFormat format);
+
+} // pipeline
+} // vkt
+
+#endif // _VKTPIPELINECLEARUTIL_HPP
diff --git a/external/vulkancts/modules/vulkan/pipeline/vktPipelineDepthTests.cpp b/external/vulkancts/modules/vulkan/pipeline/vktPipelineDepthTests.cpp
new file mode 100644 (file)
index 0000000..a3bb358
--- /dev/null
@@ -0,0 +1,1018 @@
+/*------------------------------------------------------------------------
+ * Vulkan Conformance Tests
+ * ------------------------
+ *
+ * Copyright (c) 2015 The Khronos Group Inc.
+ * Copyright (c) 2015 Imagination Technologies Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and/or associated documentation files (the
+ * "Materials"), to deal in the Materials without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Materials, and to
+ * permit persons to whom the Materials are furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice(s) and this permission notice shall be included
+ * in all copies or substantial portions of the Materials.
+ *
+ * The Materials are Confidential Information as defined by the
+ * Khronos Membership Agreement until designated non-confidential by Khronos,
+ * at which point this condition clause shall be removed.
+ *
+ * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ *
+ *//*!
+ * \file
+ * \brief Depth Tests
+ *//*--------------------------------------------------------------------*/
+
+#include "vktPipelineDepthTests.hpp"
+#include "vktPipelineClearUtil.hpp"
+#include "vktPipelineImageUtil.hpp"
+#include "vktPipelineVertexUtil.hpp"
+#include "vktPipelineReferenceRenderer.hpp"
+#include "vktTestCase.hpp"
+#include "vkImageUtil.hpp"
+#include "vkMemUtil.hpp"
+#include "vkPrograms.hpp"
+#include "vkQueryUtil.hpp"
+#include "vkRef.hpp"
+#include "vkRefUtil.hpp"
+#include "tcuImageCompare.hpp"
+#include "deUniquePtr.hpp"
+#include "deMemory.h"
+
+#include <sstream>
+#include <vector>
+
+namespace vkt
+{
+namespace pipeline
+{
+
+using namespace vk;
+
+namespace
+{
+
+class DepthTest : public vkt::TestCase
+{
+public:
+       enum
+       {
+               QUAD_COUNT = 4
+       };
+
+       static const float                                      quadDepths[QUAD_COUNT];
+
+                                                                               DepthTest                               (tcu::TestContext&              testContext,
+                                                                                                                                const std::string&             name,
+                                                                                                                                const std::string&             description,
+                                                                                                                                const VkFormat                 depthFormat,
+                                                                                                                                const VkCompareOp              depthCompareOps[QUAD_COUNT]);
+       virtual                                                         ~DepthTest                              (void);
+       virtual void                                            initPrograms                    (SourceCollection& programCollection) const;
+       virtual TestInstance*                           createInstance                  (Context& context) const;
+
+private:
+       const VkFormat                                          m_depthFormat;
+       VkCompareOp                                                     m_depthCompareOps[QUAD_COUNT];
+};
+
+class DepthTestInstance : public vkt::TestInstance
+{
+public:
+                                                                               DepthTestInstance               (Context& context, const VkFormat depthFormat, const VkCompareOp depthCompareOps[DepthTest::QUAD_COUNT]);
+       virtual                                                         ~DepthTestInstance              (void);
+       virtual tcu::TestStatus                         iterate                                 (void);
+
+private:
+       tcu::TestStatus                                         verifyImage                             (void);
+
+private:
+       VkCompareOp                                                     m_depthCompareOps[DepthTest::QUAD_COUNT];
+       const tcu::IVec2                                        m_renderSize;
+       const VkFormat                                          m_colorFormat;
+       const VkFormat                                          m_depthFormat;
+
+       VkImageCreateInfo                                       m_colorImageCreateInfo;
+       Move<VkImage>                                           m_colorImage;
+       de::MovePtr<Allocation>                         m_colorImageAlloc;
+       Move<VkImage>                                           m_depthImage;
+       de::MovePtr<Allocation>                         m_depthImageAlloc;
+       Move<VkAttachmentView>                          m_colorAttachmentView;
+       Move<VkAttachmentView>                          m_depthAttachmentView;
+       Move<VkRenderPass>                                      m_renderPass;
+       Move<VkFramebuffer>                                     m_framebuffer;
+
+       Move<VkShaderModule>                            m_vertexShaderModule;
+       Move<VkShaderModule>                            m_fragmentShaderModule;
+       Move<VkShader>                                          m_vertexShader;
+       Move<VkShader>                                          m_fragmentShader;
+
+       Move<VkBuffer>                                          m_vertexBuffer;
+       std::vector<Vertex4RGBA>                        m_vertices;
+       de::MovePtr<Allocation>                         m_vertexBufferAlloc;
+
+       Move<VkPipelineLayout>                          m_pipelineLayout;
+       Move<VkPipeline>                                        m_graphicsPipelines[DepthTest::QUAD_COUNT];
+
+       Move<VkCmdPool>                                         m_cmdPool;
+       Move<VkCmdBuffer>                                       m_cmdBuffer;
+
+       Move<VkDynamicViewportState>            m_viewportState;
+       Move<VkDynamicRasterState>                      m_rasterState;
+       Move<VkDynamicColorBlendState>          m_colorBlendState;
+       Move<VkDynamicDepthStencilState>        m_depthStencilState;
+
+       Move<VkFence>                                           m_fence;
+};
+
+const float DepthTest::quadDepths[QUAD_COUNT] =
+{
+       0.1f,
+       0.0f,
+       0.3f,
+       0.2f
+};
+
+DepthTest::DepthTest (tcu::TestContext&                testContext,
+                                         const std::string&    name,
+                                         const std::string&    description,
+                                         const VkFormat                depthFormat,
+                                         const VkCompareOp             depthCompareOps[QUAD_COUNT])
+       : vkt::TestCase (testContext, name, description)
+       , m_depthFormat (depthFormat)
+{
+       deMemcpy(m_depthCompareOps, depthCompareOps, sizeof(VkCompareOp) * QUAD_COUNT);
+}
+
+DepthTest::~DepthTest (void)
+{
+}
+
+TestInstance* DepthTest::createInstance (Context& context) const
+{
+       return new DepthTestInstance(context, m_depthFormat, m_depthCompareOps);
+}
+
+void DepthTest::initPrograms (SourceCollection& programCollection) const
+{
+       programCollection.add("color_vert") << glu::VertexSource(
+               "#version 310 es\n"
+               "layout(location = 0) in vec4 position;\n"
+               "layout(location = 1) in vec4 color;\n"
+               "layout(location = 0) out highp vec4 vtxColor;\n"
+               "void main (void)\n"
+               "{\n"
+               "       gl_Position = position;\n"
+               "       vtxColor = color;\n"
+               "}\n");
+
+       programCollection.add("color_frag") << glu::FragmentSource(
+               "#version 310 es\n"
+               "layout(location = 0) in highp vec4 vtxColor;\n"
+               "layout(location = 0) out highp vec4 fragColor;\n"
+               "void main (void)\n"
+               "{\n"
+               "       fragColor = vtxColor;\n"
+               "}\n");
+}
+
+DepthTestInstance::DepthTestInstance (Context&                         context,
+                                                                         const VkFormat                depthFormat,
+                                                                         const VkCompareOp             depthCompareOps[DepthTest::QUAD_COUNT])
+       : vkt::TestInstance     (context)
+       , m_renderSize          (32, 32)
+       , m_colorFormat         (VK_FORMAT_R8G8B8A8_UNORM)
+       , m_depthFormat         (depthFormat)
+{
+       const DeviceInterface&          vk                                      = context.getDeviceInterface();
+       const VkDevice                          vkDevice                        = context.getDevice();
+       const deUint32                          queueFamilyIndex        = context.getUniversalQueueFamilyIndex();
+       SimpleAllocator                         memAlloc                        (vk, vkDevice, getPhysicalDeviceMemoryProperties(context.getInstanceInterface(), context.getPhysicalDevice()));
+
+       // Copy depth operators
+       deMemcpy(m_depthCompareOps, depthCompareOps, sizeof(VkCompareOp) * DepthTest::QUAD_COUNT);
+
+       // Create color image
+       {
+               const VkImageCreateInfo colorImageParams =
+               {
+                       VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,                                                                            // VkStructureType              sType;
+                       DE_NULL,                                                                                                                                        // const void*                  pNext;
+                       VK_IMAGE_TYPE_2D,                                                                                                                       // VkImageType                  imageType;
+                       m_colorFormat,                                                                                                                          // VkFormat                             format;
+                       { m_renderSize.x(), m_renderSize.y(), 1u },                                                                     // VkExtent3D                   extent;
+                       1u,                                                                                                                                                     // deUint32                             mipLevels;
+                       1u,                                                                                                                                                     // deUint32                             arraySize;
+                       1u,                                                                                                                                                     // deUint32                             samples;
+                       VK_IMAGE_TILING_OPTIMAL,                                                                                                        // VkImageTiling                tiling;
+                       VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_SOURCE_BIT,       // VkImageUsageFlags    usage;
+                       0u,                                                                                                                                                     // VkImageCreateFlags   flags;
+                       VK_SHARING_MODE_EXCLUSIVE,                                                                                                      // VkSharingMode                sharingMode;
+                       1u,                                                                                                                                                     // deUint32                             queueFamilyCount;
+                       &queueFamilyIndex                                                                                                                       // const deUint32*              pQueueFamilyIndices;
+               };
+
+               m_colorImageCreateInfo  = colorImageParams;
+               m_colorImage                    = createImage(vk, vkDevice, &m_colorImageCreateInfo);
+
+               // Allocate and bind color image memory
+               m_colorImageAlloc               = memAlloc.allocate(getImageMemoryRequirements(vk, vkDevice, *m_colorImage), MemoryRequirement::Any);
+               VK_CHECK(vk.bindImageMemory(vkDevice, *m_colorImage, m_colorImageAlloc->getMemory(), m_colorImageAlloc->getOffset()));
+       }
+
+       // Create depth image
+       {
+               const VkImageCreateInfo depthImageParams =
+               {
+                       VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,                    // VkStructureType              sType;
+                       DE_NULL,                                                                                // const void*                  pNext;
+                       VK_IMAGE_TYPE_2D,                                                               // VkImageType                  imageType;
+                       m_depthFormat,                                                                  // VkFormat                             format;
+                       { m_renderSize.x(), m_renderSize.y(), 1u },             // VkExtent3D                   extent;
+                       1u,                                                                                             // deUint32                             mipLevels;
+                       1u,                                                                                             // deUint32                             arraySize;
+                       1u,                                                                                             // deUint32                             samples;
+                       VK_IMAGE_TILING_OPTIMAL,                                                // VkImageTiling                tiling;
+                       VK_IMAGE_USAGE_DEPTH_STENCIL_BIT,                               // VkImageUsageFlags    usage;
+                       0u,                                                                                             // VkImageCreateFlags   flags;
+                       VK_SHARING_MODE_EXCLUSIVE,                                              // VkSharingMode                sharingMode;
+                       1u,                                                                                             // deUint32                             queueFamilyCount;
+                       &queueFamilyIndex                                                               // const deUint32*              pQueueFamilyIndices;
+               };
+
+               m_depthImage = createImage(vk, vkDevice, &depthImageParams);
+
+               // 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()));
+       }
+
+       // Create color attachment view
+       {
+               const VkAttachmentViewCreateInfo colorAttachmentViewParams =
+               {
+                       VK_STRUCTURE_TYPE_ATTACHMENT_VIEW_CREATE_INFO,          // VkStructureType                              sType;
+                       DE_NULL,                                                                                        // constvoid*                                   pNext;
+                       *m_colorImage,                                                                          // VkImage                                              image;
+                       m_colorFormat,                                                                          // VkFormat                                             format;
+                       0u,                                                                                                     // deUint32                                             mipLevel;
+                       0u,                                                                                                     // deUint32                                             baseArraySlice;
+                       1u,                                                                                                     // deUint32                                             arraySize;
+                       0u                                                                                                      // VkAttachmentViewCreateFlags  flags;
+               };
+
+               m_colorAttachmentView = createAttachmentView(vk, vkDevice, &colorAttachmentViewParams);
+       }
+
+       // Create depth attachment view
+       {
+               const VkAttachmentViewCreateInfo depthAttachmentViewParams =
+               {
+                       VK_STRUCTURE_TYPE_ATTACHMENT_VIEW_CREATE_INFO,          // VkStructureType                              sType;
+                       DE_NULL,                                                                                        // constvoid*                                   pNext;
+                       *m_depthImage,                                                                          // VkImage                                              image;
+                       m_depthFormat,                                                                          // VkFormat                                             format;
+                       0u,                                                                                                     // deUint32                                             mipLevel;
+                       0u,                                                                                                     // deUint32                                             baseArraySlice;
+                       1u,                                                                                                     // deUint32                                             arraySize;
+                       0u                                                                                                      // VkAttachmentViewCreateFlags  flags;
+               };
+
+               m_depthAttachmentView = createAttachmentView(vk, vkDevice, &depthAttachmentViewParams);
+       }
+
+       // Create render pass
+       {
+               const VkAttachmentDescription colorAttachmentDescription =
+               {
+                       VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION,                       // VkStructureType              sType;
+                       DE_NULL,                                                                                        // const void*                  pNext;
+                       m_colorFormat,                                                                          // VkFormat                             format;
+                       1u,                                                                                                     // deUint32                             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 VkAttachmentDescription depthAttachmentDescription =
+               {
+                       VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION,                       // VkStructureType              sType;
+                       DE_NULL,                                                                                        // const void*                  pNext;
+                       m_depthFormat,                                                                          // VkFormat                             format;
+                       1u,                                                                                                     // deUint32                             samples;
+                       VK_ATTACHMENT_LOAD_OP_CLEAR,                                            // VkAttachmentLoadOp   loadOp;
+                       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_DEPTH_STENCIL_ATTACHMENT_OPTIMAL,       // VkImageLayout                initialLayout;
+                       VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL        // VkImageLayout                finalLayout;
+               };
+
+               const VkAttachmentDescription attachments[2] =
+               {
+                       colorAttachmentDescription,
+                       depthAttachmentDescription
+               };
+
+               const VkAttachmentReference colorAttachmentReference =
+               {
+                       0u,                                                                                                     // deUint32                     attachment;
+                       VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL                        // VkImageLayout        layout;
+               };
+
+               const VkAttachmentReference depthAttachmentReference =
+               {
+                       1u,                                                                                                     // deUint32                     attachment;
+                       VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL        // VkImageLayout        layout;
+               };
+
+               const VkSubpassDescription subpassDescription =
+               {
+                       VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION,                          // VkStructureType                              sType;
+                       DE_NULL,                                                                                        // constvoid*                                   pNext;
+                       VK_PIPELINE_BIND_POINT_GRAPHICS,                                        // VkPipelineBindPoint                  pipelineBindPoint;
+                       0u,                                                                                                     // VkSubpassDescriptionFlags    flags;
+                       0u,                                                                                                     // deUint32                                             inputCount;
+                       DE_NULL,                                                                                        // constVkAttachmentReference*  inputAttachments;
+                       1u,                                                                                                     // deUint32                                             colorCount;
+                       &colorAttachmentReference,                                                      // constVkAttachmentReference*  colorAttachments;
+                       DE_NULL,                                                                                        // constVkAttachmentReference*  resolveAttachments;
+                       depthAttachmentReference,                                                       // VkAttachmentReference                depthStencilAttachment;
+                       0u,                                                                                                     // deUint32                                             preserveCount;
+                       DE_NULL                                                                                         // constVkAttachmentReference*  preserveAttachments;
+               };
+
+               const VkRenderPassCreateInfo renderPassParams =
+               {
+                       VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO,                      // VkStructureType                                      sType;
+                       DE_NULL,                                                                                        // const void*                                          pNext;
+                       2u,                                                                                                     // deUint32                                                     attachmentCount;
+                       attachments,                                                                            // const VkAttachmentDescription*       pAttachments;
+                       1u,                                                                                                     // deUint32                                                     subpassCount;
+                       &subpassDescription,                                                            // const VkSubpassDescription*          pSubpasses;
+                       0u,                                                                                                     // deUint32                                                     dependencyCount;
+                       DE_NULL                                                                                         // const VkSubpassDependency*           pDependencies;
+               };
+
+               m_renderPass = createRenderPass(vk, vkDevice, &renderPassParams);
+       }
+
+       // Create framebuffer
+       {
+               const VkAttachmentBindInfo attachmentBindInfos[2] =
+               {
+                       { *m_colorAttachmentView, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL },
+                       { *m_depthAttachmentView, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL }
+               };
+
+               const VkFramebufferCreateInfo framebufferParams =
+               {
+                       VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO,                      // VkStructureType                              sType;
+                       DE_NULL,                                                                                        // const void*                                  pNext;
+                       *m_renderPass,                                                                          // VkRenderPass                                 renderPass;
+                       2u,                                                                                                     // deUint32                                             attachmentCount;
+                       attachmentBindInfos,                                                            // const VkAttachmentBindInfo*  pAttachments;
+                       (deUint32)m_renderSize.x(),                                                     // deUint32                                             width;
+                       (deUint32)m_renderSize.y(),                                                     // deUint32                                             height;
+                       1u                                                                                                      // deUint32                                             layers;
+               };
+
+               m_framebuffer = createFramebuffer(vk, vkDevice, &framebufferParams);
+       }
+
+       // Create pipeline layout
+       {
+               const VkPipelineLayoutCreateInfo pipelineLayoutParams =
+               {
+                       VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO,          // VkStructureType                              sType;
+                       DE_NULL,                                                                                        // const void*                                  pNext;
+                       0u,                                                                                                     // deUint32                                             descriptorSetCount;
+                       DE_NULL,                                                                                        // const VkDescriptorSetLayout* pSetLayouts;
+                       0u,                                                                                                     // deUint32                                             pushConstantRangeCount;
+                       DE_NULL                                                                                         // const VkPushConstantRange*   pPushConstantRanges;
+               };
+
+               m_pipelineLayout = createPipelineLayout(vk, vkDevice, &pipelineLayoutParams);
+       }
+
+       // Create shaders
+       {
+               m_vertexShaderModule    = createShaderModule(vk, vkDevice, m_context.getBinaryCollection().get("color_vert"), 0);
+               m_fragmentShaderModule  = createShaderModule(vk, vkDevice, m_context.getBinaryCollection().get("color_frag"), 0);
+
+               const VkShaderCreateInfo vertexShaderParams =
+               {
+                       VK_STRUCTURE_TYPE_SHADER_CREATE_INFO,                   // VkStructureType              sType;
+                       DE_NULL,                                                                                // const void*                  pNext;
+                       *m_vertexShaderModule,                                                  // VkShaderModule               module;
+                       "main",                                                                                 // const char*                  pName;
+                       0u                                                                                              // VkShaderCreateFlags  flags;
+               };
+
+               const VkShaderCreateInfo fragmentShaderParams =
+               {
+                       VK_STRUCTURE_TYPE_SHADER_CREATE_INFO,                   // VkStructureType              sType;
+                       DE_NULL,                                                                                // const void*                  pNext;
+                       *m_fragmentShaderModule,                                                // VkShaderModule               module;
+                       "main",                                                                                 // const char*                  pName;
+                       0u                                                                                              // VkShaderCreateFlags  flags;
+               };
+
+               m_vertexShader          = createShader(vk, vkDevice, &vertexShaderParams);
+               m_fragmentShader        = createShader(vk, vkDevice, &fragmentShaderParams);
+       }
+
+       // Create pipeline
+       {
+               const VkPipelineShaderStageCreateInfo shaderStageParams[2] =
+               {
+                       {
+                               VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO,            // VkStructureType                              sType;
+                               DE_NULL,                                                                                                        // const void*                                  pNext;
+                               VK_SHADER_STAGE_VERTEX,                                                                         // VkShaderStage                                stage;
+                               *m_vertexShader,                                                                                        // VkShader                                             shader;
+                               DE_NULL                                                                                                         // const VkSpecializationInfo*  pSpecializationInfo;
+                       },
+                       {
+                               VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO,            // VkStructureType                              sType;
+                               DE_NULL,                                                                                                        // const void*                                  pNext;
+                               VK_SHADER_STAGE_FRAGMENT,                                                                       // VkShaderStage                                stage;
+                               *m_fragmentShader,                                                                                      // VkShader                                             shader;
+                               DE_NULL                                                                                                         // const VkSpecializationInfo*  pSpecializationInfo;
+                       }
+               };
+
+               const VkVertexInputBindingDescription vertexInputBindingDescription =
+               {
+                       0u,                                                                     // deUint32                                     binding;
+                       sizeof(Vertex4RGBA),                            // deUint32                                     strideInBytes;
+                       VK_VERTEX_INPUT_STEP_RATE_VERTEX        // VkVertexInputStepRate        stepRate;
+               };
+
+               const VkVertexInputAttributeDescription vertexInputAttributeDescriptions[2] =
+               {
+                       {
+                               0u,                                                             // deUint32     location;
+                               0u,                                                             // deUint32     binding;
+                               VK_FORMAT_R32G32B32A32_SFLOAT,  // VkFormat     format;
+                               0u                                                              // deUint32     offsetInBytes;
+                       },
+                       {
+                               1u,                                                                     // deUint32     location;
+                               0u,                                                                     // deUint32     binding;
+                               VK_FORMAT_R32G32B32A32_SFLOAT,          // VkFormat     format;
+                               DE_OFFSET_OF(Vertex4RGBA, color),       // deUint32     offsetInBytes;
+                       }
+               };
+
+               const VkPipelineVertexInputStateCreateInfo vertexInputStateParams =
+               {
+                       VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO,              // VkStructureType                                                      sType;
+                       DE_NULL,                                                                                                                // const void*                                                          pNext;
+                       1u,                                                                                                                             // deUint32                                                                     bindingCount;
+                       &vertexInputBindingDescription,                                                                 // const VkVertexInputBindingDescription*       pVertexBindingDescriptions;
+                       2u,                                                                                                                             // deUint32                                                                     attributeCount;
+                       vertexInputAttributeDescriptions                                                                // const VkVertexInputAttributeDescription*     pVertexAttributeDescriptions;
+               };
+
+               const VkPipelineInputAssemblyStateCreateInfo inputAssemblyStateParams =
+               {
+                       VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO,    // VkStructureType              sType;
+                       DE_NULL,                                                                                                                // const void*                  pNext;
+                       VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST,                                                    // VkPrimitiveTopology  topology;
+                       false                                                                                                                   // VkBool32                             primitiveRestartEnable;
+               };
+
+               const VkPipelineViewportStateCreateInfo viewportStateParams =
+               {
+                       VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO,                  // VkStructureType      sType;
+                       DE_NULL,                                                                                                                // const void*          pNext;
+                       1u                                                                                                                              // deUint32                     viewportCount;
+               };
+
+               const VkPipelineRasterStateCreateInfo rasterStateParams =
+               {
+                       VK_STRUCTURE_TYPE_PIPELINE_RASTER_STATE_CREATE_INFO,                    // VkStructureType      sType;
+                       DE_NULL,                                                                                                                // const void*          pNext;
+                       false,                                                                                                                  // VkBool32                     depthClipEnable;
+                       false,                                                                                                                  // VkBool32                     rasterizerDiscardEnable;
+                       VK_FILL_MODE_SOLID,                                                                                             // VkFillMode           fillMode;
+                       VK_CULL_MODE_NONE,                                                                                              // VkCullMode           cullMode;
+                       VK_FRONT_FACE_CCW                                                                                               // VkFrontFace          frontFace;
+               };
+
+               const VkPipelineColorBlendAttachmentState colorBlendAttachmentState =
+               {
+                       false,                                                                                                                                          // VkBool32                     blendEnable;
+                       VK_BLEND_ONE,                                                                                                                           // VkBlend                      srcBlendColor;
+                       VK_BLEND_ZERO,                                                                                                                          // VkBlend                      destBlendColor;
+                       VK_BLEND_OP_ADD,                                                                                                                        // VkBlendOp            blendOpColor;
+                       VK_BLEND_ONE,                                                                                                                           // VkBlend                      srcBlendAlpha;
+                       VK_BLEND_ZERO,                                                                                                                          // VkBlend                      destBlendAlpha;
+                       VK_BLEND_OP_ADD,                                                                                                                        // VkBlendOp            blendOpAlpha;
+                       VK_CHANNEL_R_BIT | VK_CHANNEL_G_BIT | VK_CHANNEL_B_BIT | VK_CHANNEL_A_BIT       // VkChannelFlags       channelWriteMask;
+               };
+
+               const VkPipelineColorBlendStateCreateInfo colorBlendStateParams =
+               {
+                       VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO,       // VkStructureType                                                              sType;
+                       DE_NULL,                                                                                                        // const void*                                                                  pNext;
+                       false,                                                                                                          // VkBool32                                                                             alphaToCoverageEnable;
+                       false,                                                                                                          // VkBool32                                                                             logicOpEnable;
+                       VK_LOGIC_OP_COPY,                                                                                       // VkLogicOp                                                                    logicOp;
+                       1u,                                                                                                                     // deUint32                                                                             attachmentCount;
+                       &colorBlendAttachmentState                                                                      // const VkPipelineColorBlendAttachmentState*   pAttachments;
+               };
+
+               const VkPipelineMultisampleStateCreateInfo multisampleStateParams =
+               {
+                       VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO,       // VkStructureType      sType;
+                       DE_NULL,                                                                                                        // const void*          pNext;
+                       1u,                                                                                                                     // deUint32                     rasterSamples;
+                       false,                                                                                                          // VkBool32                     sampleShadingEnable;
+                       0.0f,                                                                                                           // float                        minSampleShading;
+                       ~((VkSampleMask)0)                                                                                      // VkSampleMask         sampleMask;
+               };
+
+               VkPipelineDepthStencilStateCreateInfo depthStencilStateParams =
+               {
+                       VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO,     // VkStructureType      sType;
+                       DE_NULL,                                                                                                        // const void*          pNext;
+                       true,                                                                                                           // VkBool32                     depthTestEnable;
+                       true,                                                                                                           // VkBool32                     depthWriteEnable;
+                       VK_COMPARE_OP_LESS,                                                                                     // VkCompareOp          depthCompareOp;
+                       false,                                                                                                          // VkBool32                     depthBoundsEnable;
+                       false,                                                                                                          // VkBool32                     stencilTestEnable;
+                       // VkStencilOpState     front;
+                       {
+                               VK_STENCIL_OP_KEEP,             // VkStencilOp  stencilFailOp;
+                               VK_STENCIL_OP_KEEP,             // VkStencilOp  stencilPassOp;
+                               VK_STENCIL_OP_KEEP,             // VkStencilOp  stencilDepthFailOp;
+                               VK_COMPARE_OP_NEVER             // VkCompareOp  stencilCompareOp;
+                       },
+                       // VkStencilOpState     back;
+                       {
+                               VK_STENCIL_OP_KEEP,             // VkStencilOp  stencilFailOp;
+                               VK_STENCIL_OP_KEEP,             // VkStencilOp  stencilPassOp;
+                               VK_STENCIL_OP_KEEP,             // VkStencilOp  stencilDepthFailOp;
+                               VK_COMPARE_OP_NEVER             // VkCompareOp  stencilCompareOp;
+                       }
+               };
+
+               const VkGraphicsPipelineCreateInfo graphicsPipelineParams =
+               {
+                       VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO,        // VkStructureType                                                                      sType;
+                       DE_NULL,                                                                                        // const void*                                                                          pNext;
+                       2u,                                                                                                     // deUint32                                                                                     stageCount;
+                       shaderStageParams,                                                                      // const VkPipelineShaderStageCreateInfo*                       pStages;
+                       &vertexInputStateParams,                                                        // const VkPipelineVertexInputStateCreateInfo*          pVertexInputState;
+                       &inputAssemblyStateParams,                                                      // const VkPipelineInputAssemblyStateCreateInfo*        pInputAssemblyState;
+                       DE_NULL,                                                                                        // const VkPipelineTessellationStateCreateInfo*         pTessellationState;
+                       &viewportStateParams,                                                           // const VkPipelineViewportStateCreateInfo*                     pViewportState;
+                       &rasterStateParams,                                                                     // const VkPipelineRasterStateCreateInfo*                       pRasterState;
+                       &multisampleStateParams,                                                        // const VkPipelineMultisampleStateCreateInfo*          pMultisampleState;
+                       &depthStencilStateParams,                                                       // const VkPipelineDepthStencilStateCreateInfo*         pDepthStencilState;
+                       &colorBlendStateParams,                                                         // const VkPipelineColorBlendStateCreateInfo*           pColorBlendState;
+                       0u,                                                                                                     // VkPipelineCreateFlags                                                        flags;
+                       *m_pipelineLayout,                                                                      // VkPipelineLayout                                                                     layout;
+                       *m_renderPass,                                                                          // VkRenderPass                                                                         renderPass;
+                       0u,                                                                                                     // deUint32                                                                                     subpass;
+                       0u,                                                                                                     // VkPipeline                                                                           basePipelineHandle;
+                       0u                                                                                                      // deInt32                                                                                      basePipelineIndex;
+               };
+
+               for (int quadNdx = 0; quadNdx < DepthTest::QUAD_COUNT; quadNdx++)
+               {
+                       depthStencilStateParams.depthCompareOp  = depthCompareOps[quadNdx];
+                       m_graphicsPipelines[quadNdx]                    = createGraphicsPipeline(vk, vkDevice, DE_NULL, &graphicsPipelineParams);
+               }
+       }
+
+       // Create dynamic states
+       {
+               const VkViewport viewport =
+               {
+                       0.0f,                                           // float        originX;
+                       0.0f,                                           // float        originY;
+                       (float)m_renderSize.x(),        // float        width;
+                       (float)m_renderSize.y(),        // float        height;
+                       0.0f,                                           // float        minDepth;
+                       1.0f                                            // float        maxDepth;
+               };
+
+               const VkRect2D scissor =
+               {
+                       { 0, 0 },                                                                                               // VkOffset2D  offset;
+                       { m_renderSize.x(), m_renderSize.y() }                                  // VkExtent2D  extent;
+               };
+
+               const VkDynamicViewportStateCreateInfo viewportStateParams =
+               {
+                       VK_STRUCTURE_TYPE_DYNAMIC_VIEWPORT_STATE_CREATE_INFO,   // VkStructureType              sType;
+                       DE_NULL,                                                                                                // const void*                  pNext;
+                       1,                                                                                                              // deUint32                             viewportAndScissorCount;
+                       &viewport,                                                                                              // const VkViewport*    pViewports;
+                       &scissor                                                                                                // const VkRect2D*              pScissors;
+               };
+
+               const VkDynamicRasterStateCreateInfo rasterStateParams =
+               {
+                       VK_STRUCTURE_TYPE_DYNAMIC_RASTER_STATE_CREATE_INFO,             // VkStructureType      sType;
+                       DE_NULL,                                                                                                // const void*          pNext;
+                       0.0f,                                                                                                   // float                        depthBias;
+                       0.0f,                                                                                                   // float                        depthBiasClamp;
+                       0.0f,                                                                                                   // float                        slopeScaledDepthBias;
+                       1.0f,                                                                                                   // float                        lineWidth;
+               };
+
+               const VkDynamicColorBlendStateCreateInfo colorBlendStateParams =
+               {
+                       VK_STRUCTURE_TYPE_DYNAMIC_COLOR_BLEND_STATE_CREATE_INFO,        // VkStructureType      sType;
+                       DE_NULL,                                                                                                        // const void*          pNext;
+                       { 0.0f, 0.0f, 0.0f, 0.0f }                                                                      // float                        blendConst[4];
+               };
+
+               const VkDynamicDepthStencilStateCreateInfo depthStencilStateParams =
+               {
+                       VK_STRUCTURE_TYPE_DYNAMIC_DEPTH_STENCIL_STATE_CREATE_INFO,      // VkStructureType      sType;
+                       DE_NULL,                                                                                                        // const void*          pNext;
+                       0.0f,                                                                                                           // float                        minDepthBounds;
+                       1.0f,                                                                                                           // float                        maxDepthBounds;
+                       0x0,                                                                                                            // deUint32                     stencilReadMask;
+                       0x0,                                                                                                            // deUint32                     stencilWriteMask;
+                       0x0,                                                                                                            // deUint32                     stencilFrontRef;
+                       0x0                                                                                                                     // deUint32                     stencilBackRef;
+               };
+
+               m_viewportState         = createDynamicViewportState(vk, vkDevice, &viewportStateParams);
+               m_rasterState           = createDynamicRasterState(vk, vkDevice, &rasterStateParams);
+               m_colorBlendState       = createDynamicColorBlendState(vk, vkDevice, &colorBlendStateParams);
+               m_depthStencilState     = createDynamicDepthStencilState(vk, vkDevice, &depthStencilStateParams);
+       }
+
+       // Create vertex buffer
+       {
+               const VkBufferCreateInfo vertexBufferParams =
+               {
+                       VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,           // VkStructureType              sType;
+                       DE_NULL,                                                                        // const void*                  pNext;
+                       1024u,                                                                          // VkDeviceSize                 size;
+                       VK_BUFFER_USAGE_VERTEX_BUFFER_BIT,                      // VkBufferUsageFlags   usage;
+                       0u,                                                                                     // VkBufferCreateFlags  flags;
+                       VK_SHARING_MODE_EXCLUSIVE,                                      // VkSharingMode                sharingMode;
+                       1u,                                                                                     // deUint32                             queueFamilyCount;
+                       &queueFamilyIndex                                                       // const deUint32*              pQueueFamilyIndices;
+               };
+
+               m_vertices                      = createOverlappingQuads();
+               m_vertexBuffer          = createBuffer(vk, vkDevice, &vertexBufferParams);
+               m_vertexBufferAlloc     = memAlloc.allocate(getBufferMemoryRequirements(vk, vkDevice, *m_vertexBuffer), MemoryRequirement::HostVisible);
+
+               VK_CHECK(vk.bindBufferMemory(vkDevice, *m_vertexBuffer, m_vertexBufferAlloc->getMemory(), m_vertexBufferAlloc->getOffset()));
+
+               // Adjust depths
+               for (int quadNdx = 0; quadNdx < DepthTest::QUAD_COUNT; quadNdx++)
+                       for (int vertexNdx = 0; vertexNdx < 6; vertexNdx++)
+                               m_vertices[quadNdx * 6 + vertexNdx].position.z() = DepthTest::quadDepths[quadNdx];
+
+               // Load vertices into vertex buffer
+
+               const VkMappedMemoryRange flushRange =
+               {
+                       VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE,  // VkStructureType      sType;
+                       DE_NULL,                                                                // const void*          pNext;
+                       m_vertexBufferAlloc->getMemory(),               // VkDeviceMemory       mem;
+                       m_vertexBufferAlloc->getOffset(),               // VkDeviceSize offset;
+                       vertexBufferParams.size                                 // VkDeviceSize size;
+               };
+
+               void* bufferPtr;
+               VK_CHECK(vk.mapMemory(vkDevice, m_vertexBufferAlloc->getMemory(), m_vertexBufferAlloc->getOffset(), vertexBufferParams.size, 0, &bufferPtr));
+               deMemcpy(bufferPtr, m_vertices.data(), m_vertices.size() * sizeof(Vertex4RGBA));
+               vk.flushMappedMemoryRanges(vkDevice, 1, &flushRange);
+               VK_CHECK(vk.unmapMemory(vkDevice, m_vertexBufferAlloc->getMemory()));
+       }
+
+       // Create command pool
+       {
+               const VkCmdPoolCreateInfo cmdPoolParams =
+               {
+                       VK_STRUCTURE_TYPE_CMD_POOL_CREATE_INFO,         // VkStructureType              sType;
+                       DE_NULL,                                                                        // const void*                  pNext;
+                       queueFamilyIndex,                                                       // deUint32                             queueFamilyIndex;
+                       VK_CMD_POOL_CREATE_TRANSIENT_BIT                        // VkCmdPoolCreateFlags flags;
+               };
+
+               m_cmdPool = createCommandPool(vk, vkDevice, &cmdPoolParams);
+       }
+
+       // Create command buffer
+       {
+               const VkCmdBufferCreateInfo cmdBufferParams =
+               {
+                       VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO,       // VkStructureType                      sType;
+                       DE_NULL,                                                                        // const void*                          pNext;
+                       *m_cmdPool,                                                                     // VkCmdPool                            cmdPool;
+                       VK_CMD_BUFFER_LEVEL_PRIMARY,                            // VkCmdBufferLevel                     level;
+                       0u                                                                                      // VkCmdBufferCreateFlags       flags;
+               };
+
+               const VkCmdBufferBeginInfo cmdBufferBeginInfo =
+               {
+                       VK_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO,        // VkStructureType                      sType;
+                       DE_NULL,                                                                        // const void*                          pNext;
+                       0u,                                                                                     // VkCmdBufferOptimizeFlags     flags;
+                       DE_NULL,                                                                        // VkRenderPass                         renderPass;
+                       DE_NULL                                                                         // VkFramebuffer                        framebuffer;
+               };
+
+               const VkClearValue attachmentClearValues[2] =
+               {
+                       defaultClearValue(m_colorFormat),
+                       defaultClearValue(m_depthFormat),
+               };
+
+               const VkRenderPassBeginInfo renderPassBeginInfo =
+               {
+                       VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO,                               // VkStructureType              sType;
+                       DE_NULL,                                                                                                // const void*                  pNext;
+                       *m_renderPass,                                                                                  // VkRenderPass                 renderPass;
+                       *m_framebuffer,                                                                                 // VkFramebuffer                framebuffer;
+                       { { 0, 0 }, { m_renderSize.x(), m_renderSize.y()} },    // VkRect2D                             renderArea;
+                       2,                                                                                                              // deUint32                             attachmentCount;
+                       attachmentClearValues                                                                   // const VkClearValue*  pAttachmentClearValues;
+               };
+
+               m_cmdBuffer = createCommandBuffer(vk, vkDevice, &cmdBufferParams);
+
+               VK_CHECK(vk.beginCommandBuffer(*m_cmdBuffer, &cmdBufferBeginInfo));
+               vk.cmdBeginRenderPass(*m_cmdBuffer, &renderPassBeginInfo, VK_RENDER_PASS_CONTENTS_INLINE);
+
+               vk.cmdBindDynamicViewportState(*m_cmdBuffer, *m_viewportState);
+               vk.cmdBindDynamicRasterState(*m_cmdBuffer, *m_rasterState);
+               vk.cmdBindDynamicColorBlendState(*m_cmdBuffer, *m_colorBlendState);
+               vk.cmdBindDynamicDepthStencilState(*m_cmdBuffer, *m_depthStencilState);
+
+               const VkDeviceSize              quadOffset              = (m_vertices.size() / DepthTest::QUAD_COUNT) * sizeof(Vertex4RGBA);
+
+               for (int quadNdx = 0; quadNdx < DepthTest::QUAD_COUNT; quadNdx++)
+               {
+                       VkDeviceSize vertexBufferOffset = quadOffset * quadNdx;
+
+                       vk.cmdBindPipeline(*m_cmdBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, *m_graphicsPipelines[quadNdx]);
+                       vk.cmdBindVertexBuffers(*m_cmdBuffer, 0, 1, &m_vertexBuffer.get(), &vertexBufferOffset);
+                       vk.cmdDraw(*m_cmdBuffer, 0, (deUint32)(m_vertices.size() / DepthTest::QUAD_COUNT), 0, 1);
+               }
+
+               vk.cmdEndRenderPass(*m_cmdBuffer);
+               VK_CHECK(vk.endCommandBuffer(*m_cmdBuffer));
+       }
+
+       // Create fence
+       {
+               const VkFenceCreateInfo fenceParams =
+               {
+                       VK_STRUCTURE_TYPE_FENCE_CREATE_INFO,    // VkStructureType              sType;
+                       DE_NULL,                                                                // const void*                  pNext;
+                       0u                                                                              // VkFenceCreateFlags   flags;
+               };
+
+               m_fence = createFence(vk, vkDevice, &fenceParams);
+       }
+}
+
+DepthTestInstance::~DepthTestInstance (void)
+{
+}
+
+tcu::TestStatus DepthTestInstance::iterate (void)
+{
+       const DeviceInterface&          vk                      = m_context.getDeviceInterface();
+       const VkDevice                          vkDevice        = m_context.getDevice();
+       const VkQueue                           queue           = m_context.getUniversalQueue();
+
+       VK_CHECK(vk.resetFences(vkDevice, 1, &m_fence.get()));
+       VK_CHECK(vk.queueSubmit(queue, 1, &m_cmdBuffer.get(), *m_fence));
+       VK_CHECK(vk.waitForFences(vkDevice, 1, &m_fence.get(), true, ~(0ull) /* infinity*/));
+
+       return verifyImage();
+}
+
+tcu::TestStatus DepthTestInstance::verifyImage (void)
+{
+       const tcu::TextureFormat        tcuColorFormat  = mapVkFormat(m_colorFormat);
+       const tcu::TextureFormat        tcuDepthFormat  = mapVkFormat(m_depthFormat);
+       const ColorVertexShader         vertexShader;
+       const ColorFragmentShader       fragmentShader  (tcuColorFormat, tcuDepthFormat);
+       const rr::Program                       program                 (&vertexShader, &fragmentShader);
+       ReferenceRenderer                       refRenderer             (m_renderSize.x(), m_renderSize.y(), 1, tcuColorFormat, tcuDepthFormat, &program);
+       bool                                            compareOk               = false;
+
+       // Render reference image
+       {
+               for (int quadNdx = 0; quadNdx < DepthTest::QUAD_COUNT; quadNdx++)
+               {
+                       // Set depth state
+                       rr::RenderState renderState(refRenderer.getViewportState());
+                       renderState.fragOps.depthTestEnabled = true;
+                       renderState.fragOps.depthFunc = mapVkCompareOp(m_depthCompareOps[quadNdx]);
+
+                       refRenderer.draw(renderState,
+                                                        rr::PRIMITIVETYPE_TRIANGLES,
+                                                        std::vector<Vertex4RGBA>(m_vertices.begin() + quadNdx * 6,
+                                                                                                         m_vertices.begin() + (quadNdx + 1) * 6));
+               }
+       }
+
+       // Compare result with reference image
+       {
+               const DeviceInterface&                  vk                                      = m_context.getDeviceInterface();
+               const VkDevice                                  vkDevice                        = m_context.getDevice();
+               const VkQueue                                   queue                           = m_context.getUniversalQueue();
+               const deUint32                                  queueFamilyIndex        = m_context.getUniversalQueueFamilyIndex();
+               SimpleAllocator                                 allocator                       (vk, vkDevice, getPhysicalDeviceMemoryProperties(m_context.getInstanceInterface(), m_context.getPhysicalDevice()));
+               de::MovePtr<tcu::TextureLevel>  result                          = readColorAttachment(vk, vkDevice, queue, queueFamilyIndex, allocator, *m_colorImage, m_colorFormat, m_renderSize);
+
+               compareOk = tcu::intThresholdPositionDeviationCompare(m_context.getTestContext().getLog(),
+                                                                                                                         "IntImageCompare",
+                                                                                                                         "Image comparison",
+                                                                                                                         refRenderer.getAccess(),
+                                                                                                                         result->getAccess(),
+                                                                                                                         tcu::UVec4(2, 2, 2, 2),
+                                                                                                                         tcu::IVec3(1, 1, 0),
+                                                                                                                         true,
+                                                                                                                         tcu::COMPARE_LOG_EVERYTHING);
+       }
+
+       if (compareOk)
+               return tcu::TestStatus::pass("Result image matches reference");
+       else
+               return tcu::TestStatus::fail("Image mismatch");
+}
+
+std::string    getCompareOpsName (const VkCompareOp quadDepthOps[DepthTest::QUAD_COUNT])
+{
+       std::ostringstream name;
+
+       for (int quadNdx = 0; quadNdx < DepthTest::QUAD_COUNT; quadNdx++)
+       {
+               name << getCompareOpName(quadDepthOps[quadNdx]);
+
+               if (quadNdx < DepthTest::QUAD_COUNT - 1)
+                       name << "_";
+       }
+
+       return name.str();
+}
+
+std::string    getCompareOpsDescription (const VkCompareOp quadDepthOps[DepthTest::QUAD_COUNT])
+{
+       std::ostringstream desc;
+       desc << "Draws " << DepthTest::QUAD_COUNT << " quads with depth compare ops: ";
+
+       for (int quadNdx = 0; quadNdx < DepthTest::QUAD_COUNT; quadNdx++)
+       {
+               desc << getCompareOpName(quadDepthOps[quadNdx]) << " at depth " << DepthTest::quadDepths[quadNdx];
+
+               if (quadNdx < DepthTest::QUAD_COUNT - 1)
+                       desc << ", ";
+       }
+       return desc.str();
+}
+
+
+} // anonymous
+
+tcu::TestCaseGroup* createDepthTests (tcu::TestContext& testCtx)
+{
+       const VkFormat depthFormats[] =
+       {
+               VK_FORMAT_D16_UNORM,
+               VK_FORMAT_D24_UNORM,
+               VK_FORMAT_D32_SFLOAT,
+               VK_FORMAT_D16_UNORM_S8_UINT,
+               VK_FORMAT_D24_UNORM_S8_UINT,
+               VK_FORMAT_D32_SFLOAT_S8_UINT
+       };
+
+       // Each entry configures the depth compare operators of QUAD_COUNT quads.
+       // All entries cover pair-wise combinations of compare operators.
+       const VkCompareOp depthOps[][DepthTest::QUAD_COUNT] =
+       {
+               { VK_COMPARE_OP_NOT_EQUAL,              VK_COMPARE_OP_NOT_EQUAL,                VK_COMPARE_OP_NOT_EQUAL,                VK_COMPARE_OP_NOT_EQUAL },
+               { VK_COMPARE_OP_NOT_EQUAL,              VK_COMPARE_OP_EQUAL,                    VK_COMPARE_OP_EQUAL,                    VK_COMPARE_OP_GREATER },
+               { VK_COMPARE_OP_NOT_EQUAL,              VK_COMPARE_OP_GREATER,                  VK_COMPARE_OP_GREATER,                  VK_COMPARE_OP_LESS_EQUAL },
+               { VK_COMPARE_OP_NOT_EQUAL,              VK_COMPARE_OP_GREATER_EQUAL,    VK_COMPARE_OP_GREATER_EQUAL,    VK_COMPARE_OP_GREATER_EQUAL },
+               { VK_COMPARE_OP_NOT_EQUAL,              VK_COMPARE_OP_LESS_EQUAL,               VK_COMPARE_OP_LESS_EQUAL,               VK_COMPARE_OP_ALWAYS },
+               { VK_COMPARE_OP_NOT_EQUAL,              VK_COMPARE_OP_LESS,                             VK_COMPARE_OP_LESS,                             VK_COMPARE_OP_LESS },
+               { VK_COMPARE_OP_NOT_EQUAL,              VK_COMPARE_OP_NEVER,                    VK_COMPARE_OP_NEVER,                    VK_COMPARE_OP_NEVER },
+               { VK_COMPARE_OP_EQUAL,                  VK_COMPARE_OP_NOT_EQUAL,                VK_COMPARE_OP_EQUAL,                    VK_COMPARE_OP_EQUAL },
+               { VK_COMPARE_OP_EQUAL,                  VK_COMPARE_OP_EQUAL,                    VK_COMPARE_OP_NOT_EQUAL,                VK_COMPARE_OP_LESS },
+               { VK_COMPARE_OP_EQUAL,                  VK_COMPARE_OP_GREATER,                  VK_COMPARE_OP_GREATER_EQUAL,    VK_COMPARE_OP_NOT_EQUAL },
+               { VK_COMPARE_OP_EQUAL,                  VK_COMPARE_OP_GREATER_EQUAL,    VK_COMPARE_OP_GREATER,                  VK_COMPARE_OP_GREATER },
+               { VK_COMPARE_OP_EQUAL,                  VK_COMPARE_OP_LESS_EQUAL,               VK_COMPARE_OP_LESS,                             VK_COMPARE_OP_LESS_EQUAL },
+               { VK_COMPARE_OP_NOT_EQUAL,              VK_COMPARE_OP_ALWAYS,                   VK_COMPARE_OP_ALWAYS,                   VK_COMPARE_OP_EQUAL },
+               { VK_COMPARE_OP_EQUAL,                  VK_COMPARE_OP_LESS,                             VK_COMPARE_OP_NEVER,                    VK_COMPARE_OP_ALWAYS },
+               { VK_COMPARE_OP_EQUAL,                  VK_COMPARE_OP_NEVER,                    VK_COMPARE_OP_LESS_EQUAL,               VK_COMPARE_OP_GREATER_EQUAL },
+               { VK_COMPARE_OP_GREATER,                VK_COMPARE_OP_NOT_EQUAL,                VK_COMPARE_OP_GREATER,                  VK_COMPARE_OP_LESS },
+               { VK_COMPARE_OP_GREATER,                VK_COMPARE_OP_EQUAL,                    VK_COMPARE_OP_GREATER_EQUAL,    VK_COMPARE_OP_ALWAYS },
+               { VK_COMPARE_OP_GREATER,                VK_COMPARE_OP_GREATER,                  VK_COMPARE_OP_NOT_EQUAL,                VK_COMPARE_OP_GREATER },
+               { VK_COMPARE_OP_GREATER,                VK_COMPARE_OP_GREATER_EQUAL,    VK_COMPARE_OP_LESS_EQUAL,               VK_COMPARE_OP_NOT_EQUAL },
+               { VK_COMPARE_OP_GREATER,                VK_COMPARE_OP_LESS_EQUAL,               VK_COMPARE_OP_NEVER,                    VK_COMPARE_OP_GREATER_EQUAL },
+               { VK_COMPARE_OP_GREATER,                VK_COMPARE_OP_LESS,                             VK_COMPARE_OP_EQUAL,                    VK_COMPARE_OP_NEVER },
+               { VK_COMPARE_OP_GREATER_EQUAL,  VK_COMPARE_OP_NOT_EQUAL,                VK_COMPARE_OP_GREATER_EQUAL,    VK_COMPARE_OP_GREATER },
+               { VK_COMPARE_OP_GREATER,                VK_COMPARE_OP_NEVER,                    VK_COMPARE_OP_ALWAYS,                   VK_COMPARE_OP_LESS_EQUAL },
+               { VK_COMPARE_OP_GREATER_EQUAL,  VK_COMPARE_OP_EQUAL,                    VK_COMPARE_OP_GREATER,                  VK_COMPARE_OP_NOT_EQUAL },
+               { VK_COMPARE_OP_GREATER_EQUAL,  VK_COMPARE_OP_GREATER,                  VK_COMPARE_OP_EQUAL,                    VK_COMPARE_OP_GREATER_EQUAL },
+               { VK_COMPARE_OP_GREATER_EQUAL,  VK_COMPARE_OP_GREATER_EQUAL,    VK_COMPARE_OP_NOT_EQUAL,                VK_COMPARE_OP_LESS_EQUAL },
+               { VK_COMPARE_OP_GREATER_EQUAL,  VK_COMPARE_OP_LESS_EQUAL,               VK_COMPARE_OP_ALWAYS,                   VK_COMPARE_OP_LESS },
+               { VK_COMPARE_OP_GREATER_EQUAL,  VK_COMPARE_OP_LESS,                             VK_COMPARE_OP_LESS_EQUAL,               VK_COMPARE_OP_EQUAL },
+               { VK_COMPARE_OP_GREATER_EQUAL,  VK_COMPARE_OP_ALWAYS,                   VK_COMPARE_OP_LESS,                             VK_COMPARE_OP_NEVER },
+               { VK_COMPARE_OP_LESS_EQUAL,             VK_COMPARE_OP_NOT_EQUAL,                VK_COMPARE_OP_LESS_EQUAL,               VK_COMPARE_OP_LESS_EQUAL },
+               { VK_COMPARE_OP_LESS_EQUAL,             VK_COMPARE_OP_EQUAL,                    VK_COMPARE_OP_LESS,                             VK_COMPARE_OP_EQUAL },
+               { VK_COMPARE_OP_LESS_EQUAL,             VK_COMPARE_OP_GREATER,                  VK_COMPARE_OP_NEVER,                    VK_COMPARE_OP_LESS },
+               { VK_COMPARE_OP_LESS_EQUAL,             VK_COMPARE_OP_GREATER_EQUAL,    VK_COMPARE_OP_EQUAL,                    VK_COMPARE_OP_ALWAYS },
+               { VK_COMPARE_OP_LESS_EQUAL,             VK_COMPARE_OP_LESS,                             VK_COMPARE_OP_NOT_EQUAL,                VK_COMPARE_OP_GREATER_EQUAL },
+               { VK_COMPARE_OP_LESS_EQUAL,             VK_COMPARE_OP_LESS_EQUAL,               VK_COMPARE_OP_GREATER_EQUAL,    VK_COMPARE_OP_NEVER },
+               { VK_COMPARE_OP_LESS,                   VK_COMPARE_OP_NOT_EQUAL,                VK_COMPARE_OP_LESS,                             VK_COMPARE_OP_GREATER_EQUAL },
+               { VK_COMPARE_OP_LESS,                   VK_COMPARE_OP_EQUAL,                    VK_COMPARE_OP_NEVER,                    VK_COMPARE_OP_LESS_EQUAL },
+               { VK_COMPARE_OP_LESS,                   VK_COMPARE_OP_GREATER,                  VK_COMPARE_OP_LESS_EQUAL,               VK_COMPARE_OP_NEVER },
+               { VK_COMPARE_OP_LESS,                   VK_COMPARE_OP_LESS_EQUAL,               VK_COMPARE_OP_GREATER,                  VK_COMPARE_OP_EQUAL },
+               { VK_COMPARE_OP_LESS,                   VK_COMPARE_OP_LESS,                             VK_COMPARE_OP_ALWAYS,                   VK_COMPARE_OP_NOT_EQUAL },
+               { VK_COMPARE_OP_LESS,                   VK_COMPARE_OP_NEVER,                    VK_COMPARE_OP_NOT_EQUAL,                VK_COMPARE_OP_ALWAYS },
+               { VK_COMPARE_OP_NEVER,                  VK_COMPARE_OP_NOT_EQUAL,                VK_COMPARE_OP_ALWAYS,                   VK_COMPARE_OP_ALWAYS },
+               { VK_COMPARE_OP_LESS,                   VK_COMPARE_OP_ALWAYS,                   VK_COMPARE_OP_GREATER_EQUAL,    VK_COMPARE_OP_LESS },
+               { VK_COMPARE_OP_NEVER,                  VK_COMPARE_OP_GREATER_EQUAL,    VK_COMPARE_OP_NEVER,                    VK_COMPARE_OP_EQUAL },
+               { VK_COMPARE_OP_NEVER,                  VK_COMPARE_OP_NEVER,                    VK_COMPARE_OP_LESS,                             VK_COMPARE_OP_GREATER },
+               { VK_COMPARE_OP_NEVER,                  VK_COMPARE_OP_LESS_EQUAL,               VK_COMPARE_OP_EQUAL,                    VK_COMPARE_OP_NOT_EQUAL },
+               { VK_COMPARE_OP_NEVER,                  VK_COMPARE_OP_LESS,                             VK_COMPARE_OP_GREATER_EQUAL,    VK_COMPARE_OP_LESS_EQUAL },
+               { VK_COMPARE_OP_NEVER,                  VK_COMPARE_OP_ALWAYS,                   VK_COMPARE_OP_GREATER,                  VK_COMPARE_OP_GREATER_EQUAL },
+               { VK_COMPARE_OP_ALWAYS,                 VK_COMPARE_OP_EQUAL,                    VK_COMPARE_OP_ALWAYS,                   VK_COMPARE_OP_NEVER },
+               { VK_COMPARE_OP_ALWAYS,                 VK_COMPARE_OP_NEVER,                    VK_COMPARE_OP_EQUAL,                    VK_COMPARE_OP_LESS },
+               { VK_COMPARE_OP_ALWAYS,                 VK_COMPARE_OP_GREATER,                  VK_COMPARE_OP_LESS,                             VK_COMPARE_OP_ALWAYS },
+               { VK_COMPARE_OP_ALWAYS,                 VK_COMPARE_OP_ALWAYS,                   VK_COMPARE_OP_NEVER,                    VK_COMPARE_OP_GREATER },
+               { VK_COMPARE_OP_ALWAYS,                 VK_COMPARE_OP_LESS_EQUAL,               VK_COMPARE_OP_NOT_EQUAL,                VK_COMPARE_OP_EQUAL },
+               { VK_COMPARE_OP_LESS_EQUAL,             VK_COMPARE_OP_NEVER,                    VK_COMPARE_OP_GREATER,                  VK_COMPARE_OP_NOT_EQUAL },
+               { VK_COMPARE_OP_NEVER,                  VK_COMPARE_OP_EQUAL,                    VK_COMPARE_OP_LESS_EQUAL,               VK_COMPARE_OP_LESS },
+               { VK_COMPARE_OP_EQUAL,                  VK_COMPARE_OP_GREATER_EQUAL,    VK_COMPARE_OP_ALWAYS,                   VK_COMPARE_OP_NEVER },
+               { VK_COMPARE_OP_GREATER,                VK_COMPARE_OP_ALWAYS,                   VK_COMPARE_OP_LESS,                             VK_COMPARE_OP_NOT_EQUAL },
+               { VK_COMPARE_OP_GREATER,                VK_COMPARE_OP_NEVER,                    VK_COMPARE_OP_GREATER_EQUAL,    VK_COMPARE_OP_EQUAL },
+               { VK_COMPARE_OP_EQUAL,                  VK_COMPARE_OP_ALWAYS,                   VK_COMPARE_OP_EQUAL,                    VK_COMPARE_OP_LESS_EQUAL },
+               { VK_COMPARE_OP_LESS_EQUAL,             VK_COMPARE_OP_GREATER,                  VK_COMPARE_OP_ALWAYS,                   VK_COMPARE_OP_GREATER },
+               { VK_COMPARE_OP_NEVER,                  VK_COMPARE_OP_NOT_EQUAL,                VK_COMPARE_OP_NOT_EQUAL,                VK_COMPARE_OP_NEVER },
+               { VK_COMPARE_OP_ALWAYS,                 VK_COMPARE_OP_LESS,                             VK_COMPARE_OP_GREATER,                  VK_COMPARE_OP_GREATER },
+               { VK_COMPARE_OP_ALWAYS,                 VK_COMPARE_OP_NOT_EQUAL,                VK_COMPARE_OP_NEVER,                    VK_COMPARE_OP_NOT_EQUAL },
+               { VK_COMPARE_OP_GREATER_EQUAL,  VK_COMPARE_OP_ALWAYS,                   VK_COMPARE_OP_NOT_EQUAL,                VK_COMPARE_OP_ALWAYS },
+               { VK_COMPARE_OP_LESS_EQUAL,             VK_COMPARE_OP_ALWAYS,                   VK_COMPARE_OP_LESS_EQUAL,               VK_COMPARE_OP_GREATER },
+               { VK_COMPARE_OP_LESS,                   VK_COMPARE_OP_GREATER_EQUAL,    VK_COMPARE_OP_LESS,                             VK_COMPARE_OP_GREATER },
+               { VK_COMPARE_OP_ALWAYS,                 VK_COMPARE_OP_EQUAL,                    VK_COMPARE_OP_LESS_EQUAL,               VK_COMPARE_OP_GREATER_EQUAL },
+               { VK_COMPARE_OP_ALWAYS,                 VK_COMPARE_OP_GREATER_EQUAL,    VK_COMPARE_OP_GREATER_EQUAL,    VK_COMPARE_OP_LESS_EQUAL },
+               { VK_COMPARE_OP_GREATER_EQUAL,  VK_COMPARE_OP_GREATER_EQUAL,    VK_COMPARE_OP_NEVER,                    VK_COMPARE_OP_LESS },
+               { VK_COMPARE_OP_GREATER_EQUAL,  VK_COMPARE_OP_NEVER,                    VK_COMPARE_OP_GREATER,                  VK_COMPARE_OP_NEVER },
+               { VK_COMPARE_OP_LESS,                   VK_COMPARE_OP_GREATER,                  VK_COMPARE_OP_EQUAL,                    VK_COMPARE_OP_EQUAL },
+               { VK_COMPARE_OP_NEVER,                  VK_COMPARE_OP_GREATER,                  VK_COMPARE_OP_ALWAYS,                   VK_COMPARE_OP_GREATER_EQUAL },
+               { VK_COMPARE_OP_NOT_EQUAL,              VK_COMPARE_OP_NOT_EQUAL,                VK_COMPARE_OP_GREATER,                  VK_COMPARE_OP_ALWAYS },
+               { VK_COMPARE_OP_NOT_EQUAL,              VK_COMPARE_OP_LESS_EQUAL,               VK_COMPARE_OP_NOT_EQUAL,                VK_COMPARE_OP_GREATER }
+       };
+
+       de::MovePtr<tcu::TestCaseGroup> depthTests      (new tcu::TestCaseGroup(testCtx, "depth", "Depth tests"));
+       de::MovePtr<tcu::TestCaseGroup> formatTests     (new tcu::TestCaseGroup(testCtx, "format", "Uses different depth formats"));
+
+       for (size_t formatNdx = 0; formatNdx < DE_LENGTH_OF_ARRAY(depthFormats); formatNdx++)
+       {
+               de::MovePtr<tcu::TestCaseGroup> formatTest              (new tcu::TestCaseGroup(testCtx,
+                                                                                                                                                               getFormatName(depthFormats[formatNdx]),
+                                                                                                                                                               (std::string("Uses format ") + getFormatName(depthFormats[formatNdx])).c_str()));
+               de::MovePtr<tcu::TestCaseGroup> compareOpsTests (new tcu::TestCaseGroup(testCtx, "compare_ops", "Combines depth compare operators"));
+
+               for (size_t opsNdx = 0; opsNdx < DE_LENGTH_OF_ARRAY(depthOps); opsNdx++)
+               {
+                       compareOpsTests->addChild(new DepthTest(testCtx,
+                                                                                                       getCompareOpsName(depthOps[opsNdx]),
+                                                                                                       getCompareOpsDescription(depthOps[opsNdx]),
+                                                                                                       depthFormats[formatNdx],
+                                                                                                       depthOps[opsNdx]));
+               }
+               formatTest->addChild(compareOpsTests.release());
+               formatTests->addChild(formatTest.release());
+       }
+       depthTests->addChild(formatTests.release());
+
+       return depthTests.release();
+}
+
+} // pipeline
+} // vkt
diff --git a/external/vulkancts/modules/vulkan/pipeline/vktPipelineDepthTests.hpp b/external/vulkancts/modules/vulkan/pipeline/vktPipelineDepthTests.hpp
new file mode 100644 (file)
index 0000000..3b76738
--- /dev/null
@@ -0,0 +1,51 @@
+#ifndef _VKTPIPELINEDEPTHTESTS_HPP
+#define _VKTPIPELINEDEPTHTESTS_HPP
+/*------------------------------------------------------------------------
+ * Vulkan Conformance Tests
+ * ------------------------
+ *
+ * Copyright (c) 2015 The Khronos Group Inc.
+ * Copyright (c) 2015 Imagination Technologies Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and/or associated documentation files (the
+ * "Materials"), to deal in the Materials without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Materials, and to
+ * permit persons to whom the Materials are furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice(s) and this permission notice shall be included
+ * in all copies or substantial portions of the Materials.
+ *
+ * The Materials are Confidential Information as defined by the
+ * Khronos Membership Agreement until designated non-confidential by Khronos,
+ * at which point this condition clause shall be removed.
+ *
+ * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ *
+ *//*!
+ * \file
+ * \brief Depth Tests
+ *//*--------------------------------------------------------------------*/
+
+#include "vktTestCase.hpp"
+
+namespace vkt
+{
+namespace pipeline
+{
+
+tcu::TestCaseGroup* createDepthTests (tcu::TestContext& testCtx);
+
+} // pipeline
+} // vkt
+
+#endif // _VKTPIPELINEDEPTHTESTS_HPP
+
diff --git a/external/vulkancts/modules/vulkan/pipeline/vktPipelineImageUtil.cpp b/external/vulkancts/modules/vulkan/pipeline/vktPipelineImageUtil.cpp
new file mode 100644 (file)
index 0000000..2f6dc6d
--- /dev/null
@@ -0,0 +1,213 @@
+/*------------------------------------------------------------------------
+ * Vulkan Conformance Tests
+ * ------------------------
+ *
+ * Copyright (c) 2015 The Khronos Group Inc.
+ * Copyright (c) 2015 Imagination Technologies Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and/or associated documentation files (the
+ * "Materials"), to deal in the Materials without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Materials, and to
+ * permit persons to whom the Materials are furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice(s) and this permission notice shall be included
+ * in all copies or substantial portions of the Materials.
+ *
+ * The Materials are Confidential Information as defined by the
+ * Khronos Membership Agreement until designated non-confidential by Khronos,
+ * at which point this condition clause shall be removed.
+ *
+ * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ *
+ *//*!
+ * \file
+ * \brief Utilities for images.
+ *//*--------------------------------------------------------------------*/
+
+#include "vktPipelineImageUtil.hpp"
+#include "vkImageUtil.hpp"
+#include "vkMemUtil.hpp"
+#include "vkQueryUtil.hpp"
+#include "vkRefUtil.hpp"
+#include "tcuTextureUtil.hpp"
+
+namespace vkt
+{
+namespace pipeline
+{
+
+using namespace vk;
+
+de::MovePtr<tcu::TextureLevel> readColorAttachment (const vk::DeviceInterface& vk,
+                                                                                                       vk::VkDevice                            device,
+                                                                                                       vk::VkQueue                                     queue,
+                                                                                                       deUint32                                        queueFamilyIndex,
+                                                                                                       vk::Allocator&                          allocator,
+                                                                                                       vk::VkImage                                     image,
+                                                                                                       vk::VkFormat                            format,
+                                                                                                       const tcu::IVec2&                       renderSize)
+{
+       Move<VkBuffer>                                  buffer;
+       de::MovePtr<Allocation>                 bufferAlloc;
+       Move<VkCmdPool>                                 cmdPool;
+       Move<VkCmdBuffer>                               cmdBuffer;
+       Move<VkFence>                                   fence;
+       const tcu::TextureFormat                tcuFormat               = mapVkFormat(format);
+       const VkDeviceSize                              pixelDataSize   = renderSize.x() * renderSize.y() * tcuFormat.getPixelSize();
+       de::MovePtr<tcu::TextureLevel>  resultLevel             (new tcu::TextureLevel(tcuFormat, renderSize.x(), renderSize.y()));
+
+       // Create destination buffer
+       {
+               const VkBufferCreateInfo bufferParams =
+               {
+                       VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO,           // VkStructureType              sType;
+                       DE_NULL,                                                                        // const void*                  pNext;
+                       pixelDataSize,                                                          // VkDeviceSize                 size;
+                       VK_BUFFER_USAGE_TRANSFER_DESTINATION_BIT,   // VkBufferUsageFlags       usage;
+                       0u,                                                                                     // VkBufferCreateFlags  flags;
+                       VK_SHARING_MODE_EXCLUSIVE,                                      // VkSharingMode                sharingMode;
+                       0u,                                                                                     // deUint32                             queueFamilyCount;
+                       DE_NULL,                                                                        // const deUint32*              pQueueFamilyIndices;
+               };
+
+               buffer          = createBuffer(vk, device, &bufferParams);
+               bufferAlloc = allocator.allocate(getBufferMemoryRequirements(vk, device, *buffer), MemoryRequirement::HostVisible);
+               VK_CHECK(vk.bindBufferMemory(device, *buffer, bufferAlloc->getMemory(), bufferAlloc->getOffset()));
+       }
+
+       // Create command pool and buffer
+       {
+               const VkCmdPoolCreateInfo cmdPoolParams =
+               {
+                       VK_STRUCTURE_TYPE_CMD_POOL_CREATE_INFO,         // VkStructureType              sType;
+                       DE_NULL,                                                                        // const void*                  pNext;
+                       queueFamilyIndex,                                                       // deUint32                             queueFamilyIndex;
+                       VK_CMD_POOL_CREATE_TRANSIENT_BIT                        // VkCmdPoolCreateFlags flags;
+               };
+
+               cmdPool = createCommandPool(vk, device, &cmdPoolParams);
+
+               const VkCmdBufferCreateInfo cmdBufferParams =
+               {
+                       VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO,       // VkStructureType                      sType;
+                       DE_NULL,                                                                        // const void*                          pNext;
+                       *cmdPool,                                                                       // VkCmdPool                            cmdPool;
+                       VK_CMD_BUFFER_LEVEL_PRIMARY,                            // VkCmdBufferLevel                     level;
+                       0u,                                                                                     // VkCmdBufferCreateFlags       flags;
+               };
+
+               cmdBuffer = createCommandBuffer(vk, device, &cmdBufferParams);
+       }
+
+       // Create fence
+       {
+               const VkFenceCreateInfo fenceParams =
+               {
+                       VK_STRUCTURE_TYPE_FENCE_CREATE_INFO,            // VkStructureType              sType;
+                       DE_NULL,                                                                        // const void*                  pNext;
+                       0u                                                                                      // VkFenceCreateFlags   flags;
+               };
+
+               fence = createFence(vk, device, &fenceParams);
+       }
+
+       // Barriers for copying image to buffer
+
+       const VkImageMemoryBarrier imageBarrier =
+       {
+               VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,         // VkStructureType                      sType;
+               DE_NULL,                                                                        // const void*                          pNext;
+               VK_MEMORY_OUTPUT_COLOR_ATTACHMENT_BIT,          // VkMemoryOutputFlags          outputMask;
+               VK_MEMORY_INPUT_TRANSFER_BIT,                           // VkMemoryInputFlags           inputMask;
+               VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,       // VkImageLayout                        oldLayout;
+               VK_IMAGE_LAYOUT_TRANSFER_SOURCE_OPTIMAL,        // VkImageLayout                        newLayout;
+               VK_QUEUE_FAMILY_IGNORED,                                        // deUint32                                     srcQueueFamilyIndex;
+               VK_QUEUE_FAMILY_IGNORED,                                        // deUint32                                     destQueueFamilyIndex;
+               image,                                                                          // VkImage                                      image;
+               {                                                                                       // VkImageSubresourceRange      subresourceRange;
+                       VK_IMAGE_ASPECT_COLOR,  // VkImageAspect        aspect;
+                       0u,                                             // deUint32                     baseMipLevel;
+                       1u,                                             // deUint32                     mipLevels;
+                       0u,                                             // deUint32                     baseArraySlice;
+                       1u                                              // deUint32                     arraySize;
+               }
+       };
+
+       const VkBufferMemoryBarrier bufferBarrier =
+       {
+               VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER,        // VkStructureType              sType;
+               DE_NULL,                                                                        // const void*                  pNext;
+               VK_MEMORY_OUTPUT_TRANSFER_BIT,                          // VkMemoryOutputFlags  outputMask;
+               VK_MEMORY_INPUT_HOST_READ_BIT,                          // VkMemoryInputFlags   inputMask;
+               VK_QUEUE_FAMILY_IGNORED,                                        // deUint32                             srcQueueFamilyIndex;
+               VK_QUEUE_FAMILY_IGNORED,                                        // deUint32                             destQueueFamilyIndex;
+               *buffer,                                                                        // VkBuffer                             buffer;
+               0u,                                                                                     // VkDeviceSize                 offset;
+               pixelDataSize                                                           // VkDeviceSize                 size;
+       };
+
+       const VkCmdBufferBeginInfo cmdBufferBeginInfo =
+       {
+               VK_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO,                                                                                                // VkStructureType                      sType;
+               DE_NULL,                                                                                                                                                                // const void*                          pNext;
+               VK_CMD_BUFFER_OPTIMIZE_SMALL_BATCH_BIT | VK_CMD_BUFFER_OPTIMIZE_ONE_TIME_SUBMIT_BIT,    // VkCmdBufferOptimizeFlags     flags;
+               DE_NULL,                                                                                                                                                                // VkRenderPass                         renderPass;
+               DE_NULL                                                                                                                                                                 // VkFramebuffer                        framebuffer;
+       };
+
+       const void* const       imageBarrierPtr         = &imageBarrier;
+       const void* const       bufferBarrierPtr        = &bufferBarrier;
+
+       // Copy image to buffer
+
+       const VkBufferImageCopy copyRegion =
+       {
+               0u,                                                                                     // VkDeviceSize                 bufferOffset;
+               (deUint32)renderSize.x(),                                       // deUint32                             bufferRowLength;
+               (deUint32)renderSize.y(),                                       // deUint32                             bufferImageHeight;
+               { VK_IMAGE_ASPECT_COLOR, 0u, 0u },                      // VkImageSubresource   imageSubresource;
+               { 0, 0, 0 },                                                            // VkOffset3D                   imageOffset;
+               { renderSize.x(), renderSize.y(), 1 }           // VkExtent3D                   imageExtent;
+       };
+
+       VK_CHECK(vk.beginCommandBuffer(*cmdBuffer, &cmdBufferBeginInfo));
+       vk.cmdPipelineBarrier(*cmdBuffer, VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_FALSE, 1, &imageBarrierPtr);
+       vk.cmdCopyImageToBuffer(*cmdBuffer, image, VK_IMAGE_LAYOUT_TRANSFER_SOURCE_OPTIMAL, *buffer, 1, &copyRegion);
+       vk.cmdPipelineBarrier(*cmdBuffer, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_FALSE, 1, &bufferBarrierPtr);
+       VK_CHECK(vk.endCommandBuffer(*cmdBuffer));
+
+       VK_CHECK(vk.queueSubmit(queue, 1, &cmdBuffer.get(), *fence));
+       VK_CHECK(vk.waitForFences(device, 1, &fence.get(), 0, ~(0ull) /* infinity */));
+
+
+       // Map and read buffer data
+
+       const VkMappedMemoryRange memoryRange =
+       {
+               VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE,          // VkStructureType      sType;
+               DE_NULL,                                                                        // const void*          pNext;
+               bufferAlloc->getMemory(),                                       // VkDeviceMemory       mem;
+               bufferAlloc->getOffset(),                                       // VkDeviceSize         offset;
+               pixelDataSize                                                           // VkDeviceSize         size;
+       };
+
+       void* bufferPtr;
+       VK_CHECK(vk.mapMemory(device, bufferAlloc->getMemory(), bufferAlloc->getOffset(), pixelDataSize, 0, &bufferPtr));
+       VK_CHECK(vk.invalidateMappedMemoryRanges(device, 1, &memoryRange));
+       tcu::copy(*resultLevel, tcu::ConstPixelBufferAccess(resultLevel->getFormat(), resultLevel->getSize(), bufferPtr));
+       VK_CHECK(vk.unmapMemory(device, bufferAlloc->getMemory()));
+
+       return resultLevel;
+}
+
+} // pipeline
+} // vkt
diff --git a/external/vulkancts/modules/vulkan/pipeline/vktPipelineImageUtil.hpp b/external/vulkancts/modules/vulkan/pipeline/vktPipelineImageUtil.hpp
new file mode 100644 (file)
index 0000000..c6660bf
--- /dev/null
@@ -0,0 +1,71 @@
+#ifndef _VKTPIPELINEIMAGEUTIL_HPP
+#define _VKTPIPELINEIMAGEUTIL_HPP
+/*------------------------------------------------------------------------
+ * Vulkan Conformance Tests
+ * ------------------------
+ *
+ * Copyright (c) 2015 The Khronos Group Inc.
+ * Copyright (c) 2015 Imagination Technologies Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and/or associated documentation files (the
+ * "Materials"), to deal in the Materials without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Materials, and to
+ * permit persons to whom the Materials are furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice(s) and this permission notice shall be included
+ * in all copies or substantial portions of the Materials.
+ *
+ * The Materials are Confidential Information as defined by the
+ * Khronos Membership Agreement until designated non-confidential by Khronos,
+ * at which point this condition clause shall be removed.
+ *
+ * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ *
+ *//*!
+ * \file
+ * \brief Utilities for images.
+ *//*--------------------------------------------------------------------*/
+
+#include "tcuDefs.hpp"
+#include "vkDefs.hpp"
+#include "vkDefs.hpp"
+#include "vkPlatform.hpp"
+#include "vkMemUtil.hpp"
+#include "vkRef.hpp"
+#include "tcuTexture.hpp"
+
+namespace vkt
+{
+namespace pipeline
+{
+
+/*--------------------------------------------------------------------*//*!
+ * Gets a tcu::TextureLevel initialized with data from a VK color
+ * attachment.
+ *
+ * The VkImage must be non-multisampled and able to be used as a source
+ * operand for transfer operations.
+ *//*--------------------------------------------------------------------*/
+de::MovePtr<tcu::TextureLevel> readColorAttachment (const vk::DeviceInterface& vk,
+                                                                                                       vk::VkDevice                            device,
+                                                                                                       vk::VkQueue                                     queue,
+                                                                                                       deUint32                                        queueFamilyIndex,
+                                                                                                       vk::Allocator&                          allocator,
+                                                                                                       vk::VkImage                                     image,
+                                                                                                       vk::VkFormat                            format,
+                                                                                                       const tcu::IVec2&                       renderSize);
+
+} // pipeline
+} // vkt
+
+#endif // _VKTPIPELINEIMAGEUTIL_HPP
+
diff --git a/external/vulkancts/modules/vulkan/pipeline/vktPipelineReferenceRenderer.cpp b/external/vulkancts/modules/vulkan/pipeline/vktPipelineReferenceRenderer.cpp
new file mode 100644 (file)
index 0000000..9f3ff18
--- /dev/null
@@ -0,0 +1,212 @@
+/*------------------------------------------------------------------------
+ * Vulkan Conformance Tests
+ * ------------------------
+ *
+ * Copyright (c) 2015 The Khronos Group Inc.
+ * Copyright (c) 2015 Imagination Technologies Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and/or associated documentation files (the
+ * "Materials"), to deal in the Materials without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Materials, and to
+ * permit persons to whom the Materials are furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice(s) and this permission notice shall be included
+ * in all copies or substantial portions of the Materials.
+ *
+ * The Materials are Confidential Information as defined by the
+ * Khronos Membership Agreement until designated non-confidential by Khronos,
+ * at which point this condition clause shall be removed.
+ *
+ * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ *
+ *//*!
+ * \file
+ * \brief Reference renderer.
+ *//*--------------------------------------------------------------------*/
+
+#include "vktPipelineReferenceRenderer.hpp"
+#include "vktPipelineClearUtil.hpp"
+#include "rrShadingContext.hpp"
+#include "rrVertexAttrib.hpp"
+
+namespace vkt
+{
+namespace pipeline
+{
+
+using namespace vk;
+
+rr::TestFunc mapVkCompareOp (VkCompareOp compareFunc)
+{
+       switch (compareFunc)
+       {
+               case VK_COMPARE_OP_NEVER:                       return rr::TESTFUNC_NEVER;
+               case VK_COMPARE_OP_LESS:                        return rr::TESTFUNC_LESS;
+               case VK_COMPARE_OP_EQUAL:                       return rr::TESTFUNC_EQUAL;
+               case VK_COMPARE_OP_LESS_EQUAL:          return rr::TESTFUNC_LEQUAL;
+               case VK_COMPARE_OP_GREATER:                     return rr::TESTFUNC_GREATER;
+               case VK_COMPARE_OP_NOT_EQUAL:           return rr::TESTFUNC_NOTEQUAL;
+               case VK_COMPARE_OP_GREATER_EQUAL:       return rr::TESTFUNC_GEQUAL;
+               case VK_COMPARE_OP_ALWAYS:                      return rr::TESTFUNC_ALWAYS;
+               default:
+                       DE_ASSERT(false);
+       }
+       return rr::TESTFUNC_LAST;
+}
+
+rr::PrimitiveType mapVkPrimitiveTopology (VkPrimitiveTopology primitiveTopology)
+{
+       switch (primitiveTopology)
+       {
+               case VK_PRIMITIVE_TOPOLOGY_POINT_LIST:                          return rr::PRIMITIVETYPE_POINTS;
+               case VK_PRIMITIVE_TOPOLOGY_LINE_LIST:                           return rr::PRIMITIVETYPE_LINES;
+               case VK_PRIMITIVE_TOPOLOGY_LINE_STRIP:                          return rr::PRIMITIVETYPE_LINE_STRIP;
+               case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST:                       return rr::PRIMITIVETYPE_TRIANGLES;
+               case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN:                        return rr::PRIMITIVETYPE_TRIANGLE_FAN;
+               case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP:                      return rr::PRIMITIVETYPE_TRIANGLE_STRIP;
+               case VK_PRIMITIVE_TOPOLOGY_LINE_LIST_ADJ:                       return rr::PRIMITIVETYPE_LINES_ADJACENCY;
+               case VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_ADJ:                      return rr::PRIMITIVETYPE_LINE_STRIP_ADJACENCY;
+               case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_ADJ:           return rr::PRIMITIVETYPE_TRIANGLES_ADJACENCY;
+               case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_ADJ:          return rr::PRIMITIVETYPE_TRIANGLE_STRIP_ADJACENCY;
+               default:
+                       DE_ASSERT(false);
+       }
+       return rr::PRIMITIVETYPE_LAST;
+}
+
+ReferenceRenderer::ReferenceRenderer(int                                               surfaceWidth,
+                                                                        int                                            surfaceHeight,
+                                                                        int                                            numSamples,
+                                                                        const tcu::TextureFormat&      colorFormat,
+                                                                        const tcu::TextureFormat&      depthStencilFormat,
+                                                                        const rr::Program* const       program)
+       : m_surfaceWidth                (surfaceWidth)
+       , m_surfaceHeight               (surfaceHeight)
+       , m_numSamples                  (numSamples)
+       , m_colorFormat                 (colorFormat)
+       , m_depthStencilFormat  (depthStencilFormat)
+       , m_program                             (program)
+{
+       const tcu::TextureChannelClass  formatClass                             = tcu::getTextureChannelClass(colorFormat.type);
+       const bool                                              hasDepthStencil                 = (m_depthStencilFormat.order != tcu::TextureFormat::CHANNELORDER_LAST);
+       const bool                                              hasDepthBufferOnly              = (m_depthStencilFormat.order == tcu::TextureFormat::D);
+       const bool                                              hasStencilBufferOnly    = (m_depthStencilFormat.order == tcu::TextureFormat::S);
+       const int                                               actualSamples                   = (formatClass == tcu::TEXTURECHANNELCLASS_SIGNED_INTEGER || formatClass == tcu::TEXTURECHANNELCLASS_UNSIGNED_INTEGER)? 1: m_numSamples;
+
+       m_colorBuffer.setStorage(m_colorFormat, actualSamples, m_surfaceWidth, m_surfaceHeight);
+       m_resolveColorBuffer.setStorage(m_colorFormat, m_surfaceWidth, m_surfaceHeight);
+
+       if (formatClass == tcu::TEXTURECHANNELCLASS_SIGNED_INTEGER)
+       {
+               tcu::clear(m_colorBuffer.getAccess(), defaultClearColorInt(m_colorFormat));
+               tcu::clear(m_resolveColorBuffer.getAccess(), defaultClearColorInt(m_colorFormat));
+       }
+       else if (formatClass == tcu::TEXTURECHANNELCLASS_UNSIGNED_INTEGER)
+       {
+               tcu::clear(m_colorBuffer.getAccess(), defaultClearColorUint(m_colorFormat));
+               tcu::clear(m_resolveColorBuffer.getAccess(), defaultClearColorUint(m_colorFormat));
+       }
+       else
+       {
+               tcu::clear(m_colorBuffer.getAccess(), defaultClearColorFloat(m_colorFormat));
+               tcu::clear(m_resolveColorBuffer.getAccess(), defaultClearColorFloat(m_colorFormat));
+       }
+
+       if (hasDepthStencil)
+       {
+               if (hasDepthBufferOnly)
+               {
+                       m_depthStencilBuffer.setStorage(m_depthStencilFormat, actualSamples, surfaceWidth, surfaceHeight);
+                       tcu::clearDepth(m_depthStencilBuffer.getAccess(), defaultClearDepth());
+
+                       m_renderTarget = new rr::RenderTarget(rr::MultisamplePixelBufferAccess::fromMultisampleAccess(m_colorBuffer.getAccess()),
+                                                                                                 rr::MultisamplePixelBufferAccess::fromMultisampleAccess(m_depthStencilBuffer.getAccess()));
+               }
+               else if (hasStencilBufferOnly)
+               {
+                       m_depthStencilBuffer.setStorage(m_depthStencilFormat, actualSamples, surfaceWidth, surfaceHeight);
+                       tcu::clearStencil(m_depthStencilBuffer.getAccess(), defaultClearStencil());
+
+                       m_renderTarget = new rr::RenderTarget(rr::MultisamplePixelBufferAccess::fromMultisampleAccess(m_colorBuffer.getAccess()),
+                                                                                                 rr::MultisamplePixelBufferAccess(),
+                                                                                                 rr::MultisamplePixelBufferAccess::fromMultisampleAccess(m_depthStencilBuffer.getAccess()));
+               }
+               else
+               {
+                       m_depthStencilBuffer.setStorage(m_depthStencilFormat, actualSamples, surfaceWidth, surfaceHeight);
+
+                       tcu::clearDepth(m_depthStencilBuffer.getAccess(), defaultClearDepth());
+                       tcu::clearStencil(m_depthStencilBuffer.getAccess(), defaultClearStencil());
+
+                       m_renderTarget = new rr::RenderTarget(rr::MultisamplePixelBufferAccess::fromMultisampleAccess(m_colorBuffer.getAccess()),
+                                                                                                 rr::MultisamplePixelBufferAccess::fromMultisampleAccess(m_depthStencilBuffer.getAccess()),
+                                                                                                 rr::MultisamplePixelBufferAccess::fromMultisampleAccess(m_depthStencilBuffer.getAccess()));
+               }
+       }
+       else
+       {
+               m_renderTarget = new rr::RenderTarget(rr::MultisamplePixelBufferAccess::fromMultisampleAccess(m_colorBuffer.getAccess()));
+       }
+}
+
+ReferenceRenderer::~ReferenceRenderer (void)
+{
+       delete m_renderTarget;
+}
+
+void ReferenceRenderer::draw (const rr::RenderState&                   renderState,
+                                                         const rr::PrimitiveType                       primitive,
+                                                         const std::vector<Vertex4RGBA>&       vertexBuffer)
+{
+       const rr::PrimitiveList primitives(primitive, (int)vertexBuffer.size(), 0);
+
+       std::vector<tcu::Vec4> positions;
+       std::vector<tcu::Vec4> colors;
+
+       for (size_t vertexNdx = 0; vertexNdx < vertexBuffer.size(); vertexNdx++)
+       {
+               const Vertex4RGBA& v = vertexBuffer[vertexNdx];
+               positions.push_back(v.position);
+               colors.push_back(v.color);
+       }
+
+       rr::VertexAttrib vertexAttribs[2];
+
+       // Position attribute
+       vertexAttribs[0].type           = rr::VERTEXATTRIBTYPE_FLOAT;
+       vertexAttribs[0].size           = 4;
+       vertexAttribs[0].pointer        = positions.data();
+       // UV attribute
+       vertexAttribs[1].type           = rr::VERTEXATTRIBTYPE_FLOAT;
+       vertexAttribs[1].size           = 4;
+       vertexAttribs[1].pointer        = colors.data();
+
+       rr::DrawCommand drawQuadCommand(renderState, *m_renderTarget, *m_program, 2, vertexAttribs, primitives);
+
+       m_renderer.draw(drawQuadCommand);
+}
+
+tcu::PixelBufferAccess ReferenceRenderer::getAccess (void)
+{
+       rr::MultisampleConstPixelBufferAccess multiSampleAccess = rr::MultisampleConstPixelBufferAccess::fromMultisampleAccess(m_colorBuffer.getAccess());
+       rr::resolveMultisampleColorBuffer(m_resolveColorBuffer.getAccess(), multiSampleAccess);
+
+       return m_resolveColorBuffer.getAccess();
+}
+
+const rr::ViewportState ReferenceRenderer::getViewportState (void) const
+{
+       return rr::ViewportState(rr::WindowRectangle(0, 0, m_surfaceWidth, m_surfaceHeight));
+}
+
+} // pipeline
+} // vkt
diff --git a/external/vulkancts/modules/vulkan/pipeline/vktPipelineReferenceRenderer.hpp b/external/vulkancts/modules/vulkan/pipeline/vktPipelineReferenceRenderer.hpp
new file mode 100644 (file)
index 0000000..609f684
--- /dev/null
@@ -0,0 +1,189 @@
+#ifndef _VKTPIPELINEREFERENCERENDERER_HPP
+#define _VKTPIPELINEREFERENCERENDERER_HPP
+/*------------------------------------------------------------------------
+ * Vulkan Conformance Tests
+ * ------------------------
+ *
+ * Copyright (c) 2015 The Khronos Group Inc.
+ * Copyright (c) 2015 Imagination Technologies Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and/or associated documentation files (the
+ * "Materials"), to deal in the Materials without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Materials, and to
+ * permit persons to whom the Materials are furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice(s) and this permission notice shall be included
+ * in all copies or substantial portions of the Materials.
+ *
+ * The Materials are Confidential Information as defined by the
+ * Khronos Membership Agreement until designated non-confidential by Khronos,
+ * at which point this condition clause shall be removed.
+ *
+ * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ *
+ *//*!
+ * \file
+ * \brief Reference renderer.
+ *//*--------------------------------------------------------------------*/
+
+#include "vkDefs.hpp"
+#include "vktPipelineVertexUtil.hpp"
+#include "tcuVector.hpp"
+#include "tcuVectorType.hpp"
+#include "tcuTexture.hpp"
+#include "tcuTextureUtil.hpp"
+#include "rrRenderState.hpp"
+#include "rrRenderer.hpp"
+#include <cstring>
+
+namespace vkt
+{
+
+namespace pipeline
+{
+
+class ColorVertexShader : public rr::VertexShader
+{
+public:
+       ColorVertexShader (void) : rr::VertexShader(2, 2)
+       {
+               m_inputs[0].type        = rr::GENERICVECTYPE_FLOAT;
+               m_inputs[1].type        = rr::GENERICVECTYPE_FLOAT;
+
+               m_outputs[0].type       = rr::GENERICVECTYPE_FLOAT;
+               m_outputs[1].type       = rr::GENERICVECTYPE_FLOAT;
+       }
+
+       virtual ~ColorVertexShader (void) {}
+
+       virtual void shadeVertices (const rr::VertexAttrib*             inputs,
+                                                               rr::VertexPacket* const*        packets,
+                                                               const int                                       numPackets) const
+       {
+               tcu::Vec4 position;
+               tcu::Vec4 color;
+
+               for (int packetNdx = 0; packetNdx < numPackets; packetNdx++)
+               {
+                       rr::VertexPacket* const packet  = packets[packetNdx];
+
+                       readVertexAttrib(position, inputs[0], packet->instanceNdx, packet->vertexNdx);
+                       readVertexAttrib(color, inputs[1], packet->instanceNdx, packet->vertexNdx);
+
+                       packet->outputs[0]      = position;
+                       packet->outputs[1]      = color;
+                       packet->position        = position;
+               }
+       }
+};
+
+class ColorFragmentShader : public rr::FragmentShader
+{
+private:
+       const tcu::TextureFormat                m_colorFormat;
+       const tcu::TextureFormatInfo    m_colorFormatInfo;
+       const tcu::TextureFormat                m_depthStencilFormat;
+
+public:
+       ColorFragmentShader (const tcu::TextureFormat& colorFormat,
+                                                const tcu::TextureFormat& depthStencilFormat)
+               : rr::FragmentShader    (2, 1)
+               , m_colorFormat                 (colorFormat)
+               , m_colorFormatInfo             (tcu::getTextureFormatInfo(colorFormat))
+               , m_depthStencilFormat  (depthStencilFormat)
+       {
+               const tcu::TextureChannelClass channelClass = tcu::getTextureChannelClass(m_colorFormat.type);
+
+               m_inputs[0].type        = rr::GENERICVECTYPE_FLOAT;
+               m_inputs[1].type        = rr::GENERICVECTYPE_FLOAT;
+               m_outputs[0].type       = (channelClass == tcu::TEXTURECHANNELCLASS_SIGNED_INTEGER)? rr::GENERICVECTYPE_INT32 :
+                                                         (channelClass == tcu::TEXTURECHANNELCLASS_UNSIGNED_INTEGER)? rr::GENERICVECTYPE_UINT32
+                                                         : rr::GENERICVECTYPE_FLOAT;
+       }
+
+       virtual ~ColorFragmentShader (void) {}
+
+       virtual void shadeFragments (rr::FragmentPacket*                                packets,
+                                                                const int                                                      numPackets,
+                                                                const rr::FragmentShadingContext&      context) const
+       {
+               for (int packetNdx = 0; packetNdx < numPackets; packetNdx++)
+               {
+                       const rr::FragmentPacket& packet = packets[packetNdx];
+
+                       if (m_depthStencilFormat.order == tcu::TextureFormat::D || m_depthStencilFormat.order == tcu::TextureFormat::DS)
+                       {
+                               for (int fragNdx = 0; fragNdx < 4; fragNdx++)
+                               {
+                                       const tcu::Vec4 vtxPosition = rr::readVarying<float>(packet, context, 0, fragNdx);
+                                       rr::writeFragmentDepth(context, packetNdx, fragNdx, 0, vtxPosition.z());
+                               }
+                       }
+
+                       for (int fragNdx = 0; fragNdx < 4; fragNdx++)
+                       {
+                               const tcu::Vec4 vtxColor = rr::readVarying<float>(packet, context, 1, fragNdx);
+
+                               rr::writeFragmentOutput(context,
+                                                                               packetNdx,
+                                                                               fragNdx,
+                                                                               0,
+                                                                               (vtxColor - m_colorFormatInfo.lookupBias) / m_colorFormatInfo.lookupScale);
+                       }
+               }
+       }
+};
+
+class ReferenceRenderer
+{
+public:
+                                                               ReferenceRenderer               (int                                                    surfaceWidth,
+                                                                                                                int                                                    surfaceHeight,
+                                                                                                                int                                                    numSamples,
+                                                                                                                const tcu::TextureFormat&              colorFormat,
+                                                                                                                const tcu::TextureFormat&              depthStencilFormat,
+                                                                                                                const rr::Program* const               program);
+
+       virtual                                         ~ReferenceRenderer              (void);
+
+       void                                            draw                                    (const rr::RenderState&                         renderState,
+                                                                                                                const rr::PrimitiveType                        primitive,
+                                                                                                                const std::vector<Vertex4RGBA>&        vertexBuffer);
+       tcu::PixelBufferAccess          getAccess                               (void);
+       const rr::ViewportState         getViewportState                (void) const;
+
+private:
+       rr::Renderer                            m_renderer;
+
+       const int                                       m_surfaceWidth;
+       const int                                       m_surfaceHeight;
+       const int                                       m_numSamples;
+
+       const tcu::TextureFormat        m_colorFormat;
+       const tcu::TextureFormat        m_depthStencilFormat;
+
+       tcu::TextureLevel                       m_colorBuffer;
+       tcu::TextureLevel                       m_resolveColorBuffer;
+       tcu::TextureLevel                       m_depthStencilBuffer;
+
+       rr::RenderTarget*                       m_renderTarget;
+       const rr::Program*                      m_program;
+};
+
+rr::TestFunc                                   mapVkCompareOp                  (vk::VkCompareOp compareFunc);
+rr::PrimitiveType                              mapVkPrimitiveTopology  (vk::VkPrimitiveTopology primitiveTopology);
+
+} // pipeline
+} // vkt
+
+#endif // _VKTPIPELINEREFERENCERENDERER_HPP
+
diff --git a/external/vulkancts/modules/vulkan/pipeline/vktPipelineTests.cpp b/external/vulkancts/modules/vulkan/pipeline/vktPipelineTests.cpp
new file mode 100644 (file)
index 0000000..6971d57
--- /dev/null
@@ -0,0 +1,55 @@
+/*------------------------------------------------------------------------
+ * Vulkan Conformance Tests
+ * ------------------------
+ *
+ * Copyright (c) 2015 The Khronos Group Inc.
+ * Copyright (c) 2015 Imagination Technologies Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and/or associated documentation files (the
+ * "Materials"), to deal in the Materials without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Materials, and to
+ * permit persons to whom the Materials are furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice(s) and this permission notice shall be included
+ * in all copies or substantial portions of the Materials.
+ *
+ * The Materials are Confidential Information as defined by the
+ * Khronos Membership Agreement until designated non-confidential by Khronos,
+ * at which point this condition clause shall be removed.
+ *
+ * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ *
+ *//*!
+ * \file
+ * \brief Pipeline Tests
+ *//*--------------------------------------------------------------------*/
+
+#include "vktPipelineTests.hpp"
+#include "vktPipelineDepthTests.hpp"
+#include "deUniquePtr.hpp"
+
+namespace vkt
+{
+namespace pipeline
+{
+
+tcu::TestCaseGroup* createTests (tcu::TestContext& testCtx)
+{
+       de::MovePtr<tcu::TestCaseGroup> pipelineTests (new tcu::TestCaseGroup(testCtx, "pipeline", "Pipeline Tests"));
+
+       pipelineTests->addChild(createDepthTests(testCtx));
+
+       return pipelineTests.release();
+}
+
+} // pipeline
+} // vkt
diff --git a/external/vulkancts/modules/vulkan/pipeline/vktPipelineTests.hpp b/external/vulkancts/modules/vulkan/pipeline/vktPipelineTests.hpp
new file mode 100644 (file)
index 0000000..cb1c470
--- /dev/null
@@ -0,0 +1,51 @@
+#ifndef _VKTPIPELINETESTS_HPP
+#define _VKTPIPELINETESTS_HPP
+/*------------------------------------------------------------------------
+ * Vulkan Conformance Tests
+ * ------------------------
+ *
+ * Copyright (c) 2015 The Khronos Group Inc.
+ * Copyright (c) 2015 Imagination Technologies Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and/or associated documentation files (the
+ * "Materials"), to deal in the Materials without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Materials, and to
+ * permit persons to whom the Materials are furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice(s) and this permission notice shall be included
+ * in all copies or substantial portions of the Materials.
+ *
+ * The Materials are Confidential Information as defined by the
+ * Khronos Membership Agreement until designated non-confidential by Khronos,
+ * at which point this condition clause shall be removed.
+ *
+ * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ *
+ *//*!
+ * \file
+ * \brief Pipeline Tests
+ *//*--------------------------------------------------------------------*/
+
+#include "tcuDefs.hpp"
+#include "tcuTestCase.hpp"
+
+namespace vkt
+{
+namespace pipeline
+{
+
+tcu::TestCaseGroup*            createTests                     (tcu::TestContext& testCtx);
+
+} // pipeline
+} // vkt
+
+#endif // _VKTPIPELINETESTS_HPP
diff --git a/external/vulkancts/modules/vulkan/pipeline/vktPipelineVertexUtil.cpp b/external/vulkancts/modules/vulkan/pipeline/vktPipelineVertexUtil.cpp
new file mode 100644 (file)
index 0000000..113a70d
--- /dev/null
@@ -0,0 +1,110 @@
+/*------------------------------------------------------------------------
+ * Vulkan Conformance Tests
+ * ------------------------
+ *
+ * Copyright (c) 2015 The Khronos Group Inc.
+ * Copyright (c) 2015 Imagination Technologies Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and/or associated documentation files (the
+ * "Materials"), to deal in the Materials without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Materials, and to
+ * permit persons to whom the Materials are furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice(s) and this permission notice shall be included
+ * in all copies or substantial portions of the Materials.
+ *
+ * The Materials are Confidential Information as defined by the
+ * Khronos Membership Agreement until designated non-confidential by Khronos,
+ * at which point this condition clause shall be removed.
+ *
+ * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ *
+ *//*!
+ * \file
+ * \brief Utilities for vertex buffers.
+ *//*--------------------------------------------------------------------*/
+
+#include "vktPipelineVertexUtil.hpp"
+#include "tcuVectorUtil.hpp"
+
+namespace vkt
+{
+namespace pipeline
+{
+
+std::vector<Vertex4RGBA> createOverlappingQuads (void)
+{
+       using tcu::Vec2;
+       using tcu::Vec4;
+
+       std::vector<Vertex4RGBA> vertices;
+
+       const Vec2 translations[4] =
+       {
+               Vec2(-0.25f, -0.25f),
+               Vec2(-1.0f, -0.25f),
+               Vec2(-1.0f, -1.0f),
+               Vec2(-0.25f, -1.0f)
+       };
+
+       const Vec4 quadColors[4] =
+       {
+               Vec4(1.0f, 0.0f, 0.0f, 1.0),
+               Vec4(0.0f, 1.0f, 0.0f, 1.0),
+               Vec4(0.0f, 0.0f, 1.0f, 1.0),
+               Vec4(1.0f, 0.0f, 1.0f, 1.0)
+       };
+
+       const float quadSize = 1.25f;
+
+       for (int quadNdx = 0; quadNdx < 4; quadNdx++)
+       {
+               const Vec2&     translation     = translations[quadNdx];
+               const Vec4&     color           = quadColors[quadNdx];
+
+               const Vertex4RGBA lowerLeftVertex =
+               {
+                       Vec4(translation.x(), translation.y(), 0.0f, 1.0f),
+                       color
+               };
+               const Vertex4RGBA upperLeftVertex =
+               {
+                       Vec4(translation.x(), translation.y() + quadSize, 0.0f, 1.0f),
+                       color
+               };
+               const Vertex4RGBA lowerRightVertex =
+               {
+                       Vec4(translation.x() + quadSize, translation.y(), 0.0f, 1.0f),
+                       color
+               };
+               const Vertex4RGBA upperRightVertex =
+               {
+                       Vec4(translation.x() + quadSize, translation.y() + quadSize, 0.0f, 1.0f),
+                       color
+               };
+
+               // Triangle 1, CCW
+               vertices.push_back(lowerLeftVertex);
+               vertices.push_back(lowerRightVertex);
+               vertices.push_back(upperLeftVertex);
+
+               // Triangle 2, CW
+               vertices.push_back(lowerRightVertex);
+               vertices.push_back(upperLeftVertex);
+               vertices.push_back(upperRightVertex);
+       }
+
+       return vertices;
+}
+
+} // pipeline
+} // vkt
diff --git a/external/vulkancts/modules/vulkan/pipeline/vktPipelineVertexUtil.hpp b/external/vulkancts/modules/vulkan/pipeline/vktPipelineVertexUtil.hpp
new file mode 100644 (file)
index 0000000..0fc3663
--- /dev/null
@@ -0,0 +1,64 @@
+#ifndef _VKTPIPELINEVERTEXUTIL_HPP
+#define _VKTPIPELINEVERTEXUTIL_HPP
+/*------------------------------------------------------------------------
+ * Vulkan Conformance Tests
+ * ------------------------
+ *
+ * Copyright (c) 2015 The Khronos Group Inc.
+ * Copyright (c) 2015 Imagination Technologies Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and/or associated documentation files (the
+ * "Materials"), to deal in the Materials without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Materials, and to
+ * permit persons to whom the Materials are furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice(s) and this permission notice shall be included
+ * in all copies or substantial portions of the Materials.
+ *
+ * The Materials are Confidential Information as defined by the
+ * Khronos Membership Agreement until designated non-confidential by Khronos,
+ * at which point this condition clause shall be removed.
+ *
+ * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ *
+ *//*!
+ * \file
+ * \brief Utilities for vertex buffers.
+ *//*--------------------------------------------------------------------*/
+
+#include "tcuDefs.hpp"
+#include "tcuVectorUtil.hpp"
+#include <vector>
+
+namespace vkt
+{
+namespace pipeline
+{
+
+struct Vertex4RGBA
+{
+       tcu::Vec4 position;
+       tcu::Vec4 color;
+};
+
+/*! \brief Creates a pattern of 4 overlapping quads.
+ *
+ *  The quads are alined along the plane Z = 0, with X,Y taking values between -1 and 1.
+ *  Each quad covers one of the quadrants of the scene and partially extends to the other 3 quadrants.
+ *  The triangles of each quad have different winding orders (CW/CCW).
+ */
+std::vector<Vertex4RGBA> createOverlappingQuads (void);
+
+} // pipeline
+} // vkt
+
+#endif  // _VKTPIPELINEVERTEXUTIL_HPP
index 4cd4435..fb0d2bc 100644 (file)
@@ -47,6 +47,7 @@
 
 #include "vktInfo.hpp"
 #include "vktApiTests.hpp"
+#include "vktPipelineTests.hpp"
 
 #include <vector>
 #include <sstream>
@@ -206,8 +207,9 @@ tcu::TestCaseExecutor* TestPackage::createExecutor (void) const
 
 void TestPackage::init (void)
 {
-       addChild(createInfoTests        (m_testCtx));
-       addChild(api::createTests       (m_testCtx));
+       addChild(createInfoTests                (m_testCtx));
+       addChild(api::createTests               (m_testCtx));
+       addChild(pipeline::createTests  (m_testCtx));
 }
 
 } // vkt