From: Graeme Leese Date: Tue, 7 May 2019 12:41:46 +0000 (+0100) Subject: Simplify support checking and fix typos in messages X-Git-Tag: upstream/1.3.5~2134 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b2193dabefd4e1b0b6717a01d4e44106d6a2e277;p=platform%2Fupstream%2FVK-GL-CTS.git Simplify support checking and fix typos in messages The code for checking format support was duplicated for source and destination formats and there were several typos in the various error messages. Components: Vulkan Affects: dEQP-VK.ycbcr.copy.* Change-Id: I1cc02a5aa66f521e5a152f608f39456e24c4ccb8 --- diff --git a/external/vulkancts/modules/vulkan/ycbcr/vktYCbCrCopyTests.cpp b/external/vulkancts/modules/vulkan/ycbcr/vktYCbCrCopyTests.cpp index f121fb5..ad74bae 100644 --- a/external/vulkancts/modules/vulkan/ycbcr/vktYCbCrCopyTests.cpp +++ b/external/vulkancts/modules/vulkan/ycbcr/vktYCbCrCopyTests.cpp @@ -93,26 +93,23 @@ struct TestConfig ImageConfig dst; }; -void checkSupport (Context& context, const TestConfig config) +void checkFormatSupport(Context& context, const ImageConfig& config) { - if (!de::contains(context.getDeviceExtensions().begin(), context.getDeviceExtensions().end(), string("VK_KHR_sampler_ycbcr_conversion"))) - TCU_THROW(NotSupportedError, "Extension VK_KHR_sampler_ycbcr_conversion not supported"); - try { - const vk::VkFormatProperties properties (vk::getPhysicalDeviceFormatProperties(context.getInstanceInterface(), context.getPhysicalDevice(), config.src.format)); - const vk::VkFormatFeatureFlags features (config.src.tiling == vk::VK_IMAGE_TILING_OPTIMAL + const vk::VkFormatProperties properties (vk::getPhysicalDeviceFormatProperties(context.getInstanceInterface(), context.getPhysicalDevice(), config.format)); + const vk::VkFormatFeatureFlags features (config.tiling == vk::VK_IMAGE_TILING_OPTIMAL ? properties.optimalTilingFeatures : properties.linearTilingFeatures); if ((features & vk::VK_FORMAT_FEATURE_TRANSFER_SRC_BIT) == 0 && (features & vk::VK_FORMAT_FEATURE_TRANSFER_DST_BIT) == 0) { - TCU_THROW(NotSupportedError, "Source format doesn't support copies"); + TCU_THROW(NotSupportedError, "Format doesn't support copies"); } - if (config.src.disjoint && ((features & vk::VK_FORMAT_FEATURE_DISJOINT_BIT) == 0)) - TCU_THROW(NotSupportedError, "Format doesn'tsupport disjoint planes"); + if (config.disjoint && ((features & vk::VK_FORMAT_FEATURE_DISJOINT_BIT) == 0)) + TCU_THROW(NotSupportedError, "Format doesn't support disjoint planes"); } catch (const vk::Error& err) { @@ -121,30 +118,15 @@ void checkSupport (Context& context, const TestConfig config) throw; } +} - try - { - const vk::VkFormatProperties properties (vk::getPhysicalDeviceFormatProperties(context.getInstanceInterface(), context.getPhysicalDevice(), config.dst.format)); - const vk::VkFormatFeatureFlags features (config.dst.tiling == vk::VK_IMAGE_TILING_OPTIMAL - ? properties.optimalTilingFeatures - : properties.linearTilingFeatures); - - if ((features & vk::VK_FORMAT_FEATURE_TRANSFER_SRC_BIT) == 0 - && (features & vk::VK_FORMAT_FEATURE_TRANSFER_DST_BIT) == 0) - { - TCU_THROW(NotSupportedError, "Source format doesn't support copies"); - } - - if (config.dst.disjoint && ((features & vk::VK_FORMAT_FEATURE_DISJOINT_BIT) == 0)) - TCU_THROW(NotSupportedError, "Format doesn't disjoint planes"); - } - catch (const vk::Error& err) - { - if (err.getError() == vk::VK_ERROR_FORMAT_NOT_SUPPORTED) - TCU_THROW(NotSupportedError, "Format not supported"); +void checkSupport (Context& context, const TestConfig config) +{ + if (!de::contains(context.getDeviceExtensions().begin(), context.getDeviceExtensions().end(), string("VK_KHR_sampler_ycbcr_conversion"))) + TCU_THROW(NotSupportedError, "Extension VK_KHR_sampler_ycbcr_conversion not supported"); - throw; - } + checkFormatSupport(context, config.src); + checkFormatSupport(context, config.dst); } vk::Move createImage (const vk::DeviceInterface& vkd,