From 7b815af3318e104d6338c91171cbf4133fde5a7b Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Fri, 30 Nov 2018 07:22:28 -0800 Subject: [PATCH] GPU: Force use of indexes on cull mode flip. Since we flip in the index, it can't be pure in this case. --- GPU/Common/IndexGenerator.cpp | 10 +++++++++- GPU/Common/ShaderId.h | 1 - GPU/GPUCommon.cpp | 5 +++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/GPU/Common/IndexGenerator.cpp b/GPU/Common/IndexGenerator.cpp index 06bef591df11..d339fb479062 100644 --- a/GPU/Common/IndexGenerator.cpp +++ b/GPU/Common/IndexGenerator.cpp @@ -77,6 +77,10 @@ void IndexGenerator::AddList(int numVerts, bool clockwise) { count_ += numVerts; prim_ = GE_PRIM_TRIANGLES; seenPrims_ |= 1 << GE_PRIM_TRIANGLES; + if (!clockwise) { + // Make sure we don't treat this as pure. + seenPrims_ |= 1 << GE_PRIM_TRIANGLE_STRIP; + } } void IndexGenerator::AddStrip(int numVerts, bool clockwise) { @@ -96,7 +100,7 @@ void IndexGenerator::AddStrip(int numVerts, bool clockwise) { if (numTris > 0) count_ += numTris * 3; // This is so we can detect one single strip by just looking at seenPrims_. - if (!seenPrims_) { + if (!seenPrims_ && clockwise) { seenPrims_ = 1 << GE_PRIM_TRIANGLE_STRIP; prim_ = GE_PRIM_TRIANGLE_STRIP; pureCount_ = numVerts; @@ -123,6 +127,10 @@ void IndexGenerator::AddFan(int numVerts, bool clockwise) { count_ += numTris * 3; prim_ = GE_PRIM_TRIANGLES; seenPrims_ |= 1 << GE_PRIM_TRIANGLE_FAN; + if (!clockwise) { + // Make sure we don't treat this as pure. + seenPrims_ |= 1 << GE_PRIM_TRIANGLE_STRIP; + } } //Lines diff --git a/GPU/Common/ShaderId.h b/GPU/Common/ShaderId.h index 573da9c3f34e..df0efb36d547 100644 --- a/GPU/Common/ShaderId.h +++ b/GPU/Common/ShaderId.h @@ -176,7 +176,6 @@ struct FShaderID : ShaderID { }; -bool CanUseHardwareTransform(int prim); void ComputeVertexShaderID(ShaderID *id, uint32_t vertexType, bool useHWTransform); // Generates a compact string that describes the shader. Useful in a list to get an overview // of the current flora of shaders. diff --git a/GPU/GPUCommon.cpp b/GPU/GPUCommon.cpp index 2030f23f01fa..3b55b566db2d 100644 --- a/GPU/GPUCommon.cpp +++ b/GPU/GPUCommon.cpp @@ -1537,7 +1537,7 @@ void GPUCommon::Execute_Prim(u32 op, u32 diff) { } void *verts = Memory::GetPointerUnchecked(gstate_c.vertexAddr); - void *inds = 0; + void *inds = nullptr; u32 vertexType = gstate.vertType; if ((vertexType & GE_VTYPE_IDX_MASK) != GE_VTYPE_IDX_NONE) { u32 indexAddr = gstate_c.indexAddr; @@ -1602,9 +1602,10 @@ void GPUCommon::Execute_Prim(u32 op, u32 diff) { } GEPrimitiveType newPrim = static_cast((data >> 16) & 7); + SetDrawType(DRAW_PRIM, newPrim); // TODO: more efficient updating of verts/inds verts = Memory::GetPointerUnchecked(gstate_c.vertexAddr); - inds = 0; + inds = nullptr; if ((vertexType & GE_VTYPE_IDX_MASK) != GE_VTYPE_IDX_NONE) { inds = Memory::GetPointerUnchecked(gstate_c.indexAddr); }