Correct image properties tests on Null driver
authorPiotr Byszewski <piotr.byszewski@mobica.com>
Tue, 23 Oct 2018 09:42:49 +0000 (11:42 +0200)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Thu, 1 Nov 2018 09:48:16 +0000 (05:48 -0400)
On Null driver all features are enabled and this trigered some issues
with YCBCR format in image_format_properties tests. This change
resolves those issues.

VK-GL-CTS issue: 1438

Components: Vulkan

Change-Id: I3d1707438909ae4f5e828092a97a6380b615beca
Affects: dEQP-VK.api.info.image_format_properties.*

external/vulkancts/modules/vulkan/api/vktApiFeatureInfo.cpp

index f70b924..30b4107 100644 (file)
@@ -2135,29 +2135,42 @@ VkSampleCountFlags getRequiredOptimalTilingSampleCounts (const VkPhysicalDeviceL
                                                                                                                 const VkFormat                                 format,
                                                                                                                 const VkImageUsageFlags                usageFlags)
 {
-       if (!isCompressedFormat(format))
+       if (isCompressedFormat(format))
+               return VK_SAMPLE_COUNT_1_BIT;
+
+       bool            hasDepthComp    = false;
+       bool            hasStencilComp  = false;
+       const bool      isYCbCr                 = isYCbCrFormat(format);
+       if (!isYCbCr)
        {
-               const tcu::TextureFormat                tcuFormat               = mapVkFormat(format);
-               const bool                                              hasDepthComp    = (tcuFormat.order == tcu::TextureFormat::D || tcuFormat.order == tcu::TextureFormat::DS);
-               const bool                                              hasStencilComp  = (tcuFormat.order == tcu::TextureFormat::S || tcuFormat.order == tcu::TextureFormat::DS);
-               const bool                                              isColorFormat   = !hasDepthComp && !hasStencilComp;
-               VkSampleCountFlags                              sampleCounts    = ~(VkSampleCountFlags)0;
+               const tcu::TextureFormat        tcuFormat               = mapVkFormat(format);
+               hasDepthComp    = (tcuFormat.order == tcu::TextureFormat::D || tcuFormat.order == tcu::TextureFormat::DS);
+               hasStencilComp  = (tcuFormat.order == tcu::TextureFormat::S || tcuFormat.order == tcu::TextureFormat::DS);
+       }
 
-               DE_ASSERT((hasDepthComp || hasStencilComp) != isColorFormat);
+       const bool                                              isColorFormat   = !hasDepthComp && !hasStencilComp;
+       VkSampleCountFlags                              sampleCounts    = ~(VkSampleCountFlags)0;
 
-               if ((usageFlags & VK_IMAGE_USAGE_STORAGE_BIT) != 0)
-                       sampleCounts &= deviceLimits.storageImageSampleCounts;
+       DE_ASSERT((hasDepthComp || hasStencilComp) != isColorFormat);
 
-               if ((usageFlags & VK_IMAGE_USAGE_SAMPLED_BIT) != 0)
-               {
-                       if (hasDepthComp)
-                               sampleCounts &= deviceLimits.sampledImageDepthSampleCounts;
+       if ((usageFlags & VK_IMAGE_USAGE_STORAGE_BIT) != 0)
+               sampleCounts &= deviceLimits.storageImageSampleCounts;
 
-                       if (hasStencilComp)
-                               sampleCounts &= deviceLimits.sampledImageStencilSampleCounts;
+       if ((usageFlags & VK_IMAGE_USAGE_SAMPLED_BIT) != 0)
+       {
+               if (hasDepthComp)
+                       sampleCounts &= deviceLimits.sampledImageDepthSampleCounts;
+
+               if (hasStencilComp)
+                       sampleCounts &= deviceLimits.sampledImageStencilSampleCounts;
 
-                       if (isColorFormat)
+               if (isColorFormat)
+               {
+                       if (isYCbCr)
+                               sampleCounts &= deviceLimits.sampledImageColorSampleCounts;
+                       else
                        {
+                               const tcu::TextureFormat                tcuFormat       = mapVkFormat(format);
                                const tcu::TextureChannelClass  chnClass        = tcu::getTextureChannelClass(tcuFormat.type);
 
                                if (chnClass == tcu::TEXTURECHANNELCLASS_UNSIGNED_INTEGER ||
@@ -2167,28 +2180,26 @@ VkSampleCountFlags getRequiredOptimalTilingSampleCounts (const VkPhysicalDeviceL
                                        sampleCounts &= deviceLimits.sampledImageColorSampleCounts;
                        }
                }
+       }
 
-               if ((usageFlags & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT) != 0)
-                       sampleCounts &= deviceLimits.framebufferColorSampleCounts;
+       if ((usageFlags & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT) != 0)
+               sampleCounts &= deviceLimits.framebufferColorSampleCounts;
 
-               if ((usageFlags & VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) != 0)
-               {
-                       if (hasDepthComp)
-                               sampleCounts &= deviceLimits.framebufferDepthSampleCounts;
+       if ((usageFlags & VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) != 0)
+       {
+               if (hasDepthComp)
+                       sampleCounts &= deviceLimits.framebufferDepthSampleCounts;
 
-                       if (hasStencilComp)
-                               sampleCounts &= deviceLimits.framebufferStencilSampleCounts;
-               }
+               if (hasStencilComp)
+                       sampleCounts &= deviceLimits.framebufferStencilSampleCounts;
+       }
 
-               // If there is no usage flag set that would have corresponding device limit,
-               // only VK_SAMPLE_COUNT_1_BIT is required.
-               if (sampleCounts == ~(VkSampleCountFlags)0)
-                       sampleCounts &= VK_SAMPLE_COUNT_1_BIT;
+       // If there is no usage flag set that would have corresponding device limit,
+       // only VK_SAMPLE_COUNT_1_BIT is required.
+       if (sampleCounts == ~(VkSampleCountFlags)0)
+               sampleCounts &= VK_SAMPLE_COUNT_1_BIT;
 
-               return sampleCounts;
-       }
-       else
-               return VK_SAMPLE_COUNT_1_BIT;
+       return sampleCounts;
 }
 
 struct ImageFormatPropertyCase