diff options
| author | 2023-06-15 23:16:26 +0200 | |
|---|---|---|
| committer | 2023-06-15 23:16:26 +0200 | |
| commit | a3b7b5b22af8ef83fc765afac9d6f6b8dac7f62b (patch) | |
| tree | 0b3bea548cb1282d45a53365faea13e4321a69f8 /src | |
| parent | video_core: Disable AF for non-color image formats (diff) | |
| download | yuzu-a3b7b5b22af8ef83fc765afac9d6f6b8dac7f62b.tar.gz yuzu-a3b7b5b22af8ef83fc765afac9d6f6b8dac7f62b.tar.xz yuzu-a3b7b5b22af8ef83fc765afac9d6f6b8dac7f62b.zip | |
video_core: Fallback to default anisotropy instead to 1x anisotropy
Diffstat (limited to 'src')
7 files changed, 20 insertions, 16 deletions
diff --git a/src/video_core/renderer_opengl/gl_graphics_pipeline.cpp b/src/video_core/renderer_opengl/gl_graphics_pipeline.cpp index 0fa0fc594..58e4e1919 100644 --- a/src/video_core/renderer_opengl/gl_graphics_pipeline.cpp +++ b/src/video_core/renderer_opengl/gl_graphics_pipeline.cpp | |||
| @@ -488,7 +488,7 @@ void GraphicsPipeline::ConfigureImpl(bool is_indexed) { | |||
| 488 | const bool use_fallback_sampler{sampler.HasAddedAnisotropy() && | 488 | const bool use_fallback_sampler{sampler.HasAddedAnisotropy() && |
| 489 | !image_view.SupportsAnisotropy()}; | 489 | !image_view.SupportsAnisotropy()}; |
| 490 | gl_samplers[sampler_binding++] = | 490 | gl_samplers[sampler_binding++] = |
| 491 | use_fallback_sampler ? sampler.HandleWithoutAnisotropy() : sampler.Handle(); | 491 | use_fallback_sampler ? sampler.HandleWithDefaultAnisotropy() : sampler.Handle(); |
| 492 | } | 492 | } |
| 493 | } | 493 | } |
| 494 | for (const auto& desc : info.image_descriptors) { | 494 | for (const auto& desc : info.image_descriptors) { |
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp index 7ff54003f..3b446be07 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.cpp +++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp | |||
| @@ -1306,8 +1306,10 @@ Sampler::Sampler(TextureCacheRuntime& runtime, const TSCEntry& config) { | |||
| 1306 | }; | 1306 | }; |
| 1307 | 1307 | ||
| 1308 | sampler = create_sampler(max_anisotropy); | 1308 | sampler = create_sampler(max_anisotropy); |
| 1309 | if (Settings::values.max_anisotropy.GetValue() > 0 && max_anisotropy > 1.0f) { | 1309 | |
| 1310 | sampler_without_anisotropy = create_sampler(1.0f); | 1310 | const f32 max_anisotropy_default = static_cast<f32>(1U << config.max_anisotropy); |
| 1311 | if (max_anisotropy > max_anisotropy_default) { | ||
| 1312 | sampler_default_anisotropy = create_sampler(max_anisotropy_default); | ||
| 1311 | } | 1313 | } |
| 1312 | } | 1314 | } |
| 1313 | 1315 | ||
diff --git a/src/video_core/renderer_opengl/gl_texture_cache.h b/src/video_core/renderer_opengl/gl_texture_cache.h index 82756fca7..3676eaaa9 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.h +++ b/src/video_core/renderer_opengl/gl_texture_cache.h | |||
| @@ -313,17 +313,17 @@ public: | |||
| 313 | return sampler.handle; | 313 | return sampler.handle; |
| 314 | } | 314 | } |
| 315 | 315 | ||
| 316 | [[nodiscard]] GLuint HandleWithoutAnisotropy() const noexcept { | 316 | [[nodiscard]] GLuint HandleWithDefaultAnisotropy() const noexcept { |
| 317 | return sampler_without_anisotropy.handle; | 317 | return sampler_default_anisotropy.handle; |
| 318 | } | 318 | } |
| 319 | 319 | ||
| 320 | [[nodiscard]] bool HasAddedAnisotropy() const noexcept { | 320 | [[nodiscard]] bool HasAddedAnisotropy() const noexcept { |
| 321 | return static_cast<bool>(sampler_without_anisotropy.handle); | 321 | return static_cast<bool>(sampler_default_anisotropy.handle); |
| 322 | } | 322 | } |
| 323 | 323 | ||
| 324 | private: | 324 | private: |
| 325 | OGLSampler sampler; | 325 | OGLSampler sampler; |
| 326 | OGLSampler sampler_without_anisotropy; | 326 | OGLSampler sampler_default_anisotropy; |
| 327 | }; | 327 | }; |
| 328 | 328 | ||
| 329 | class Framebuffer { | 329 | class Framebuffer { |
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, | |||
| 192 | const Sampler& sampler{**(samplers++)}; | 192 | const Sampler& sampler{**(samplers++)}; |
| 193 | const bool use_fallback_sampler{sampler.HasAddedAnisotropy() && | 193 | const bool use_fallback_sampler{sampler.HasAddedAnisotropy() && |
| 194 | !image_view.SupportsAnisotropy()}; | 194 | !image_view.SupportsAnisotropy()}; |
| 195 | const VkSampler vk_sampler{use_fallback_sampler ? sampler.HandleWithoutAnisotropy() | 195 | const VkSampler vk_sampler{use_fallback_sampler ? sampler.HandleWithDefaultAnisotropy() |
| 196 | : sampler.Handle()}; | 196 | : sampler.Handle()}; |
| 197 | guest_descriptor_queue.AddSampledImage(vk_image_view, vk_sampler); | 197 | guest_descriptor_queue.AddSampledImage(vk_image_view, vk_sampler); |
| 198 | rescaling.PushTexture(texture_cache.IsRescaling(image_view)); | 198 | 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 | |||
| 1827 | }; | 1827 | }; |
| 1828 | 1828 | ||
| 1829 | sampler = create_sampler(max_anisotropy); | 1829 | sampler = create_sampler(max_anisotropy); |
| 1830 | if (Settings::values.max_anisotropy.GetValue() > 0 && max_anisotropy > 1.0f) { | 1830 | |
| 1831 | sampler_without_anisotropy = create_sampler(1.0f); | 1831 | const f32 max_anisotropy_default = static_cast<f32>(1U << tsc.max_anisotropy); |
| 1832 | if (max_anisotropy > max_anisotropy_default) { | ||
| 1833 | sampler_default_anisotropy = create_sampler(max_anisotropy_default); | ||
| 1832 | } | 1834 | } |
| 1833 | } | 1835 | } |
| 1834 | 1836 | ||
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: | |||
| 279 | return *sampler; | 279 | return *sampler; |
| 280 | } | 280 | } |
| 281 | 281 | ||
| 282 | [[nodiscard]] VkSampler HandleWithoutAnisotropy() const noexcept { | 282 | [[nodiscard]] VkSampler HandleWithDefaultAnisotropy() const noexcept { |
| 283 | return *sampler_without_anisotropy; | 283 | return *sampler_default_anisotropy; |
| 284 | } | 284 | } |
| 285 | 285 | ||
| 286 | [[nodiscard]] bool HasAddedAnisotropy() const noexcept { | 286 | [[nodiscard]] bool HasAddedAnisotropy() const noexcept { |
| 287 | return static_cast<bool>(sampler_without_anisotropy); | 287 | return static_cast<bool>(sampler_default_anisotropy); |
| 288 | } | 288 | } |
| 289 | 289 | ||
| 290 | private: | 290 | private: |
| 291 | vk::Sampler sampler; | 291 | vk::Sampler sampler; |
| 292 | vk::Sampler sampler_without_anisotropy; | 292 | vk::Sampler sampler_default_anisotropy; |
| 293 | }; | 293 | }; |
| 294 | 294 | ||
| 295 | class Framebuffer { | 295 | class Framebuffer { |
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 { | |||
| 68 | const bool has_regular_lods = min_lod_clamp == 0 && max_lod_clamp >= 256; | 68 | const bool has_regular_lods = min_lod_clamp == 0 && max_lod_clamp >= 256; |
| 69 | const bool is_bilinear_filter = min_filter == TextureFilter::Linear && | 69 | const bool is_bilinear_filter = min_filter == TextureFilter::Linear && |
| 70 | reduction_filter == SamplerReduction::WeightedAverage; | 70 | reduction_filter == SamplerReduction::WeightedAverage; |
| 71 | if (max_anisotropy == 0 && (depth_compare_enabled.Value() || !has_regular_lods || | 71 | if (max_anisotropy == 0 && (depth_compare_enabled || !has_regular_lods || !is_bilinear_filter || |
| 72 | !is_bilinear_filter || !is_suitable_mipmap_filter)) { | 72 | !is_suitable_mipmap_filter)) { |
| 73 | return 1.0f; | 73 | return 1.0f; |
| 74 | } | 74 | } |
| 75 | const auto anisotropic_settings = Settings::values.max_anisotropy.GetValue(); | 75 | const auto anisotropic_settings = Settings::values.max_anisotropy.GetValue(); |