[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:
@@ -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(
|
||||
|
||||
@@ -30,7 +30,7 @@ struct Snapshot {
|
||||
SamplerDescriptor("Default Snapshot Sampler",
|
||||
MinMagFilter::kLinear,
|
||||
MinMagFilter::kLinear,
|
||||
MipFilter::kLinear);
|
||||
MipFilter::kNone);
|
||||
|
||||
Scalar opacity = 1.0f;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user