Update web ui fragment shader tests#181877
Conversation
There was a problem hiding this comment.
Code Review
This pull request fixes an issue with uniform offset calculation in fragment shaders for the web, where the uniform's integer location was used instead of its float offset. The fix introduces a floatOffset property to UniformData and correctly calculates it in ShaderData. This fix is applied to both CanvasKit and SkWasm backends.
Additionally, the PR significantly refactors and expands the fragment shader tests. It adds a comprehensive suite of tests for various uniform types (float, vec2, vec3, vec4, and arrays) and different ways of setting them. This improves test coverage and reliability for custom fragment shaders on the web.
The changes look good and the fix is correct. I have a couple of minor suggestions for the test file to improve clarity.
engine/src/flutter/lib/web_ui/test/ui/fragment_shader_test.dart
Outdated
Show resolved
Hide resolved
|
autosubmit label was removed for flutter/flutter/181877, because - The status or check suite Linux linux_web_engine_tests has failed. Please fix the issues identified (or deflake) before re-applying this label. |
Adds a bunch of tests for uniform setting functionality for custom fragment shaders on the web. Deletes redundant tests. Fixes a discovered issue in the uniform offset calculation. We were previously using the `location`, which is the integer offset of the uniform, not the offset in floats.
Adds a bunch of tests for uniform setting functionality for custom fragment shaders on the web. Deletes redundant tests. Fixes a discovered issue in the uniform offset calculation. We were previously using the `location`, which is the integer offset of the uniform, not the offset in floats.
Reland `Enabled some disabled impeller fragment shader dart tests` (flutter#180788) relands flutter#180759 changes since revert: 1) waits for async tests now 1) keeps 2 tests that don't pass on impeller disabled - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md Enables fragment shader test for impeller (fixes mat2 on vulkan) (flutter#181013) This rearranges the packing of mat2 fields in structs which was causing an existing fragment shader test to fail. The test still doesn't work on Metal, but this PR fixes it for Vulkan. I suspect the fix for metal may be similar but since the uniforms aren't in a virtual struct the code isn't hitting this fix. issue: flutter#180873 - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md Account for vec3 padding in Metal (flutter#181563) Re-landing of flutter#181340 incorporating flutter#181550. Vec3 uniforms on the metal backend are vec4-aligned. This PR accounts for that padding. --------- Co-authored-by: gaaclarke <30870216+gaaclarke@users.noreply.github.com> Fixes getUniformX for Vulkan (flutter#181286) Does what it says on the tin! This PR adds struct member information to the runtime flatbuffer format. This allows dart code to introspect structs at runtime. Also modifies the runtime_stage tests to verify formats for all supported uniform types. Bubbles up struct member information to dart, and uses that information to grab struct members in `getUniformX` related functions. This is necessary on Vulkan because all uniforms are packaged into a single struct. Also re-enables tests - [ ] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [ ] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [ ] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [ ] I signed the [CLA]. - [ ] I listed at least one issue that this PR fixes in the description above. - [ ] I updated/added relevant documentation (doc comments with `///`). - [ ] I added new tests to check the change I am making, or this PR is [test-exempt]. - [ ] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [ ] All existing and new tests are passing. Organize and update fragment shader uniform tests. (flutter#181822) Adds more comprehensive testing for setFloat and getUniform* on fragment shaders. Deletes redundant tests. Fixes getUniformVecX indexing errors. Update web ui fragment shader tests (flutter#181877) Adds a bunch of tests for uniform setting functionality for custom fragment shaders on the web. Deletes redundant tests. Fixes a discovered issue in the uniform offset calculation. We were previously using the `location`, which is the integer offset of the uniform, not the offset in floats.
Reland `Enabled some disabled impeller fragment shader dart tests` (flutter#180788) relands flutter#180759 changes since revert: 1) waits for async tests now 1) keeps 2 tests that don't pass on impeller disabled - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md Enables fragment shader test for impeller (fixes mat2 on vulkan) (flutter#181013) This rearranges the packing of mat2 fields in structs which was causing an existing fragment shader test to fail. The test still doesn't work on Metal, but this PR fixes it for Vulkan. I suspect the fix for metal may be similar but since the uniforms aren't in a virtual struct the code isn't hitting this fix. issue: flutter#180873 - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md Account for vec3 padding in Metal (flutter#181563) Re-landing of flutter#181340 incorporating flutter#181550. Vec3 uniforms on the metal backend are vec4-aligned. This PR accounts for that padding. --------- Co-authored-by: gaaclarke <30870216+gaaclarke@users.noreply.github.com> Fixes getUniformX for Vulkan (flutter#181286) Does what it says on the tin! This PR adds struct member information to the runtime flatbuffer format. This allows dart code to introspect structs at runtime. Also modifies the runtime_stage tests to verify formats for all supported uniform types. Bubbles up struct member information to dart, and uses that information to grab struct members in `getUniformX` related functions. This is necessary on Vulkan because all uniforms are packaged into a single struct. Also re-enables tests - [ ] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [ ] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [ ] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [ ] I signed the [CLA]. - [ ] I listed at least one issue that this PR fixes in the description above. - [ ] I updated/added relevant documentation (doc comments with `///`). - [ ] I added new tests to check the change I am making, or this PR is [test-exempt]. - [ ] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [ ] All existing and new tests are passing. Organize and update fragment shader uniform tests. (flutter#181822) Adds more comprehensive testing for setFloat and getUniform* on fragment shaders. Deletes redundant tests. Fixes getUniformVecX indexing errors. Update web ui fragment shader tests (flutter#181877) Adds a bunch of tests for uniform setting functionality for custom fragment shaders on the web. Deletes redundant tests. Fixes a discovered issue in the uniform offset calculation. We were previously using the `location`, which is the integer offset of the uniform, not the offset in floats.
Adds a bunch of tests for uniform setting functionality for custom fragment shaders on the web. Deletes redundant tests. Fixes a discovered issue in the uniform offset calculation. We were previously using the `location`, which is the integer offset of the uniform, not the offset in floats.
Adds a bunch of tests for uniform setting functionality for custom fragment shaders on the web.
Deletes redundant tests.
Fixes a discovered issue in the uniform offset calculation. We were previously using the
location, which is the integer offset of the uniform, not the offset in floats.