GPU/HW: Ensure buffers are unmapped before present

Darn DX11...
This commit is contained in:
Stenzek
2024-03-08 13:43:20 +10:00
parent 25db163347
commit 7159330f63
5 changed files with 23 additions and 4 deletions

View File

@ -76,6 +76,8 @@ bool GPU::Initialize()
void GPU::UpdateSettings(const Settings& old_settings)
{
FlushRender();
m_force_progressive_scan = g_settings.gpu_disable_interlacing;
m_fifo_size = g_settings.gpu_fifo_size;
m_max_run_ahead = g_settings.gpu_max_run_ahead;
@ -1665,6 +1667,8 @@ void GPU::SetDisplayParameters(s32 display_width, s32 display_height, s32 active
bool GPU::PresentDisplay()
{
FlushRender();
if (!HasDisplayTexture())
return g_gpu_device->BeginPresent(false);

View File

@ -713,6 +713,10 @@ void GPU_HW::DestroyBuffers()
{
ClearDisplayTexture();
DebugAssert((m_batch_vertex_ptr != nullptr) == (m_batch_index_ptr != nullptr));
if (m_batch_vertex_ptr)
UnmapGPUBuffer(0, 0);
m_vram_upload_buffer.reset();
m_vram_readback_download_texture.reset();
g_gpu_device->RecycleTexture(std::move(m_downsample_texture));
@ -3054,13 +3058,14 @@ void GPU_HW::DispatchRenderCommand()
void GPU_HW::FlushRender()
{
if (m_batch_index_count == 0)
return;
const u32 base_vertex = m_batch_base_vertex;
const u32 base_index = m_batch_base_index;
const u32 index_count = m_batch_index_count;
UnmapGPUBuffer(m_batch_vertex_count, m_batch_index_count);
DebugAssert((m_batch_vertex_ptr != nullptr) == (m_batch_index_ptr != nullptr));
if (m_batch_vertex_ptr)
UnmapGPUBuffer(m_batch_vertex_count, index_count);
if (index_count == 0)
return;
#ifdef _DEBUG
GL_SCOPE_FMT("Hardware Draw {}", ++s_draw_number);