Mesa (main): d3d12: Don't suballocate TBO buffers

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Feb 8 21:13:47 UTC 2022


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

Author: Jesse Natalie <jenatali at microsoft.com>
Date:   Tue Feb  8 07:26:10 2022 -0800

d3d12: Don't suballocate TBO buffers

Reviewed-by: Sil Vilerino <sivileri at microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14933>

---

 src/gallium/drivers/d3d12/d3d12_resource.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/gallium/drivers/d3d12/d3d12_resource.cpp b/src/gallium/drivers/d3d12/d3d12_resource.cpp
index 14851beb7bf..1ae95167760 100644
--- a/src/gallium/drivers/d3d12/d3d12_resource.cpp
+++ b/src/gallium/drivers/d3d12/d3d12_resource.cpp
@@ -147,6 +147,14 @@ init_buffer(struct d3d12_screen *screen,
    default:
       unreachable("Invalid pipe usage");
    }
+
+   /* We can't suballocate buffers that might be bound as a sampler view, *only*
+    * because in the case of R32G32B32 formats (12 bytes per pixel), it's not possible
+    * to guarantee the offset will be divisible.
+    */
+   if (templ->bind & PIPE_BIND_SAMPLER_VIEW)
+      bufmgr = screen->cache_bufmgr;
+
    buf_desc.alignment = D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT;
    res->dxgi_format = DXGI_FORMAT_UNKNOWN;
    buf = bufmgr->create_buffer(bufmgr, templ->width0, &buf_desc);



More information about the mesa-commit mailing list