GS:MTL: Always end all encoders on FlushEncoders

Previously, texture upload encoders weren't submitted if no rendering had been done, which would result in an assertion failure if the device was destroyed in that state, as the encoders would be released without calling `endEncoding` on them.
This commit is contained in:
TellowKrinkle 2023-04-25 00:29:34 -05:00 committed by refractionpcsx2
parent b47fdcdfab
commit d3e527f2a4
1 changed files with 8 additions and 4 deletions

View File

@ -252,10 +252,12 @@ void GSDeviceMTL::DrawCommandBufferFinished(u64 draw, id<MTLCommandBuffer> buffe
void GSDeviceMTL::FlushEncoders()
{
if (!m_current_render_cmdbuf)
return;
EndRenderPass();
Sync(m_vertex_upload_buf);
bool needs_submit = m_current_render_cmdbuf;
if (needs_submit)
{
EndRenderPass();
Sync(m_vertex_upload_buf);
}
if (m_dev.features.unified_memory)
{
ASSERT(!m_vertex_upload_cmdbuf && "Should never be used!");
@ -274,6 +276,8 @@ void GSDeviceMTL::FlushEncoders()
m_texture_upload_encoder = nil;
m_texture_upload_cmdbuf = nil;
}
if (!needs_submit)
return;
if (m_late_texture_upload_encoder)
{
[m_late_texture_upload_encoder endEncoding];