From 5ed4b532b78e9781afce4d8148b0854a116af405 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 13 Jun 2023 10:11:15 +0200 Subject: [PATCH] Micro-optimize SubmitPrim, remove outdated mitigation --- GPU/Common/DrawEngineCommon.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/GPU/Common/DrawEngineCommon.cpp b/GPU/Common/DrawEngineCommon.cpp index 4cccdaff10..e02b1b5bff 100644 --- a/GPU/Common/DrawEngineCommon.cpp +++ b/GPU/Common/DrawEngineCommon.cpp @@ -802,8 +802,8 @@ void DrawEngineCommon::SubmitPrim(const void *verts, const void *inds, GEPrimiti prevPrim_ = prim; } - // If vtype has changed, setup the vertex decoder. - if (vertTypeID != lastVType_ || !dec_) { + // If vtype has changed, setup the vertex decoder. Don't need to nullcheck dec_ since we set lastVType_ to an invalid value whenever we null it. + if (vertTypeID != lastVType_) { dec_ = GetVertexDecoder(vertTypeID); lastVType_ = vertTypeID; } @@ -811,7 +811,7 @@ void DrawEngineCommon::SubmitPrim(const void *verts, const void *inds, GEPrimiti *bytesRead = vertexCount * dec_->VertexSize(); // Check that we have enough vertices to form the requested primitive. - if ((vertexCount < 2 && prim > 0) || (vertexCount < 3 && prim > GE_PRIM_LINE_STRIP && prim != GE_PRIM_RECTANGLES)) + if (vertexCount < 3 && ((vertexCount < 2 && prim > 0) || (prim > GE_PRIM_LINE_STRIP && prim != GE_PRIM_RECTANGLES))) return; DeferredDrawCall &dc = drawCalls_[numDrawCalls_]; @@ -832,16 +832,10 @@ void DrawEngineCommon::SubmitPrim(const void *verts, const void *inds, GEPrimiti numDrawCalls_++; vertexCountInDrawCalls_ += vertexCount; - if (decOptions_.applySkinInDecode && (vertTypeID & GE_VTYPE_WEIGHT_MASK)) { + if ((vertTypeID & GE_VTYPE_WEIGHT_MASK) && decOptions_.applySkinInDecode) { DecodeVertsStep(decoded_, decodeCounter_, decodedVerts_, &dc.uvScale); decodeCounter_++; } - - if (prim == GE_PRIM_RECTANGLES && (gstate.getTextureAddress(0) & 0x3FFFFFFF) == (gstate.getFrameBufAddress() & 0x3FFFFFFF)) { - // Rendertarget == texture? Shouldn't happen. Still, try some mitigations. - gstate_c.Dirty(DIRTY_TEXTURE_PARAMS); - DispatchFlush(); - } } bool DrawEngineCommon::CanUseHardwareTransform(int prim) {