Claim support for YCbCr 3- and 2-plane 420 format
Implementation will follow.
Bug: b/132437008
Tests: dEQP-VK.*ycbcr*
Change-Id: I5fd4826257c6886e109d007ac926ee61895bf62d
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/31613
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
diff --git a/src/Vulkan/VkPhysicalDevice.cpp b/src/Vulkan/VkPhysicalDevice.cpp
index 8387e2f..dda45f3 100644
--- a/src/Vulkan/VkPhysicalDevice.cpp
+++ b/src/Vulkan/VkPhysicalDevice.cpp
@@ -93,7 +93,7 @@
void PhysicalDevice::getFeatures(VkPhysicalDeviceSamplerYcbcrConversionFeatures* features) const
{
- features->samplerYcbcrConversion = VK_FALSE;
+ features->samplerYcbcrConversion = VK_TRUE;
}
void PhysicalDevice::getFeatures(VkPhysicalDevice16BitStorageFeatures* features) const
@@ -326,7 +326,7 @@
void PhysicalDevice::getProperties(VkSamplerYcbcrConversionImageFormatProperties* properties) const
{
- properties->combinedImageSamplerDescriptorCount = 0;
+ properties->combinedImageSamplerDescriptorCount = 1; // Need only one descriptor for YCbCr sampling.
}
#ifdef __ANDROID__
@@ -452,6 +452,16 @@
VK_FORMAT_FEATURE_TRANSFER_SRC_BIT |
VK_FORMAT_FEATURE_TRANSFER_DST_BIT;
break;
+
+ // YCbCr formats:
+ case VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM:
+ case VK_FORMAT_G8_B8R8_2PLANE_420_UNORM:
+ pFormatProperties->optimalTilingFeatures |=
+ VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT |
+ VK_FORMAT_FEATURE_TRANSFER_SRC_BIT |
+ VK_FORMAT_FEATURE_TRANSFER_DST_BIT |
+ VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT;
+ break;
default:
break;
}
diff --git a/src/Vulkan/libVulkan.cpp b/src/Vulkan/libVulkan.cpp
index fc75a01..c639a81 100644
--- a/src/Vulkan/libVulkan.cpp
+++ b/src/Vulkan/libVulkan.cpp
@@ -399,10 +399,11 @@
{
const VkPhysicalDeviceSamplerYcbcrConversionFeatures* samplerYcbcrConversionFeatures = reinterpret_cast<const VkPhysicalDeviceSamplerYcbcrConversionFeatures*>(extensionCreateInfo);
- if(samplerYcbcrConversionFeatures->samplerYcbcrConversion == VK_TRUE)
- {
- return VK_ERROR_FEATURE_NOT_PRESENT;
- }
+ // YCbCr conversion is supported.
+ // samplerYcbcrConversionFeatures->samplerYcbcrConversion can be VK_TRUE or VK_FALSE.
+ // No action needs to be taken on our end in either case; it's the apps responsibility that
+ // "To create a sampler YCbCr conversion, the samplerYcbcrConversion feature must be enabled."
+ (void)samplerYcbcrConversionFeatures->samplerYcbcrConversion;
}
break;
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES: