Float TC coordinates apparently work in through mode. Add one more special case for blending.

This commit is contained in:
Henrik Rydgard 2012-11-26 11:32:49 +01:00
parent 00c218860e
commit ec55fac3cd
3 changed files with 17 additions and 4 deletions

View file

@ -530,6 +530,9 @@ void TransformAndDrawPrim(void *verts, void *inds, int prim, int vertexCount, Li
// TODO: All this setup is soon so expensive that we'll need dirty flags, or simply do it in the command writes where we detect dirty by xoring. Silly to do all this work on every drawcall.
// TODO: The top bit of the alpha channel should be written to the stencil bit somehow. This appears to require very expensive multipass rendering :( Alternatively, one could do a
// single fullscreen pass that converts alpha to stencil (or 2 passes, to set both the 0 and 1 values) very easily.
// Set cull
bool wantCull = !gstate.isModeClear() && !gstate.isModeThrough() && gstate.isCullEnabled();
glstate.cullFace.set(wantCull);
@ -588,6 +591,11 @@ void TransformAndDrawPrim(void *verts, void *inds, int prim, int vertexCount, Li
glBlendFuncB = GL_ONE_MINUS_CONSTANT_COLOR;
const float blendColor[4] = {(fixA & 0xFF)/255.0f, ((fixA >> 8) & 0xFF)/255.0f, ((fixA >> 16) & 0xFF)/255.0f, 1.0f};
glstate.blendColor.set(blendColor);
} else if (fixA == fixB) {
glBlendFuncA = GL_CONSTANT_COLOR;
glBlendFuncB = GL_CONSTANT_COLOR;
const float blendColor[4] = {(fixA & 0xFF)/255.0f, ((fixA >> 8) & 0xFF)/255.0f, ((fixA >> 16) & 0xFF)/255.0f, 1.0f};
glstate.blendColor.set(blendColor);
} else {
NOTICE_LOG(HLE, "ERROR INVALID blendcolorstate: FixA=%06x FixB=%06x FuncA=%i FuncB=%i", gstate.getFixA(), gstate.getFixB(), gstate.getBlendFuncA(), gstate.getBlendFuncB());
glBlendFuncA = GL_ONE;

View file

@ -190,7 +190,7 @@ void VertexDecoder::DecodeVerts(DecodedVertex *decoded, const void *verts, const
{
const u8 *uvdata = (const u8*)(ptr + tcoff);
for (int j = 0; j < 2; j++)
uv[j] = (float)uvdata[j]/255.0f;
uv[j] = (float)uvdata[j] / 255.0f;
break;
}
@ -213,8 +213,13 @@ void VertexDecoder::DecodeVerts(DecodedVertex *decoded, const void *verts, const
case GE_VTYPE_TC_FLOAT:
{
const float *uvdata = (const float*)(ptr + tcoff);
for (int j = 0; j < 2; j++)
uv[j] = uvdata[j];
if (throughmode) {
uv[0] = uvdata[0] / (float)(gstate_c.curTextureWidth);
uv[1] = uvdata[1] / (float)(gstate_c.curTextureHeight);
} else {
uv[0] = uvdata[0];
uv[1] = uvdata[1];
}
}
break;
}

2
native

@ -1 +1 @@
Subproject commit 975986f79b693952d64272a752ffaded21a84afd
Subproject commit 5ca7692912c7bb53e1019bffbedbb09fd9d0a525