vkd3d: Match native runtime better in command allocator reset.
Even when misusing the API, S_OK is still returned on native runtimes. Keep the error log, and add an error report to command allocator release if there are still pending submissions. Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
This commit is contained in:
parent
6335e411bb
commit
4ff504b52d
|
@ -1700,6 +1700,7 @@ static ULONG STDMETHODCALLTYPE d3d12_command_allocator_Release(ID3D12CommandAllo
|
||||||
struct d3d12_command_allocator *allocator = impl_from_ID3D12CommandAllocator(iface);
|
struct d3d12_command_allocator *allocator = impl_from_ID3D12CommandAllocator(iface);
|
||||||
ULONG refcount = InterlockedDecrement(&allocator->refcount);
|
ULONG refcount = InterlockedDecrement(&allocator->refcount);
|
||||||
unsigned int i, j;
|
unsigned int i, j;
|
||||||
|
LONG pending;
|
||||||
|
|
||||||
TRACE("%p decreasing refcount to %u.\n", allocator, refcount);
|
TRACE("%p decreasing refcount to %u.\n", allocator, refcount);
|
||||||
|
|
||||||
|
@ -1710,6 +1711,13 @@ static ULONG STDMETHODCALLTYPE d3d12_command_allocator_Release(ID3D12CommandAllo
|
||||||
|
|
||||||
vkd3d_private_store_destroy(&allocator->private_store);
|
vkd3d_private_store_destroy(&allocator->private_store);
|
||||||
|
|
||||||
|
if ((pending = vkd3d_atomic_uint32_load_explicit(&allocator->outstanding_submissions_count, vkd3d_memory_order_acquire)) != 0)
|
||||||
|
{
|
||||||
|
/* Nothing we can do about this other than report the error. Might find some game bugs! */
|
||||||
|
ERR("Attempting to free command allocator, but there are still %u pending submissions!\n",
|
||||||
|
(unsigned int)allocator->outstanding_submissions_count);
|
||||||
|
}
|
||||||
|
|
||||||
if (allocator->current_command_list)
|
if (allocator->current_command_list)
|
||||||
d3d12_command_list_allocator_destroyed(allocator->current_command_list);
|
d3d12_command_list_allocator_destroyed(allocator->current_command_list);
|
||||||
|
|
||||||
|
@ -1856,11 +1864,12 @@ static HRESULT STDMETHODCALLTYPE d3d12_command_allocator_Reset(ID3D12CommandAllo
|
||||||
* however, this is enough to workaround SotTR which resets the command list right
|
* however, this is enough to workaround SotTR which resets the command list right
|
||||||
* after calling ID3D12CommandQueue::ExecuteCommandLists().
|
* after calling ID3D12CommandQueue::ExecuteCommandLists().
|
||||||
* Only happens once or twice on bootup and doesn't cause memory leaks over time
|
* Only happens once or twice on bootup and doesn't cause memory leaks over time
|
||||||
* since the command pool is eventually reset.
|
* since the command pool is eventually reset. */
|
||||||
* Game does not seem to care if E_FAIL is returned, which is the correct thing to do here. */
|
|
||||||
|
/* Runtime appears to detect this case, but does not return E_FAIL for whatever reason anymore. */
|
||||||
ERR("There are still %u pending command lists awaiting execution from command allocator iface %p!\n",
|
ERR("There are still %u pending command lists awaiting execution from command allocator iface %p!\n",
|
||||||
(unsigned int)pending, iface);
|
(unsigned int)pending, iface);
|
||||||
return E_FAIL;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
device = allocator->device;
|
device = allocator->device;
|
||||||
|
|
Loading…
Reference in New Issue