Avoid accidental sign ext for > 24 bit clut shift.

This commit is contained in:
Unknown W. Brackets 2015-04-26 00:11:47 -07:00
parent a4a10588ed
commit 5b61c03b7f
2 changed files with 2 additions and 2 deletions

View file

@ -88,7 +88,7 @@ void GenerateDepalShader300(char *buffer, GEBufferFormat pixelFormat) {
texturePixels = 512;
if (shift) {
WRITE(p, " index = ((index >> %i) & 0x%02x)", shift, mask);
WRITE(p, " index = (int(uint(index) >> %i) & 0x%02x)", shift, mask);
} else {
WRITE(p, " index = (index & 0x%02x)", mask);
}

View file

@ -309,7 +309,7 @@ struct GPUgstate
int getClutIndexShift() const { return (clutformat >> 2) & 0x1F; }
int getClutIndexMask() const { return (clutformat >> 8) & 0xFF; }
int getClutIndexStartPos() const { return ((clutformat >> 16) & 0x1F) << 4; }
int transformClutIndex(int index) const { return ((index >> getClutIndexShift()) & getClutIndexMask()) | getClutIndexStartPos(); }
u32 transformClutIndex(u32 index) const { return ((index >> getClutIndexShift()) & getClutIndexMask()) | getClutIndexStartPos(); }
bool isClutIndexSimple() const { return (clutformat & ~3) == 0xC500FF00; } // Meaning, no special mask, shift, or start pos.
bool isTextureSwizzled() const { return texmode & 1; }
bool isClutSharedForMipmaps() const { return (texmode & 0x100) == 0; }