mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-03-18 19:32:41 +00:00
Metal: Always run endEncoding on command encoders
Fixes a macOS Metal crash when stopping immediately after boot starts. m_upload_encoder and m_texture_upload_encoder could be dealloc'd during shutdown before endEncoding could be called, which causes a Metal assertion failure. Co-authored-by: OatmealDome <julian@oatmealdome.me>
This commit is contained in:
parent
f898d75bf3
commit
03bcd564c5
@ -383,11 +383,14 @@ void Metal::StateTracker::EndRenderPass()
|
||||
|
||||
void Metal::StateTracker::FlushEncoders()
|
||||
{
|
||||
if (!m_current_render_cmdbuf)
|
||||
return;
|
||||
EndRenderPass();
|
||||
for (int i = 0; i <= static_cast<int>(UploadBuffer::Last); ++i)
|
||||
Sync(m_upload_buffers[i]);
|
||||
const bool needs_submit = m_current_render_cmdbuf;
|
||||
if (needs_submit)
|
||||
{
|
||||
EndRenderPass();
|
||||
for (int i = 0; i <= static_cast<int>(UploadBuffer::Last); ++i)
|
||||
Sync(m_upload_buffers[i]);
|
||||
}
|
||||
|
||||
if (!m_manual_buffer_upload)
|
||||
{
|
||||
ASSERT(!m_upload_cmdbuf && "Should never be used!");
|
||||
@ -407,6 +410,10 @@ void Metal::StateTracker::FlushEncoders()
|
||||
m_texture_upload_encoder = nullptr;
|
||||
m_texture_upload_cmdbuf = nullptr;
|
||||
}
|
||||
|
||||
if (!needs_submit)
|
||||
return;
|
||||
|
||||
[m_current_render_cmdbuf
|
||||
addCompletedHandler:[backref = m_backref, draw = m_current_draw,
|
||||
q = std::move(m_current_perf_query)](id<MTLCommandBuffer> buf) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user