From 6fd4e994429cb7532c776976480b5313fc6c215e Mon Sep 17 00:00:00 2001 From: Brandon DeRosier Date: Tue, 23 Aug 2022 11:08:27 -0700 Subject: [PATCH] [Impeller] Use linear sampling for reads in the texture atlas (flutter/engine#35618) --- .../impeller/entity/contents/text_contents.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/engine/src/flutter/impeller/entity/contents/text_contents.cc b/engine/src/flutter/impeller/entity/contents/text_contents.cc index 17b5f9948ac..c082aabb4a1 100644 --- a/engine/src/flutter/impeller/entity/contents/text_contents.cc +++ b/engine/src/flutter/impeller/entity/contents/text_contents.cc @@ -9,7 +9,9 @@ #include "impeller/entity/contents/content_context.h" #include "impeller/entity/entity.h" #include "impeller/geometry/path_builder.h" +#include "impeller/renderer/formats.h" #include "impeller/renderer/render_pass.h" +#include "impeller/renderer/sampler_descriptor.h" #include "impeller/renderer/sampler_library.h" #include "impeller/tessellator/tessellator.h" #include "impeller/typographer/glyph_atlas.h" @@ -93,11 +95,16 @@ bool TextContents::Render(const ContentContext& renderer, frame_info.text_color = ToVector(color_.Premultiply()); VS::BindFrameInfo(cmd, pass.GetTransientsBuffer().EmplaceUniform(frame_info)); + SamplerDescriptor sampler_desc; + sampler_desc.min_filter = MinMagFilter::kLinear; + sampler_desc.mag_filter = MinMagFilter::kLinear; + // Common fragment uniforms for all glyphs. FS::BindGlyphAtlasSampler( - cmd, // command - atlas->GetTexture(), // texture - renderer.GetContext()->GetSamplerLibrary()->GetSampler({}) // sampler + cmd, // command + atlas->GetTexture(), // texture + renderer.GetContext()->GetSamplerLibrary()->GetSampler( + sampler_desc) // sampler ); // Common vertex information for all glyphs.