simplify texture readback

This commit is contained in:
Samuliak 2024-08-23 09:41:00 +02:00
parent 28aef858f2
commit 6bb191212b
3 changed files with 6 additions and 22 deletions

View file

@ -21,7 +21,7 @@
#include "HW/Latte/Renderer/Metal/MetalCommon.h"
#include "gui/guiWrapper.h"
#define DEFAULT_COMMIT_TRESHOLD 256
#define COMMIT_TRESHOLD 256
extern bool hasValidFramebufferAttached;
@ -297,7 +297,7 @@ bool MetalRenderer::BeginFrame(bool mainWindow)
void MetalRenderer::Flush(bool waitIdle)
{
if (m_commitOnIdle || m_recordedDrawcalls > 0)
if (m_recordedDrawcalls > 0)
CommitCommandBuffer();
if (waitIdle)
{
@ -308,8 +308,8 @@ void MetalRenderer::Flush(bool waitIdle)
void MetalRenderer::NotifyLatteCommandProcessorIdle()
{
if (m_commitOnIdle)
CommitCommandBuffer();
//if (m_commitOnIdle)
// CommitCommandBuffer();
}
void MetalRenderer::AppendOverlayDebugInfo()
@ -1055,7 +1055,7 @@ void MetalRenderer::draw_endSequence()
bool hasReadback = LatteTextureReadback_Update();
m_recordedDrawcalls++;
// The number of draw calls needs to twice as big, since we are interrupting the render pass
if (m_recordedDrawcalls >= m_commitTreshold * 2 || hasReadback)
if (m_recordedDrawcalls >= COMMIT_TRESHOLD * 2 || hasReadback)
{
CommitCommandBuffer();
@ -1320,16 +1320,14 @@ void MetalRenderer::EndEncoding()
m_encoderType = MetalEncoderType::None;
// Commit the command buffer if enough draw calls have been recorded
if (m_recordedDrawcalls >= m_commitTreshold)
if (m_recordedDrawcalls >= COMMIT_TRESHOLD)
CommitCommandBuffer();
}
}
void MetalRenderer::CommitCommandBuffer()
{
m_commitTreshold = DEFAULT_COMMIT_TRESHOLD;
m_recordedDrawcalls = 0;
m_commitOnIdle = false;
if (m_commandBuffers.size() != 0)
{