diff --git a/GPU/Common/VertexDecoderCommon.h b/GPU/Common/VertexDecoderCommon.h index e4c886cbd4..7c2dcb2cfc 100644 --- a/GPU/Common/VertexDecoderCommon.h +++ b/GPU/Common/VertexDecoderCommon.h @@ -300,8 +300,6 @@ public: bool hasNormal() const { return decFmt_.nrmfmt != 0; } bool hasUV() const { return decFmt_.uvfmt != 0; } bool isThrough() const { return (vtype_ & GE_VTYPE_THROUGH) != 0; } - bool skinningEnabled() const { return vertTypeIsSkinningEnabled(vtype_); } - int numBoneWeights() const { return vertTypeGetNumBoneWeights(vtype_); } void Goto(int index) { data_ = base_ + index * decFmt_.stride; } diff --git a/GPU/Software/TransformUnit.cpp b/GPU/Software/TransformUnit.cpp index 731e4078f3..bc1f8679eb 100644 --- a/GPU/Software/TransformUnit.cpp +++ b/GPU/Software/TransformUnit.cpp @@ -62,6 +62,11 @@ SoftwareDrawEngine::~SoftwareDrawEngine() { FreeMemoryPages(decIndex, DECODED_INDEX_BUFFER_SIZE); } +void SoftwareDrawEngine::NotifyConfigChanged() { + DrawEngineCommon::NotifyConfigChanged(); + decOptions_.applySkinInDecode = true; +} + void SoftwareDrawEngine::DispatchFlush() { transformUnit.Flush("debug"); } @@ -72,7 +77,7 @@ void SoftwareDrawEngine::DispatchSubmitPrim(const void *verts, const void *inds, } void SoftwareDrawEngine::DispatchSubmitImm(GEPrimitiveType prim, TransformedVertex *buffer, int vertexCount, int cullMode, bool continuation) { - uint32_t vertTypeID = GetVertTypeID(gstate.vertType | GE_VTYPE_POS_FLOAT, gstate.getUVGenMode(), decOptions_.applySkinInDecode); + uint32_t vertTypeID = GetVertTypeID(gstate.vertType | GE_VTYPE_POS_FLOAT, gstate.getUVGenMode(), true); int flipCull = cullMode != gstate.getCullMode() ? 1 : 0; // TODO: For now, just setting all dirty. @@ -137,7 +142,7 @@ void SoftwareDrawEngine::DispatchSubmitImm(GEPrimitiveType prim, TransformedVert } VertexDecoder *SoftwareDrawEngine::FindVertexDecoder(u32 vtype) { - const u32 vertTypeID = GetVertTypeID(vtype, gstate.getUVGenMode(), decOptions_.applySkinInDecode); + const u32 vertTypeID = GetVertTypeID(vtype, gstate.getUVGenMode(), true); return DrawEngineCommon::GetVertexDecoder(vertTypeID); } @@ -245,7 +250,6 @@ struct TransformState { bool enableLighting : 1; bool enableFog : 1; bool readUV : 1; - bool readWeights : 1; bool negateNormals : 1; uint8_t uvGenMode : 2; uint8_t matrixMode : 2; @@ -257,7 +261,6 @@ void ComputeTransformState(TransformState *state, const VertexReader &vreader) { state->enableLighting = gstate.isLightingEnabled(); state->enableFog = gstate.isFogEnabled(); state->readUV = !gstate.isModeClear() && gstate.isTextureMapEnabled() && vreader.hasUV(); - state->readWeights = vreader.skinningEnabled() && state->enableTransform && !g_Config.bSoftwareSkinning; state->negateNormals = gstate.areNormalsReversed(); state->uvGenMode = gstate.getUVGenMode(); @@ -344,27 +347,6 @@ ClipVertexData TransformUnit::ReadVertex(VertexReader &vreader, const TransformS if (state.negateNormals) normal = -normal; - if (state.readWeights) { - float W[8] = { 1.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f }; - vreader.ReadWeights(W); - - Vec3 tmppos(0.f, 0.f, 0.f); - Vec3 tmpnrm(0.f, 0.f, 0.f); - - for (int i = 0; i < vreader.numBoneWeights(); ++i) { - Vec3 step = Vec3ByMatrix43(pos, gstate.boneMatrix + i * 12); - tmppos += step * W[i]; - if (vreader.hasNormal()) { - step = Norm3ByMatrix43(normal, gstate.boneMatrix + i * 12); - tmpnrm += step * W[i]; - } - } - - pos = tmppos; - if (vreader.hasNormal()) - normal = tmpnrm; - } - if (vreader.hasColor0()) { vreader.ReadColor0_8888((u8 *)&vertex.v.color0); } else { @@ -858,7 +840,7 @@ void TransformUnit::SubmitImmVertex(const ClipVertexData &vert, SoftwareDrawEngi break; } - uint32_t vertTypeID = GetVertTypeID(gstate.vertType | GE_VTYPE_POS_FLOAT, gstate.getUVGenMode(), g_Config.bSoftwareSkinning); + uint32_t vertTypeID = GetVertTypeID(gstate.vertType | GE_VTYPE_POS_FLOAT, gstate.getUVGenMode(), true); // This now processes the step with shared logic, given the existing data_. isImmDraw_ = true; SubmitPrimitive(nullptr, nullptr, GE_PRIM_KEEP_PREVIOUS, 0, vertTypeID, nullptr, drawEngine); diff --git a/GPU/Software/TransformUnit.h b/GPU/Software/TransformUnit.h index 3c022523d2..a55c824a91 100644 --- a/GPU/Software/TransformUnit.h +++ b/GPU/Software/TransformUnit.h @@ -171,6 +171,7 @@ public: SoftwareDrawEngine(); ~SoftwareDrawEngine(); + void NotifyConfigChanged() override; void DispatchFlush() override; void DispatchSubmitPrim(const void *verts, const void *inds, GEPrimitiveType prim, int vertexCount, u32 vertType, int cullMode, int *bytesRead) override; void DispatchSubmitImm(GEPrimitiveType prim, TransformedVertex *buffer, int vertexCount, int cullMode, bool continuation) override;