softgpu: Always use software skinning.

There's only software skinning, after all.
This commit is contained in:
Unknown W. Brackets 2022-11-06 08:44:22 -08:00
parent 6c36f03a0d
commit 7880eb15c1
3 changed files with 9 additions and 28 deletions

View File

@ -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;
}

View File

@ -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<float> tmppos(0.f, 0.f, 0.f);
Vec3<float> tmpnrm(0.f, 0.f, 0.f);
for (int i = 0; i < vreader.numBoneWeights(); ++i) {
Vec3<float> 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);

View File

@ -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;