GL: blending support for punch-through polys

Disable trilinear filtering for PTs
PT alpha test should be done after color+tex shading according to documentation
This commit is contained in:
Flyinghead 2019-08-09 12:05:56 +02:00
parent 7ff225bfa0
commit 1a019b79b0
2 changed files with 8 additions and 6 deletions

View File

@ -179,7 +179,7 @@ template <u32 Type, bool SortingEnabled>
__forceinline
void SetGPState(const PolyParam* gp,u32 cflip=0)
{
if (gp->pcw.Texture && gp->tsp.FilterMode > 1)
if (gp->pcw.Texture && gp->tsp.FilterMode > 1 && Type != ListType_Punch_Through)
{
ShaderUniforms.trilinear_alpha = 0.25 * (gp->tsp.MipMapD & 0x3);
if (gp->tsp.FilterMode == 2)
@ -237,7 +237,8 @@ __forceinline
glcache.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
}
if (Type==ListType_Translucent)
// Apparently punch-through polys support blending, or at least some combinations
if (Type == ListType_Translucent || Type == ListType_Punch_Through)
{
glcache.Enable(GL_BLEND);
glcache.BlendFunc(SrcBlendGL[gp->tsp.SrcInstr],DstBlendGL[gp->tsp.DstInstr]);

View File

@ -271,10 +271,6 @@ void main() \n\
#if pp_IgnoreTexA==1 \n\
texcol.a=1.0; \n\
#endif\n\
\n\
#if cp_AlphaTest == 1 \n\
if (cp_AlphaTestValue>texcol.a) discard;\n\
#endif \n\
#endif \n\
#if pp_ShadInstr==0 \n\
{ \n\
@ -298,6 +294,11 @@ void main() \n\
} \n\
#endif\n\
\n\
#if cp_AlphaTest == 1 \n\
if (cp_AlphaTestValue > color.a) \n\
discard; \n\
#endif \n\
\n\
#if pp_Offset==1 && pp_BumpMap == 0 \n\
{ \n\
color.rgb+=vtx_offs.rgb; \n\