From 1e27f0b83b6a451b01ac726df243c20f5a8982d8 Mon Sep 17 00:00:00 2001 From: "Herman S." <429230+has207@users.noreply.github.com> Date: Tue, 14 Apr 2026 18:06:32 +0900 Subject: [PATCH] [D3D12] Fix bindful shared-memory descriptor layout view_count_full_update was sized for one of the two descriptor groups UpdateBindings_BindfulPath writes, letting the overflow clobber later draws. Also null the live UAV in the SRV-first group to match master. Original issue inherited from canary due to master merge (26415cb8b1) that took master's two-block layout but not its reservation and null-UAV fixes (4add1f67b). --- src/xenia/gpu/d3d12/d3d12_command_processor.cc | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/xenia/gpu/d3d12/d3d12_command_processor.cc b/src/xenia/gpu/d3d12/d3d12_command_processor.cc index 139d7fb0e..e538a6918 100644 --- a/src/xenia/gpu/d3d12/d3d12_command_processor.cc +++ b/src/xenia/gpu/d3d12/d3d12_command_processor.cc @@ -5576,12 +5576,14 @@ bool D3D12CommandProcessor::UpdateBindings_BindfulPath( if (write_textures_pixel) { view_count_partial_update += texture_count_pixel; } - // All the constants + shared memory SRV and UAV + textures. + // Shared memory SRV and null UAV + null SRV and shared memory UAV + + // textures. size_t view_count_full_update = - 2 + texture_count_vertex + texture_count_pixel; + 4 + texture_count_vertex + texture_count_pixel; if (edram_rov_used) { - // + EDRAM UAV and the ZPD counter UAV. - view_count_full_update += 2; + // + EDRAM UAV and ZPD counter UAV in two tables (with the shared memory + // SRV and with the shared memory UAV). + view_count_full_update += 4; } D3D12_CPU_DESCRIPTOR_HANDLE view_cpu_handle; D3D12_GPU_DESCRIPTOR_HANDLE view_gpu_handle; @@ -5626,11 +5628,13 @@ bool D3D12CommandProcessor::UpdateBindings_BindfulPath( bindful_textures_written_pixel_ = false; // If updating fully, write the shared memory SRV and UAV descriptors and, // if needed, the EDRAM and ZPD counter descriptors. + // SRV + null UAV + EDRAM + ZPD counter. gpu_handle_shared_memory_srv_and_edram_ = view_gpu_handle; shared_memory_->WriteRawSRVDescriptor(view_cpu_handle); view_cpu_handle.ptr += descriptor_size_view; view_gpu_handle.ptr += descriptor_size_view; - shared_memory_->WriteRawUAVDescriptor(view_cpu_handle); + ui::d3d12::util::CreateBufferRawUAV(provider.GetDevice(), view_cpu_handle, + nullptr, 0); view_cpu_handle.ptr += descriptor_size_view; view_gpu_handle.ptr += descriptor_size_view; if (edram_rov_used) {