[Impeller] Don't mip filter TextureFilterInput snapshots when there's no mipmap (#40425)
[Impeller] Don't mip filter TextureFilterInput snapshots when there's no mipmap
diff --git a/impeller/entity/contents/filters/inputs/texture_filter_input.cc b/impeller/entity/contents/filters/inputs/texture_filter_input.cc
index 09a393b..b64a78a 100644
--- a/impeller/entity/contents/filters/inputs/texture_filter_input.cc
+++ b/impeller/entity/contents/filters/inputs/texture_filter_input.cc
@@ -6,6 +6,8 @@
#include <utility>
+#include "impeller/renderer/formats.h"
+
namespace impeller {
TextureFilterInput::TextureFilterInput(std::shared_ptr<Texture> texture,
@@ -21,7 +23,13 @@
std::optional<Snapshot> TextureFilterInput::GetSnapshot(
const ContentContext& renderer,
const Entity& entity) const {
- return Snapshot{.texture = texture_, .transform = GetTransform(entity)};
+ auto snapshot =
+ Snapshot{.texture = texture_, .transform = GetTransform(entity)};
+ if (texture_->GetMipCount() > 1) {
+ snapshot.sampler_descriptor.label = "TextureFilterInput Trilinear Sampler";
+ snapshot.sampler_descriptor.mip_filter = MipFilter::kLinear;
+ }
+ return snapshot;
}
std::optional<Rect> TextureFilterInput::GetCoverage(
diff --git a/impeller/renderer/snapshot.h b/impeller/renderer/snapshot.h
index 41ad407..4820447 100644
--- a/impeller/renderer/snapshot.h
+++ b/impeller/renderer/snapshot.h
@@ -30,7 +30,7 @@
SamplerDescriptor("Default Snapshot Sampler",
MinMagFilter::kLinear,
MinMagFilter::kLinear,
- MipFilter::kLinear);
+ MipFilter::kNone);
Scalar opacity = 1.0f;