From 0b4b2bfe9c8144b2c186aa3d318b5ead3000ef63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Mon, 26 Feb 2018 13:51:14 +0100 Subject: [PATCH] Avoid the most common virtual call when possible. --- GPU/Common/DrawEngineCommon.h | 3 +++ GPU/GPUCommon.cpp | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/GPU/Common/DrawEngineCommon.h b/GPU/Common/DrawEngineCommon.h index 10af8ca780..b99bc12cea 100644 --- a/GPU/Common/DrawEngineCommon.h +++ b/GPU/Common/DrawEngineCommon.h @@ -79,6 +79,9 @@ public: bool IsCodePtrVertexDecoder(const u8 *ptr) const { return decJitCache_->IsInSpace(ptr); } + int GetNumDrawCalls() const { + return numDrawCalls; + } protected: virtual void ClearTrackedVertexArrays() {} diff --git a/GPU/GPUCommon.cpp b/GPU/GPUCommon.cpp index 782b2a324d..d30ba2cfdf 100644 --- a/GPU/GPUCommon.cpp +++ b/GPU/GPUCommon.cpp @@ -985,7 +985,9 @@ void GPUCommon::FastRunLoop(DisplayList &list) { } else { uint64_t flags = info.flags; if (flags & FLAG_FLUSHBEFOREONCHANGE) { - drawEngineCommon_->DispatchFlush(); + if (drawEngineCommon_->GetNumDrawCalls()) { + drawEngineCommon_->DispatchFlush(); + } } gstate.cmdmem[cmd] = op; if (flags & (FLAG_EXECUTE | FLAG_EXECUTEONCHANGE)) {