mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 13:30:02 +00:00
Add type safe getter for texture and clut format fields.
This commit is contained in:
parent
a70220a1d5
commit
cc180fa204
@ -206,9 +206,9 @@ static u32 GetClutAddr() {
|
||||
}
|
||||
|
||||
static u32 GetClutIndex(u32 index) {
|
||||
const u32 clutBase = (gstate.clutformat & 0x1f0000) >> 12;
|
||||
const u32 clutMask = (gstate.clutformat >> 8) & 0xff;
|
||||
const u8 clutShift = (gstate.clutformat >> 2) & 0x1f;
|
||||
const u32 clutBase = gstate.getClutIndexStartPos();
|
||||
const u32 clutMask = gstate.getClutIndexMask();
|
||||
const u8 clutShift = gstate.getClutIndexShift();
|
||||
return ((index >> clutShift) & clutMask) | clutBase;
|
||||
}
|
||||
|
||||
@ -831,7 +831,7 @@ void TextureCache::LoadClut() {
|
||||
}
|
||||
|
||||
void TextureCache::UpdateCurrentClut() {
|
||||
const GEPaletteFormat clutFormat = (GEPaletteFormat)(gstate.clutformat & 3);
|
||||
const GEPaletteFormat clutFormat = gstate.getClutPaletteFormat();
|
||||
const u32 clutBase = (gstate.clutformat & 0x1f0000) >> 12;
|
||||
const u32 clutBaseBytes = clutBase * (clutFormat == GE_CMODE_32BIT_ABGR8888 ? sizeof(u32) : sizeof(u16));
|
||||
// Technically, these extra bytes weren't loaded, but hopefully it was loaded earlier.
|
||||
|
@ -217,11 +217,13 @@ struct GPUgstate
|
||||
bool isTextureMapEnabled() const { return textureMapEnable & 1; }
|
||||
int getTextureFunction() const { return texfunc & 0x7; }
|
||||
bool isColorDoublingEnabled() const { return (texfunc & 0x10000) != 0; }
|
||||
GETextureFormat getTextureFormat() const { return static_cast<GETextureFormat>(texformat & 0xF); }
|
||||
|
||||
int getTextureEnvColR() const { return texenvcolor&0xFF; }
|
||||
int getTextureEnvColG() const { return (texenvcolor>>8)&0xFF; }
|
||||
int getTextureEnvColB() const { return (texenvcolor>>16)&0xFF; }
|
||||
|
||||
GEPaletteFormat getClutPaletteFormat() { return static_cast<GEPaletteFormat>(clutformat & 3); }
|
||||
int getClutIndexShift() const { return (clutformat >> 2) & 0x1F; }
|
||||
int getClutIndexMask() const { return (clutformat >> 8) & 0xFF; }
|
||||
int getClutIndexStartPos() const { return ((clutformat >> 16) & 0x1F) << 4; }
|
||||
|
Loading…
Reference in New Issue
Block a user