1414#include " impeller/entity/contents/solid_color_contents.h"
1515#include " impeller/entity/entity.h"
1616#include " impeller/geometry/path_builder.h"
17+ #include " impeller/renderer/formats.h"
1718#include " impeller/renderer/render_pass.h"
1819#include " impeller/renderer/sampler_library.h"
1920
@@ -107,8 +108,9 @@ static std::optional<Snapshot> AdvancedBlend(
107108
108109 typename FS::BlendInfo blend_info;
109110
110- auto sampler = renderer.GetContext ()->GetSamplerLibrary ()->GetSampler ({});
111- FS::BindTextureSamplerDst (cmd, dst_snapshot->texture , sampler);
111+ auto dst_sampler = renderer.GetContext ()->GetSamplerLibrary ()->GetSampler (
112+ dst_snapshot->sampler_descriptor );
113+ FS::BindTextureSamplerDst (cmd, dst_snapshot->texture , dst_sampler);
112114 blend_info.dst_y_coord_scale = dst_snapshot->texture ->GetYCoordScale ();
113115 blend_info.dst_input_alpha = absorb_opacity ? dst_snapshot->opacity : 1.0 ;
114116
@@ -118,10 +120,12 @@ static std::optional<Snapshot> AdvancedBlend(
118120 // This texture will not be sampled from due to the color factor. But
119121 // this is present so that validation doesn't trip on a missing
120122 // binding.
121- FS::BindTextureSamplerSrc (cmd, dst_snapshot->texture , sampler );
123+ FS::BindTextureSamplerSrc (cmd, dst_snapshot->texture , dst_sampler );
122124 } else {
125+ auto src_sampler = renderer.GetContext ()->GetSamplerLibrary ()->GetSampler (
126+ src_snapshot->sampler_descriptor );
123127 blend_info.color_factor = 0 ;
124- FS::BindTextureSamplerSrc (cmd, src_snapshot->texture , sampler );
128+ FS::BindTextureSamplerSrc (cmd, src_snapshot->texture , src_sampler );
125129 blend_info.src_y_coord_scale = src_snapshot->texture ->GetYCoordScale ();
126130 }
127131 auto blend_uniform = host_buffer.EmplaceUniform (blend_info);
@@ -145,7 +149,10 @@ static std::optional<Snapshot> AdvancedBlend(
145149
146150 return Snapshot{.texture = out_texture,
147151 .transform = Matrix::MakeTranslation (coverage.origin ),
148- .sampler_descriptor = dst_snapshot->sampler_descriptor ,
152+ // Since we absorbed the transform of the inputs and used the
153+ // respective snapshot sampling modes when blending, pass on
154+ // the default NN clamp sampler.
155+ .sampler_descriptor = {},
149156 .opacity = (absorb_opacity ? 1 .0f : dst_snapshot->opacity ) *
150157 alpha.value_or (1.0 )};
151158}
@@ -168,8 +175,6 @@ static std::optional<Snapshot> PipelineBlend(
168175 RenderPass& pass) {
169176 auto & host_buffer = pass.GetTransientsBuffer ();
170177
171- auto sampler = renderer.GetContext ()->GetSamplerLibrary ()->GetSampler ({});
172-
173178 Command cmd;
174179 cmd.label = " Pipeline Blend Filter" ;
175180 auto options = OptionsFromPass (pass);
@@ -183,6 +188,8 @@ static std::optional<Snapshot> PipelineBlend(
183188 return false ;
184189 }
185190
191+ auto sampler = renderer.GetContext ()->GetSamplerLibrary ()->GetSampler (
192+ input->sampler_descriptor );
186193 FS::BindTextureSamplerSrc (cmd, input->texture , sampler);
187194
188195 auto size = input->texture ->GetSize ();
@@ -262,13 +269,14 @@ static std::optional<Snapshot> PipelineBlend(
262269 }
263270 out_texture->SetLabel (" Pipeline Blend Filter Texture" );
264271
265- return Snapshot{
266- .texture = out_texture,
267- .transform = Matrix::MakeTranslation (coverage.origin ),
268- .sampler_descriptor =
269- inputs[0 ]->GetSnapshot (renderer, entity)->sampler_descriptor ,
270- .opacity = (absorb_opacity ? 1 .0f : dst_snapshot->opacity ) *
271- alpha.value_or (1.0 )};
272+ return Snapshot{.texture = out_texture,
273+ .transform = Matrix::MakeTranslation (coverage.origin ),
274+ // Since we absorbed the transform of the inputs and used the
275+ // respective snapshot sampling modes when blending, pass on
276+ // the default NN clamp sampler.
277+ .sampler_descriptor = {},
278+ .opacity = (absorb_opacity ? 1 .0f : dst_snapshot->opacity ) *
279+ alpha.value_or (1.0 )};
272280}
273281
274282#define BLEND_CASE (mode ) \
@@ -346,6 +354,7 @@ std::optional<Snapshot> BlendFilterContents::RenderFilter(
346354 foreground_color_, GetAbsorbOpacity (),
347355 GetAlpha ());
348356 }
357+
349358 FML_UNREACHABLE ();
350359}
351360
0 commit comments