VertexDecoderCommon: Avoid reading the destination during vertex decode, might be some kind of memory that's not good to read from...

This commit is contained in:
Henrik Rydgård 2018-01-03 16:30:39 +01:00
parent 2e2d76e109
commit e472947488

View file

@ -502,28 +502,28 @@ void VertexDecoder::Step_Color5551() const
{
u8 *c = decoded_ + decFmt.c0off;
u16 cdata = *(u16_le *)(ptr_ + coloff);
gstate_c.vertexFullAlpha = gstate_c.vertexFullAlpha && (cdata >> 15) != 0;
c[0] = Convert5To8(cdata & 0x1f);
c[1] = Convert5To8((cdata >> 5) & 0x1f);
c[2] = Convert5To8((cdata >> 10) & 0x1f);
c[3] = (cdata >> 15) ? 255 : 0;
gstate_c.vertexFullAlpha = gstate_c.vertexFullAlpha && c[3] != 0;
}
void VertexDecoder::Step_Color4444() const
{
u8 *c = decoded_ + decFmt.c0off;
u16 cdata = *(u16_le *)(ptr_ + coloff);
gstate_c.vertexFullAlpha = gstate_c.vertexFullAlpha && (cdata >> 12) == 0xF;
for (int j = 0; j < 4; j++)
c[j] = Convert4To8((cdata >> (j * 4)) & 0xF);
gstate_c.vertexFullAlpha = gstate_c.vertexFullAlpha && c[3] == 255;
}
void VertexDecoder::Step_Color8888() const
{
u8 *c = decoded_ + decFmt.c0off;
const u8 *cdata = (const u8*)(ptr_ + coloff);
gstate_c.vertexFullAlpha = gstate_c.vertexFullAlpha && cdata[3] == 255;
memcpy(c, cdata, sizeof(u8) * 4);
gstate_c.vertexFullAlpha = gstate_c.vertexFullAlpha && c[3] == 255;
}
void VertexDecoder::Step_Color565Morph() const