diff --git a/engine/src/flutter/impeller/entity/contents/filters/blend_filter_contents.cc b/engine/src/flutter/impeller/entity/contents/filters/blend_filter_contents.cc index 69968adfb2..efc2627b1c 100644 --- a/engine/src/flutter/impeller/entity/contents/filters/blend_filter_contents.cc +++ b/engine/src/flutter/impeller/entity/contents/filters/blend_filter_contents.cc @@ -192,9 +192,11 @@ static std::optional PipelineBlend( frame_info.mvp = Matrix::MakeOrthographic(pass.GetRenderTargetSize()) * Matrix::MakeTranslation(-coverage.origin) * input->transform; - - auto uniform_view = host_buffer.EmplaceUniform(frame_info); - VS::BindFrameInfo(cmd, uniform_view); + FS::FragInfo frag_info; + frag_info.texture_sampler_y_coord_scale = + input->texture->GetYCoordScale(); + FS::BindFragInfo(cmd, host_buffer.EmplaceUniform(frag_info)); + VS::BindFrameInfo(cmd, host_buffer.EmplaceUniform(frame_info)); pass.AddCommand(cmd); return true; diff --git a/engine/src/flutter/impeller/entity/contents/filters/border_mask_blur_filter_contents.cc b/engine/src/flutter/impeller/entity/contents/filters/border_mask_blur_filter_contents.cc index a7d578531d..6d6fdef5f1 100644 --- a/engine/src/flutter/impeller/entity/contents/filters/border_mask_blur_filter_contents.cc +++ b/engine/src/flutter/impeller/entity/contents/filters/border_mask_blur_filter_contents.cc @@ -108,8 +108,11 @@ std::optional BorderMaskBlurFilterContents::RenderFilter( frame_info.src_factor = src_color_factor_; frame_info.inner_blur_factor = inner_blur_factor_; frame_info.outer_blur_factor = outer_blur_factor_; - auto uniform_view = host_buffer.EmplaceUniform(frame_info); - VS::BindFrameInfo(cmd, uniform_view); + FS::FragInfo frag_info; + frag_info.texture_sampler_y_coord_scale = + input_snapshot->texture->GetYCoordScale(); + FS::BindFragInfo(cmd, host_buffer.EmplaceUniform(frag_info)); + VS::BindFrameInfo(cmd, host_buffer.EmplaceUniform(frame_info)); auto sampler = renderer.GetContext()->GetSamplerLibrary()->GetSampler({}); FS::BindTextureSampler(cmd, input_snapshot->texture, sampler); diff --git a/engine/src/flutter/impeller/entity/contents/filters/linear_to_srgb_filter_contents.cc b/engine/src/flutter/impeller/entity/contents/filters/linear_to_srgb_filter_contents.cc index 445ffa9e46..e117813212 100644 --- a/engine/src/flutter/impeller/entity/contents/filters/linear_to_srgb_filter_contents.cc +++ b/engine/src/flutter/impeller/entity/contents/filters/linear_to_srgb_filter_contents.cc @@ -61,9 +61,13 @@ std::optional LinearToSrgbFilterContents::RenderFilter( VS::FrameInfo frame_info; frame_info.mvp = Matrix::MakeOrthographic(ISize(1, 1)); + FS::FragInfo frag_info; + frag_info.texture_sampler_y_coord_scale = + input_snapshot->texture->GetYCoordScale(); + auto sampler = renderer.GetContext()->GetSamplerLibrary()->GetSampler({}); FS::BindInputTexture(cmd, input_snapshot->texture, sampler); - + FS::BindFragInfo(cmd, host_buffer.EmplaceUniform(frag_info)); VS::BindFrameInfo(cmd, host_buffer.EmplaceUniform(frame_info)); return pass.AddCommand(std::move(cmd)); diff --git a/engine/src/flutter/impeller/entity/contents/filters/srgb_to_linear_filter_contents.cc b/engine/src/flutter/impeller/entity/contents/filters/srgb_to_linear_filter_contents.cc index 6f5a7bc143..1d0ad22b57 100644 --- a/engine/src/flutter/impeller/entity/contents/filters/srgb_to_linear_filter_contents.cc +++ b/engine/src/flutter/impeller/entity/contents/filters/srgb_to_linear_filter_contents.cc @@ -61,9 +61,13 @@ std::optional SrgbToLinearFilterContents::RenderFilter( VS::FrameInfo frame_info; frame_info.mvp = Matrix::MakeOrthographic(ISize(1, 1)); + FS::FragInfo frag_info; + frag_info.texture_sampler_y_coord_scale = + input_snapshot->texture->GetYCoordScale(); + auto sampler = renderer.GetContext()->GetSamplerLibrary()->GetSampler({}); FS::BindInputTexture(cmd, input_snapshot->texture, sampler); - + FS::BindFragInfo(cmd, host_buffer.EmplaceUniform(frag_info)); VS::BindFrameInfo(cmd, host_buffer.EmplaceUniform(frame_info)); return pass.AddCommand(std::move(cmd)); diff --git a/engine/src/flutter/impeller/entity/shaders/blending/blend.frag b/engine/src/flutter/impeller/entity/shaders/blending/blend.frag index debce522d6..d5122145bb 100644 --- a/engine/src/flutter/impeller/entity/shaders/blending/blend.frag +++ b/engine/src/flutter/impeller/entity/shaders/blending/blend.frag @@ -2,12 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include + uniform sampler2D texture_sampler_src; +uniform FragInfo { + float texture_sampler_y_coord_scale; +} frag_info; + in vec2 v_texture_coords; out vec4 frag_color; void main() { - frag_color = texture(texture_sampler_src, v_texture_coords); + frag_color = IPSample(texture_sampler_src, v_texture_coords, + frag_info.texture_sampler_y_coord_scale); } diff --git a/engine/src/flutter/impeller/entity/shaders/border_mask_blur.frag b/engine/src/flutter/impeller/entity/shaders/border_mask_blur.frag index 4c018bf3ad..d35280f8df 100644 --- a/engine/src/flutter/impeller/entity/shaders/border_mask_blur.frag +++ b/engine/src/flutter/impeller/entity/shaders/border_mask_blur.frag @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include + // Constant time mask blur for image borders. // // This mask blur extends the geometry of the source image (with clamp border @@ -13,6 +15,10 @@ uniform sampler2D texture_sampler; +uniform FragInfo { + float texture_sampler_y_coord_scale; +} frag_info; + in vec2 v_texture_coords; in vec2 v_sigma_uv; in float v_src_factor; @@ -48,7 +54,8 @@ float BoxBlurMask(vec2 uv) { } void main() { - vec4 image_color = texture(texture_sampler, v_texture_coords); + vec4 image_color = IPSample(texture_sampler, v_texture_coords, + frag_info.texture_sampler_y_coord_scale); float blur_factor = BoxBlurMask(v_texture_coords); float within_bounds = diff --git a/engine/src/flutter/impeller/entity/shaders/linear_to_srgb_filter.frag b/engine/src/flutter/impeller/entity/shaders/linear_to_srgb_filter.frag index fea911c14f..562bb5e119 100644 --- a/engine/src/flutter/impeller/entity/shaders/linear_to_srgb_filter.frag +++ b/engine/src/flutter/impeller/entity/shaders/linear_to_srgb_filter.frag @@ -3,6 +3,7 @@ // found in the LICENSE file. #include +#include // A color filter that applies the sRGB gamma curve to the color. // @@ -10,11 +11,16 @@ uniform sampler2D input_texture; +uniform FragInfo { + float texture_sampler_y_coord_scale; +} frag_info; + in vec2 v_position; out vec4 frag_color; void main() { - vec4 input_color = texture(input_texture, v_position); + vec4 input_color = IPSample(input_texture, v_position, + frag_info.texture_sampler_y_coord_scale); for (int i = 0; i < 4; i++) { if (input_color[i] <= 0.0031308) { diff --git a/engine/src/flutter/impeller/entity/shaders/srgb_to_linear_filter.frag b/engine/src/flutter/impeller/entity/shaders/srgb_to_linear_filter.frag index 6c51b59a1d..e18bd18f3b 100644 --- a/engine/src/flutter/impeller/entity/shaders/srgb_to_linear_filter.frag +++ b/engine/src/flutter/impeller/entity/shaders/srgb_to_linear_filter.frag @@ -3,17 +3,23 @@ // found in the LICENSE file. #include +#include // Creates a color filter that applies the inverse of the sRGB gamma curve // to the RGB channels. uniform sampler2D input_texture; +uniform FragInfo { + float texture_sampler_y_coord_scale; +} frag_info; + in vec2 v_position; out vec4 frag_color; void main() { - vec4 input_color = texture(input_texture, v_position); + vec4 input_color = IPSample(input_texture, v_position, + frag_info.texture_sampler_y_coord_scale); for (int i = 0; i < 4; i++) { if (input_color[i] <= 0.04045) {