summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/Src/XFStructs.cpp
diff options
context:
space:
mode:
authorPierre Bourdon <delroth@gmail.com>2012-05-18 23:13:53 +0200
committerPierre Bourdon <delroth@gmail.com>2012-05-18 23:13:53 +0200
commit5a77cae2e3434fa5cbb3710f183328e36620fa5f (patch)
tree5ee73dd013e8da678bfaa9762990bd966276c504 /Source/Core/VideoCommon/Src/XFStructs.cpp
parent1bc5f41e40e604ef6c1d1e84617c13fdf40e04d1 (diff)
Check if BP and XF changes actually change values before flushing
Diffstat (limited to 'Source/Core/VideoCommon/Src/XFStructs.cpp')
-rw-r--r--Source/Core/VideoCommon/Src/XFStructs.cpp65
1 files changed, 48 insertions, 17 deletions
diff --git a/Source/Core/VideoCommon/Src/XFStructs.cpp b/Source/Core/VideoCommon/Src/XFStructs.cpp
index ec3975cb07..d879c83652 100644
--- a/Source/Core/VideoCommon/Src/XFStructs.cpp
+++ b/Source/Core/VideoCommon/Src/XFStructs.cpp
@@ -121,12 +121,18 @@ void XFRegWritten(int transferSize, u32 baseAddress, u32 *pData)
case XFMEM_SETVIEWPORT+3:
case XFMEM_SETVIEWPORT+4:
case XFMEM_SETVIEWPORT+5:
- VertexManager::Flush();
- VertexShaderManager::SetViewportChanged();
- PixelShaderManager::SetViewportChanged();
+ {
+ u8 size = std::min(transferSize, 6 * 4);
+ if (memcmp((u32*)&xfregs + (address - 0x1000), pData + dataIndex, size))
+ {
+ VertexManager::Flush();
+ VertexShaderManager::SetViewportChanged();
+ PixelShaderManager::SetViewportChanged();
+ }
- nextAddress = XFMEM_SETVIEWPORT + 6;
- break;
+ nextAddress = XFMEM_SETVIEWPORT + 6;
+ break;
+ }
case XFMEM_SETPROJECTION:
case XFMEM_SETPROJECTION+1:
@@ -135,11 +141,17 @@ void XFRegWritten(int transferSize, u32 baseAddress, u32 *pData)
case XFMEM_SETPROJECTION+4:
case XFMEM_SETPROJECTION+5:
case XFMEM_SETPROJECTION+6:
- VertexManager::Flush();
- VertexShaderManager::SetProjectionChanged();
+ {
+ u8 size = std::min(transferSize, 7 * 4);
+ if (memcmp((u32*)&xfregs + (address - 0x1000), pData + dataIndex, size))
+ {
+ VertexManager::Flush();
+ VertexShaderManager::SetProjectionChanged();
+ }
- nextAddress = XFMEM_SETPROJECTION + 7;
- break;
+ nextAddress = XFMEM_SETPROJECTION + 7;
+ break;
+ }
case XFMEM_SETNUMTEXGENS: // GXSetNumTexGens
if (xfregs.numTexGen.numTexGens != (newValue & 15))
@@ -154,10 +166,16 @@ void XFRegWritten(int transferSize, u32 baseAddress, u32 *pData)
case XFMEM_SETTEXMTXINFO+5:
case XFMEM_SETTEXMTXINFO+6:
case XFMEM_SETTEXMTXINFO+7:
- VertexManager::Flush();
+ {
+ u8 size = std::min(transferSize, 8 * 4);
+ if (memcmp((u32*)&xfregs + (address - 0x1000), pData + dataIndex, size))
+ {
+ VertexManager::Flush();
+ }
- nextAddress = XFMEM_SETTEXMTXINFO + 8;
- break;
+ nextAddress = XFMEM_SETTEXMTXINFO + 8;
+ break;
+ }
case XFMEM_SETPOSMTXINFO:
case XFMEM_SETPOSMTXINFO+1:
@@ -167,10 +185,16 @@ void XFRegWritten(int transferSize, u32 baseAddress, u32 *pData)
case XFMEM_SETPOSMTXINFO+5:
case XFMEM_SETPOSMTXINFO+6:
case XFMEM_SETPOSMTXINFO+7:
- VertexManager::Flush();
+ {
+ u8 size = std::min(transferSize, 8 * 4);
+ if (memcmp((u32*)&xfregs + (address - 0x1000), pData + dataIndex, size))
+ {
+ VertexManager::Flush();
+ }
- nextAddress = XFMEM_SETPOSMTXINFO + 8;
- break;
+ nextAddress = XFMEM_SETPOSMTXINFO + 8;
+ break;
+ }
// --------------
// Unknown Regs
@@ -240,8 +264,15 @@ void LoadXFReg(u32 transferSize, u32 baseAddress, u32 *pData)
transferSize = 0;
}
- XFMemWritten(xfMemTransferSize, xfMemBase);
- memcpy_gc(&xfmem[xfMemBase], pData, xfMemTransferSize * 4);
+ for (u32 i = 0; i < xfMemTransferSize; ++i)
+ {
+ if (((u32*)&xfmem[xfMemBase])[i] != pData[i])
+ {
+ XFMemWritten(xfMemTransferSize, xfMemBase);
+ memcpy_gc(&xfmem[xfMemBase], pData, xfMemTransferSize * 4);
+ break;
+ }
+ }
pData += xfMemTransferSize;
}