summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/Src/BPStructs.cpp
diff options
context:
space:
mode:
authordegasus <wickmarkus@web.de>2013-10-07 21:57:18 +0200
committerdegasus <wickmarkus@web.de>2013-10-12 20:31:25 +0200
commitcc6c454898486f17f10cfd7a0ed88c7605588437 (patch)
tree795b2068d6ef9c16462b392afcc6bfd7654d13cd /Source/Core/VideoCommon/Src/BPStructs.cpp
parent15ed0ea9cf1588fc076b89374ead8ab610c093bb (diff)
VideoCommon: refactor PixelShaderManager setters
The old way was to use a dirty flag per setter. Now we just update the const buffer per setter directly. The old optimization isn't needed any more as the setters don't call the backend any more. The follow parts are rewritten: Alpha ZTextureType zbias FogParam FogColor Color TexDim IndMatrix MaterialColor FogRangeAdjust Lights
Diffstat (limited to 'Source/Core/VideoCommon/Src/BPStructs.cpp')
-rw-r--r--Source/Core/VideoCommon/Src/BPStructs.cpp31
1 files changed, 20 insertions, 11 deletions
diff --git a/Source/Core/VideoCommon/Src/BPStructs.cpp b/Source/Core/VideoCommon/Src/BPStructs.cpp
index 9f885e7953..785546fea7 100644
--- a/Source/Core/VideoCommon/Src/BPStructs.cpp
+++ b/Source/Core/VideoCommon/Src/BPStructs.cpp
@@ -168,12 +168,16 @@ void BPWritten(const BPCmd& bp)
case BPMEM_IND_MTXA+6:
case BPMEM_IND_MTXB+6:
case BPMEM_IND_MTXC+6:
- PixelShaderManager::SetIndMatrixChanged((bp.address - BPMEM_IND_MTXA) / 3);
+ if(bp.changes)
+ PixelShaderManager::SetIndMatrixChanged((bp.address - BPMEM_IND_MTXA) / 3);
break;
case BPMEM_RAS1_SS0: // Index Texture Coordinate Scale 0
- PixelShaderManager::SetIndTexScaleChanged(0x03);
+ if(bp.changes)
+ PixelShaderManager::SetIndTexScaleChanged(0x03);
+ break;
case BPMEM_RAS1_SS1: // Index Texture Coordinate Scale 1
- PixelShaderManager::SetIndTexScaleChanged(0x0c);
+ if(bp.changes)
+ PixelShaderManager::SetIndTexScaleChanged(0x0c);
break;
// ----------------
// Scissor Control
@@ -220,7 +224,8 @@ void BPWritten(const BPCmd& bp)
case BPMEM_CONSTANTALPHA: // Set Destination Alpha
{
PRIM_LOG("constalpha: alp=%d, en=%d", bpmem.dstalpha.alpha, bpmem.dstalpha.enable);
- PixelShaderManager::SetDestAlpha(bpmem.dstalpha);
+ if(bp.changes & 0xFF)
+ PixelShaderManager::SetDestAlpha(bpmem.dstalpha);
if(bp.changes & 0x100)
SetBlendMode();
break;
@@ -341,29 +346,32 @@ void BPWritten(const BPCmd& bp)
case BPMEM_FOGRANGE+3:
case BPMEM_FOGRANGE+4:
case BPMEM_FOGRANGE+5:
- if (!GetConfig(CONFIG_DISABLEFOG))
+ if (!GetConfig(CONFIG_DISABLEFOG) && bp.changes)
PixelShaderManager::SetFogRangeAdjustChanged();
break;
case BPMEM_FOGPARAM0:
case BPMEM_FOGBMAGNITUDE:
case BPMEM_FOGBEXPONENT:
case BPMEM_FOGPARAM3:
- if (!GetConfig(CONFIG_DISABLEFOG))
+ if (!GetConfig(CONFIG_DISABLEFOG) && bp.changes)
PixelShaderManager::SetFogParamChanged();
break;
case BPMEM_FOGCOLOR: // Fog Color
- if (!GetConfig(CONFIG_DISABLEFOG))
+ if (!GetConfig(CONFIG_DISABLEFOG) && bp.changes)
PixelShaderManager::SetFogColorChanged();
break;
case BPMEM_ALPHACOMPARE: // Compare Alpha Values
PRIM_LOG("alphacmp: ref0=%d, ref1=%d, comp0=%d, comp1=%d, logic=%d", bpmem.alpha_test.ref0,
bpmem.alpha_test.ref1, bpmem.alpha_test.comp0, bpmem.alpha_test.comp1, bpmem.alpha_test.logic);
- PixelShaderManager::SetAlpha(bpmem.alpha_test);
- g_renderer->SetColorMask();
+ if(bp.changes & 0xFFFF)
+ PixelShaderManager::SetAlpha(bpmem.alpha_test);
+ if(bp.changes)
+ g_renderer->SetColorMask();
break;
case BPMEM_BIAS: // BIAS
PRIM_LOG("ztex bias=0x%x", bpmem.ztex1.bias);
- PixelShaderManager::SetZTextureBias(bpmem.ztex1.bias);
+ if(bp.changes)
+ PixelShaderManager::SetZTextureBias(bpmem.ztex1.bias);
break;
case BPMEM_ZTEX2: // Z Texture type
{
@@ -573,7 +581,8 @@ void BPWritten(const BPCmd& bp)
case BPMEM_SU_TSIZE+12:
case BPMEM_SU_SSIZE+14:
case BPMEM_SU_TSIZE+14:
- PixelShaderManager::SetTexCoordChanged((bp.address - BPMEM_SU_SSIZE) >> 1);
+ if(bp.changes)
+ PixelShaderManager::SetTexCoordChanged((bp.address - BPMEM_SU_SSIZE) >> 1);
break;
// ------------------------
// BPMEM_TX_SETMODE0 - (Texture lookup and filtering mode) LOD/BIAS Clamp, MaxAnsio, LODBIAS, DiagLoad, Min Filter, Mag Filter, Wrap T, S