Eliminate SamplerCommon::AreBpTexMode0MipmapsEnabled
This was added in0b9a72a62d
but became irrelevant in70f9fc4e75
as the check is now self-explanatory due to a rejiggering of the bitfields.
This commit is contained in:
parent
d2041b4c2a
commit
3096f77ba0
|
@ -11,7 +11,6 @@
|
||||||
#include "Core/HW/Memmap.h"
|
#include "Core/HW/Memmap.h"
|
||||||
|
|
||||||
#include "VideoCommon/BPMemory.h"
|
#include "VideoCommon/BPMemory.h"
|
||||||
#include "VideoCommon/SamplerCommon.h"
|
|
||||||
#include "VideoCommon/TextureDecoder.h"
|
#include "VideoCommon/TextureDecoder.h"
|
||||||
|
|
||||||
#define ALLOW_MIPMAP 1
|
#define ALLOW_MIPMAP 1
|
||||||
|
@ -79,7 +78,7 @@ void Sample(s32 s, s32 t, s32 lod, bool linear, u8 texmap, u8* sample)
|
||||||
|
|
||||||
const s32 lodFract = lod & 0xf;
|
const s32 lodFract = lod & 0xf;
|
||||||
|
|
||||||
if (lod > 0 && SamplerCommon::AreBpTexMode0MipmapsEnabled(tm0))
|
if (lod > 0 && tm0.mipmap_filter != MipMode::None)
|
||||||
{
|
{
|
||||||
// use mipmap
|
// use mipmap
|
||||||
baseMip = lod >> 4;
|
baseMip = lod >> 4;
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include "VideoCommon/RenderState.h"
|
#include "VideoCommon/RenderState.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <array>
|
#include <array>
|
||||||
#include "VideoCommon/SamplerCommon.h"
|
|
||||||
#include "VideoCommon/TextureConfig.h"
|
#include "VideoCommon/TextureConfig.h"
|
||||||
|
|
||||||
void RasterizationState::Generate(const BPMemory& bp, PrimitiveType primitive_type)
|
void RasterizationState::Generate(const BPMemory& bp, PrimitiveType primitive_type)
|
||||||
|
@ -235,9 +236,9 @@ void SamplerState::Generate(const BPMemory& bp, u32 index)
|
||||||
mag_filter = tm0.mag_filter == FilterMode::Linear ? Filter::Linear : Filter::Point;
|
mag_filter = tm0.mag_filter == FilterMode::Linear ? Filter::Linear : Filter::Point;
|
||||||
|
|
||||||
// If mipmaps are disabled, clamp min/max lod
|
// If mipmaps are disabled, clamp min/max lod
|
||||||
max_lod = SamplerCommon::AreBpTexMode0MipmapsEnabled(tm0) ? tm1.max_lod.Value() : 0;
|
max_lod = tm0.mipmap_filter != MipMode::None ? tm1.max_lod.Value() : 0;
|
||||||
min_lod = std::min(max_lod.Value(), static_cast<u64>(tm1.min_lod));
|
min_lod = std::min(max_lod.Value(), static_cast<u64>(tm1.min_lod));
|
||||||
lod_bias = SamplerCommon::AreBpTexMode0MipmapsEnabled(tm0) ? tm0.lod_bias * (256 / 32) : 0;
|
lod_bias = tm0.mipmap_filter != MipMode::None ? tm0.lod_bias * (256 / 32) : 0;
|
||||||
|
|
||||||
// Address modes
|
// Address modes
|
||||||
// Hardware testing indicates that wrap_mode set to 3 behaves the same as clamp.
|
// Hardware testing indicates that wrap_mode set to 3 behaves the same as clamp.
|
||||||
|
|
|
@ -17,11 +17,4 @@ constexpr bool IsBpTexMode0PointFiltering(const T& tm0)
|
||||||
{
|
{
|
||||||
return tm0.min_filter == FilterMode::Near && tm0.mag_filter == FilterMode::Near;
|
return tm0.min_filter == FilterMode::Near && tm0.mag_filter == FilterMode::Near;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the minification filter has mipmap based filtering modes enabled.
|
|
||||||
template <class T>
|
|
||||||
constexpr bool AreBpTexMode0MipmapsEnabled(const T& tm0)
|
|
||||||
{
|
|
||||||
return tm0.mipmap_filter != MipMode::None;
|
|
||||||
}
|
|
||||||
} // namespace SamplerCommon
|
} // namespace SamplerCommon
|
||||||
|
|
|
@ -979,9 +979,8 @@ static void SetSamplerState(u32 index, float custom_tex_scale, bool custom_tex,
|
||||||
{
|
{
|
||||||
state.min_filter = SamplerState::Filter::Linear;
|
state.min_filter = SamplerState::Filter::Linear;
|
||||||
state.mag_filter = SamplerState::Filter::Linear;
|
state.mag_filter = SamplerState::Filter::Linear;
|
||||||
state.mipmap_filter = SamplerCommon::AreBpTexMode0MipmapsEnabled(tm0) ?
|
state.mipmap_filter = tm0.mipmap_filter != MipMode::None ? SamplerState::Filter::Linear :
|
||||||
SamplerState::Filter::Linear :
|
SamplerState::Filter::Point;
|
||||||
SamplerState::Filter::Point;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom textures may have a greater number of mips
|
// Custom textures may have a greater number of mips
|
||||||
|
@ -1000,7 +999,7 @@ static void SetSamplerState(u32 index, float custom_tex_scale, bool custom_tex,
|
||||||
// disabling anisotropy, or changing the anisotropic algorithm employed.
|
// disabling anisotropy, or changing the anisotropic algorithm employed.
|
||||||
state.min_filter = SamplerState::Filter::Linear;
|
state.min_filter = SamplerState::Filter::Linear;
|
||||||
state.mag_filter = SamplerState::Filter::Linear;
|
state.mag_filter = SamplerState::Filter::Linear;
|
||||||
if (SamplerCommon::AreBpTexMode0MipmapsEnabled(tm0))
|
if (tm0.mipmap_filter != MipMode::None)
|
||||||
state.mipmap_filter = SamplerState::Filter::Linear;
|
state.mipmap_filter = SamplerState::Filter::Linear;
|
||||||
state.anisotropic_filtering = 1;
|
state.anisotropic_filtering = 1;
|
||||||
}
|
}
|
||||||
|
@ -1009,7 +1008,7 @@ static void SetSamplerState(u32 index, float custom_tex_scale, bool custom_tex,
|
||||||
state.anisotropic_filtering = 0;
|
state.anisotropic_filtering = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (has_arbitrary_mips && SamplerCommon::AreBpTexMode0MipmapsEnabled(tm0))
|
if (has_arbitrary_mips && tm0.mipmap_filter != MipMode::None)
|
||||||
{
|
{
|
||||||
// Apply a secondary bias calculated from the IR scale to pull inwards mipmaps
|
// 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
|
// that have arbitrary contents, eg. are used for fog effects where the
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
#include "Common/Align.h"
|
#include "Common/Align.h"
|
||||||
#include "Core/HW/Memmap.h"
|
#include "Core/HW/Memmap.h"
|
||||||
#include "VideoCommon/BPMemory.h"
|
#include "VideoCommon/BPMemory.h"
|
||||||
#include "VideoCommon/SamplerCommon.h"
|
|
||||||
#include "VideoCommon/TextureDecoder.h"
|
#include "VideoCommon/TextureDecoder.h"
|
||||||
|
|
||||||
TextureInfo TextureInfo::FromStage(u32 stage)
|
TextureInfo TextureInfo::FromStage(u32 stage)
|
||||||
|
@ -28,7 +27,7 @@ TextureInfo TextureInfo::FromStage(u32 stage)
|
||||||
const u8* tlut_ptr = &texMem[tlutaddr];
|
const u8* tlut_ptr = &texMem[tlutaddr];
|
||||||
|
|
||||||
std::optional<u32> mip_count;
|
std::optional<u32> mip_count;
|
||||||
const bool has_mipmaps = SamplerCommon::AreBpTexMode0MipmapsEnabled(tex.texMode0);
|
const bool has_mipmaps = tex.texMode0.mipmap_filter != MipMode::None;
|
||||||
if (has_mipmaps)
|
if (has_mipmaps)
|
||||||
{
|
{
|
||||||
mip_count = (tex.texMode1.max_lod + 0xf) / 0x10;
|
mip_count = (tex.texMode1.max_lod + 0xf) / 0x10;
|
||||||
|
|
Loading…
Reference in New Issue