Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

[Impeller] Fix GLES gaussian implementation. #55329

Merged
merged 5 commits into from
Sep 23, 2024

Conversation

jonahwilliams
Copy link
Member

@jonahwilliams jonahwilliams commented Sep 21, 2024

Fixes flutter/flutter#142355

problems: no uniform structs, no int uniforms, buffer bindings dont work when the struct type doesn't match the uniform name 😓

@jonahwilliams jonahwilliams marked this pull request as ready for review September 21, 2024 18:02
@flutter-dashboard
Copy link

Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change).

If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review.

Changes reported for pull request #55329 at sha e1bfaf1

Copy link
Member

@gaaclarke gaaclarke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good for the most part, nice work eliminating the copy. Here are the important notes:

  1. Keep the kernel size assert (to avoid obscure crashes)
  2. Add named getters for uv_offset and coefficient so that we don't trade off readability for performance.

@@ -481,11 +485,9 @@ fml::StatusOr<RenderTarget> MakeBlurSubpass(
linear_sampler_descriptor));
GaussianBlurVertexShader::BindFrameInfo(
pass, host_buffer.EmplaceUniform(frame_info));
GaussianBlurPipeline::FragmentShader::KernelSamples kernel_samples =
LerpHackKernelSamples(GenerateBlurInfo(blur_info));
FML_CHECK(kernel_samples.sample_count <= kGaussianBlurMaxKernelSize);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please bring back this check. It's important because we'll crash anyways if we violate this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is checked in the LerpHackFunction too, I don't think the count can change after that point?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay yea, in that case I'd rather keep this one here since it is the final point before we'd actually get the error. We can remove the lerp hack one.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But the kernel samples UBO has a std::array of a fixed size. It cannot be greater than kGaussianBlurMaxKernelSize

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could static assert this though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yea, the sample_count isn't even consequential here because emplace isn't looking at it. Lets keep the runtime DCHECK in the lerp hack and a static assert sounds good to me.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


result.sample_data[i].z = left.coefficient + right.coefficient;

