VideoCommon: Always update pixel shader constants when tevregs change
This time, it doesn't break the games i tested, and still fixes Metroid Prime 3 texts/colors. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7668 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
951e20ae73
commit
1f2adf0563
|
@ -553,11 +553,16 @@ void BPWritten(const BPCmd& bp)
|
||||||
case BPMEM_TEV_REGISTER_H+4:
|
case BPMEM_TEV_REGISTER_H+4:
|
||||||
case BPMEM_TEV_REGISTER_L+6: // Reg 4
|
case BPMEM_TEV_REGISTER_L+6: // Reg 4
|
||||||
case BPMEM_TEV_REGISTER_H+6:
|
case BPMEM_TEV_REGISTER_H+6:
|
||||||
if (bp.address & 1) // only run this code for the _H! is this right? what if L is set independently?
|
// some games only send the _L part, so always update
|
||||||
|
// there actually are 2 register behind each of these
|
||||||
|
// addresses, selected by the type bit.
|
||||||
{
|
{
|
||||||
// don't compare with changes!
|
// don't compare with changes!
|
||||||
int num = (bp.address >> 1) & 0x3;
|
int num = (bp.address >> 1) & 0x3;
|
||||||
PixelShaderManager::SetColorChanged(bpmem.tevregs[num].high.type, num);
|
if ((bp.address & 1) == 0)
|
||||||
|
PixelShaderManager::SetColorChanged(bpmem.tevregs[num].low.type, num, false);
|
||||||
|
else
|
||||||
|
PixelShaderManager::SetColorChanged(bpmem.tevregs[num].high.type, num, true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -340,17 +340,20 @@ void PixelShaderManager::SetPSTextureDims(int texid)
|
||||||
|
|
||||||
// This one is high in profiles (0.5%). TODO: Move conversion out, only store the raw color value
|
// This one is high in profiles (0.5%). TODO: Move conversion out, only store the raw color value
|
||||||
// and update it when the shader constant is set, only.
|
// and update it when the shader constant is set, only.
|
||||||
void PixelShaderManager::SetColorChanged(int type, int num)
|
void PixelShaderManager::SetColorChanged(int type, int num, bool high)
|
||||||
{
|
{
|
||||||
int r = bpmem.tevregs[num].low.a;
|
|
||||||
int a = bpmem.tevregs[num].low.b;
|
|
||||||
int b = bpmem.tevregs[num].high.a;
|
|
||||||
int g = bpmem.tevregs[num].high.b;
|
|
||||||
float *pf = &lastRGBAfull[type][num][0];
|
float *pf = &lastRGBAfull[type][num][0];
|
||||||
pf[0] = (float)r * (1.0f / 255.0f);
|
if (!high) {
|
||||||
pf[1] = (float)g * (1.0f / 255.0f);
|
int r = bpmem.tevregs[num].low.a;
|
||||||
pf[2] = (float)b * (1.0f / 255.0f);
|
int a = bpmem.tevregs[num].low.b;
|
||||||
pf[3] = (float)a * (1.0f / 255.0f);
|
pf[0] = (float)r * (1.0f / 255.0f);
|
||||||
|
pf[3] = (float)a * (1.0f / 255.0f);
|
||||||
|
} else {
|
||||||
|
int b = bpmem.tevregs[num].high.a;
|
||||||
|
int g = bpmem.tevregs[num].high.b;
|
||||||
|
pf[1] = (float)g * (1.0f / 255.0f);
|
||||||
|
pf[2] = (float)b * (1.0f / 255.0f);
|
||||||
|
}
|
||||||
s_nColorsChanged[type] |= 1 << num;
|
s_nColorsChanged[type] |= 1 << num;
|
||||||
PRIM_LOG("pixel %scolor%d: %f %f %f %f\n", type?"k":"", num, pf[0], pf[1], pf[2], pf[3]);
|
PRIM_LOG("pixel %scolor%d: %f %f %f %f\n", type?"k":"", num, pf[0], pf[1], pf[2], pf[3]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ public:
|
||||||
static void SetConstants(); // sets pixel shader constants
|
static void SetConstants(); // sets pixel shader constants
|
||||||
|
|
||||||
// constant management, should be called after memory is committed
|
// constant management, should be called after memory is committed
|
||||||
static void SetColorChanged(int type, int index);
|
static void SetColorChanged(int type, int index, bool high);
|
||||||
static void SetAlpha(const AlphaFunc& alpha);
|
static void SetAlpha(const AlphaFunc& alpha);
|
||||||
static void SetDestAlpha(const ConstantAlpha& alpha);
|
static void SetDestAlpha(const ConstantAlpha& alpha);
|
||||||
static void SetTexDims(int texmapid, u32 width, u32 height, u32 wraps, u32 wrapt);
|
static void SetTexDims(int texmapid, u32 width, u32 height, u32 wraps, u32 wrapt);
|
||||||
|
|
Loading…
Reference in New Issue