Enable anisotropic filtering when the game requests it

This commit is contained in:
Pokechu22
2021-07-30 12:14:54 -07:00
committed by Jordan Woyak
parent 0299540209
commit 79a1e480ca
7 changed files with 18 additions and 17 deletions

View File

@ -309,10 +309,15 @@ void SamplerState::Generate(const BPMemory& bp, u32 index)
};
tm0.wrap_u = filter_invalid_wrap(bp_tm0.wrap_s);
tm0.wrap_v = filter_invalid_wrap(bp_tm0.wrap_t);
if (bp_tm0.max_aniso == MaxAniso::Two)
tm0.anisotropic_filtering = 1;
else if (bp_tm0.max_aniso == MaxAniso::Four)
tm0.anisotropic_filtering = 2;
else
tm0.anisotropic_filtering = 0;
tm0.diag_lod = bp_tm0.diag_lod;
tm0.anisotropic_filtering = false; // TODO: Respect BP anisotropic filtering mode
tm0.lod_clamp = bp_tm0.lod_clamp; // TODO: What does this do?
tm0.lod_clamp = bp_tm0.lod_clamp; // TODO: What does this do?
}
namespace RenderState

View File

@ -200,7 +200,7 @@ struct SamplerState
BitField<7, 1, LODType> diag_lod;
BitField<8, 16, s32> lod_bias; // multiplied by 256, higher precision than normal
BitField<24, 1, bool, u32> lod_clamp; // TODO: This isn't currently implemented
BitField<25, 1, bool, u32> anisotropic_filtering; // TODO: This doesn't use the BP one yet
BitField<25, 4, u32> anisotropic_filtering;
u32 hex = 0;
};
union TM1

View File

@ -1051,11 +1051,7 @@ SamplerState TextureCacheBase::GetSamplerState(u32 index, float custom_tex_scale
state.tm0.mag_filter = FilterMode::Linear;
if (tm0.mipmap_filter != MipMode::None)
state.tm0.mipmap_filter = FilterMode::Linear;
state.tm0.anisotropic_filtering = true;
}
else
{
state.tm0.anisotropic_filtering = false;
state.tm0.anisotropic_filtering = g_ActiveConfig.iMaxAnisotropy;
}
if (has_arbitrary_mips && tm0.mipmap_filter != MipMode::None)
@ -1068,7 +1064,7 @@ SamplerState TextureCacheBase::GetSamplerState(u32 index, float custom_tex_scale
state.tm0.lod_bias = std::clamp<s32>(state.tm0.lod_bias + lod_offset, -32768, 32767);
// Anisotropic also pushes mips farther away so it cannot be used either
state.tm0.anisotropic_filtering = false;
state.tm0.anisotropic_filtering = 0;
}
return state;