mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
BPMem: Abstract TexUnit Addressing into struct
The addressing of the texture units is a bit non-obvious. This struct abstracts the complexity away.
This commit is contained in:
@ -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)
|
||||
|
Reference in New Issue
Block a user