Merge pull request #5594 from unknownbrackets/gpu-minor

Fix some software skinning glitches
This commit is contained in:
Henrik Rydgård committed 2014-03-03 13:32:03 +07:00
commit c2f76ac549
4 files changed
+23 -5

No files matched your search

+15 -3
View File
@@ -882,7 +882,8 @@ void GLES_GPU::ExecuteOpInternal(u32 op, u32 diff) {
if (diff & (GE_VTYPE_TC_MASK | GE_VTYPE_THROUGH_MASK))
shaderManager_->DirtyUniform(DIRTY_UVSCALEOFFSET);
} else {
if (diff & ~GE_VTYPE_WEIGHTCOUNT_MASK) {
// Don't flush when weight count changes, unless morph is enabled.
if ((diff & ~GE_VTYPE_WEIGHTCOUNT_MASK) || (data & GE_VTYPE_MORPHCOUNT_MASK) != 0) {
// Restore and flush
gstate.vertType ^= diff;
Flush();
@@ -1406,8 +1407,7 @@ void GLES_GPU::ExecuteOpInternal(u32 op, u32 diff) {
u32 newVal = data << 8;
if (num < 96 && newVal != ((const u32 *)gstate.boneMatrix)[num]) {
// Bone matrices should NOT flush when software skinning is enabled!
// TODO: Also check for morph...
if (!g_Config.bSoftwareSkinning) {
if (!g_Config.bSoftwareSkinning || (gstate.vertType & GE_VTYPE_MORPHCOUNT_MASK) != 0) {
Flush();
shaderManager_->DirtyUniform(DIRTY_BONEMATRIX0 << (num / 12));
}
@@ -1509,6 +1509,18 @@ void GLES_GPU::ExecuteOpInternal(u32 op, u32 diff) {
}
}
void GLES_GPU::FastLoadBoneMatrix(u32 target) {
if (!g_Config.bSoftwareSkinning || (gstate.vertType & GE_VTYPE_MORPHCOUNT_MASK) != 0) {
Flush();
const int num = gstate.boneMatrixNumber & 0x7F;
shaderManager_->DirtyUniform(DIRTY_BONEMATRIX0 << (num / 12));
if ((num % 12) != 0) {
shaderManager_->DirtyUniform((DIRTY_BONEMATRIX0 << (num / 12)) + 1);
}
}
gstate.FastLoadBoneMatrix(target);
}
void GLES_GPU::UpdateStats() {
gpuStats.numVertexShaders = shaderManager_->NumVertexShaders();
gpuStats.numFragmentShaders = shaderManager_->NumFragmentShaders();
+1
View File
@@ -78,6 +78,7 @@ public:
protected:
virtual void FastRunLoop(DisplayList &list);
virtual void ProcessEvent(GPUEvent ev);
virtual void FastLoadBoneMatrix(u32 target);
private:
void Flush() {
+6 -2
View File
@@ -736,12 +736,12 @@ void GPUCommon::ExecuteOp(u32 op, u32 diff) {
u32 target = gstate_c.getRelativeAddress(data);
// Bone matrix optimization - many games will CALL a bone matrix (!).
if (g_Config.bSoftwareSkinning && (Memory::ReadUnchecked_U32(target) >> 24) == GE_CMD_BONEMATRIXDATA) {
if ((Memory::ReadUnchecked_U32(target) >> 24) == GE_CMD_BONEMATRIXDATA) {
// Check for the end
if ((Memory::ReadUnchecked_U32(target + 11 * 4) >> 24) == GE_CMD_BONEMATRIXDATA &&
(Memory::ReadUnchecked_U32(target + 12 * 4) >> 24) == GE_CMD_RET) {
// Yep, pretty sure this is a bone matrix call.
gstate.FastLoadBoneMatrix(target);
FastLoadBoneMatrix(target);
break;
}
}
@@ -933,6 +933,10 @@ void GPUCommon::ExecuteOp(u32 op, u32 diff) {
}
}
void GPUCommon::FastLoadBoneMatrix(u32 target) {
gstate.FastLoadBoneMatrix(target);
}
struct DisplayListOld {
int id;
u32 startpc;
+1
View File
@@ -88,6 +88,7 @@ protected:
int GetNextListIndex();
void ProcessDLQueueInternal();
void ReapplyGfxStateInternal();
virtual void FastLoadBoneMatrix(u32 target);
virtual void ProcessEvent(GPUEvent ev);
virtual bool ShouldExitEventLoop() {
return coreState != CORE_RUNNING;