From: Boris Brezillon Date: Thu, 30 Jun 2022 13:55:23 +0000 (-0700) Subject: dzn: Take VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT into account X-Git-Tag: upstream/22.3.5~6604 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=99352b87dce99c469aad81f3ae63fe761d0611a5;p=platform%2Fupstream%2Fmesa.git dzn: Take VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT into account Use a typeless format when VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT is set, so we can cast to compatible types at least. Still doesn't work when formats are of the same size but from incompatible types (like R32_FLOAT and RGBA8_UNORM), which Vulkan considers as compatible while D3D12 doesn't, but it gets us closer to what the Vulkan API wants. D3D12_FEATURE_DATA_D3D12_OPTIONS12::RelaxedFormatCastingSupported should address the remaining limitations. Reviewed-by: Jesse Natalie Part-of: --- diff --git a/src/microsoft/vulkan/dzn_image.c b/src/microsoft/vulkan/dzn_image.c index 16d6f78..5bbef22 100644 --- a/src/microsoft/vulkan/dzn_image.c +++ b/src/microsoft/vulkan/dzn_image.c @@ -169,6 +169,9 @@ dzn_image_create(struct dzn_device *device, image->desc.Layout = D3D12_TEXTURE_LAYOUT_UNKNOWN; } + if (image->vk.create_flags & VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT) + image->desc.Format = dzn_get_typeless_dxgi_format(image->desc.Format); + if (image->desc.SampleDesc.Count > 1) image->desc.Alignment = D3D12_DEFAULT_MSAA_RESOURCE_PLACEMENT_ALIGNMENT; else