D3D12Device: Fix crash when using media capture

This commit is contained in:
Stenzek 2024-09-09 17:27:10 +10:00
parent 559aff0ad5
commit de551c1836
No known key found for this signature in database
2 changed files with 7 additions and 0 deletions

View File

@ -556,6 +556,7 @@ ID3D12GraphicsCommandList4* D3D12Device::GetInitCommandList()
void D3D12Device::SubmitCommandList(bool wait_for_completion) void D3D12Device::SubmitCommandList(bool wait_for_completion)
{ {
DebugAssert(!InRenderPass());
if (m_device_was_lost) [[unlikely]] if (m_device_was_lost) [[unlikely]]
return; return;

View File

@ -996,10 +996,16 @@ void D3D12DownloadTexture::Flush()
// Need to execute command buffer. // Need to execute command buffer.
if (dev.GetCurrentFenceValue() == m_copy_fence_value) if (dev.GetCurrentFenceValue() == m_copy_fence_value)
{
if (dev.InRenderPass())
dev.EndRenderPass();
dev.SubmitCommandList(true); dev.SubmitCommandList(true);
}
else else
{
dev.WaitForFence(m_copy_fence_value); dev.WaitForFence(m_copy_fence_value);
} }
}
void D3D12DownloadTexture::SetDebugName(std::string_view name) void D3D12DownloadTexture::SetDebugName(std::string_view name)
{ {