From fb08bc8d76df7d24f313811ed8d33a73ab3231da Mon Sep 17 00:00:00 2001 From: Jesse Natalie Date: Tue, 8 Feb 2022 07:26:10 -0800 Subject: [PATCH] d3d12: Don't suballocate TBO buffers Reviewed-by: Sil Vilerino Part-of: --- 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);