Skip to content

Commit

Permalink
vertexjit: Fix some stupid mistakes in x86 morph.
Browse files Browse the repository at this point in the history
Good to have somewhere to test it properly.
  • Loading branch information
unknownbrackets committed Mar 29, 2014
1 parent 7d6ce24 commit 6b606aa
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions GPU/GLES/VertexDecoderX86.cpp
Expand Up @@ -790,9 +790,9 @@ void VertexDecoderJitCache::Jit_Color4444Morph() {
Jit_WriteMorphColor(dec_->decFmt.c0off);
}

// Intentionally in reverse order.
// The mask is intentionally in reverse order (but skips A.)
static const u32 MEMORY_ALIGNED16(color565Mask[4]) = { 0x0000f800, 0x000007e0, 0x0000001f, 0x00000000, };
static const float MEMORY_ALIGNED16(byColor565[4]) = { 255.0f / 1.0f, 255.0f / 31.0f, 255.0f / 63.0f, 255.0f / 31.0f, };
static const float MEMORY_ALIGNED16(byColor565[4]) = { 255.0f / 31.0f, 255.0f / 63.0f, 255.0f / 31.0f, 255.0f / 1.0f, };

void VertexDecoderJitCache::Jit_Color565Morph() {
MOV(PTRBITS, R(tempReg1), ImmPtr(&gstate_c.morphWeights[0]));
Expand All @@ -804,9 +804,10 @@ void VertexDecoderJitCache::Jit_Color565Morph() {
for (int n = 0; n < dec_->morphcount; ++n) {
const X64Reg reg = first ? fpScratchReg : fpScratchReg3;
MOVD_xmm(fpScratchReg2, MDisp(srcReg, dec_->onesize_ * n + dec_->coloff));
// Spread it out into each lane.
// Spread it out into each lane. We end up with it reversed (R high, A low.)
// Below, we shift out each lane from low to high and reverse them.
PSHUFD(fpScratchReg2, R(fpScratchReg2), _MM_SHUFFLE(0, 0, 0, 0));
PAND(fpScratchReg, R(XMM5));
PAND(fpScratchReg2, R(XMM5));

// Alpha - start with 1.
MOVD_xmm(reg, R(tempReg2));
Expand Down Expand Up @@ -844,9 +845,9 @@ void VertexDecoderJitCache::Jit_Color565Morph() {
Jit_WriteMorphColor(dec_->decFmt.c0off, false);
}

// Intentionally in reverse order.
// The mask is intentionally in reverse order.
static const u32 MEMORY_ALIGNED16(color5551Mask[4]) = { 0x00008000, 0x00007c00, 0x000003e0, 0x0000001f, };
static const float MEMORY_ALIGNED16(byColor5551[4]) = { 255.0f / 1.0f, 255.0f / 31.0f, 255.0f / 31.0f, 255.0f / 31.0f, };
static const float MEMORY_ALIGNED16(byColor5551[4]) = { 255.0f / 31.0f, 255.0f / 31.0f, 255.0f / 31.0f, 255.0f / 1.0f, };

void VertexDecoderJitCache::Jit_Color5551Morph() {
MOV(PTRBITS, R(tempReg1), ImmPtr(&gstate_c.morphWeights[0]));
Expand All @@ -859,7 +860,7 @@ void VertexDecoderJitCache::Jit_Color5551Morph() {
MOVD_xmm(fpScratchReg2, MDisp(srcReg, dec_->onesize_ * n + dec_->coloff));
// Spread it out into each lane.
PSHUFD(fpScratchReg2, R(fpScratchReg2), _MM_SHUFFLE(0, 0, 0, 0));
PAND(fpScratchReg, R(XMM5));
PAND(fpScratchReg2, R(XMM5));

// Alpha first.
MOVSS(reg, R(fpScratchReg2));
Expand Down

0 comments on commit 6b606aa

Please sign in to comment.