diff options
author | Pedro J. Estébanez <pedrojrulez@gmail.com> | 2024-01-31 20:00:23 +0100 |
---|---|---|
committer | Pedro J. Estébanez <pedrojrulez@gmail.com> | 2024-01-31 20:00:23 +0100 |
commit | 6057ec9b06e71d4d0fc68de1067001ec3f41000d (patch) | |
tree | dd9837ca3b13a66b40fdb244ff512fe91c1ced37 /drivers | |
parent | 107f2961ccfac179af7682eb5f6e7ea91e80040c (diff) | |
download | redot-engine-6057ec9b06e71d4d0fc68de1067001ec3f41000d.tar.gz |
Direct3D 12: Avoid terrible leak related to command allocators
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/d3d12/rendering_device_driver_d3d12.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/d3d12/rendering_device_driver_d3d12.cpp b/drivers/d3d12/rendering_device_driver_d3d12.cpp index 1d1dc6bec8..266e4f91f8 100644 --- a/drivers/d3d12/rendering_device_driver_d3d12.cpp +++ b/drivers/d3d12/rendering_device_driver_d3d12.cpp @@ -1828,7 +1828,9 @@ bool RenderingDeviceDriverD3D12::command_buffer_begin(CommandBufferID p_cmd_buff #ifdef DEBUG_ENABLED ERR_FAIL_COND_V(cmd_buf_info->cmd_list->GetType() != D3D12_COMMAND_LIST_TYPE_DIRECT, false); #endif - HRESULT res = cmd_buf_info->cmd_list->Reset(cmd_buf_info->cmd_allocator.Get(), nullptr); + HRESULT res = cmd_buf_info->cmd_allocator->Reset(); + ERR_FAIL_COND_V_MSG(!SUCCEEDED(res), false, "Reset failed with error " + vformat("0x%08ux", (uint64_t)res) + "."); + res = cmd_buf_info->cmd_list->Reset(cmd_buf_info->cmd_allocator.Get(), nullptr); ERR_FAIL_COND_V_MSG(!SUCCEEDED(res), false, "Reset failed with error " + vformat("0x%08ux", (uint64_t)res) + "."); return true; } @@ -1838,7 +1840,9 @@ bool RenderingDeviceDriverD3D12::command_buffer_begin_secondary(CommandBufferID #ifdef DEBUG_ENABLED ERR_FAIL_COND_V(cmd_buf_info->cmd_list->GetType() != D3D12_COMMAND_LIST_TYPE_BUNDLE, false); #endif - HRESULT res = cmd_buf_info->cmd_list->Reset(cmd_buf_info->cmd_allocator.Get(), nullptr); + HRESULT res = cmd_buf_info->cmd_allocator->Reset(); + ERR_FAIL_COND_V_MSG(!SUCCEEDED(res), false, "Reset failed with error " + vformat("0x%08ux", (uint64_t)res) + "."); + res = cmd_buf_info->cmd_list->Reset(cmd_buf_info->cmd_allocator.Get(), nullptr); ERR_FAIL_COND_V_MSG(!SUCCEEDED(res), false, "Reset failed with error " + vformat("0x%08ux", (uint64_t)res) + "."); return true; } |