Mesa (main): dzn: Take VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT into account

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jul 6 06:29:45 UTC 2022


Module: Mesa
Branch: main
Commit: 99352b87dce99c469aad81f3ae63fe761d0611a5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=99352b87dce99c469aad81f3ae63fe761d0611a5

Author: Boris Brezillon <boris.brezillon at collabora.com>
Date:   Thu Jun 30 06:55:23 2022 -0700

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 <jenatali at microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17368>

---

 src/microsoft/vulkan/dzn_image.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/microsoft/vulkan/dzn_image.c b/src/microsoft/vulkan/dzn_image.c
index 16d6f785841..5bbef22d2f1 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



More information about the mesa-commit mailing list