From 92d3fc302acf3a41b914b48034e98a9d80f502a8 Mon Sep 17 00:00:00 2001 From: Skyth <19259897+blueskythlikesclouds@users.noreply.github.com> Date: Tue, 18 Nov 2025 15:33:30 +0300 Subject: [PATCH] Fix buffer creation on old D3D12 runtimes. --- drivers/d3d12/rendering_device_driver_d3d12.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/d3d12/rendering_device_driver_d3d12.cpp b/drivers/d3d12/rendering_device_driver_d3d12.cpp index 2ba7cb509cb2..56e10885b509 100644 --- a/drivers/d3d12/rendering_device_driver_d3d12.cpp +++ b/drivers/d3d12/rendering_device_driver_d3d12.cpp @@ -1059,6 +1059,11 @@ RDD::BufferID RenderingDeviceDriverD3D12::buffer_create(uint64_t p_size, BitFiel if (p_usage.has_flag(BUFFER_USAGE_DYNAMIC_PERSISTENT_BIT)) { allocation_desc.HeapType = dynamic_persistent_upload_heap; + // D3D12_HEAP_TYPE_UPLOAD mandates D3D12_RESOURCE_STATE_GENERIC_READ. + if (dynamic_persistent_upload_heap == D3D12_HEAP_TYPE_UPLOAD) { + initial_state = D3D12_RESOURCE_STATE_GENERIC_READ; + } + // We can't use STORAGE for write access, just for read. resource_desc.Flags = resource_desc.Flags & ~D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS; }