From 64c2b84d5b3840ff060b2626d89c2d3397db6597 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 6 Nov 2022 23:12:32 +0100 Subject: [PATCH] Address feedback --- GPU/Common/SoftwareTransformCommon.cpp | 17 ++++++++--------- GPU/GPUCommon.cpp | 4 ++-- GPU/GPUCommon.h | 2 +- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/GPU/Common/SoftwareTransformCommon.cpp b/GPU/Common/SoftwareTransformCommon.cpp index c8e79b1202..67ba97af4c 100644 --- a/GPU/Common/SoftwareTransformCommon.cpp +++ b/GPU/Common/SoftwareTransformCommon.cpp @@ -168,13 +168,6 @@ void SoftwareTransform::SetProjMatrix(float mtx[14], bool invertedX, bool invert projMatrix_.translateAndScale(trans, scale); } -static void ReadWeightedNormal(Vec3f &source, VertexReader &reader, u32 vertType) { - if (reader.hasNormal()) - reader.ReadNrm(source.AsArray()); - if (gstate.areNormalsReversed()) - source = -source; -} - void SoftwareTransform::Decode(int prim, u32 vertType, const DecVtxFormat &decVtxFormat, int maxIndex, SoftwareTransformResult *result) { u8 *decoded = params_.decoded; TransformedVertex *transformed = params_.transformed; @@ -346,7 +339,10 @@ void SoftwareTransform::Decode(int prim, u32 vertType, const DecVtxFormat &decVt source = normal.Normalized(cpu_info.bSSE4_1); } else { reader.Goto(index); - ReadWeightedNormal(source, reader, vertType); + if (reader.hasNormal()) + reader.ReadNrm(source.AsArray()); + if (gstate.areNormalsReversed()) + source = -source; source.Normalize(); } if (!reader.hasNormal()) { @@ -361,7 +357,10 @@ void SoftwareTransform::Decode(int prim, u32 vertType, const DecVtxFormat &decVt } else { // Need to read the normal for this vertex and weight it again.. reader.Goto(index); - ReadWeightedNormal(source, reader, vertType); + if (reader.hasNormal()) + reader.ReadNrm(source.AsArray()); + if (gstate.areNormalsReversed()) + source = -source; } if (!reader.hasNormal()) { ERROR_LOG_REPORT(G3D, "Normal projection mapping without normal?"); diff --git a/GPU/GPUCommon.cpp b/GPU/GPUCommon.cpp index 269b5a3278..60da15bd72 100644 --- a/GPU/GPUCommon.cpp +++ b/GPU/GPUCommon.cpp @@ -67,7 +67,7 @@ const CommonCommandTableEntry commonCommandTable[] = { { GE_CMD_SPLINE, FLAG_EXECUTE, 0, &GPUCommon::Execute_Spline }, // Changing the vertex type requires us to flush, unless we just change the weight count - need to handle in a func. - { GE_CMD_VERTEXTYPE, FLAG_EXECUTEONCHANGE, 0, &GPUCommon::Execute_VertexTypeSkinning }, + { GE_CMD_VERTEXTYPE, FLAG_EXECUTEONCHANGE, 0, &GPUCommon::Execute_VertexType }, { GE_CMD_LOADCLUT, FLAG_FLUSHBEFOREONCHANGE | FLAG_EXECUTE, 0, &GPUCommon::Execute_LoadClut }, @@ -1674,7 +1674,7 @@ void GPUCommon::Execute_LoadClut(u32 op, u32 diff) { textureCache_->LoadClut(gstate.getClutAddress(), gstate.getClutLoadBytes()); } -void GPUCommon::Execute_VertexTypeSkinning(u32 op, u32 diff) { +void GPUCommon::Execute_VertexType(u32 op, u32 diff) { // Don't flush when weight count changes. if (diff & ~GE_VTYPE_WEIGHTCOUNT_MASK) { // Restore and flush diff --git a/GPU/GPUCommon.h b/GPU/GPUCommon.h index 3c700dc0fa..7ba4901a2a 100644 --- a/GPU/GPUCommon.h +++ b/GPU/GPUCommon.h @@ -145,7 +145,7 @@ public: void Execute_Ret(u32 op, u32 diff); void Execute_End(u32 op, u32 diff); - void Execute_VertexTypeSkinning(u32 op, u32 diff); + void Execute_VertexType(u32 op, u32 diff); void Execute_Prim(u32 op, u32 diff); void Execute_Bezier(u32 op, u32 diff);