diff options
| author | Tommaso Checchi <tommaso.checchi1@gmail.com> | 2017-10-18 02:02:56 -0700 |
|---|---|---|
| committer | Tommaso Checchi <tommaso.checchi1@gmail.com> | 2017-10-27 00:45:20 -0700 |
| commit | 5fb6ceac452fa7960301d132f2f044073045564a (patch) | |
| tree | f9591414a257597d734b7177f448f8691a2d9cc6 /Source/Core/VideoCommon/VertexManagerBase.cpp | |
| parent | 802fda26ab0959f92327a37fac966d728c8dcc5f (diff) | |
Fixed fog, lava, water in Mario Galaxy (and possibly other games) in higher IRs by detecting & fixing the mipmaps that aren't just used for downscaling, but are handmade to create a gradient.
Diffstat (limited to 'Source/Core/VideoCommon/VertexManagerBase.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/VertexManagerBase.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/Source/Core/VideoCommon/VertexManagerBase.cpp b/Source/Core/VideoCommon/VertexManagerBase.cpp index 9138b0db09..870b9ad1e2 100644 --- a/Source/Core/VideoCommon/VertexManagerBase.cpp +++ b/Source/Core/VideoCommon/VertexManagerBase.cpp @@ -209,7 +209,7 @@ std::pair<size_t, size_t> VertexManagerBase::ResetFlushAspectRatioCount() return val; } -static void SetSamplerState(u32 index, bool custom_tex) +static void SetSamplerState(u32 index, bool custom_tex, bool has_arbitrary_mips) { const FourTexUnits& tex = bpmem.tex[index / 4]; const TexMode0& tm0 = tex.texMode0[index % 4]; @@ -252,6 +252,18 @@ static void SetSamplerState(u32 index, bool custom_tex) state.anisotropic_filtering = 0; } + if (has_arbitrary_mips && SamplerCommon::AreBpTexMode0MipmapsEnabled(tm0)) + { + // Apply a secondary bias calculated from the IR scale to pull inwards mipmaps + // that have arbitrary contents, eg. are used for fog effects where the + // distance they kick in at is important to preserve at any resolution. + state.lod_bias = + state.lod_bias + std::log2(static_cast<float>(g_ActiveConfig.iEFBScale)) * 256.f; + + // Anisotropic also pushes mips farther away so it cannot be used either + state.anisotropic_filtering = 0; + } + g_renderer->SetSamplerState(index, state); } @@ -323,7 +335,7 @@ void VertexManagerBase::Flush() if (tentry) { - SetSamplerState(i, tentry->is_custom_tex); + SetSamplerState(i, tentry->is_custom_tex, tentry->has_arbitrary_mips); PixelShaderManager::SetTexDims(i, tentry->native_width, tentry->native_height); } else |
