summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/BPStructs.cpp
diff options
context:
space:
mode:
authorScott Mansell <phiren@gmail.com>2021-09-12 18:12:51 +1200
committerScott Mansell <phiren@gmail.com>2021-10-10 09:01:57 +1300
commitef0e401708dc534e8bfac52e5e43086b4255c22d (patch)
treef4a7176efc7bd624fb10ff93728025a0eae23384 /Source/Core/VideoCommon/BPStructs.cpp
parent1beaa07793028da7225e979b2baf2e22df011573 (diff)
BPMem: Abstract TexUnit Addressing into struct
The addressing of the texture units is a bit non-obvious. This struct abstracts the complexity away.
Diffstat (limited to 'Source/Core/VideoCommon/BPStructs.cpp')
-rw-r--r--Source/Core/VideoCommon/BPStructs.cpp80
1 files changed, 40 insertions, 40 deletions
diff --git a/Source/Core/VideoCommon/BPStructs.cpp b/Source/Core/VideoCommon/BPStructs.cpp
index fb6372f09c..110ae5e803 100644
--- a/Source/Core/VideoCommon/BPStructs.cpp
+++ b/Source/Core/VideoCommon/BPStructs.cpp
@@ -646,48 +646,48 @@ static void BPWritten(const BPCmd& bp)
GeometryShaderManager::SetTexCoordChanged((bp.address - BPMEM_SU_SSIZE) >> 1);
}
return;
- // ------------------------
- // BPMEM_TX_SETMODE0 - (Texture lookup and filtering mode) LOD/BIAS Clamp, MaxAnsio, LODBIAS,
- // DiagLoad, Min Filter, Mag Filter, Wrap T, S
- // BPMEM_TX_SETMODE1 - (LOD Stuff) - Max LOD, Min LOD
- // ------------------------
- case BPMEM_TX_SETMODE0: // (0x90 for linear)
- case BPMEM_TX_SETMODE0_4:
- TextureCacheBase::InvalidateAllBindPoints();
- return;
+ }
- case BPMEM_TX_SETMODE1:
- case BPMEM_TX_SETMODE1_4:
- TextureCacheBase::InvalidateAllBindPoints();
- return;
- // --------------------------------------------
- // BPMEM_TX_SETIMAGE0 - Texture width, height, format
- // BPMEM_TX_SETIMAGE1 - even LOD address in TMEM - Image Type, Cache Height, Cache Width, TMEM
- // Offset
- // BPMEM_TX_SETIMAGE2 - odd LOD address in TMEM - Cache Height, Cache Width, TMEM Offset
- // BPMEM_TX_SETIMAGE3 - Address of Texture in main memory
- // --------------------------------------------
- case BPMEM_TX_SETIMAGE0:
- case BPMEM_TX_SETIMAGE0_4:
- case BPMEM_TX_SETIMAGE1:
- case BPMEM_TX_SETIMAGE1_4:
- case BPMEM_TX_SETIMAGE2:
- case BPMEM_TX_SETIMAGE2_4:
- case BPMEM_TX_SETIMAGE3:
- case BPMEM_TX_SETIMAGE3_4:
- TextureCacheBase::InvalidateAllBindPoints();
- return;
- // -------------------------------
- // Set a TLUT
- // BPMEM_TX_SETTLUT - Format, TMEM Offset (offset of TLUT from start of TMEM high bank > > 5)
- // -------------------------------
- case BPMEM_TX_SETTLUT:
- case BPMEM_TX_SETTLUT_4:
- TextureCacheBase::InvalidateAllBindPoints();
- return;
+ if ((bp.address & 0xc0) == 0x80)
+ {
+ auto tex_address = TexUnitAddress::FromBPAddress(bp.address);
- default:
- break;
+ switch (tex_address.Reg)
+ {
+ // ------------------------
+ // BPMEM_TX_SETMODE0 - (Texture lookup and filtering mode) LOD/BIAS Clamp, MaxAnsio, LODBIAS,
+ // DiagLoad, Min Filter, Mag Filter, Wrap T, S
+ // BPMEM_TX_SETMODE1 - (LOD Stuff) - Max LOD, Min LOD
+ // ------------------------
+ case TexUnitAddress::Register::SETMODE0:
+ case TexUnitAddress::Register::SETMODE1:
+ TextureCacheBase::InvalidateAllBindPoints();
+ return;
+
+ // --------------------------------------------
+ // BPMEM_TX_SETIMAGE0 - Texture width, height, format
+ // BPMEM_TX_SETIMAGE1 - even LOD address in TMEM - Image Type, Cache Height, Cache Width,
+ // TMEM Offset
+ // BPMEM_TX_SETIMAGE2 - odd LOD address in TMEM - Cache Height, Cache Width, TMEM Offset
+ // BPMEM_TX_SETIMAGE3 - Address of Texture in main memory
+ // --------------------------------------------
+ case TexUnitAddress::Register::SETIMAGE0:
+ case TexUnitAddress::Register::SETIMAGE1:
+ case TexUnitAddress::Register::SETIMAGE2:
+ case TexUnitAddress::Register::SETIMAGE3:
+ TextureCacheBase::InvalidateAllBindPoints();
+ return;
+
+ // -------------------------------
+ // Set a TLUT
+ // BPMEM_TX_SETTLUT - Format, TMEM Offset (offset of TLUT from start of TMEM high bank > > 5)
+ // -------------------------------
+ case TexUnitAddress::Register::SETTLUT:
+ TextureCacheBase::InvalidateAllBindPoints();
+ return;
+ case TexUnitAddress::Register::UNKNOWN:
+ break; // Not handled
+ }
}
switch (bp.address & 0xF0)