[Mesa-dev] [PATCH 13/15] anv: support VkSamplerYcbcrConversionInfo in vkCreateImageView
Tapani Pälli
tapani.palli at intel.com
Tue Oct 30 05:26:06 UTC 2018
If a conversion struct was passed, then we resolve the format from
conversion structure.
Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
---
src/intel/vulkan/anv_image.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c
index 26b5389f6d9..cca43f6e6a0 100644
--- a/src/intel/vulkan/anv_image.c
+++ b/src/intel/vulkan/anv_image.c
@@ -1379,6 +1379,18 @@ anv_CreateImageView(VkDevice _device,
assert(range->layerCount > 0);
assert(range->baseMipLevel < image->levels);
+ struct anv_format *ext_format = NULL;
+#ifdef ANDROID
+ /* Search for VkExternalFormatANDROID and set the format. */
+ const struct VkSamplerYcbcrConversionInfo *ext_info =
+ vk_find_struct_const(pCreateInfo->pNext, SAMPLER_YCBCR_CONVERSION_INFO);
+
+ if (ext_info) {
+ ANV_FROM_HANDLE(anv_ycbcr_conversion, conversion, ext_info->conversion);
+ ext_format = conversion->format;
+ }
+#endif
+
const VkImageViewUsageCreateInfo *usage_info =
vk_find_struct_const(pCreateInfo, IMAGE_VIEW_USAGE_CREATE_INFO);
VkImageUsageFlags view_usage = usage_info ? usage_info->usage : image->usage;
@@ -1423,6 +1435,10 @@ anv_CreateImageView(VkDevice _device,
iview->n_planes = anv_image_aspect_get_planes(iview->aspect_mask);
iview->vk_format = pCreateInfo->format;
+ /* External format - resolve vk_format from external format. */
+ if (ext_format)
+ iview->vk_format = anv_get_vkformat(ext_format);
+
iview->extent = (VkExtent3D) {
.width = anv_minify(image->extent.width , range->baseMipLevel),
.height = anv_minify(image->extent.height, range->baseMipLevel),
@@ -1439,7 +1455,7 @@ anv_CreateImageView(VkDevice _device,
VkImageAspectFlags vplane_aspect =
anv_plane_to_aspect(iview->aspect_mask, vplane);
struct anv_format_plane format =
- anv_get_format_plane(&device->info, pCreateInfo->format,
+ anv_get_format_plane(&device->info, iview->vk_format,
vplane_aspect, image->tiling);
iview->planes[vplane].image_plane = iplane;
--
2.17.2
More information about the mesa-dev
mailing list