Test OpTypeImage with different depth property values
authorPaavo Pessi <paavo.pessi@siru.fi>
Fri, 23 Mar 2018 13:32:30 +0000 (15:32 +0200)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Tue, 24 Apr 2018 13:56:35 +0000 (09:56 -0400)
SPIR-V specification states that whether or not depth comparisons are
actually done depends on the sampling opcode, not the depth property
of the image itself.

New tests were added to verify that all three depth property values of
OpTypeImage can be used with both color and depth images, and that
depth comparisons are actually performed regardless of the depth
property.

New tests:

dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.*

Components: Vulkan

VK-GL-CTS issue: 1072
VK-GL-CTS public issue: 88

Change-Id: I5e0dbfba991ff1d477f5ebb706ffe1db32a2349f

android/cts/master/vk-master.txt
external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmGraphicsShaderTestUtil.cpp
external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmGraphicsShaderTestUtil.hpp
external/vulkancts/modules/vulkan/spirv_assembly/vktSpvAsmImageSamplerTests.cpp
external/vulkancts/mustpass/1.1.2/vk-default-no-waivers.txt
external/vulkancts/mustpass/1.1.2/vk-default.txt

index 8dddce5..cd62512 100755 (executable)
@@ -212498,6 +212498,54 @@ dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.imagesample.combined_i
 dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.imagesample.combined_image_sampler_separate_descriptors.pass_image_and_sampler_to_function.shader_tesse
 dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.imagesample.combined_image_sampler_separate_descriptors.pass_image_and_sampler_to_function.shader_geom
 dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.imagesample.combined_image_sampler_separate_descriptors.pass_image_and_sampler_to_function.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagefetch.sampled_image.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagefetch.combined_image_sampler.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagefetch.combined_image_sampler_separate_variables.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagefetch.combined_image_sampler_separate_descriptors.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagesample.sampled_image.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagesample.combined_image_sampler.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagesample.combined_image_sampler_separate_variables.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagesample.combined_image_sampler_separate_descriptors.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagesample_dref_implicit_lod.sampled_image.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagesample_dref_implicit_lod.combined_image_sampler.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagesample_dref_implicit_lod.combined_image_sampler_separate_variables.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagesample_dref_implicit_lod.combined_image_sampler_separate_descriptors.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagesample_dref_explicit_lod.sampled_image.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagesample_dref_explicit_lod.combined_image_sampler.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagesample_dref_explicit_lod.combined_image_sampler_separate_variables.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagesample_dref_explicit_lod.combined_image_sampler_separate_descriptors.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagefetch.sampled_image.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagefetch.combined_image_sampler.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagefetch.combined_image_sampler_separate_variables.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagefetch.combined_image_sampler_separate_descriptors.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagesample.sampled_image.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagesample.combined_image_sampler.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagesample.combined_image_sampler_separate_variables.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagesample.combined_image_sampler_separate_descriptors.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagesample_dref_implicit_lod.sampled_image.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagesample_dref_implicit_lod.combined_image_sampler.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagesample_dref_implicit_lod.combined_image_sampler_separate_variables.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagesample_dref_implicit_lod.combined_image_sampler_separate_descriptors.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagesample_dref_explicit_lod.sampled_image.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagesample_dref_explicit_lod.combined_image_sampler.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagesample_dref_explicit_lod.combined_image_sampler_separate_variables.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagesample_dref_explicit_lod.combined_image_sampler_separate_descriptors.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagefetch.sampled_image.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagefetch.combined_image_sampler.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagefetch.combined_image_sampler_separate_variables.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagefetch.combined_image_sampler_separate_descriptors.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagesample.sampled_image.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagesample.combined_image_sampler.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagesample.combined_image_sampler_separate_variables.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagesample.combined_image_sampler_separate_descriptors.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagesample_dref_implicit_lod.sampled_image.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagesample_dref_implicit_lod.combined_image_sampler.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagesample_dref_implicit_lod.combined_image_sampler_separate_variables.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagesample_dref_implicit_lod.combined_image_sampler_separate_descriptors.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagesample_dref_explicit_lod.sampled_image.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagesample_dref_explicit_lod.combined_image_sampler.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagesample_dref_explicit_lod.combined_image_sampler_separate_variables.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagesample_dref_explicit_lod.combined_image_sampler_separate_descriptors.shader_frag
 dEQP-VK.spirv_assembly.instruction.graphics.sconvert.int16_to_int32_vert
 dEQP-VK.spirv_assembly.instruction.graphics.sconvert.int16_to_int32_tessc
 dEQP-VK.spirv_assembly.instruction.graphics.sconvert.int16_to_int32_tesse
index 8154346..2b9adec 100644 (file)
@@ -25,6 +25,7 @@
 
 #include "tcuFloat.hpp"
 #include "tcuStringTemplate.hpp"
+#include "tcuTextureUtil.hpp"
 
 #include "vkDefs.hpp"
 #include "vkMemUtil.hpp"
@@ -32,6 +33,7 @@
 #include "vkQueryUtil.hpp"
 #include "vkRefUtil.hpp"
 #include "vkTypeUtil.hpp"
+#include "vkImageUtil.hpp"
 #include "vkCmdUtil.hpp"
 
 #include "deRandom.hpp"
@@ -173,7 +175,7 @@ string IFDataType::str (void) const
        return string("v") + numberToString(numElements) + ret;
 }
 
-VkBufferUsageFlagBits getMatchingBufferUsageFlagBit(VkDescriptorType dType)
+VkBufferUsageFlagBits getMatchingBufferUsageFlagBit (VkDescriptorType dType)
 {
        switch (dType)
        {
@@ -187,7 +189,7 @@ VkBufferUsageFlagBits getMatchingBufferUsageFlagBit(VkDescriptorType dType)
        return (VkBufferUsageFlagBits)0;
 }
 
-VkImageUsageFlags getMatchingImageUsageFlags(VkDescriptorType dType)
+VkImageUsageFlags getMatchingImageUsageFlags (VkDescriptorType dType)
 {
        switch (dType)
        {
@@ -199,7 +201,7 @@ VkImageUsageFlags getMatchingImageUsageFlags(VkDescriptorType dType)
        return (VkImageUsageFlags)0;
 }
 
-static void requireFormatUsageSupport(const InstanceInterface& vki, VkPhysicalDevice physicalDevice, VkFormat format, VkImageTiling imageTiling, VkImageUsageFlags requiredUsageFlags)
+static void requireFormatUsageSupport (const InstanceInterface& vki, VkPhysicalDevice physicalDevice, VkFormat format, VkImageTiling imageTiling, VkImageUsageFlags requiredUsageFlags)
 {
        VkFormatProperties              properties;
        VkFormatFeatureFlags    tilingFeatures  = 0;
@@ -467,7 +469,7 @@ void createPipelineShaderStages (const DeviceInterface&                                             vk,
 // layout(location = 1) in vec4 color;
 // layout(location = 1) out highp vec4 vtxColor;
 // void main (void) { gl_Position = position; vtxColor = test_func(color); }
-string makeVertexShaderAssembly(const map<string, string>& fragments)
+string makeVertexShaderAssembly (const map<string, string>& fragments)
 {
        static const char vertexShaderBoilerplate[] =
                "OpCapability Shader\n"
@@ -673,7 +675,7 @@ string makeTessControlShaderAssembly (const map<string, string>& fragments)
 //                  vec4(gl_TessCoord.z) * gl_in[2].gl_Position;
 //   out_color = testfun(interpolate(in_color));
 // }
-string makeTessEvalShaderAssembly(const map<string, string>& fragments)
+string makeTessEvalShaderAssembly (const map<string, string>& fragments)
 {
        static const char tessEvalBoilerplate[] =
                "OpCapability Tessellation\n"
@@ -822,7 +824,7 @@ string makeTessEvalShaderAssembly(const map<string, string>& fragments)
 //   EmitVertex();
 //   EndPrimitive();
 // }
-string makeGeometryShaderAssembly(const map<string, string>& fragments)
+string makeGeometryShaderAssembly (const map<string, string>& fragments)
 {
        static const char geometryShaderBoilerplate[] =
                "OpCapability Geometry\n"
@@ -944,7 +946,7 @@ string makeGeometryShaderAssembly(const map<string, string>& fragments)
 //
 // with modifications including passing vtxColor by value and ripping out
 // testfun() definition.
-string makeFragmentShaderAssembly(const map<string, string>& fragments)
+string makeFragmentShaderAssembly (const map<string, string>& fragments)
 {
        static const char fragmentShaderBoilerplate[] =
                "OpCapability Shader\n"
@@ -996,7 +998,7 @@ string makeFragmentShaderAssembly(const map<string, string>& fragments)
 
 // Creates mappings from placeholders to pass-through shader code which copies
 // the input to the output faithfully.
-map<string, string> passthruInterface(const IFDataType& data_type)
+map<string, string> passthruInterface (const IFDataType& data_type)
 {
        const string            var_type        = data_type.str();
        map<string, string>     fragments       = passthruFragments();
@@ -1202,7 +1204,7 @@ map<string, string> fillInterfacePlaceholderTessEvalGeom (void)
        return fragments;
 }
 
-map<string, string> passthruFragments(void)
+map<string, string> passthruFragments (void)
 {
        map<string, string> fragments;
        fragments["testfun"] =
@@ -1249,7 +1251,7 @@ void addShaderCodeCustomVertex (vk::SourceCollections& dst, InstanceContext cont
 // Adds shader assembly text to dst.spirvAsmSources for all shader kinds.
 // Tessellation control shader gets custom code from context, the rest are
 // pass-through.
-void addShaderCodeCustomTessControl(vk::SourceCollections& dst, InstanceContext& context, const SpirVAsmBuildOptions* spirVAsmBuildOptions)
+void addShaderCodeCustomTessControl (vk::SourceCollections& dst, InstanceContext& context, const SpirVAsmBuildOptions* spirVAsmBuildOptions)
 {
        SpirvVersion targetSpirvVersion;
 
@@ -1287,7 +1289,7 @@ void addShaderCodeCustomTessControl (vk::SourceCollections& dst, InstanceContext
 // Adds shader assembly text to dst.spirvAsmSources for all shader kinds.
 // Tessellation evaluation shader gets custom code from context, the rest are
 // pass-through.
-void addShaderCodeCustomTessEval(vk::SourceCollections& dst, InstanceContext& context, const SpirVAsmBuildOptions* spirVAsmBuildOptions)
+void addShaderCodeCustomTessEval (vk::SourceCollections& dst, InstanceContext& context, const SpirVAsmBuildOptions* spirVAsmBuildOptions)
 {
        SpirvVersion targetSpirvVersion;
 
@@ -1387,7 +1389,7 @@ void addShaderCodeCustomFragment (vk::SourceCollections& dst, InstanceContext co
        addShaderCodeCustomFragment(dst, context, DE_NULL);
 }
 
-void createCombinedModule(vk::SourceCollections& dst, InstanceContext)
+void createCombinedModule (vk::SourceCollections& dst, InstanceContext)
 {
        // \todo [2015-12-07 awoloszyn] Make tessellation / geometry conditional
        dst.spirvAsmSources.add("module") <<
@@ -1616,7 +1618,7 @@ void createCombinedModule(vk::SourceCollections& dst, InstanceContext)
                "OpFunctionEnd\n";
 }
 
-void createMultipleEntries(vk::SourceCollections& dst, InstanceContext)
+void createMultipleEntries (vk::SourceCollections& dst, InstanceContext)
 {
        dst.spirvAsmSources.add("vert") <<
        // This module contains 2 vertex shaders. One that is a passthrough
@@ -2158,7 +2160,7 @@ Move<VkBuffer> createBufferForResource (const DeviceInterface& vk, const VkDevic
        return createBuffer(vk, vkDevice, &resourceBufferParams);
 }
 
-Move<VkImage> createImageForResource (const DeviceInterface& vk, const VkDevice vkDevice, const Resource& resource, deUint32 queueFamilyIndex)
+Move<VkImage> createImageForResource (const DeviceInterface& vk, const VkDevice vkDevice, const Resource& resource, VkFormat inputFormat, deUint32 queueFamilyIndex)
 {
        const VkImageCreateInfo resourceImageParams     =
        {
@@ -2166,7 +2168,7 @@ Move<VkImage> createImageForResource (const DeviceInterface& vk, const VkDevice
                DE_NULL,                                                                                                                        //      const void*                     pNext;
                0u,                                                                                                                                     //      VkImageCreateFlags      flags;
                VK_IMAGE_TYPE_2D,                                                                                                       //      VkImageType                     imageType;
-               VK_FORMAT_R32G32B32A32_SFLOAT,                                                                          //      VkFormat                        format;
+               inputFormat,                                                                                                            //      VkFormat                        format;
                { 8, 8, 1 },                                                                                                            //      VkExtent3D                      extent;
                1u,                                                                                                                                     //      deUint32                        mipLevels;
                1u,                                                                                                                                     //      deUint32                        arraySize;
@@ -2182,7 +2184,7 @@ Move<VkImage> createImageForResource (const DeviceInterface& vk, const VkDevice
        return createImage(vk, vkDevice, &resourceImageParams);
 }
 
-void copyBufferToImage (const DeviceInterface& vk, const VkDevice& device, const VkQueue& queue, VkCommandBuffer cmdBuffer, VkBuffer buffer, VkImage image)
+void copyBufferToImage (const DeviceInterface& vk, const VkDevice& device, const VkQueue& queue, VkCommandBuffer cmdBuffer, VkBuffer buffer, VkImage image, VkImageAspectFlags aspect)
 {
        const VkBufferImageCopy                 copyRegion                      =
        {
@@ -2190,7 +2192,7 @@ void copyBufferToImage (const DeviceInterface& vk, const VkDevice& device, const
                0u,                                                                                             // deUint32                                     bufferRowLength;
                0u,                                                                                             // deUint32                                     bufferImageHeight;
                {
-                       VK_IMAGE_ASPECT_COLOR_BIT,                                              // VkImageAspectFlags           aspect;
+                       aspect,                                                                                 // VkImageAspectFlags           aspect;
                        0u,                                                                                             // deUint32                                     mipLevel;
                        0u,                                                                                             // deUint32                                     baseArrayLayer;
                        1u,                                                                                             // deUint32                                     layerCount;
@@ -2214,7 +2216,7 @@ void copyBufferToImage (const DeviceInterface& vk, const VkDevice& device, const
                        VK_QUEUE_FAMILY_IGNORED,                                        // deUint32                                     dstQueueFamilyIndex;
                        image,                                                                          // VkImage                                      image;
                        {                                                                                       // VkImageSubresourceRange      subresourceRange;
-                               VK_IMAGE_ASPECT_COLOR_BIT,              // VkImageAspectFlags   aspectMask;
+                               aspect,                                                 // VkImageAspectFlags   aspectMask;
                                0u,                                                             // deUint32                             baseMipLevel;
                                1u,                                                             // deUint32                             mipLevels;
                                0u,                                                             // deUint32                             baseArraySlice;
@@ -2232,7 +2234,7 @@ void copyBufferToImage (const DeviceInterface& vk, const VkDevice& device, const
                        VK_QUEUE_FAMILY_IGNORED,                                        // deUint32                                     dstQueueFamilyIndex;
                        image,                                                                          // VkImage                                      image;
                        {                                                                                       // VkImageSubresourceRange      subresourceRange;
-                               VK_IMAGE_ASPECT_COLOR_BIT,              // VkImageAspectFlags   aspectMask;
+                               aspect,                                                 // VkImageAspectFlags   aspectMask;
                                0u,                                                             // deUint32                             baseMipLevel;
                                1u,                                                             // deUint32                             mipLevels;
                                0u,                                                             // deUint32                             baseArraySlice;
@@ -2253,6 +2255,23 @@ void copyBufferToImage (const DeviceInterface& vk, const VkDevice& device, const
        submitCommandsAndWait(vk, device, queue, cmdBuffer);
 }
 
+VkImageAspectFlags getImageAspectFlags (VkFormat format)
+{
+       const tcu::TextureFormat::ChannelOrder  channelOrder    = vk::mapVkFormat(format).order;
+       VkImageAspectFlags                                              aspectFlags             = (VkImageAspectFlags)0u;
+
+       if (tcu::hasDepthComponent(channelOrder))
+               aspectFlags |= VK_IMAGE_ASPECT_DEPTH_BIT;
+
+       if (tcu::hasStencilComponent(channelOrder))
+               aspectFlags |= VK_IMAGE_ASPECT_STENCIL_BIT;
+
+       if (!aspectFlags)
+               aspectFlags |= VK_IMAGE_ASPECT_COLOR_BIT;
+
+       return aspectFlags;
+};
+
 TestStatus runAndVerifyDefaultPipeline (Context& context, InstanceContext instance)
 {
        if (getMinRequiredVulkanVersion(instance.resources.spirvVersion) > context.getUsedApiVersion())
@@ -2622,6 +2641,7 @@ TestStatus runAndVerifyDefaultPipeline (Context& context, InstanceContext instan
                },                                                                                              //      VkImageSubresourceRange         subresourceRange;
        };
        const Unique<VkImageView>                               colorAttView                    (createImageView(vk, device, &colorAttViewParams));
+       const VkImageAspectFlags                                inputImageAspect                = getImageAspectFlags(instance.resources.inputFormat);
 
        vector<VkImageView>                                             attViews;
        attViews.push_back(*colorAttView);
@@ -2723,12 +2743,12 @@ TestStatus runAndVerifyDefaultPipeline (Context& context, InstanceContext instan
                                        VK_CHECK(vk.flushMappedMemoryRanges(device, 1u, &range));
                                }
 
-                               Move<VkImage>                                   resourceImage                   = createImageForResource(vk, device, resource, queueFamilyIndex);
+                               Move<VkImage>                                   resourceImage                   = createImageForResource(vk, device, resource, instance.resources.inputFormat, queueFamilyIndex);
                                de::MovePtr<Allocation>                 resourceImageMemory             = allocator.allocate(getImageMemoryRequirements(vk, device, *resourceImage), MemoryRequirement::Any);
 
                                VK_CHECK(vk.bindImageMemory(device, *resourceImage, resourceImageMemory->getMemory(), resourceImageMemory->getOffset()));
 
-                               copyBufferToImage(vk, device, queue, *cmdBuf, resourceBuffer.get(), resourceImage.get());
+                               copyBufferToImage(vk, device, queue, *cmdBuf, resourceBuffer.get(), resourceImage.get(), inputImageAspect);
 
                                inResourceMemories.push_back(AllocationSp(resourceImageMemory.release()));
                                inResourceImages.push_back(ImageHandleSp(new ImageHandleUp(resourceImage)));
@@ -2866,25 +2886,25 @@ TestStatus runAndVerifyDefaultPipeline (Context& context, InstanceContext instan
                                {
                                        const VkImageViewCreateInfo     imgViewParams   =
                                        {
-                                               VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,                       //      VkStructureType                         sType;
-                                               DE_NULL,                                                                                        //      const void*                                     pNext;
-                                               0u,                                                                                                     //      VkImageViewCreateFlags          flags;
-                                               **inResourceImages[imgResourceNdx++],                           //      VkImage                                         image;
-                                               VK_IMAGE_VIEW_TYPE_2D,                                                          //      VkImageViewType                         viewType;
-                                               VK_FORMAT_R32G32B32A32_SFLOAT,                                          //      VkFormat                                        format;
+                                               VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,       //      VkStructureType                         sType;
+                                               DE_NULL,                                                                        //      const void*                                     pNext;
+                                               0u,                                                                                     //      VkImageViewCreateFlags          flags;
+                                               **inResourceImages[imgResourceNdx++],           //      VkImage                                         image;
+                                               VK_IMAGE_VIEW_TYPE_2D,                                          //      VkImageViewType                         viewType;
+                                               instance.resources.inputFormat,                         //      VkFormat                                        format;
                                                {
                                                        VK_COMPONENT_SWIZZLE_R,
                                                        VK_COMPONENT_SWIZZLE_G,
                                                        VK_COMPONENT_SWIZZLE_B,
                                                        VK_COMPONENT_SWIZZLE_A
-                                               },                                                                                                      //      VkChannelMapping                        channels;
+                                               },                                                                                      //      VkComponentMapping                      channels;
                                                {
-                                                       VK_IMAGE_ASPECT_COLOR_BIT,                                              //      VkImageAspectFlags      aspectMask;
-                                                       0u,                                                                                             //      deUint32                        baseMipLevel;
-                                                       1u,                                                                                             //      deUint32                        mipLevels;
-                                                       0u,                                                                                             //      deUint32                        baseArrayLayer;
-                                                       1u,                                                                                             //      deUint32                        arraySize;
-                                               },                                                                                                      //      VkImageSubresourceRange         subresourceRange;
+                                                       inputImageAspect,       //      VkImageAspectFlags      aspectMask;
+                                                       0u,                                     //      deUint32                        baseMipLevel;
+                                                       1u,                                     //      deUint32                        mipLevels;
+                                                       0u,                                     //      deUint32                        baseArrayLayer;
+                                                       1u,                                     //      deUint32                        arraySize;
+                                               },                                                                                      //      VkImageSubresourceRange         subresourceRange;
                                        };
 
                                        Move<VkImageView>                       imgView                 (createImageView(vk, device, &imgViewParams));
@@ -2893,7 +2913,8 @@ TestStatus runAndVerifyDefaultPipeline (Context& context, InstanceContext instan
 
                                if (hasSampler)
                                {
-                                       const VkSamplerCreateInfo       samplerParams   =
+                                       const bool                                      hasDepthComponent       = tcu::hasDepthComponent(vk::mapVkFormat(instance.resources.inputFormat).order);
+                                       const VkSamplerCreateInfo       samplerParams           =
                                        {
                                                VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO,          // VkStructureType                      sType;
                                                DE_NULL,                                                                        // const void*                          pNext;
@@ -2907,8 +2928,8 @@ TestStatus runAndVerifyDefaultPipeline (Context& context, InstanceContext instan
                                                0.0f,                                                                           // float                                        mipLodBias;
                                                VK_FALSE,                                                                       // VkBool32                                     anistoropyÉnable;
                                                1.0f,                                                                           // float                                        maxAnisotropy;
-                                               VK_FALSE,                                                                       // VkBool32                                     compareEnable;
-                                               VK_COMPARE_OP_ALWAYS,                                           // VkCompareOp                          compareOp;
+                                               (hasDepthComponent) ? VK_TRUE : VK_FALSE,       // VkBool32                                     compareEnable;
+                                               VK_COMPARE_OP_LESS,                                                     // VkCompareOp                          compareOp;
                                                0.0f,                                                                           // float                                        minLod;
                                                0.0f,                                                                           // float                                        maxLod;
                                                VK_BORDER_COLOR_INT_OPAQUE_BLACK,                       // VkBorderColor                        borderColor;
@@ -3815,7 +3836,7 @@ TestStatus runAndVerifyDefaultPipeline (Context& context, InstanceContext instan
        return TestStatus::pass("Rendered output matches input");
 }
 
-const vector<ShaderElement>& getVertFragPipelineStages()
+const vector<ShaderElement>& getVertFragPipelineStages (void)
 {
        static vector<ShaderElement> vertFragPipelineStages;
        if(vertFragPipelineStages.empty())
@@ -3826,7 +3847,7 @@ const vector<ShaderElement>& getVertFragPipelineStages()
        return vertFragPipelineStages;
 }
 
-const vector<ShaderElement>& getTessPipelineStages()
+const vector<ShaderElement>& getTessPipelineStages (void)
 {
        static vector<ShaderElement> tessPipelineStages;
        if(tessPipelineStages.empty())
@@ -3839,7 +3860,7 @@ const vector<ShaderElement>& getTessPipelineStages()
        return tessPipelineStages;
 }
 
-const vector<ShaderElement>& getGeomPipelineStages()
+const vector<ShaderElement>& getGeomPipelineStages (void)
 {
        static vector<ShaderElement> geomPipelineStages;
        if(geomPipelineStages.empty())
@@ -3874,7 +3895,7 @@ struct StageData
 };
 
 // Helper function used by addTestForStage function.
-const StageData& getStageData(vk::VkShaderStageFlagBits stage)
+const StageData& getStageData (vk::VkShaderStageFlagBits stage)
 {
        // Construct map
        static map<vk::VkShaderStageFlagBits, StageData> testedStageData;
@@ -3890,31 +3911,31 @@ const StageData& getStageData(vk::VkShaderStageFlagBits stage)
        return testedStageData[stage];
 }
 
-void createTestForStage(vk::VkShaderStageFlagBits      stage,
-                                               const std::string&                      name,
-                                               const RGBA                                      (&inputColors)[4],
-                                               const RGBA                                      (&outputColors)[4],
-                                               const map<string, string>&      testCodeFragments,
-                                               const vector<deInt32>&          specConstants,
-                                               const PushConstants&            pushConstants,
-                                               const GraphicsResources&        resources,
-                                               const GraphicsInterfaces&       interfaces,
-                                               const vector<string>&           extensions,
-                                               const vector<string>&           features,
-                                               VulkanFeatures                          vulkanFeatures,
-                                               tcu::TestCaseGroup*                     tests,
-                                               const qpTestResult                      failResult,
-                                               const string&                           failMessageTemplate)
+void createTestForStage (vk::VkShaderStageFlagBits     stage,
+                                                const std::string&                     name,
+                                                const RGBA                                     (&inputColors)[4],
+                                                const RGBA                                     (&outputColors)[4],
+                                                const map<string, string>&     testCodeFragments,
+                                                const vector<deInt32>&         specConstants,
+                                                const PushConstants&           pushConstants,
+                                                const GraphicsResources&       resources,
+                                                const GraphicsInterfaces&      interfaces,
+                                                const vector<string>&          extensions,
+                                                const vector<string>&          features,
+                                                VulkanFeatures                         vulkanFeatures,
+                                                tcu::TestCaseGroup*            tests,
+                                                const qpTestResult                     failResult,
+                                                const string&                          failMessageTemplate)
 {
-       const StageData& stageData = getStageData(stage);
+       const StageData&                                stageData                       = getStageData(stage);
        DE_ASSERT(stageData.getPipelineFn || stageData.initProgramsFn);
-       const vector<ShaderElement>& pipeline = stageData.getPipelineFn();
+       const vector<ShaderElement>&    pipeline                        = stageData.getPipelineFn();
 
-       StageToSpecConstantMap  specConstantMap;
+       StageToSpecConstantMap                  specConstantMap;
        if (!specConstants.empty())
                specConstantMap[stage] = specConstants;
 
-       InstanceContext ctx(inputColors, outputColors, testCodeFragments, specConstantMap, pushConstants, resources, interfaces, extensions, features, vulkanFeatures, stage);
+       InstanceContext                                 ctx                                     (inputColors, outputColors, testCodeFragments, specConstantMap, pushConstants, resources, interfaces, extensions, features, vulkanFeatures, stage);
        for (size_t i = 0; i < pipeline.size(); ++i)
        {
                ctx.moduleMap[pipeline[i].moduleName].push_back(std::make_pair(pipeline[i].entryName, pipeline[i].stage));
@@ -3964,7 +3985,7 @@ void createTestsForAllStages (const std::string&                  name,
                                           interfaces, extensions, features, vulkanFeatures, tests, failResult, failMessageTemplate);
 }
 
-void addTessCtrlTest(tcu::TestCaseGroup* group, const char* name, const map<string, string>& fragments)
+void addTessCtrlTest (tcu::TestCaseGroup* group, const char* name, const map<string, string>& fragments)
 {
        RGBA defaultColors[4];
        getDefaultColors(defaultColors);
index 305e035..17229b9 100644 (file)
@@ -88,6 +88,8 @@ struct GraphicsResources
 {
        // Resources used as inputs.
        std::vector<Resource>           inputs;
+       // Input resource format if used
+       VkFormat                                        inputFormat;
        // Resources used as outputs. The data supplied will be used as
        // the expected outputs for the corresponding bindings by default.
        // If other behaviors are needed, please provide a custom verifyIO.
@@ -103,7 +105,8 @@ struct GraphicsResources
        SpirvVersion                            spirvVersion;
 
                                                        GraphicsResources()
-                                                               : verifyIO              (DE_NULL)
+                                                               : inputFormat   (VK_FORMAT_R32G32B32A32_SFLOAT)
+                                                               , verifyIO              (DE_NULL)
                                                                , verifyBinary  (DE_NULL)
                                                                , spirvVersion  (SPIRV_VERSION_1_0)
                                                        {}
@@ -248,7 +251,7 @@ private:
 };
 
 // Returns the corresponding buffer usage flag bit for the given descriptor type.
-VkBufferUsageFlagBits getMatchingBufferUsageFlagBit(VkDescriptorType dType);
+VkBufferUsageFlagBits getMatchingBufferUsageFlagBit (VkDescriptorType dType);
 
 // Context for a specific test instantiation. For example, an instantiation
 // may test colors yellow/magenta/cyan/mauve in a tesselation shader
@@ -327,7 +330,7 @@ const std::string numberToString (T number)
 
 // Performs a bitwise copy of source to the destination type Dest.
 template <typename Dest, typename Src>
-Dest bitwiseCast(Src source)
+Dest bitwiseCast (Src source)
 {
   Dest dest;
   DE_STATIC_ASSERT(sizeof(source) == sizeof(dest));
@@ -347,13 +350,13 @@ void getHalfColorsFullAlpha (tcu::RGBA (&colors)[4]);
 void getInvertedDefaultColors (tcu::RGBA (&colors)[4]);
 
 // Creates fragments that specialize into a simple pass-through shader (of any kind).
-std::map<std::string, std::string> passthruFragments(void);
+std::map<std::string, std::string> passthruFragments (void);
 
-void createCombinedModule(vk::SourceCollections& dst, InstanceContext);
+void createCombinedModule (vk::SourceCollections& dst, InstanceContext);
 
 // This has two shaders of each stage. The first
 // is a passthrough, the second inverts the color.
-void createMultipleEntries(vk::SourceCollections& dst, InstanceContext);
+void createMultipleEntries (vk::SourceCollections& dst, InstanceContext);
 
 // Turns a statically sized array of ShaderElements into an instance-context
 // by setting up the mapping of modules to their contained shaders and stages.
@@ -409,27 +412,27 @@ InstanceContext createInstanceContext (const ShaderElement                                                        (&elements)[N],
        return createInstanceContext(elements, defaultColors, defaultColors, testCodeFragments);
 }
 
-void addShaderCodeCustomVertex(vk::SourceCollections& dst, InstanceContext& context, const SpirVAsmBuildOptions* spirVAsmBuildOptions);
-void addShaderCodeCustomTessControl(vk::SourceCollections& dst, InstanceContext& context, const SpirVAsmBuildOptions* spirVAsmBuildOptions);
-void addShaderCodeCustomTessEval(vk::SourceCollections& dst, InstanceContext& context, const SpirVAsmBuildOptions* spirVAsmBuildOptions);
-void addShaderCodeCustomGeometry(vk::SourceCollections& dst, InstanceContext& context, const SpirVAsmBuildOptions* spirVAsmBuildOptions);
-void addShaderCodeCustomFragment(vk::SourceCollections& dst, InstanceContext& context, const SpirVAsmBuildOptions* spirVAsmBuildOptions);
-
-void createTestForStage(vk::VkShaderStageFlagBits                                      stage,
-                                               const std::string&                                                      name,
-                                               const tcu::RGBA                                                         (&inputColors)[4],
-                                               const tcu::RGBA                                                         (&outputColors)[4],
-                                               const std::map<std::string, std::string>&       testCodeFragments,
-                                               const std::vector<deInt32>&                                     specConstants,
-                                               const PushConstants&                                            pushConstants,
-                                               const GraphicsResources&                                        resources,
-                                               const GraphicsInterfaces&                                       interfaces,
-                                               const std::vector<std::string>&                         extensions,
-                                               const std::vector<std::string>&                         features,
-                                               VulkanFeatures                                                          vulkanFeatures,
-                                               tcu::TestCaseGroup*                                                     tests,
-                                               const qpTestResult                                                      failResult                      = QP_TEST_RESULT_FAIL,
-                                               const std::string&                                                      failMessageTemplate = std::string());
+void addShaderCodeCustomVertex (vk::SourceCollections& dst, InstanceContext& context, const SpirVAsmBuildOptions* spirVAsmBuildOptions);
+void addShaderCodeCustomTessControl (vk::SourceCollections& dst, InstanceContext& context, const SpirVAsmBuildOptions* spirVAsmBuildOptions);
+void addShaderCodeCustomTessEval (vk::SourceCollections& dst, InstanceContext& context, const SpirVAsmBuildOptions* spirVAsmBuildOptions);
+void addShaderCodeCustomGeometry (vk::SourceCollections& dst, InstanceContext& context, const SpirVAsmBuildOptions* spirVAsmBuildOptions);
+void addShaderCodeCustomFragment (vk::SourceCollections& dst, InstanceContext& context, const SpirVAsmBuildOptions* spirVAsmBuildOptions);
+
+void createTestForStage (vk::VkShaderStageFlagBits                                     stage,
+                                                const std::string&                                                     name,
+                                                const tcu::RGBA                                                        (&inputColors)[4],
+                                                const tcu::RGBA                                                        (&outputColors)[4],
+                                                const std::map<std::string, std::string>&      testCodeFragments,
+                                                const std::vector<deInt32>&                            specConstants,
+                                                const PushConstants&                                           pushConstants,
+                                                const GraphicsResources&                                       resources,
+                                                const GraphicsInterfaces&                                      interfaces,
+                                                const std::vector<std::string>&                        extensions,
+                                                const std::vector<std::string>&                        features,
+                                                VulkanFeatures                                                         vulkanFeatures,
+                                                tcu::TestCaseGroup*                                            tests,
+                                                const qpTestResult                                                     failResult                      = QP_TEST_RESULT_FAIL,
+                                                const std::string&                                                     failMessageTemplate = std::string());
 
 void createTestsForAllStages (const std::string&                                               name,
                                                          const tcu::RGBA                                                       (&inputColors)[4],
@@ -585,7 +588,7 @@ tcu::TestStatus runAndVerifyDefaultPipeline (Context& context, InstanceContext i
 // Adds a new test to group using custom fragments for the tessellation-control
 // stage and passthrough fragments for all other stages.  Uses default colors
 // for input and expected output.
-void addTessCtrlTest(tcu::TestCaseGroup* group, const char* name, const std::map<std::string, std::string>& fragments);
+void addTessCtrlTest (tcu::TestCaseGroup* group, const char* name, const std::map<std::string, std::string>& fragments);
 
 // Given the original 32-bit float value, computes the corresponding 16-bit
 // float value under the given rounding mode flags and compares with the
index 5a920f6..ec739ef 100644 (file)
@@ -26,6 +26,9 @@
 #include "vktSpvAsmComputeShaderTestUtil.hpp"
 #include "vktSpvAsmGraphicsShaderTestUtil.hpp"
 
+#include "vkImageUtil.hpp"
+#include "tcuTextureUtil.hpp"
+
 namespace vkt
 {
 namespace SpirVAssembly
@@ -56,6 +59,8 @@ enum ReadOp
        READOP_IMAGEREAD = 0,
        READOP_IMAGEFETCH,
        READOP_IMAGESAMPLE,
+       READOP_IMAGESAMPLE_DREF_IMPLICIT_LOD,
+       READOP_IMAGESAMPLE_DREF_EXPLICIT_LOD,
 
        READOP_LAST
 };
@@ -71,6 +76,15 @@ enum DescriptorType
        DESCRIPTOR_TYPE_LAST
 };
 
+enum DepthProperty
+{
+       DEPTH_PROPERTY_NON_DEPTH = 0,
+       DEPTH_PROPERTY_DEPTH,
+       DEPTH_PROPERTY_UNKNOWN,
+
+       DEPTH_PROPERTY_LAST
+};
+
 bool isValidTestCase (TestType testType, DescriptorType descriptorType, ReadOp readOp)
 {
        // Check valid descriptor type and test type combinations
@@ -119,6 +133,8 @@ bool isValidTestCase (TestType testType, DescriptorType descriptorType, ReadOp r
                        break;
 
                case READOP_IMAGESAMPLE:
+               case READOP_IMAGESAMPLE_DREF_IMPLICIT_LOD:
+               case READOP_IMAGESAMPLE_DREF_EXPLICIT_LOD:
                        if (descriptorType != DESCRIPTOR_TYPE_SAMPLED_IMAGE                                                                     &&
                                descriptorType != DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER                                                &&
                                descriptorType != DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER_SEPARATE_VARIABLES             &&
@@ -168,6 +184,12 @@ const char* getReadOpName (ReadOp readOp)
                case READOP_IMAGESAMPLE:
                        return "imagesample";
 
+               case READOP_IMAGESAMPLE_DREF_IMPLICIT_LOD:
+                       return "imagesample_dref_implicit_lod";
+
+               case READOP_IMAGESAMPLE_DREF_EXPLICIT_LOD:
+                       return "imagesample_dref_explicit_lod";
+
                default:
                        DE_FATAL("Unknown readop");
                        return "";
@@ -199,6 +221,25 @@ const char* getDescriptorName (DescriptorType descType)
        }
 }
 
+const char* getDepthPropertyName (DepthProperty depthProperty)
+{
+       switch (depthProperty)
+       {
+               case DEPTH_PROPERTY_NON_DEPTH:
+                       return "non_depth";
+
+               case DEPTH_PROPERTY_DEPTH:
+                       return "depth";
+
+               case DEPTH_PROPERTY_UNKNOWN:
+                       return "unknown";
+
+               default:
+                       DE_FATAL("Unknown depth property");
+                       return "";
+       }
+}
+
 VkDescriptorType getVkDescriptorType (DescriptorType descType)
 {
        switch (descType)
@@ -220,6 +261,25 @@ VkDescriptorType getVkDescriptorType (DescriptorType descType)
        }
 }
 
+VkFormat getImageFormat (ReadOp readOp)
+{
+       switch (readOp)
+       {
+               case READOP_IMAGEREAD:
+               case READOP_IMAGEFETCH:
+               case READOP_IMAGESAMPLE:
+                       return VK_FORMAT_R32G32B32A32_SFLOAT;
+
+               case READOP_IMAGESAMPLE_DREF_IMPLICIT_LOD:
+               case READOP_IMAGESAMPLE_DREF_EXPLICIT_LOD:
+                       return VK_FORMAT_D32_SFLOAT;
+
+               default:
+                       DE_FATAL("Unknown readop");
+                       return VK_FORMAT_UNDEFINED;
+       }
+}
+
 // Get variables that are declared in the read function, ie. not passed as parameters
 std::string getFunctionDstVariableStr (ReadOp readOp, DescriptorType descType, TestType testType)
 {
@@ -266,6 +326,8 @@ std::string getFunctionDstVariableStr (ReadOp readOp, DescriptorType descType, T
                                        break;
 
                                case READOP_IMAGESAMPLE:
+                               case READOP_IMAGESAMPLE_DREF_IMPLICIT_LOD:
+                               case READOP_IMAGESAMPLE_DREF_EXPLICIT_LOD:
                                        if (passNdx)
                                                return  "           %func_img = OpLoad %Image %InputData\n"
                                                                "           %func_smp = OpLoad %Sampler %SamplerData\n"
@@ -300,6 +362,8 @@ std::string getFunctionDstVariableStr (ReadOp readOp, DescriptorType descType, T
                                        break;
 
                                case READOP_IMAGESAMPLE:
+                               case READOP_IMAGESAMPLE_DREF_IMPLICIT_LOD:
+                               case READOP_IMAGESAMPLE_DREF_EXPLICIT_LOD:
                                        if (passNdx)
                                                return  "           %func_smi = OpLoad %SampledImage %InputData\n";
                                        break;
@@ -329,6 +393,8 @@ std::string getFunctionDstVariableStr (ReadOp readOp, DescriptorType descType, T
                                        break;
 
                                case READOP_IMAGESAMPLE:
+                               case READOP_IMAGESAMPLE_DREF_IMPLICIT_LOD:
+                               case READOP_IMAGESAMPLE_DREF_EXPLICIT_LOD:
                                        if (passNdx)
                                                return  "           %func_img = OpLoad %Image %InputData2\n"
                                                                "           %func_smp = OpLoad %Sampler %SamplerData\n"
@@ -390,6 +456,8 @@ std::string getFunctionSrcVariableStr (ReadOp readOp, DescriptorType descType, T
                        {
                                case READOP_IMAGEFETCH:
                                case READOP_IMAGESAMPLE:
+                               case READOP_IMAGESAMPLE_DREF_IMPLICIT_LOD:
+                               case READOP_IMAGESAMPLE_DREF_EXPLICIT_LOD:
                                        if (passImg)
                                                result +=       "           %call_img = OpLoad %Image %InputData\n";
 
@@ -412,6 +480,8 @@ std::string getFunctionSrcVariableStr (ReadOp readOp, DescriptorType descType, T
                        {
                                case READOP_IMAGEFETCH:
                                case READOP_IMAGESAMPLE:
+                               case READOP_IMAGESAMPLE_DREF_IMPLICIT_LOD:
+                               case READOP_IMAGESAMPLE_DREF_EXPLICIT_LOD:
                                        if (passImg)
                                                result +=       "           %call_img = OpLoad %Image %InputData2\n";
 
@@ -511,24 +581,37 @@ std::string getImageReadOpStr (ReadOp readOp)
                case READOP_IMAGESAMPLE:
                        return "OpImageSampleExplicitLod %v4f32 %func_smi %normalcoordf Lod %c_f32_0";
 
+               case READOP_IMAGESAMPLE_DREF_IMPLICIT_LOD:
+                       return "OpImageSampleDrefImplicitLod %f32 %func_smi %normalcoordf %c_f32_0_5 Bias %c_f32_0";
+
+               case READOP_IMAGESAMPLE_DREF_EXPLICIT_LOD:
+                       return "OpImageSampleDrefExplicitLod %f32 %func_smi %normalcoordf %c_f32_0_5 Lod %c_f32_0";
+
                default:
                        DE_FATAL("Unknown readop");
                        return "";
        }
 }
 
+bool isImageSampleDrefReadOp (ReadOp readOp)
+{
+       return (readOp == READOP_IMAGESAMPLE_DREF_IMPLICIT_LOD) || (readOp == READOP_IMAGESAMPLE_DREF_EXPLICIT_LOD);
+}
+
 // Get types and pointers for input images and samplers
-std::string getImageSamplerTypeStr (DescriptorType descType)
+std::string getImageSamplerTypeStr (DescriptorType descType, ReadOp readOp, deUint32 depthProperty)
 {
+       const string imageFormat = isImageSampleDrefReadOp(readOp) ? "R32f" : "Rgba32f";
+
        switch (descType)
        {
                case DESCRIPTOR_TYPE_STORAGE_IMAGE:
-                       return  "              %Image = OpTypeImage %f32 2D 0 0 0 2 Rgba32f\n"
+                       return  "              %Image = OpTypeImage %f32 2D " + de::toString(depthProperty) + " 0 0 2 " + imageFormat + "\n"
                                        "           %ImagePtr = OpTypePointer UniformConstant %Image\n"
                                        "          %InputData = OpVariable %ImagePtr UniformConstant\n";
 
                case DESCRIPTOR_TYPE_SAMPLED_IMAGE:
-                       return  "              %Image = OpTypeImage %f32 2D 0 0 0 1 Rgba32f\n"
+                       return  "              %Image = OpTypeImage %f32 2D " + de::toString(depthProperty) + " 0 0 1 " + imageFormat + "\n"
                                        "           %ImagePtr = OpTypePointer UniformConstant %Image\n"
                                        "          %InputData = OpVariable %ImagePtr UniformConstant\n"
 
@@ -538,13 +621,13 @@ std::string getImageSamplerTypeStr (DescriptorType descType)
                                        "       %SampledImage = OpTypeSampledImage %Image\n";
 
                case DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER:
-                       return  "              %Image = OpTypeImage %f32 2D 0 0 0 1 Rgba32f\n"
+                       return  "              %Image = OpTypeImage %f32 2D " + de::toString(depthProperty) + " 0 0 1 " + imageFormat + "\n"
                                        "       %SampledImage = OpTypeSampledImage %Image\n"
                                        "         %SamplerPtr = OpTypePointer UniformConstant %SampledImage\n"
                                        "          %InputData = OpVariable %SamplerPtr UniformConstant\n";
 
                case DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER_SEPARATE_VARIABLES:
-                       return  "              %Image = OpTypeImage %f32 2D 0 0 0 1 Rgba32f\n"
+                       return  "              %Image = OpTypeImage %f32 2D " + de::toString(depthProperty) + " 0 0 1 " + imageFormat + "\n"
                                        "           %ImagePtr = OpTypePointer UniformConstant %Image\n"
                                        "          %InputData = OpVariable %ImagePtr UniformConstant\n"
 
@@ -554,7 +637,7 @@ std::string getImageSamplerTypeStr (DescriptorType descType)
                                        "       %SampledImage = OpTypeSampledImage %Image\n";
 
                case DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER_SEPARATE_DESCRIPTORS:
-                       return  "              %Image = OpTypeImage %f32 2D 0 0 0 1 Rgba32f\n"
+                       return  "              %Image = OpTypeImage %f32 2D " + de::toString(depthProperty) + " 0 0 1 " + imageFormat + "\n"
                                        "           %ImagePtr = OpTypePointer UniformConstant %Image\n"
                                        "          %InputData = OpVariable %ImagePtr UniformConstant\n"
                                        "         %InputData2 = OpVariable %ImagePtr UniformConstant\n"
@@ -613,7 +696,7 @@ void addComputeImageSamplerTest (tcu::TestCaseGroup* group)
        for (deUint32 numIdx = 0; numIdx < numDataPoints; ++numIdx)
                inputData.push_back(tcu::Vec4(rnd.getFloat(), rnd.getFloat(), rnd.getFloat(), rnd.getFloat()));
 
-       for (deUint32 opNdx = 0u; opNdx < READOP_LAST; opNdx++)
+       for (deUint32 opNdx = 0u; opNdx <= READOP_IMAGESAMPLE; opNdx++)
        {
                de::MovePtr<tcu::TestCaseGroup> readOpGroup     (new tcu::TestCaseGroup(testCtx, getReadOpName((ReadOp)opNdx), ""));
 
@@ -628,7 +711,7 @@ void addComputeImageSamplerTest (tcu::TestCaseGroup* group)
 
                                const std::string       imageReadOp                             = getImageReadOpStr((ReadOp)opNdx);
 
-                               const std::string       imageSamplerTypes               = getImageSamplerTypeStr((DescriptorType)descNdx);
+                               const std::string       imageSamplerTypes               = getImageSamplerTypeStr((DescriptorType)descNdx, (ReadOp)opNdx, DEPTH_PROPERTY_NON_DEPTH);
                                const std::string       functionParamTypes              = getFunctionParamTypeStr((TestType)testNdx);
 
                                const std::string       functionSrcVariables    = getFunctionSrcVariableStr((ReadOp)opNdx, (DescriptorType)descNdx, (TestType)testNdx);
@@ -763,26 +846,133 @@ void addComputeImageSamplerTest (tcu::TestCaseGroup* group)
        }
 }
 
+map<string, string> generateGraphicsImageSamplerSource (ReadOp readOp, DescriptorType descriptorType, TestType testType, DepthProperty depthProperty, deUint32 outputBinding)
+{
+       map<string, string>     source;
+
+       const std::string       imageReadOp                             = getImageReadOpStr(readOp);
+       const std::string       imageSamplerTypes               = getImageSamplerTypeStr(descriptorType, readOp, depthProperty);
+       const std::string       functionParamTypes              = getFunctionParamTypeStr(testType);
+       const std::string       functionSrcVariables    = getFunctionSrcVariableStr(readOp, descriptorType, testType);
+       const std::string       functionDstVariables    = getFunctionDstVariableStr(readOp, descriptorType, testType);
+       const std::string       functionSrcParams               = getFunctionSrcParamStr(testType);
+       const std::string       functionDstParams               = getFunctionDstParamStr(readOp, testType);
+       const std::string       samplerDecoration               = getSamplerDecoration(descriptorType);
+       const std::string       outputUniformPtr                = isImageSampleDrefReadOp(readOp) ? "%_ptr_Uniform_f32" : "%_ptr_Uniform_v4f32";
+       const std::string       outputArrayStruct               = isImageSampleDrefReadOp(readOp) ? "%_arr_f32_u32_64" : "%_arr_v4f32_u32_64";
+
+       source["pre_main"]      =
+               "           %c_u32_64 = OpConstant %u32 64\n"
+               "           %c_i32_64 = OpConstant %i32 64\n"
+               "            %c_i32_8 = OpConstant %i32 8\n"
+               "        %c_v2f32_8_8 = OpConstantComposite %v2f32 %c_f32_8 %c_f32_8\n"
+
+               "    %_arr_f32_u32_64 = OpTypeArray %f32 %c_u32_64\n"
+               "  %_arr_v4f32_u32_64 = OpTypeArray %v4f32 %c_u32_64\n"
+               "   %_ptr_Uniform_f32 = OpTypePointer Uniform %f32\n"
+               " %_ptr_Uniform_v4f32 = OpTypePointer Uniform %v4f32\n"
+
+               "             %Output = OpTypeStruct " + outputArrayStruct + "\n"
+               "%_ptr_Uniform_Output = OpTypePointer Uniform %Output\n"
+               "         %OutputData = OpVariable %_ptr_Uniform_Output Uniform\n"
+
+               + imageSamplerTypes +
+
+               "     %read_func_type = OpTypeFunction %void %i32" + functionParamTypes + "\n";
+
+       source["decoration"]    =
+               "                       OpDecorate %_arr_f32_u32_64 ArrayStride 4\n"
+               "                       OpDecorate %_arr_v4f32_u32_64 ArrayStride 16\n"
+               "                       OpMemberDecorate %Output 0 Offset 0\n"
+               "                       OpDecorate %Output BufferBlock\n"
+               "                       OpDecorate %InputData DescriptorSet 0\n"
+               "                       OpDecorate %InputData Binding 0\n"
+
+               + samplerDecoration +
+
+               "OpDecorate %OutputData DescriptorSet 0\n"
+               "OpDecorate %OutputData Binding " + de::toString(outputBinding) + "\n";
+
+       source["testfun"]       =
+               "          %read_func = OpFunction %void None %read_func_type\n"
+               "           %func_ndx = OpFunctionParameter %i32\n"
+
+               + functionDstParams +
+
+               "          %funcentry = OpLabel\n"
+
+               "                %row = OpSRem %i32 %func_ndx %c_i32_8\n"
+               "                %col = OpSDiv %i32 %func_ndx %c_i32_8\n"
+               "              %coord = OpCompositeConstruct %v2i32 %row %col\n"
+               "             %coordf = OpConvertSToF %v2f32 %coord\n"
+               "       %normalcoordf = OpFDiv %v2f32 %coordf %c_v2f32_8_8\n"
+
+               + functionDstVariables +
+
+               "              %color = " + imageReadOp + "\n"
+               "                 %36 = OpAccessChain " + outputUniformPtr + " %OutputData %c_i32_0 %func_ndx\n"
+               "                       OpStore %36 %color\n"
+
+               "                       OpReturn\n"
+               "                       OpFunctionEnd\n"
+
+               "          %test_code = OpFunction %v4f32 None %v4f32_function\n"
+               "              %param = OpFunctionParameter %v4f32\n"
+
+               "              %entry = OpLabel\n"
+
+               "                  %i = OpVariable %fp_i32 Function\n"
+               "                       OpStore %i %c_i32_0\n"
+               "                       OpBranch %loop\n"
+
+               "               %loop = OpLabel\n"
+               "                 %15 = OpLoad %i32 %i\n"
+               "                 %lt = OpSLessThan %bool %15 %c_i32_64\n"
+               "                       OpLoopMerge %merge %inc None\n"
+               "                       OpBranchConditional %lt %write %merge\n"
+
+               "              %write = OpLabel\n"
+               "              %index = OpLoad %i32 %i\n"
+
+               + functionSrcVariables +
+
+               "                %res = OpFunctionCall %void %read_func %index" + functionSrcParams + "\n"
+               "                       OpBranch %inc\n"
+
+               "                %inc = OpLabel\n"
+
+               "                 %37 = OpLoad %i32 %i\n"
+               "                 %39 = OpIAdd %i32 %37 %c_i32_1\n"
+               "                       OpStore %i %39\n"
+               "                       OpBranch %loop\n"
+
+               "              %merge = OpLabel\n"
+               "                       OpReturnValue %param\n"
+               "                       OpFunctionEnd\n";
+
+       return source;
+}
+
 void addGraphicsImageSamplerTest (tcu::TestCaseGroup* group)
 {
-       tcu::TestContext& testCtx = group->getTestContext();
+       tcu::TestContext&                       testCtx                         = group->getTestContext();
 
-       de::Random                              rnd                                     (deStringHash(group->getName()));
-       const deUint32                  numDataPoints           = 64;
-       RGBA                                    defaultColors[4];
+       de::Random                                      rnd                                     (deStringHash(group->getName()));
+       const deUint32                          numDataPoints           = 64;
+       RGBA                                            defaultColors[4];
 
        std::vector<deInt32>            noSpecConstants;
        PushConstants                           noPushConstants;
        GraphicsInterfaces                      noInterfaces;
        std::vector<std::string>        noFeatures;
        std::vector<std::string>        noExtensions;
-       VulkanFeatures                          vulkanFeatures = VulkanFeatures();
+       VulkanFeatures                          vulkanFeatures          = VulkanFeatures();
 
        vector<tcu::Vec4> inputData(numDataPoints);
        for (deUint32 numIdx = 0; numIdx < numDataPoints; ++numIdx)
                inputData[numIdx] = tcu::Vec4(rnd.getFloat(), rnd.getFloat(), rnd.getFloat(), rnd.getFloat());
 
-       for (deUint32 opNdx = 0u; opNdx < READOP_LAST; opNdx++)
+       for (deUint32 opNdx = 0u; opNdx <= READOP_IMAGESAMPLE; opNdx++)
        {
                de::MovePtr<tcu::TestCaseGroup> readOpGroup     (new tcu::TestCaseGroup(testCtx, getReadOpName((ReadOp)opNdx), ""));
 
@@ -795,20 +985,8 @@ void addGraphicsImageSamplerTest (tcu::TestCaseGroup* group)
                                if (!isValidTestCase((TestType)testNdx, (DescriptorType)descNdx, (ReadOp)opNdx))
                                        continue;
 
-                               const std::string                               imageReadOp                             = getImageReadOpStr((ReadOp)opNdx);
-
-                               const std::string                               imageSamplerTypes               = getImageSamplerTypeStr((DescriptorType)descNdx);
-                               const std::string                               functionParamTypes              = getFunctionParamTypeStr((TestType)testNdx);
-
-                               const std::string                               functionSrcVariables    = getFunctionSrcVariableStr((ReadOp)opNdx, (DescriptorType)descNdx, (TestType)testNdx);
-                               const std::string                               functionDstVariables    = getFunctionDstVariableStr((ReadOp)opNdx, (DescriptorType)descNdx, (TestType)testNdx);
+                               de::MovePtr<tcu::TestCaseGroup> typeGroup(new tcu::TestCaseGroup(testCtx, getTestTypeName((TestType)testNdx), ""));
 
-                               const std::string                               functionSrcParams               = getFunctionSrcParamStr(TestType(testNdx));
-                               const std::string                               functionDstParams               = getFunctionDstParamStr((ReadOp)opNdx, TestType(testNdx));
-
-                               de::MovePtr<tcu::TestCaseGroup> typeGroup                               (new tcu::TestCaseGroup(testCtx, getTestTypeName((TestType)testNdx), ""));
-
-                               map<string, string>                             fragments;
                                GraphicsResources                               resources;
 
                                resources.inputs.push_back(std::make_pair(getVkDescriptorType((DescriptorType)descNdx), BufferSp(new Vec4Buffer(inputData))));
@@ -832,129 +1010,164 @@ void addGraphicsImageSamplerTest (tcu::TestCaseGroup* group)
                                // Shader is expected to pass the input image data to output buffer
                                resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,                   BufferSp(new Vec4Buffer(inputData))));
 
-                               const std::string                               samplerDecoration               = getSamplerDecoration((DescriptorType)descNdx);
-
                                getDefaultColors(defaultColors);
 
-                               fragments["pre_main"]   =
-                                       "           %c_u32_64 = OpConstant %u32 64\n"
-                                       "           %c_i32_64 = OpConstant %i32 64\n"
-                                       "            %c_i32_8 = OpConstant %i32 8\n"
-                                       "        %c_v2f32_8_8 = OpConstantComposite %v2f32 %c_f32_8 %c_f32_8\n"
+                               const map<string, string>               fragments       = generateGraphicsImageSamplerSource((ReadOp)opNdx, (DescriptorType)descNdx, (TestType)testNdx, DEPTH_PROPERTY_NON_DEPTH, (deUint32)resources.inputs.size());
 
-                                       "    %_arr_v4f_u32_64 = OpTypeArray %v4f32 %c_u32_64\n"
-                                       "   %_ptr_Uniform_v4f = OpTypePointer Uniform %v4f32\n"
+                               vulkanFeatures.coreFeatures.vertexPipelineStoresAndAtomics = DE_TRUE;
+                               vulkanFeatures.coreFeatures.fragmentStoresAndAtomics = DE_FALSE;
+                               createTestForStage(VK_SHADER_STAGE_VERTEX_BIT, "shader_vert", defaultColors, defaultColors, fragments, noSpecConstants,
+                                                                  noPushConstants, resources, noInterfaces, noExtensions, noFeatures, vulkanFeatures, typeGroup.get());
 
-                                       "             %Output = OpTypeStruct %_arr_v4f_u32_64\n"
-                                       "%_ptr_Uniform_Output = OpTypePointer Uniform %Output\n"
-                                       "         %OutputData = OpVariable %_ptr_Uniform_Output Uniform\n"
+                               createTestForStage(VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT, "shader_tessc", defaultColors, defaultColors, fragments, noSpecConstants,
+                                                                  noPushConstants, resources, noInterfaces, noExtensions, noFeatures, vulkanFeatures, typeGroup.get());
 
-                                       + imageSamplerTypes +
+                               createTestForStage(VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT, "shader_tesse", defaultColors, defaultColors, fragments, noSpecConstants,
+                                                                  noPushConstants, resources, noInterfaces, noExtensions, noFeatures, vulkanFeatures, typeGroup.get());
 
-                                       "     %read_func_type = OpTypeFunction %void %i32" + functionParamTypes + "\n";
+                               createTestForStage(VK_SHADER_STAGE_GEOMETRY_BIT, "shader_geom", defaultColors, defaultColors, fragments, noSpecConstants,
+                                                                  noPushConstants, resources, noInterfaces, noExtensions, noFeatures, vulkanFeatures, typeGroup.get());
 
-                               fragments["decoration"] =
-                                       "                       OpDecorate %_arr_v4f_u32_64 ArrayStride 16\n"
-                                       "                       OpMemberDecorate %Output 0 Offset 0\n"
-                                       "                       OpDecorate %Output BufferBlock\n"
-                                       "                       OpDecorate %InputData DescriptorSet 0\n"
-                                       "                       OpDecorate %InputData Binding 0\n"
+                               vulkanFeatures.coreFeatures.vertexPipelineStoresAndAtomics = DE_FALSE;
+                               vulkanFeatures.coreFeatures.fragmentStoresAndAtomics = DE_TRUE;
+                               createTestForStage(VK_SHADER_STAGE_FRAGMENT_BIT, "shader_frag", defaultColors, defaultColors, fragments, noSpecConstants,
+                                                                  noPushConstants, resources, noInterfaces, noExtensions, noFeatures, vulkanFeatures, typeGroup.get());
 
-                                       + samplerDecoration +
+                               descGroup->addChild(typeGroup.release());
+                       }
+                       readOpGroup->addChild(descGroup.release());
+               }
+               group->addChild(readOpGroup.release());
+       }
+}
 
-                                       "OpDecorate %OutputData DescriptorSet 0\n"
-                                       "OpDecorate %OutputData Binding " + de::toString(resources.inputs.size()) + "\n";
+bool verifyDepthCompareResult (const std::vector<Resource>&            originalFloats,
+                                                          const std::vector<AllocationSp>&     outputAllocs,
+                                                          const std::vector<Resource>&         expectedOutputs,
+                                                          tcu::TestLog&)
+{
+       DE_UNREF(originalFloats);
 
-                               fragments["testfun"]    =
-                                       "          %read_func = OpFunction %void None %read_func_type\n"
-                                       "           %func_ndx = OpFunctionParameter %i32\n"
+       if (outputAllocs.size() != expectedOutputs.size())
+               return false;
 
-                                       + functionDstParams +
+       vector<deUint8> expectedBytes;
+       expectedOutputs[0].second->getBytes(expectedBytes);
 
-                                       "          %funcentry = OpLabel\n"
+       const float*    returnedAsFloat = static_cast<const float*>(outputAllocs[0]->getHostPtr());
+       const float*    expectedAsFloat = reinterpret_cast<const float*>(&expectedBytes.front());
 
-                                       "                %row = OpSRem %i32 %func_ndx %c_i32_8\n"
-                                       "                %col = OpSDiv %i32 %func_ndx %c_i32_8\n"
-                                       "              %coord = OpCompositeConstruct %v2i32 %row %col\n"
-                                       "             %coordf = OpConvertSToF %v2f32 %coord\n"
-                                       "       %normalcoordf = OpFDiv %v2f32 %coordf %c_v2f32_8_8\n"
+       for (deUint32 elementNdx = 0; elementNdx < static_cast<deUint32>(expectedBytes.size() / sizeof(float)); ++elementNdx)
+       {
+               const float input       = expectedAsFloat[elementNdx];
+               const float result      = returnedAsFloat[elementNdx];
 
-                                       + functionDstVariables +
+               // VK_COMPARE_OP_LESS: D = 1.0 if D < Dref, otherwise D = 0.0
+               if ((input < 0.5f && result != 0.0f) || (input >= 0.5f && result != 1.0f))
+                       return false;
+       }
 
-                                       "              %color = " + imageReadOp + "\n"
-                                       "                 %36 = OpAccessChain %_ptr_Uniform_v4f %OutputData %c_i32_0 %func_ndx\n"
-                                       "                       OpStore %36 %color\n"
+       return true;
+}
 
-                                       "                       OpReturn\n"
-                                       "                       OpFunctionEnd\n"
+void addGraphicsDepthPropertyTest (tcu::TestCaseGroup* group)
+{
+       tcu::TestContext&                       testCtx                         = group->getTestContext();
 
-                                       "          %test_code = OpFunction %v4f32 None %v4f32_function\n"
-                                       "              %param = OpFunctionParameter %v4f32\n"
+       de::Random                                      rnd                                     (deStringHash(group->getName()));
+       const deUint32                          numDataPoints           = 64;
+       RGBA                                            defaultColors[4];
+       vector<Vec4>                            inputDataVec4;
 
-                                       "              %entry = OpLabel\n"
+       std::vector<deInt32>            noSpecConstants;
+       PushConstants                           noPushConstants;
+       GraphicsInterfaces                      noInterfaces;
+       std::vector<std::string>        noFeatures;
+       std::vector<std::string>        noExtensions;
+       VulkanFeatures                          vulkanFeatures          = VulkanFeatures();
 
-                                       "                  %i = OpVariable %fp_i32 Function\n"
-                                       "                       OpStore %i %c_i32_0\n"
-                                       "                       OpBranch %loop\n"
+       vulkanFeatures.coreFeatures.vertexPipelineStoresAndAtomics = DE_FALSE;
+       vulkanFeatures.coreFeatures.fragmentStoresAndAtomics = DE_TRUE;
 
-                                       "               %loop = OpLabel\n"
-                                       "                 %15 = OpLoad %i32 %i\n"
-                                       "                 %lt = OpSLessThan %bool %15 %c_i32_64\n"
-                                       "                       OpLoopMerge %merge %inc None\n"
-                                       "                       OpBranchConditional %lt %write %merge\n"
+       inputDataVec4.reserve(numDataPoints);
 
-                                       "              %write = OpLabel\n"
-                                       "              %index = OpLoad %i32 %i\n"
+       for (deUint32 numIdx = 0; numIdx < numDataPoints; ++numIdx)
+               inputDataVec4.push_back(Vec4(rnd.getFloat(), rnd.getFloat(), rnd.getFloat(), rnd.getFloat()));
 
-                                       + functionSrcVariables +
+       de::MovePtr<tcu::TestCaseGroup> testGroup (new tcu::TestCaseGroup(testCtx, "depth_property", ""));
 
-                                       "                %res = OpFunctionCall %void %read_func %index" + functionSrcParams + "\n"
-                                       "                       OpBranch %inc\n"
+       for (deUint32 propertyNdx = 0u; propertyNdx < DEPTH_PROPERTY_LAST; propertyNdx++)
+       {
+               de::MovePtr<tcu::TestCaseGroup> depthPropertyGroup (new tcu::TestCaseGroup(testCtx, getDepthPropertyName((DepthProperty)propertyNdx), ""));
 
-                                       "                %inc = OpLabel\n"
+               for (deUint32 opNdx = 0u; opNdx < READOP_LAST; opNdx++)
+               {
+                       de::MovePtr<tcu::TestCaseGroup> readOpGroup     (new tcu::TestCaseGroup(testCtx, getReadOpName((ReadOp)opNdx), ""));
 
-                                       "                 %37 = OpLoad %i32 %i\n"
-                                       "                 %39 = OpIAdd %i32 %37 %c_i32_1\n"
-                                       "                       OpStore %i %39\n"
-                                       "                       OpBranch %loop\n"
+                       for (deUint32 descNdx = DESCRIPTOR_TYPE_SAMPLED_IMAGE; descNdx < DESCRIPTOR_TYPE_LAST; descNdx++)
+                       {
+                               de::MovePtr<tcu::TestCaseGroup> descGroup (new tcu::TestCaseGroup(testCtx, getDescriptorName((DescriptorType)descNdx), ""));
 
-                                       "              %merge = OpLabel\n"
-                                       "                       OpReturnValue %param\n"
-                                       "                       OpFunctionEnd\n"
+                               if (!isValidTestCase(TESTTYPE_LOCAL_VARIABLES, (DescriptorType)descNdx, (ReadOp)opNdx))
+                                       continue;
 
-                                       "";
+                               const VkFormat                          imageFormat                     = getImageFormat((ReadOp)opNdx);
+                               const bool                                      hasDpethComponent       = tcu::hasDepthComponent(vk::mapVkFormat(imageFormat).order);
 
-                               vulkanFeatures.coreFeatures.vertexPipelineStoresAndAtomics = DE_TRUE;
-                               vulkanFeatures.coreFeatures.fragmentStoresAndAtomics = DE_FALSE;
-                               createTestForStage(VK_SHADER_STAGE_VERTEX_BIT, "shader_vert", defaultColors, defaultColors, fragments, noSpecConstants,
-                                                                  noPushConstants, resources, noInterfaces, noExtensions, noFeatures, vulkanFeatures, typeGroup.get());
+                               GraphicsResources                       resources;
+                               resources.inputFormat = imageFormat;
 
-                               createTestForStage(VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT, "shader_tessc", defaultColors, defaultColors, fragments, noSpecConstants,
-                                                                  noPushConstants, resources, noInterfaces, noExtensions, noFeatures, vulkanFeatures, typeGroup.get());
+                               std::vector<Vec4>                       inputData                       = inputDataVec4;
 
-                               createTestForStage(VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT, "shader_tesse", defaultColors, defaultColors, fragments, noSpecConstants,
-                                                                  noPushConstants, resources, noInterfaces, noExtensions, noFeatures, vulkanFeatures, typeGroup.get());
+                               // Depth images have one channel, thus only needing 1/4 of the data
+                               if (hasDpethComponent)
+                                       inputData.resize(numDataPoints / 4u);
 
-                               createTestForStage(VK_SHADER_STAGE_GEOMETRY_BIT, "shader_geom", defaultColors, defaultColors, fragments, noSpecConstants,
-                                                                  noPushConstants, resources, noInterfaces, noExtensions, noFeatures, vulkanFeatures, typeGroup.get());
+                               resources.inputs.push_back(std::make_pair(getVkDescriptorType((DescriptorType)descNdx), BufferSp(new Vec4Buffer(inputData))));
+
+                               // Separate sampler for sampled images
+                               if ((DescriptorType)descNdx == DESCRIPTOR_TYPE_SAMPLED_IMAGE)
+                               {
+                                       vector<Vec4> dummyData;
+                                       resources.inputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_SAMPLER, BufferSp(new Vec4Buffer(dummyData))));
+                               }
+
+                               // Second combined image sampler with different image data
+                               if ((DescriptorType)descNdx == DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER_SEPARATE_DESCRIPTORS)
+                               {
+                                       for (size_t i = 0; i < inputData.size(); i++)
+                                               inputData[i] = Vec4(1.0f) - inputData[i];
+
+                                       resources.inputs.push_back(std::make_pair(getVkDescriptorType((DescriptorType)descNdx), BufferSp(new Vec4Buffer(inputData))));
+                               }
+
+                               // Read image without depth reference: shader is expected to pass the input image data to output buffer
+                               resources.outputs.push_back(std::make_pair(VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, BufferSp(new Vec4Buffer(inputData))));
+
+                               // Read image with depth reference: shader is expected to pass the depth comparison result to output buffer
+                               if (hasDpethComponent)
+                                       resources.verifyIO = verifyDepthCompareResult;
+
+                               const map<string, string>       fragments                       = generateGraphicsImageSamplerSource((ReadOp)opNdx, (DescriptorType)descNdx, TESTTYPE_LOCAL_VARIABLES, (DepthProperty)propertyNdx, (deUint32)resources.inputs.size());
+
+                               getDefaultColors(defaultColors);
 
-                               vulkanFeatures.coreFeatures.vertexPipelineStoresAndAtomics = DE_FALSE;
-                               vulkanFeatures.coreFeatures.fragmentStoresAndAtomics = DE_TRUE;
                                createTestForStage(VK_SHADER_STAGE_FRAGMENT_BIT, "shader_frag", defaultColors, defaultColors, fragments, noSpecConstants,
-                                                                  noPushConstants, resources, noInterfaces, noExtensions, noFeatures, vulkanFeatures, typeGroup.get());
+                                                                  noPushConstants, resources, noInterfaces, noExtensions, noFeatures, vulkanFeatures, descGroup.get());
 
-                               descGroup->addChild(typeGroup.release());
+                               readOpGroup->addChild(descGroup.release());
                        }
-                       readOpGroup->addChild(descGroup.release());
+                       depthPropertyGroup->addChild(readOpGroup.release());
                }
-               group->addChild(readOpGroup.release());
+               testGroup->addChild(depthPropertyGroup.release());
        }
+       group->addChild(testGroup.release());
 }
 } // anonymous
 
 tcu::TestCaseGroup* createImageSamplerComputeGroup (tcu::TestContext& testCtx)
 {
-       de::MovePtr<tcu::TestCaseGroup> group           (new tcu::TestCaseGroup(testCtx, "image_sampler", "Compute tests for combining images and samplers."));
+       de::MovePtr<tcu::TestCaseGroup> group (new tcu::TestCaseGroup(testCtx, "image_sampler", "Compute tests for combining images and samplers."));
        addComputeImageSamplerTest(group.get());
 
        return group.release();
@@ -962,8 +1175,10 @@ tcu::TestCaseGroup* createImageSamplerComputeGroup (tcu::TestContext& testCtx)
 
 tcu::TestCaseGroup* createImageSamplerGraphicsGroup (tcu::TestContext& testCtx)
 {
-       de::MovePtr<tcu::TestCaseGroup> group           (new tcu::TestCaseGroup(testCtx, "image_sampler", "Graphics tests for combining images and samplers."));
+       de::MovePtr<tcu::TestCaseGroup> group   (new tcu::TestCaseGroup(testCtx, "image_sampler", "Graphics tests for combining images and samplers."));
+
        addGraphicsImageSamplerTest(group.get());
+       addGraphicsDepthPropertyTest(group.get());
 
        return group.release();
 }
index 55f4c70..c9413c4 100644 (file)
@@ -212479,6 +212479,54 @@ dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.imagesample.combined_i
 dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.imagesample.combined_image_sampler_separate_descriptors.pass_image_and_sampler_to_function.shader_tesse
 dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.imagesample.combined_image_sampler_separate_descriptors.pass_image_and_sampler_to_function.shader_geom
 dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.imagesample.combined_image_sampler_separate_descriptors.pass_image_and_sampler_to_function.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagefetch.sampled_image.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagefetch.combined_image_sampler.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagefetch.combined_image_sampler_separate_variables.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagefetch.combined_image_sampler_separate_descriptors.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagesample.sampled_image.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagesample.combined_image_sampler.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagesample.combined_image_sampler_separate_variables.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagesample.combined_image_sampler_separate_descriptors.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagesample_dref_implicit_lod.sampled_image.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagesample_dref_implicit_lod.combined_image_sampler.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagesample_dref_implicit_lod.combined_image_sampler_separate_variables.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagesample_dref_implicit_lod.combined_image_sampler_separate_descriptors.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagesample_dref_explicit_lod.sampled_image.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagesample_dref_explicit_lod.combined_image_sampler.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagesample_dref_explicit_lod.combined_image_sampler_separate_variables.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagesample_dref_explicit_lod.combined_image_sampler_separate_descriptors.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagefetch.sampled_image.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagefetch.combined_image_sampler.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagefetch.combined_image_sampler_separate_variables.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagefetch.combined_image_sampler_separate_descriptors.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagesample.sampled_image.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagesample.combined_image_sampler.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagesample.combined_image_sampler_separate_variables.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagesample.combined_image_sampler_separate_descriptors.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagesample_dref_implicit_lod.sampled_image.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagesample_dref_implicit_lod.combined_image_sampler.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagesample_dref_implicit_lod.combined_image_sampler_separate_variables.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagesample_dref_implicit_lod.combined_image_sampler_separate_descriptors.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagesample_dref_explicit_lod.sampled_image.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagesample_dref_explicit_lod.combined_image_sampler.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagesample_dref_explicit_lod.combined_image_sampler_separate_variables.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagesample_dref_explicit_lod.combined_image_sampler_separate_descriptors.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagefetch.sampled_image.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagefetch.combined_image_sampler.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagefetch.combined_image_sampler_separate_variables.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagefetch.combined_image_sampler_separate_descriptors.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagesample.sampled_image.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagesample.combined_image_sampler.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagesample.combined_image_sampler_separate_variables.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagesample.combined_image_sampler_separate_descriptors.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagesample_dref_implicit_lod.sampled_image.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagesample_dref_implicit_lod.combined_image_sampler.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagesample_dref_implicit_lod.combined_image_sampler_separate_variables.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagesample_dref_implicit_lod.combined_image_sampler_separate_descriptors.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagesample_dref_explicit_lod.sampled_image.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagesample_dref_explicit_lod.combined_image_sampler.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagesample_dref_explicit_lod.combined_image_sampler_separate_variables.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagesample_dref_explicit_lod.combined_image_sampler_separate_descriptors.shader_frag
 dEQP-VK.spirv_assembly.instruction.graphics.sconvert.int16_to_int32_vert
 dEQP-VK.spirv_assembly.instruction.graphics.sconvert.int16_to_int32_tessc
 dEQP-VK.spirv_assembly.instruction.graphics.sconvert.int16_to_int32_tesse
index a60c72c..de38b9d 100644 (file)
@@ -212479,6 +212479,54 @@ dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.imagesample.combined_i
 dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.imagesample.combined_image_sampler_separate_descriptors.pass_image_and_sampler_to_function.shader_tesse
 dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.imagesample.combined_image_sampler_separate_descriptors.pass_image_and_sampler_to_function.shader_geom
 dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.imagesample.combined_image_sampler_separate_descriptors.pass_image_and_sampler_to_function.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagefetch.sampled_image.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagefetch.combined_image_sampler.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagefetch.combined_image_sampler_separate_variables.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagefetch.combined_image_sampler_separate_descriptors.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagesample.sampled_image.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagesample.combined_image_sampler.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagesample.combined_image_sampler_separate_variables.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagesample.combined_image_sampler_separate_descriptors.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagesample_dref_implicit_lod.sampled_image.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagesample_dref_implicit_lod.combined_image_sampler.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagesample_dref_implicit_lod.combined_image_sampler_separate_variables.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagesample_dref_implicit_lod.combined_image_sampler_separate_descriptors.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagesample_dref_explicit_lod.sampled_image.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagesample_dref_explicit_lod.combined_image_sampler.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagesample_dref_explicit_lod.combined_image_sampler_separate_variables.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.non_depth.imagesample_dref_explicit_lod.combined_image_sampler_separate_descriptors.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagefetch.sampled_image.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagefetch.combined_image_sampler.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagefetch.combined_image_sampler_separate_variables.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagefetch.combined_image_sampler_separate_descriptors.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagesample.sampled_image.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagesample.combined_image_sampler.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagesample.combined_image_sampler_separate_variables.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagesample.combined_image_sampler_separate_descriptors.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagesample_dref_implicit_lod.sampled_image.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagesample_dref_implicit_lod.combined_image_sampler.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagesample_dref_implicit_lod.combined_image_sampler_separate_variables.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagesample_dref_implicit_lod.combined_image_sampler_separate_descriptors.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagesample_dref_explicit_lod.sampled_image.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagesample_dref_explicit_lod.combined_image_sampler.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagesample_dref_explicit_lod.combined_image_sampler_separate_variables.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.depth.imagesample_dref_explicit_lod.combined_image_sampler_separate_descriptors.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagefetch.sampled_image.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagefetch.combined_image_sampler.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagefetch.combined_image_sampler_separate_variables.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagefetch.combined_image_sampler_separate_descriptors.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagesample.sampled_image.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagesample.combined_image_sampler.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagesample.combined_image_sampler_separate_variables.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagesample.combined_image_sampler_separate_descriptors.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagesample_dref_implicit_lod.sampled_image.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagesample_dref_implicit_lod.combined_image_sampler.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagesample_dref_implicit_lod.combined_image_sampler_separate_variables.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagesample_dref_implicit_lod.combined_image_sampler_separate_descriptors.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagesample_dref_explicit_lod.sampled_image.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagesample_dref_explicit_lod.combined_image_sampler.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagesample_dref_explicit_lod.combined_image_sampler_separate_variables.shader_frag
+dEQP-VK.spirv_assembly.instruction.graphics.image_sampler.depth_property.unknown.imagesample_dref_explicit_lod.combined_image_sampler_separate_descriptors.shader_frag
 dEQP-VK.spirv_assembly.instruction.graphics.sconvert.int16_to_int32_vert
 dEQP-VK.spirv_assembly.instruction.graphics.sconvert.int16_to_int32_tessc
 dEQP-VK.spirv_assembly.instruction.graphics.sconvert.int16_to_int32_tesse