Commit e2f5da4b by Nicolas Capens Committed by Nicolas Capens

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: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarChris Forbes <chrisforbes@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
parent 0c73680a
...@@ -93,7 +93,7 @@ const VkPhysicalDeviceFeatures& PhysicalDevice::getFeatures() const ...@@ -93,7 +93,7 @@ const VkPhysicalDeviceFeatures& PhysicalDevice::getFeatures() const
void PhysicalDevice::getFeatures(VkPhysicalDeviceSamplerYcbcrConversionFeatures* features) const void PhysicalDevice::getFeatures(VkPhysicalDeviceSamplerYcbcrConversionFeatures* features) const
{ {
features->samplerYcbcrConversion = VK_FALSE; features->samplerYcbcrConversion = VK_TRUE;
} }
void PhysicalDevice::getFeatures(VkPhysicalDevice16BitStorageFeatures* features) const void PhysicalDevice::getFeatures(VkPhysicalDevice16BitStorageFeatures* features) const
...@@ -326,7 +326,7 @@ void PhysicalDevice::getProperties(const VkExternalMemoryHandleTypeFlagBits* han ...@@ -326,7 +326,7 @@ void PhysicalDevice::getProperties(const VkExternalMemoryHandleTypeFlagBits* han
void PhysicalDevice::getProperties(VkSamplerYcbcrConversionImageFormatProperties* properties) const void PhysicalDevice::getProperties(VkSamplerYcbcrConversionImageFormatProperties* properties) const
{ {
properties->combinedImageSamplerDescriptorCount = 0; properties->combinedImageSamplerDescriptorCount = 1; // Need only one descriptor for YCbCr sampling.
} }
#ifdef __ANDROID__ #ifdef __ANDROID__
...@@ -452,6 +452,16 @@ void PhysicalDevice::getFormatProperties(VkFormat format, VkFormatProperties* pF ...@@ -452,6 +452,16 @@ void PhysicalDevice::getFormatProperties(VkFormat format, VkFormatProperties* pF
VK_FORMAT_FEATURE_TRANSFER_SRC_BIT | VK_FORMAT_FEATURE_TRANSFER_SRC_BIT |
VK_FORMAT_FEATURE_TRANSFER_DST_BIT; VK_FORMAT_FEATURE_TRANSFER_DST_BIT;
break; 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: default:
break; break;
} }
......
...@@ -399,10 +399,11 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateDevice(VkPhysicalDevice physicalDevice, c ...@@ -399,10 +399,11 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateDevice(VkPhysicalDevice physicalDevice, c
{ {
const VkPhysicalDeviceSamplerYcbcrConversionFeatures* samplerYcbcrConversionFeatures = reinterpret_cast<const VkPhysicalDeviceSamplerYcbcrConversionFeatures*>(extensionCreateInfo); const VkPhysicalDeviceSamplerYcbcrConversionFeatures* samplerYcbcrConversionFeatures = reinterpret_cast<const VkPhysicalDeviceSamplerYcbcrConversionFeatures*>(extensionCreateInfo);
if(samplerYcbcrConversionFeatures->samplerYcbcrConversion == VK_TRUE) // YCbCr conversion is supported.
{ // samplerYcbcrConversionFeatures->samplerYcbcrConversion can be VK_TRUE or VK_FALSE.
return VK_ERROR_FEATURE_NOT_PRESENT; // 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; break;
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES: case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment