From 0eacf547c0733f39e11515e7aedf300d0cd06e99 Mon Sep 17 00:00:00 2001 From: Wollnashorn Date: Mon, 12 Jun 2023 15:59:44 +0200 Subject: video_core: Option to apply anisotropic filtering for all mipmap modes --- src/video_core/textures/texture.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/video_core/textures/texture.cpp') diff --git a/src/video_core/textures/texture.cpp b/src/video_core/textures/texture.cpp index 4a80a59f9..12372a004 100644 --- a/src/video_core/textures/texture.cpp +++ b/src/video_core/textures/texture.cpp @@ -62,7 +62,8 @@ std::array TSCEntry::BorderColor() const noexcept { } float TSCEntry::MaxAnisotropy() const noexcept { - if (max_anisotropy == 0 && mipmap_filter != TextureMipmapFilter::Linear) { + if (max_anisotropy == 0 && (mipmap_filter != TextureMipmapFilter::Linear && + !Settings::values.use_aggressive_anisotropic_filtering)) { return 1.0f; } const auto anisotropic_settings = Settings::values.max_anisotropy.GetValue(); -- cgit v1.2.3 From b9bba3ac8941e4561ef150517cf44943a42b99e7 Mon Sep 17 00:00:00 2001 From: Wollnashorn Date: Tue, 13 Jun 2023 18:07:08 +0200 Subject: video_core: Disable anisotropic filtering for samplers with depth compare --- src/video_core/textures/texture.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/video_core/textures/texture.cpp') diff --git a/src/video_core/textures/texture.cpp b/src/video_core/textures/texture.cpp index 12372a004..083bfd8d3 100644 --- a/src/video_core/textures/texture.cpp +++ b/src/video_core/textures/texture.cpp @@ -62,8 +62,9 @@ std::array TSCEntry::BorderColor() const noexcept { } float TSCEntry::MaxAnisotropy() const noexcept { - if (max_anisotropy == 0 && (mipmap_filter != TextureMipmapFilter::Linear && - !Settings::values.use_aggressive_anisotropic_filtering)) { + if (max_anisotropy == 0 && (depth_compare_enabled.Value() || + (mipmap_filter != TextureMipmapFilter::Linear && + !Settings::values.use_aggressive_anisotropic_filtering))) { return 1.0f; } const auto anisotropic_settings = Settings::values.max_anisotropy.GetValue(); -- cgit v1.2.3 From 44f616edb97520e9bc82b9f9c0658a8a35806b89 Mon Sep 17 00:00:00 2001 From: Wollnashorn Date: Wed, 14 Jun 2023 03:57:39 +0200 Subject: video_core: Never apply AF to None mipmap mode Should fix some artifacts with the "apply anisotropic filtering for all mipmap modes" option --- src/video_core/textures/texture.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/video_core/textures/texture.cpp') diff --git a/src/video_core/textures/texture.cpp b/src/video_core/textures/texture.cpp index 083bfd8d3..b46dce096 100644 --- a/src/video_core/textures/texture.cpp +++ b/src/video_core/textures/texture.cpp @@ -62,9 +62,10 @@ std::array TSCEntry::BorderColor() const noexcept { } float TSCEntry::MaxAnisotropy() const noexcept { - if (max_anisotropy == 0 && (depth_compare_enabled.Value() || - (mipmap_filter != TextureMipmapFilter::Linear && - !Settings::values.use_aggressive_anisotropic_filtering))) { + const bool suitable_mipmap_filter = Settings::values.use_aggressive_anisotropic_filtering + ? mipmap_filter != TextureMipmapFilter::None + : mipmap_filter != TextureMipmapFilter::Linear; + if (max_anisotropy == 0 && (depth_compare_enabled.Value() || !suitable_mipmap_filter)) { return 1.0f; } const auto anisotropic_settings = Settings::values.max_anisotropy.GetValue(); -- cgit v1.2.3 From a9e4dddad582d61871076b4310f2c99009afe0db Mon Sep 17 00:00:00 2001 From: Wollnashorn Date: Wed, 14 Jun 2023 11:21:22 +0200 Subject: video_core: Fix default anisotropic heuristic --- src/video_core/textures/texture.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/video_core/textures/texture.cpp') diff --git a/src/video_core/textures/texture.cpp b/src/video_core/textures/texture.cpp index b46dce096..1daa2d488 100644 --- a/src/video_core/textures/texture.cpp +++ b/src/video_core/textures/texture.cpp @@ -62,10 +62,10 @@ std::array TSCEntry::BorderColor() const noexcept { } float TSCEntry::MaxAnisotropy() const noexcept { - const bool suitable_mipmap_filter = Settings::values.use_aggressive_anisotropic_filtering - ? mipmap_filter != TextureMipmapFilter::None - : mipmap_filter != TextureMipmapFilter::Linear; - if (max_anisotropy == 0 && (depth_compare_enabled.Value() || !suitable_mipmap_filter)) { + const bool unsupported_mipmap_filter = Settings::values.use_aggressive_anisotropic_filtering + ? mipmap_filter == TextureMipmapFilter::None + : mipmap_filter != TextureMipmapFilter::Linear; + if (max_anisotropy == 0 && (depth_compare_enabled.Value() || unsupported_mipmap_filter)) { return 1.0f; } const auto anisotropic_settings = Settings::values.max_anisotropy.GetValue(); -- cgit v1.2.3 From 0de6b9e3f56fb54e74f5ec1fdbecac31986a8054 Mon Sep 17 00:00:00 2001 From: Wollnashorn Date: Wed, 14 Jun 2023 13:27:27 +0200 Subject: video_core: Apply AF only to samplers with normal LOD range [0, 1+x] --- src/video_core/textures/texture.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/video_core/textures/texture.cpp') diff --git a/src/video_core/textures/texture.cpp b/src/video_core/textures/texture.cpp index 1daa2d488..560b3af8a 100644 --- a/src/video_core/textures/texture.cpp +++ b/src/video_core/textures/texture.cpp @@ -62,10 +62,12 @@ std::array TSCEntry::BorderColor() const noexcept { } float TSCEntry::MaxAnisotropy() const noexcept { - const bool unsupported_mipmap_filter = Settings::values.use_aggressive_anisotropic_filtering - ? mipmap_filter == TextureMipmapFilter::None - : mipmap_filter != TextureMipmapFilter::Linear; - if (max_anisotropy == 0 && (depth_compare_enabled.Value() || unsupported_mipmap_filter)) { + const bool is_unsupported_mipmap_filter = Settings::values.use_aggressive_anisotropic_filtering + ? mipmap_filter == TextureMipmapFilter::None + : mipmap_filter != TextureMipmapFilter::Linear; + const bool has_regular_lods = min_lod_clamp == 0 && max_lod_clamp >= 256; + if (max_anisotropy == 0 && + (depth_compare_enabled.Value() || !has_regular_lods || is_unsupported_mipmap_filter)) { return 1.0f; } const auto anisotropic_settings = Settings::values.max_anisotropy.GetValue(); -- cgit v1.2.3 From 42c944b250d8d5c8147b24b3a453cba29968d46c Mon Sep 17 00:00:00 2001 From: Wollnashorn Date: Thu, 15 Jun 2023 18:19:32 +0200 Subject: video_core: Add per-image anisotropy heuristics (format & mip count) --- src/video_core/textures/texture.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/video_core/textures/texture.cpp') diff --git a/src/video_core/textures/texture.cpp b/src/video_core/textures/texture.cpp index 560b3af8a..cb24d0399 100644 --- a/src/video_core/textures/texture.cpp +++ b/src/video_core/textures/texture.cpp @@ -62,12 +62,14 @@ std::array TSCEntry::BorderColor() const noexcept { } float TSCEntry::MaxAnisotropy() const noexcept { - const bool is_unsupported_mipmap_filter = Settings::values.use_aggressive_anisotropic_filtering - ? mipmap_filter == TextureMipmapFilter::None - : mipmap_filter != TextureMipmapFilter::Linear; + const bool is_suitable_mipmap_filter = Settings::values.use_aggressive_anisotropic_filtering + ? mipmap_filter != TextureMipmapFilter::None + : mipmap_filter == TextureMipmapFilter::Linear; const bool has_regular_lods = min_lod_clamp == 0 && max_lod_clamp >= 256; - if (max_anisotropy == 0 && - (depth_compare_enabled.Value() || !has_regular_lods || is_unsupported_mipmap_filter)) { + const bool is_bilinear_filter = min_filter == TextureFilter::Linear && + reduction_filter == SamplerReduction::WeightedAverage; + if (max_anisotropy == 0 && (depth_compare_enabled.Value() || !has_regular_lods || + !is_bilinear_filter || !is_suitable_mipmap_filter)) { return 1.0f; } const auto anisotropic_settings = Settings::values.max_anisotropy.GetValue(); -- cgit v1.2.3 From a3b7b5b22af8ef83fc765afac9d6f6b8dac7f62b Mon Sep 17 00:00:00 2001 From: Wollnashorn Date: Thu, 15 Jun 2023 23:16:26 +0200 Subject: video_core: Fallback to default anisotropy instead to 1x anisotropy --- src/video_core/textures/texture.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/video_core/textures/texture.cpp') diff --git a/src/video_core/textures/texture.cpp b/src/video_core/textures/texture.cpp index cb24d0399..63ebdfa82 100644 --- a/src/video_core/textures/texture.cpp +++ b/src/video_core/textures/texture.cpp @@ -68,8 +68,8 @@ float TSCEntry::MaxAnisotropy() const noexcept { const bool has_regular_lods = min_lod_clamp == 0 && max_lod_clamp >= 256; const bool is_bilinear_filter = min_filter == TextureFilter::Linear && reduction_filter == SamplerReduction::WeightedAverage; - if (max_anisotropy == 0 && (depth_compare_enabled.Value() || !has_regular_lods || - !is_bilinear_filter || !is_suitable_mipmap_filter)) { + if (max_anisotropy == 0 && (depth_compare_enabled || !has_regular_lods || !is_bilinear_filter || + !is_suitable_mipmap_filter)) { return 1.0f; } const auto anisotropic_settings = Settings::values.max_anisotropy.GetValue(); -- cgit v1.2.3 From c309a1c69b933bd196412cae854acb4837243806 Mon Sep 17 00:00:00 2001 From: Wollnashorn Date: Sat, 17 Jun 2023 11:19:39 +0200 Subject: video_core: Removed AF for all mip modes option as it's default now --- src/video_core/textures/texture.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/video_core/textures/texture.cpp') diff --git a/src/video_core/textures/texture.cpp b/src/video_core/textures/texture.cpp index 63ebdfa82..d8b88d9bc 100644 --- a/src/video_core/textures/texture.cpp +++ b/src/video_core/textures/texture.cpp @@ -62,14 +62,12 @@ std::array TSCEntry::BorderColor() const noexcept { } float TSCEntry::MaxAnisotropy() const noexcept { - const bool is_suitable_mipmap_filter = Settings::values.use_aggressive_anisotropic_filtering - ? mipmap_filter != TextureMipmapFilter::None - : mipmap_filter == TextureMipmapFilter::Linear; + const bool is_suitable_mipmap_filter = mipmap_filter != TextureMipmapFilter::None; const bool has_regular_lods = min_lod_clamp == 0 && max_lod_clamp >= 256; const bool is_bilinear_filter = min_filter == TextureFilter::Linear && reduction_filter == SamplerReduction::WeightedAverage; - if (max_anisotropy == 0 && (depth_compare_enabled || !has_regular_lods || !is_bilinear_filter || - !is_suitable_mipmap_filter)) { + if (max_anisotropy == 0 && (!is_suitable_mipmap_filter || !has_regular_lods || + !is_bilinear_filter || depth_compare_enabled)) { return 1.0f; } const auto anisotropic_settings = Settings::values.max_anisotropy.GetValue(); -- cgit v1.2.3