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/renderer_vulkan/pipeline_helper.h | 2 +- src/video_core/renderer_vulkan/vk_texture_cache.cpp | 6 ++++-- src/video_core/renderer_vulkan/vk_texture_cache.h | 8 ++++---- 3 files changed, 9 insertions(+), 7 deletions(-) (limited to 'src/video_core/renderer_vulkan') diff --git a/src/video_core/renderer_vulkan/pipeline_helper.h b/src/video_core/renderer_vulkan/pipeline_helper.h index 1632a6f26..0a9dce937 100644 --- a/src/video_core/renderer_vulkan/pipeline_helper.h +++ b/src/video_core/renderer_vulkan/pipeline_helper.h @@ -192,7 +192,7 @@ inline void PushImageDescriptors(TextureCache& texture_cache, const Sampler& sampler{**(samplers++)}; const bool use_fallback_sampler{sampler.HasAddedAnisotropy() && !image_view.SupportsAnisotropy()}; - const VkSampler vk_sampler{use_fallback_sampler ? sampler.HandleWithoutAnisotropy() + const VkSampler vk_sampler{use_fallback_sampler ? sampler.HandleWithDefaultAnisotropy() : sampler.Handle()}; guest_descriptor_queue.AddSampledImage(vk_image_view, vk_sampler); rescaling.PushTexture(texture_cache.IsRescaling(image_view)); diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp index 8ec181335..f025f618b 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp @@ -1827,8 +1827,10 @@ Sampler::Sampler(TextureCacheRuntime& runtime, const Tegra::Texture::TSCEntry& t }; sampler = create_sampler(max_anisotropy); - if (Settings::values.max_anisotropy.GetValue() > 0 && max_anisotropy > 1.0f) { - sampler_without_anisotropy = create_sampler(1.0f); + + const f32 max_anisotropy_default = static_cast(1U << tsc.max_anisotropy); + if (max_anisotropy > max_anisotropy_default) { + sampler_default_anisotropy = create_sampler(max_anisotropy_default); } } diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.h b/src/video_core/renderer_vulkan/vk_texture_cache.h index ee0d0480d..f14525dcb 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.h +++ b/src/video_core/renderer_vulkan/vk_texture_cache.h @@ -279,17 +279,17 @@ public: return *sampler; } - [[nodiscard]] VkSampler HandleWithoutAnisotropy() const noexcept { - return *sampler_without_anisotropy; + [[nodiscard]] VkSampler HandleWithDefaultAnisotropy() const noexcept { + return *sampler_default_anisotropy; } [[nodiscard]] bool HasAddedAnisotropy() const noexcept { - return static_cast(sampler_without_anisotropy); + return static_cast(sampler_default_anisotropy); } private: vk::Sampler sampler; - vk::Sampler sampler_without_anisotropy; + vk::Sampler sampler_default_anisotropy; }; class Framebuffer { -- cgit v1.2.3