diff --git a/GPU/GPUCommon.h b/GPU/GPUCommon.h index 8b3f59b9dd..2ad73539dd 100644 --- a/GPU/GPUCommon.h +++ b/GPU/GPUCommon.h @@ -224,7 +224,10 @@ protected: virtual void CheckRenderResized() {} inline bool IsTrianglePrim(GEPrimitiveType prim) const { - return prim != GE_PRIM_RECTANGLES && prim > GE_PRIM_LINE_STRIP; + // TODO: KEEP_PREVIOUS is mistakenly treated as TRIANGLE here... This isn't new. + // static const bool p[8] = { false, false, false, true, true, true, false, true }; + // 10111000 = 0xB8; + return (0xB8 >> (int)prim) & 1; } void SetDrawType(DrawType type, GEPrimitiveType prim) { diff --git a/GPU/GPUCommonHW.cpp b/GPU/GPUCommonHW.cpp index 617caaea82..5e7c1575bf 100644 --- a/GPU/GPUCommonHW.cpp +++ b/GPU/GPUCommonHW.cpp @@ -1009,21 +1009,22 @@ void GPUCommonHW::Execute_Prim(u32 op, u32 diff) { if (debugRecording_) goto bail; + bool isTriangle = IsTrianglePrim(prim); while (src != stall) { uint32_t data = *src; switch (data >> 24) { case GE_CMD_PRIM: { - u32 count = data & 0xFFFF; GEPrimitiveType newPrim = static_cast((data >> 16) & 7); - SetDrawType(DRAW_PRIM, newPrim); + if (IsTrianglePrim(newPrim) != isTriangle) + goto bail; // Can't join over this boundary. Might as well exit and get this on the next time around. // TODO: more efficient updating of verts/inds verts = Memory::GetPointerUnchecked(gstate_c.vertexAddr); inds = nullptr; if ((vertexType & GE_VTYPE_IDX_MASK) != GE_VTYPE_IDX_NONE) { inds = Memory::GetPointerUnchecked(gstate_c.indexAddr); } - + u32 count = data & 0xFFFF; drawEngineCommon_->SubmitPrim(verts, inds, newPrim, count, vertTypeID, cullMode, &bytesRead); AdvanceVerts(vertexType, count, bytesRead); totalVertCount += count;