[Impeller] Don't mip filter TextureFilterInput snapshots when there's no mipmap (flutter/engine#40425)

[Impeller] Don't mip filter TextureFilterInput snapshots when there's no mipmap
This commit is contained in:
Brandon DeRosier
2023-03-18 11:26:33 -07:00
committed by GitHub
parent e2b5c56bff
commit cae5fd8ba6
2 changed files with 10 additions and 2 deletions

View File

@@ -6,6 +6,8 @@
#include <utility>
#include "impeller/renderer/formats.h"
namespace impeller {
TextureFilterInput::TextureFilterInput(std::shared_ptr<Texture> texture,
@@ -21,7 +23,13 @@ FilterInput::Variant TextureFilterInput::GetInput() const {
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(

View File

@@ -30,7 +30,7 @@ struct Snapshot {
SamplerDescriptor("Default Snapshot Sampler",
MinMagFilter::kLinear,
MinMagFilter::kLinear,
MipFilter::kLinear);
MipFilter::kNone);
Scalar opacity = 1.0f;