fix color overflow in capture blending; fixes freedom wings

This commit is contained in:
zeromus 2009-07-25 03:40:27 +00:00
parent 3856c0c5e9
commit c0b302f4e4
3 changed files with 13 additions and 5 deletions

View File

@ -20,7 +20,9 @@ Graphics:
bug: fix backdrop blending with garbage
bug: fix 256B granularity sprite addressing for sub gpu
bug: fix 128-wide captures
bug: swrast: add clear image emulation
bug: fix color overflow in capture blending
bug: swrast: add clear image and scroll emulation
bug: swrast: fixes to shadow rendering
Windows:
bug: improve map view tool to support more modes

View File

@ -545,7 +545,7 @@ static void GPU_InitFadeColors()
for(int eva=0;eva<=16;eva++)
for(int evb=0;evb<=16;evb++)
{
int blend = ((c0 * eva / 16) + (c1 * evb / 16) );
int blend = ((c0 * eva) + (c1 * evb) ) / 16;
int final = std::min<int>(31,blend);
gpuBlendTable555[eva][evb][c0][c1] = final;
}
@ -2574,6 +2574,7 @@ template<bool SKIP> static void GPU_ligne_DispCapture(u16 l)
if ((srcA) && (srcB))
{
const int todo = (gpu->dispCapCnt.capx==DISPCAPCNT::_128?128:256);
for(u16 i = 0; i < todo; i++)
{
u16 a,r,g,b;
@ -2581,7 +2582,7 @@ template<bool SKIP> static void GPU_ligne_DispCapture(u16 l)
u16 a_alpha = srcA[i] & 0x8000;
u16 b_alpha = srcB[i] & 0x8000;
if (gpu->dispCapCnt.EVA && a_alpha)
if(a_alpha)
{
a = 0x8000;
r = ((srcA[i] & 0x1F) * gpu->dispCapCnt.EVA);
@ -2591,7 +2592,7 @@ template<bool SKIP> static void GPU_ligne_DispCapture(u16 l)
else
a = r = g = b = 0;
if (gpu->dispCapCnt.EVB && b_alpha)
if(b_alpha)
{
a = 0x8000;
r += ((srcB[i] & 0x1F) * gpu->dispCapCnt.EVB);
@ -2603,6 +2604,10 @@ template<bool SKIP> static void GPU_ligne_DispCapture(u16 l)
g >>= 4;
b >>= 4;
r = std::min((u16)31,r);
g = std::min((u16)31,g);
b = std::min((u16)31,b);
T2WriteWord(cap_dst, i << 1, a | (b << 10) | (g << 5) | r);
}
}

View File

@ -345,7 +345,8 @@ struct Shader
{
mode = (polyattr>>4)&0x3;
//if there is no texture set, then set to the mode which doesnt even use a texture
if(sampler.texFormat == 0 && mode == 0)
//unless we're in shadow
if(sampler.texFormat == 0 && mode != 3)
mode = 4;
}