ignore trilinear filtering if texture isn't mipmapped

fixes shenmue snowflakes color
This commit is contained in:
Flyinghead 2020-01-21 19:52:09 +01:00
parent ef3512a2f3
commit ff69efff48
5 changed files with 6 additions and 5 deletions

View File

@ -76,7 +76,8 @@ static void SetTextureRepeatMode(int index, GLuint dir, u32 clamp, u32 mirror)
template <u32 Type, bool SortingEnabled, Pass pass>
static void SetGPState(const PolyParam* gp)
{
if (gp->pcw.Texture && gp->tsp.FilterMode > 1)
// Trilinear filtering. Ignore if texture isn't mipmapped (shenmue snowflakes)
if (gp->pcw.Texture && gp->tsp.FilterMode > 1 && Type != ListType_Punch_Through && gp->tcw.MipMapped == 1)
{
gl4ShaderUniforms.trilinear_alpha = 0.25 * (gp->tsp.MipMapD & 0x3);
if (gp->tsp.FilterMode == 2)

View File

@ -147,7 +147,7 @@ template <u32 Type, bool SortingEnabled>
__forceinline
void SetGPState(const PolyParam* gp,u32 cflip=0)
{
if (gp->pcw.Texture && gp->tsp.FilterMode > 1 && Type != ListType_Punch_Through)
if (gp->pcw.Texture && gp->tsp.FilterMode > 1 && Type != ListType_Punch_Through && gp->tcw.MipMapped == 1)
{
ShaderUniforms.trilinear_alpha = 0.25 * (gp->tsp.MipMapD & 0x3);
if (gp->tsp.FilterMode == 2)

View File

@ -189,7 +189,7 @@ void Drawer::DrawPoly(const vk::CommandBuffer& cmdBuffer, u32 listType, bool sor
SetScissor(cmdBuffer, baseScissor);
float trilinearAlpha = 1.f;
if (poly.tsp.FilterMode > 1 && poly.pcw.Texture && listType != ListType_Punch_Through)
if (poly.tsp.FilterMode > 1 && poly.pcw.Texture && listType != ListType_Punch_Through && poly.tcw.MipMapped == 1)
{
trilinearAlpha = 0.25 * (poly.tsp.MipMapD & 0x3);
if (poly.tsp.FilterMode == 2)

View File

@ -33,7 +33,7 @@ void OITDrawer::DrawPoly(const vk::CommandBuffer& cmdBuffer, u32 listType, bool
SetScissor(cmdBuffer, baseScissor);
float trilinearAlpha = 1.f;
if (poly.tsp.FilterMode > 1 && poly.pcw.Texture && listType != ListType_Punch_Through)
if (poly.tsp.FilterMode > 1 && poly.pcw.Texture && listType != ListType_Punch_Through && poly.tcw.MipMapped == 1)
{
trilinearAlpha = 0.25 * (poly.tsp.MipMapD & 0x3);
if (poly.tsp.FilterMode == 2)

View File

@ -301,7 +301,7 @@ void PipelineManager::CreatePipeline(u32 listType, bool sortTriangles, const Pol
params.offset = pp.pcw.Offset;
params.shaderInstr = pp.tsp.ShadInstr;
params.texture = pp.pcw.Texture;
params.trilinear = pp.pcw.Texture && pp.tsp.FilterMode > 1 && listType != ListType_Punch_Through;
params.trilinear = pp.pcw.Texture && pp.tsp.FilterMode > 1 && listType != ListType_Punch_Through && pp.tcw.MipMapped == 1;
params.useAlpha = pp.tsp.UseAlpha;
vk::ShaderModule fragment_module = shaderManager->GetFragmentShader(params);