Fix incorrect flushing behavior in the prim sequencer, small optimization

This commit is contained in:
Henrik Rydgård committed 2023-10-01 14:23:34 +02:00
1 parent a2fe906534
commit 3cef04f885
2 files changed
+8 -4

No files matched your search

+4 -1
View File
@@ -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) {
+4 -3
View File
@@ -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<GEPrimitiveType>((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;