Skip to content

Commit

Permalink
SoftGPU: Fix separate mipmap cluts.
Browse files Browse the repository at this point in the history
These should only be used for CLUT4.
  • Loading branch information
unknownbrackets committed May 8, 2017
1 parent f5dd3b9 commit 3944a07
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions GPU/Software/Rasterizer.cpp
Expand Up @@ -386,30 +386,31 @@ inline static Nearest4 SampleNearest(int level, int u[N], int v[N], const u8 *sr
for (int i = 0; i < N; ++i) {
const u8 *src = srcptr + GetPixelDataOffset<32>(texbufwidthbytes, u[i], v[i]);
u32 val = src[0] + (src[1] << 8) + (src[2] << 16) + (src[3] << 24);
res.v[i] = LookupColor(gstate.transformClutIndex(val), level);
res.v[i] = LookupColor(gstate.transformClutIndex(val), 0);
}
return res;

case GE_TFMT_CLUT16:
for (int i = 0; i < N; ++i) {
const u8 *src = srcptr + GetPixelDataOffset<16>(texbufwidthbytes, u[i], v[i]);
u16 val = src[0] + (src[1] << 8);
res.v[i] = LookupColor(gstate.transformClutIndex(val), level);
res.v[i] = LookupColor(gstate.transformClutIndex(val), 0);
}
return res;

case GE_TFMT_CLUT8:
for (int i = 0; i < N; ++i) {
const u8 *src = srcptr + GetPixelDataOffset<8>(texbufwidthbytes, u[i], v[i]);
u8 val = *src;
res.v[i] = LookupColor(gstate.transformClutIndex(val), level);
res.v[i] = LookupColor(gstate.transformClutIndex(val), 0);
}
return res;

case GE_TFMT_CLUT4:
for (int i = 0; i < N; ++i) {
const u8 *src = srcptr + GetPixelDataOffset<4>(texbufwidthbytes, u[i], v[i]);
u8 val = (u[i] & 1) ? (src[0] >> 4) : (src[0] & 0xF);
// Only CLUT4 uses separate mipmap palettes.
res.v[i] = LookupColor(gstate.transformClutIndex(val), level);
}
return res;
Expand Down

0 comments on commit 3944a07

Please sign in to comment.