2016-03-23 20:23:56 -06:00
|
|
|
// Copyright 2016 Dolphin Emulator Project
|
2021-07-04 19:22:19 -06:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2016-03-23 20:23:56 -06:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2016-03-23 20:42:08 -06:00
|
|
|
namespace SamplerCommon
|
|
|
|
{
|
2016-03-23 20:23:56 -06:00
|
|
|
// Helper for checking if a BPMemory TexMode0 register is set to Point
|
|
|
|
// Filtering modes. This is used to decide whether Anisotropic enhancements
|
|
|
|
// are (mostly) safe in the VideoBackends.
|
|
|
|
// If both the minification and magnification filters are set to POINT modes
|
|
|
|
// then applying anisotropic filtering is equivalent to forced filtering. Point
|
|
|
|
// mode textures are usually some sort of 2D UI billboard which will end up
|
|
|
|
// misaligned from the correct pixels when filtered anisotropically.
|
|
|
|
template <class T>
|
|
|
|
constexpr bool IsBpTexMode0PointFiltering(const T& tm0)
|
|
|
|
{
|
2021-02-10 19:11:31 -07:00
|
|
|
return tm0.min_filter == FilterMode::Near && tm0.mag_filter == FilterMode::Near;
|
2016-03-23 20:23:56 -06:00
|
|
|
}
|
2016-03-23 20:42:08 -06:00
|
|
|
|
|
|
|
// Check if the minification filter has mipmap based filtering modes enabled.
|
|
|
|
template <class T>
|
|
|
|
constexpr bool AreBpTexMode0MipmapsEnabled(const T& tm0)
|
|
|
|
{
|
2021-02-10 19:11:31 -07:00
|
|
|
return tm0.mipmap_filter != MipMode::None;
|
2016-03-23 20:42:08 -06:00
|
|
|
}
|
2019-05-05 17:48:12 -06:00
|
|
|
} // namespace SamplerCommon
|