auto uv = (left.uv_offset * left.coefficient +
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
auto uv = (left.uv_offset * left.coefficient +
Point uv = (left.uv_offset * left.coefficient +

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

EXPECT_FLOAT_EQ(fast_samples[2].coefficient, 0.3);
EXPECT_FLOAT_EQ(blur_info.sample_data[0].x, -1.3333333);
EXPECT_FLOAT_EQ(blur_info.sample_data[0].y, 0);
EXPECT_FLOAT_EQ(blur_info.sample_data[0].z, 0.3);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
EXPECT_FLOAT_EQ(blur_info.sample_data[0].z, 0.3);
EXPECT_FLOAT_EQ(GetCoefficient(blur_info.sample_data[0]), 0.3);

I think we would be better off not losing the names of values. It's very confusing to have to remember that .z means "get the coefficient". Can we codify that into some tiny functions?

Same thing for uv_offset.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -57,6 +57,7 @@ class BufferBindingsGLES {
std::vector<VertexAttribPointer> vertex_attrib_arrays_;

std::unordered_map<std::string, GLint> uniform_locations_;
std::vector<uint8_t> array_element_buffer_;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we adding this as an instance variable? I'd rather keep it localized to where it is used to avoid stale data bugs.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was trying to avoid creating the empty vector, since I can't safely conditionally initialize it. But that is probably not a worthwhile change

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

Copy link
Member

@gaaclarke gaaclarke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks

@flutter-dashboard
Copy link

Golden file changes are available for triage from new commit, Click here to view.

Changes reported for pull request #55329 at sha dd01c63

@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 23, 2024
@auto-submit auto-submit bot merged commit 22d3abd into flutter:main Sep 23, 2024
30 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 24, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Sep 24, 2024
…155583)

flutter/engine@95c5a09...8a5af19

2024-09-23 skia-flutter-autoroll@skia.org Roll Skia from 7174ab7a984d to 7b0669f89aef (1 revision) (flutter/engine#55371)
2024-09-23 jonahwilliams@google.com [Impeller] Fix GLES gaussian implementation. (flutter/engine#55329)
2024-09-23 30870216+gaaclarke@users.noreply.github.com Made YAML version of vscode workspace to avoid redundancy (flutter/engine#55322)
2024-09-23 skia-flutter-autoroll@skia.org Roll Skia from acb93a9f241f to 7174ab7a984d (6 revisions) (flutter/engine#55369)
2024-09-23 jonahwilliams@google.com [Impeller] add triangle fan support and remove drawVertices copying. (flutter/engine#55236)
2024-09-23 jason-simmons@users.noreply.github.com Copy Dart SDK vm_shared sources into the sky_engine package (flutter/engine#55158)
2024-09-23 jonahwilliams@google.com [Impeller] use BufferSubData to update gles device buffer. (flutter/engine#55330)
2024-09-23 jonahwilliams@google.com [Impeller] remove usage of VBB when allocating vertices of a fixed size. (flutter/engine#55235)
2024-09-23 6844906+zijiehe-google-com@users.noreply.github.com [fuchsia] Update fuchsia instruction in Compiling-the-engine.md (flutter/engine#55365)
2024-09-23 jonahwilliams@google.com [iOS] sprinkle some null checks on BringLayersIntoView. (flutter/engine#55334)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC chinmaygarde@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
thejitenpatel pushed a commit to thejitenpatel/flutter that referenced this pull request Sep 26, 2024
…lutter#155583)

flutter/engine@95c5a09...8a5af19

2024-09-23 skia-flutter-autoroll@skia.org Roll Skia from 7174ab7a984d to 7b0669f89aef (1 revision) (flutter/engine#55371)
2024-09-23 jonahwilliams@google.com [Impeller] Fix GLES gaussian implementation. (flutter/engine#55329)
2024-09-23 30870216+gaaclarke@users.noreply.github.com Made YAML version of vscode workspace to avoid redundancy (flutter/engine#55322)
2024-09-23 skia-flutter-autoroll@skia.org Roll Skia from acb93a9f241f to 7174ab7a984d (6 revisions) (flutter/engine#55369)
2024-09-23 jonahwilliams@google.com [Impeller] add triangle fan support and remove drawVertices copying. (flutter/engine#55236)
2024-09-23 jason-simmons@users.noreply.github.com Copy Dart SDK vm_shared sources into the sky_engine package (flutter/engine#55158)
2024-09-23 jonahwilliams@google.com [Impeller] use BufferSubData to update gles device buffer. (flutter/engine#55330)
2024-09-23 jonahwilliams@google.com [Impeller] remove usage of VBB when allocating vertices of a fixed size. (flutter/engine#55235)
2024-09-23 6844906+zijiehe-google-com@users.noreply.github.com [fuchsia] Update fuchsia instruction in Compiling-the-engine.md (flutter/engine#55365)
2024-09-23 jonahwilliams@google.com [iOS] sprinkle some null checks on BringLayersIntoView. (flutter/engine#55334)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC chinmaygarde@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
thejitenpatel pushed a commit to thejitenpatel/flutter that referenced this pull request Sep 26, 2024
…lutter#155583)

flutter/engine@95c5a09...8a5af19

2024-09-23 skia-flutter-autoroll@skia.org Roll Skia from 7174ab7a984d to 7b0669f89aef (1 revision) (flutter/engine#55371)
2024-09-23 jonahwilliams@google.com [Impeller] Fix GLES gaussian implementation. (flutter/engine#55329)
2024-09-23 30870216+gaaclarke@users.noreply.github.com Made YAML version of vscode workspace to avoid redundancy (flutter/engine#55322)
2024-09-23 skia-flutter-autoroll@skia.org Roll Skia from acb93a9f241f to 7174ab7a984d (6 revisions) (flutter/engine#55369)
2024-09-23 jonahwilliams@google.com [Impeller] add triangle fan support and remove drawVertices copying. (flutter/engine#55236)
2024-09-23 jason-simmons@users.noreply.github.com Copy Dart SDK vm_shared sources into the sky_engine package (flutter/engine#55158)
2024-09-23 jonahwilliams@google.com [Impeller] use BufferSubData to update gles device buffer. (flutter/engine#55330)
2024-09-23 jonahwilliams@google.com [Impeller] remove usage of VBB when allocating vertices of a fixed size. (flutter/engine#55235)
2024-09-23 6844906+zijiehe-google-com@users.noreply.github.com [fuchsia] Update fuchsia instruction in Compiling-the-engine.md (flutter/engine#55365)
2024-09-23 jonahwilliams@google.com [iOS] sprinkle some null checks on BringLayersIntoView. (flutter/engine#55334)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC chinmaygarde@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
thejitenpatel pushed a commit to thejitenpatel/flutter that referenced this pull request Sep 27, 2024
…lutter#155583)

flutter/engine@95c5a09...8a5af19

2024-09-23 skia-flutter-autoroll@skia.org Roll Skia from 7174ab7a984d to 7b0669f89aef (1 revision) (flutter/engine#55371)
2024-09-23 jonahwilliams@google.com [Impeller] Fix GLES gaussian implementation. (flutter/engine#55329)
2024-09-23 30870216+gaaclarke@users.noreply.github.com Made YAML version of vscode workspace to avoid redundancy (flutter/engine#55322)
2024-09-23 skia-flutter-autoroll@skia.org Roll Skia from acb93a9f241f to 7174ab7a984d (6 revisions) (flutter/engine#55369)
2024-09-23 jonahwilliams@google.com [Impeller] add triangle fan support and remove drawVertices copying. (flutter/engine#55236)
2024-09-23 jason-simmons@users.noreply.github.com Copy Dart SDK vm_shared sources into the sky_engine package (flutter/engine#55158)
2024-09-23 jonahwilliams@google.com [Impeller] use BufferSubData to update gles device buffer. (flutter/engine#55330)
2024-09-23 jonahwilliams@google.com [Impeller] remove usage of VBB when allocating vertices of a fixed size. (flutter/engine#55235)
2024-09-23 6844906+zijiehe-google-com@users.noreply.github.com [fuchsia] Update fuchsia instruction in Compiling-the-engine.md (flutter/engine#55365)
2024-09-23 jonahwilliams@google.com [iOS] sprinkle some null checks on BringLayersIntoView. (flutter/engine#55334)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC chinmaygarde@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
thejitenpatel pushed a commit to thejitenpatel/flutter that referenced this pull request Sep 27, 2024
…lutter#155583)

flutter/engine@95c5a09...8a5af19

2024-09-23 skia-flutter-autoroll@skia.org Roll Skia from 7174ab7a984d to 7b0669f89aef (1 revision) (flutter/engine#55371)
2024-09-23 jonahwilliams@google.com [Impeller] Fix GLES gaussian implementation. (flutter/engine#55329)
2024-09-23 30870216+gaaclarke@users.noreply.github.com Made YAML version of vscode workspace to avoid redundancy (flutter/engine#55322)
2024-09-23 skia-flutter-autoroll@skia.org Roll Skia from acb93a9f241f to 7174ab7a984d (6 revisions) (flutter/engine#55369)
2024-09-23 jonahwilliams@google.com [Impeller] add triangle fan support and remove drawVertices copying. (flutter/engine#55236)
2024-09-23 jason-simmons@users.noreply.github.com Copy Dart SDK vm_shared sources into the sky_engine package (flutter/engine#55158)
2024-09-23 jonahwilliams@google.com [Impeller] use BufferSubData to update gles device buffer. (flutter/engine#55330)
2024-09-23 jonahwilliams@google.com [Impeller] remove usage of VBB when allocating vertices of a fixed size. (flutter/engine#55235)
2024-09-23 6844906+zijiehe-google-com@users.noreply.github.com [fuchsia] Update fuchsia instruction in Compiling-the-engine.md (flutter/engine#55365)
2024-09-23 jonahwilliams@google.com [iOS] sprinkle some null checks on BringLayersIntoView. (flutter/engine#55334)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC chinmaygarde@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
autosubmit Merge PR when tree becomes green via auto submit App e: impeller will affect goldens
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Impeller] guassian blurs fail in opengl
2 participants