mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-30 19:24:23 +01:00
Correctly keep track of "full alpha" in vertices (x86 jit only).
This commit is contained in:
1 parent
6260ac4bc7
commit
2c76e6d023
3 files changed
+36
-5
No files matched your search
@@ -265,11 +265,6 @@ void TransformDrawEngine::SetupVertexDecoder(u32 vertType) {
|
||||
if (vertTypeID != lastVType_) {
|
||||
dec_ = GetVertexDecoder(vertTypeID);
|
||||
lastVType_ = vertTypeID;
|
||||
|
||||
// TODO: Add functionality to VertexDecoder to scan for non-full alpha in the two other formats,
|
||||
// which are quite common.
|
||||
int colorType = vertTypeID & GE_VTYPE_COL_MASK;
|
||||
gstate_c.vertexFullAlpha = colorType == GE_VTYPE_COL_NONE || colorType == GE_VTYPE_COL_565;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -566,6 +561,8 @@ void TransformDrawEngine::DoFlush() {
|
||||
vai->numVerts = indexGen.VertexCount();
|
||||
vai->prim = indexGen.Prim();
|
||||
vai->maxIndex = indexGen.MaxIndex();
|
||||
vai->flags = gstate_c.vertexFullAlpha ? VAI_FLAG_VERTEXFULLALPHA : 0;
|
||||
|
||||
goto rotateVBO;
|
||||
}
|
||||
|
||||
@@ -645,6 +642,8 @@ void TransformDrawEngine::DoFlush() {
|
||||
vertexCount = vai->numVerts;
|
||||
maxIndex = vai->maxIndex;
|
||||
prim = static_cast<GEPrimitiveType>(vai->prim);
|
||||
|
||||
gstate_c.vertexFullAlpha = vai->flags & VAI_FLAG_VERTEXFULLALPHA;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -665,6 +664,8 @@ void TransformDrawEngine::DoFlush() {
|
||||
vertexCount = vai->numVerts;
|
||||
maxIndex = vai->maxIndex;
|
||||
prim = static_cast<GEPrimitiveType>(vai->prim);
|
||||
|
||||
gstate_c.vertexFullAlpha = vai->flags & VAI_FLAG_VERTEXFULLALPHA;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -717,6 +718,7 @@ rotateVBO:
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
} else {
|
||||
DecodeVerts();
|
||||
|
||||
LinkedShader *program = shaderManager_->ApplyFragmentShader(vshader, prim, lastVType_);
|
||||
gpuStats.numUncachedVertsDrawn += indexGen.VertexCount();
|
||||
prim = indexGen.Prim();
|
||||
@@ -737,6 +739,7 @@ rotateVBO:
|
||||
decodeCounter_ = 0;
|
||||
dcid_ = 0;
|
||||
prevPrim_ = GE_PRIM_INVALID;
|
||||
gstate_c.vertexFullAlpha = true;
|
||||
|
||||
#ifndef MOBILE_DEVICE
|
||||
host->GPUNotifyDraw();
|
||||
|
||||
@@ -43,6 +43,10 @@ struct DecVtxFormat;
|
||||
// DRAWN_ONCE -> death
|
||||
// DRAWN_RELIABLE -> death
|
||||
|
||||
enum {
|
||||
VAI_FLAG_VERTEXFULLALPHA = 1,
|
||||
};
|
||||
|
||||
// Try to keep this POD.
|
||||
class VertexArrayInfo {
|
||||
public:
|
||||
@@ -57,6 +61,7 @@ public:
|
||||
lastFrame = gpuStats.numFlips;
|
||||
numVerts = 0;
|
||||
drawsUntilNextFullHash = 0;
|
||||
flags = 0;
|
||||
}
|
||||
~VertexArrayInfo();
|
||||
|
||||
@@ -85,6 +90,7 @@ public:
|
||||
int numFrames;
|
||||
int lastFrame; // So that we can forget.
|
||||
u16 drawsUntilNextFullHash;
|
||||
u8 flags;
|
||||
};
|
||||
|
||||
// Handles transform, lighting and drawing.
|
||||
|
||||
@@ -556,6 +556,11 @@ void VertexDecoderJitCache::Jit_TcFloatThrough() {
|
||||
void VertexDecoderJitCache::Jit_Color8888() {
|
||||
MOV(32, R(tempReg1), MDisp(srcReg, dec_->coloff));
|
||||
MOV(32, MDisp(dstReg, dec_->decFmt.c0off), R(tempReg1));
|
||||
|
||||
CMP(32, R(tempReg1), Imm32(0xFF000000));
|
||||
FixupBranch skip = J_CC(CC_GE, false);
|
||||
MOV(8, M(&gstate_c.textureFullAlpha), Imm8(0));
|
||||
SetJumpTarget(skip);
|
||||
}
|
||||
|
||||
static const u32 MEMORY_ALIGNED16(nibbles[4]) = { 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, };
|
||||
@@ -625,6 +630,11 @@ void VertexDecoderJitCache::Jit_Color4444() {
|
||||
OR(32, R(tempReg2), R(tempReg3));
|
||||
|
||||
MOV(32, MDisp(dstReg, dec_->decFmt.c0off), R(tempReg2));
|
||||
|
||||
CMP(32, R(tempReg2), Imm32(0xFF000000));
|
||||
FixupBranch skip = J_CC(CC_AE, false);
|
||||
MOV(8, M(&gstate_c.textureFullAlpha), Imm8(0));
|
||||
SetJumpTarget(skip);
|
||||
}
|
||||
|
||||
void VertexDecoderJitCache::Jit_Color565() {
|
||||
@@ -696,6 +706,11 @@ void VertexDecoderJitCache::Jit_Color5551() {
|
||||
OR(32, R(tempReg2), R(tempReg1));
|
||||
|
||||
MOV(32, MDisp(dstReg, dec_->decFmt.c0off), R(tempReg2));
|
||||
|
||||
CMP(32, R(tempReg2), Imm32(0xFF000000));
|
||||
FixupBranch skip = J_CC(CC_AE, false);
|
||||
MOV(8, M(&gstate_c.textureFullAlpha), Imm8(0));
|
||||
SetJumpTarget(skip);
|
||||
}
|
||||
|
||||
void VertexDecoderJitCache::Jit_Color8888Morph() {
|
||||
@@ -890,6 +905,13 @@ void VertexDecoderJitCache::Jit_WriteMorphColor(int outOff) {
|
||||
PACKSSDW(fpScratchReg, R(fpScratchReg));
|
||||
PACKUSWB(fpScratchReg, R(fpScratchReg));
|
||||
MOVD_xmm(MDisp(dstReg, outOff), fpScratchReg);
|
||||
|
||||
// TODO: May be a faster way to do this without the MOVD.
|
||||
MOVD_xmm(R(tempReg1), fpScratchReg);
|
||||
CMP(32, R(tempReg1), Imm32(0xFF000000));
|
||||
FixupBranch skip = J_CC(CC_AE, false);
|
||||
MOV(8, M(&gstate_c.textureFullAlpha), Imm8(0));
|
||||
SetJumpTarget(skip);
|
||||
}
|
||||
|
||||
// Copy 3 bytes and then a zero. Might as well copy four.
|
||||
|
||||
Reference in new issue
Block a user