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"))
// 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)
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)
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);
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;
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();
"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;
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();