fix: present issue

This commit is contained in:
Samuliak 2024-08-03 08:24:39 +02:00
parent 4022755a33
commit db709c3495
2 changed files with 10 additions and 0 deletions

View File

@ -137,6 +137,7 @@ void MetalRenderer::SwapBuffers(bool swapTV, bool swapDRC)
debug_printf("skipped present!\n");
}
m_drawable = nullptr;
m_drawableAcquired = false;
CommitCommandBuffer();
}
@ -145,6 +146,14 @@ void MetalRenderer::DrawBackbufferQuad(LatteTextureView* texView, RendererOutput
sint32 imageX, sint32 imageY, sint32 imageWidth, sint32 imageHeight,
bool padView, bool clearBackground)
{
if (m_drawableAcquired)
{
debug_printf("drawable already acquired this frame\n");
return;
}
m_drawableAcquired = true;
// Acquire drawable
m_drawable = m_metalLayer->nextDrawable();
if (!m_drawable)

View File

@ -216,6 +216,7 @@ private:
MetalEncoderType m_encoderType = MetalEncoderType::None;
MTL::CommandEncoder* m_commandEncoder = nullptr;
CA::MetalDrawable* m_drawable = nullptr;
bool m_drawableAcquired = false;
// State
MetalState m_state;