From af03cbdcbbdd4baf3144c5be6fb4bee21aa2b6b3 Mon Sep 17 00:00:00 2001 From: Slawomir Cygan Date: Wed, 7 Mar 2018 18:02:56 +0100 Subject: [PATCH] Add tests for checking YCbCr format enums in Vulkan 1.1 Check that YCbCr format enums added in Vulkan 1.1 are recognized by implementation, even when samplerYcbcrConversion feature is not supported. This change splits 'checkYcrbrConversionSupport' into: - API support (if VkFormats are recognized by the implementation) - the actual conversion support. YCbCr feature check tests are run always when API is supported, even if YCbCr conversion it not. However, support for format properties and image format properties is still not required, if YCBCr conversion feature is not supported. Component: Vulkan VK-GL-CTS Issue: 1059 Affects: dEQP-VK.api.info.format_properties.* dEQP-VK.api.info.*image_format_properties* Change-Id: I84280eaa481a566e05ce028b9e4ec407f2d27599 --- .../modules/vulkan/api/vktApiFeatureInfo.cpp | 34 ++++++++++++------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/external/vulkancts/modules/vulkan/api/vktApiFeatureInfo.cpp b/external/vulkancts/modules/vulkan/api/vktApiFeatureInfo.cpp index c693b71ab..e795812af 100644 --- a/external/vulkancts/modules/vulkan/api/vktApiFeatureInfo.cpp +++ b/external/vulkancts/modules/vulkan/api/vktApiFeatureInfo.cpp @@ -1885,8 +1885,12 @@ VkPhysicalDeviceSamplerYcbcrConversionFeatures getPhysicalDeviceSamplerYcbcrConv return ycbcrFeatures; } -void checkYcbcrConversionSupport (Context& context) +void checkYcbcrApiSupport (Context& context) { + // check if YCbcr API and are supported by implementation + + // the support for formats and YCbCr may still be optional - see isYcbcrConversionSupported below + if (!vk::isCoreDeviceExtension(context.getUsedApiVersion(), "VK_KHR_sampler_ycbcr_conversion")) { if (!vk::isDeviceExtensionSupported(context.getUsedApiVersion(), context.getDeviceExtensions(), "VK_KHR_sampler_ycbcr_conversion")) @@ -1895,13 +1899,15 @@ void checkYcbcrConversionSupport (Context& context) // Hard dependency for ycbcr TCU_CHECK(de::contains(context.getInstanceExtensions().begin(), context.getInstanceExtensions().end(), "VK_KHR_get_physical_device_properties2")); } +} - { - const VkPhysicalDeviceSamplerYcbcrConversionFeatures ycbcrFeatures = getPhysicalDeviceSamplerYcbcrConversionFeatures(context.getInstanceInterface(), context.getPhysicalDevice()); +bool isYcbcrConversionSupported (Context& context) +{ + checkYcbcrApiSupport(context); - if (ycbcrFeatures.samplerYcbcrConversion == VK_FALSE) - TCU_THROW(NotSupportedError, "samplerYcbcrConversion is not supported"); - } + const VkPhysicalDeviceSamplerYcbcrConversionFeatures ycbcrFeatures = getPhysicalDeviceSamplerYcbcrConversionFeatures(context.getInstanceInterface(), context.getPhysicalDevice()); + + return (ycbcrFeatures.samplerYcbcrConversion == VK_TRUE); } VkFormatFeatureFlags getAllowedYcbcrFormatFeatures (VkFormat format) @@ -1921,7 +1927,7 @@ VkFormatFeatureFlags getAllowedYcbcrFormatFeatures (VkFormat format) flags |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT; flags |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT; flags |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE_BIT; - flags |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_MINMAX_BIT_EXT; + flags |= VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_MINMAX_BIT_EXT; // multi-plane formats *may* support DISJOINT_BIT if (getPlaneCount(format) >= 2) @@ -1936,7 +1942,8 @@ VkFormatFeatureFlags getAllowedYcbcrFormatFeatures (VkFormat format) tcu::TestStatus ycbcrFormatProperties (Context& context, VkFormat format) { DE_ASSERT(isYCbCrFormat(format)); - checkYcbcrConversionSupport(context); + // check if Ycbcr format enums are valid given the version and extensions + checkYcbcrApiSupport(context); TestLog& log = context.getTestContext().getLog(); const VkFormatProperties properties = getPhysicalDeviceFormatProperties(context.getInstanceInterface(), context.getPhysicalDevice(), format); @@ -1960,7 +1967,8 @@ tcu::TestStatus ycbcrFormatProperties (Context& context, VkFormat format) VK_FORMAT_G8_B8R8_2PLANE_420_UNORM, VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM }; - const bool isRequiredBaseFormat (de::contains(DE_ARRAY_BEGIN(s_requiredBaseFormats), DE_ARRAY_END(s_requiredBaseFormats), format)); + const bool isRequiredBaseFormat = isYcbcrConversionSupported(context) && + de::contains(DE_ARRAY_BEGIN(s_requiredBaseFormats), DE_ARRAY_END(s_requiredBaseFormats), format); log << TestLog::Message << properties << TestLog::EndMessage; @@ -2446,7 +2454,8 @@ struct ImageFormatPropertyCase tcu::TestStatus imageFormatProperties (Context& context, const VkFormat format, const VkImageType imageType, const VkImageTiling tiling) { if (isYCbCrFormat(format)) - checkYcbcrConversionSupport(context); + // check if Ycbcr format enums are valid given the version and extensions + checkYcbcrApiSupport(context); TestLog& log = context.getTestContext().getLog(); const VkPhysicalDeviceFeatures& deviceFeatures = context.getDeviceFeatures(); @@ -2465,7 +2474,7 @@ tcu::TestStatus imageFormatProperties (Context& context, const VkFormat format, "A sampled image format must have VK_FORMAT_FEATURE_TRANSFER_SRC_BIT and VK_FORMAT_FEATURE_TRANSFER_DST_BIT format feature flags set"); } - if (format == VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM_KHR || format == VK_FORMAT_G8_B8R8_2PLANE_420_UNORM_KHR) + if (isYcbcrConversionSupported(context) && (format == VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM_KHR || format == VK_FORMAT_G8_B8R8_2PLANE_420_UNORM_KHR)) { const VkFormatFeatureFlags requiredFeatures = VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT | VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR | VK_FORMAT_FEATURE_TRANSFER_DST_BIT_KHR | VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT_KHR; @@ -3171,7 +3180,8 @@ tcu::TestStatus deviceMemoryProperties2 (Context& context) tcu::TestStatus imageFormatProperties2 (Context& context, const VkFormat format, const VkImageType imageType, const VkImageTiling tiling) { if (isYCbCrFormat(format)) - checkYcbcrConversionSupport(context); + // check if Ycbcr format enums are valid given the version and extensions + checkYcbcrApiSupport(context); TestLog& log = context.getTestContext().getLog(); -- 2.34.1