add sdf golden variants for OpenGL#187246
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces the kOpenGLESSDF and kVulkanSDF playground backends to Impeller, enabling SDF-based rendering tests for OpenGLES and Vulkan. The changes update backend string conversions, support checks, playground creation logic, and unit tests to handle these new backends. The reviewer suggests simplifying the playground creation logic in playground_impl.cc by grouping the SDF and non-SDF cases for both OpenGLES and Vulkan using [[fallthrough]] to avoid code duplication.
| case PlaygroundBackend::kVulkanSDF: | ||
| if (!PlaygroundImplVK::IsVulkanDriverPresent()) { | ||
| FML_CHECK(false) << "Attempted to create playground with backend that " | ||
| "isn't available or was disabled on this platform: " | ||
| << PlaygroundBackendToString(backend); | ||
| } | ||
| switches.flags.use_sdfs = true; | ||
| switches.enable_vulkan_validation = true; | ||
| return std::make_unique<PlaygroundImplVK>(switches); |
There was a problem hiding this comment.
Similarly to the OpenGL case, we can avoid duplicating the driver check, validation flag setup, and PlaygroundImplVK creation by placing case PlaygroundBackend::kVulkanSDF: before case PlaygroundBackend::kVulkan: and using [[fallthrough]].
Since case PlaygroundBackend::kVulkan: is outside the current diff hunk, a direct code suggestion cannot be applied here, but please consider manually refactoring it like so:
case PlaygroundBackend::kVulkanSDF:
switches.flags.use_sdfs = true;
[[fallthrough]];
case PlaygroundBackend::kVulkan:
if (!PlaygroundImplVK::IsVulkanDriverPresent()) {
FML_CHECK(false) << "Attempted to create playground with backend that "
"isn't available or was disabled on this platform: "
<< PlaygroundBackendToString(backend);
}
switches.enable_vulkan_validation = true;
return std::make_unique<PlaygroundImplVK>(switches);References
- Suggest simplification and refactoring: Assess whether the code can be made simpler or refactored to enhance readability and maintainability. (link)
gaaclarke
left a comment
There was a problem hiding this comment.
okay, let's give this a shot
|
autosubmit label was removed for flutter/flutter/187246, because - The status or check suite Flutter Presubmits has failed. Please fix the issues identified (or deflake) before re-applying this label. |
flutter/flutter@b05a9d7...54e199a 2026-06-01 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from jMR_VXQi07kAk8vbR... to q27k7_um1GvVrySZS... (flutter/flutter#187338) 2026-06-01 rmacnak@google.com Remove use of deprecated API related to removal of the VM isolate. (flutter/flutter#187013) 2026-06-01 116356835+AbdeMohlbi@users.noreply.github.com Improve `dependOnInheritedWidgetOfExactType` documentation to explain why it is bad to use it in initState (flutter/flutter#186216) 2026-06-01 chris@bracken.jp Revert "Move dart-lang/ai to a top level third party dependency in en… (flutter/flutter#187370) 2026-05-30 jakemac@google.com Move dart-lang/ai to a top level third party dependency in engine (flutter/flutter#187268) 2026-05-30 evanwall@buffalo.edu add sdf golden variants for OpenGL (flutter/flutter#187246) 2026-05-30 engine-flutter-autoroll@skia.org Roll Skia from dc01525ac468 to 0aee4675e0ad (6 revisions) (flutter/flutter#187334) 2026-05-29 engine-flutter-autoroll@skia.org Roll Skia from c480ba2eb2eb to dc01525ac468 (4 revisions) (flutter/flutter#187317) 2026-05-29 jason-simmons@users.noreply.github.com Remove the Y coordinate flip workaround in the Material stretch effect shader now that it is no longer required by the Impeller GLES back end (flutter/flutter#187247) 2026-05-29 bkonyi@google.com [flutter_tools, devicelab] Fix filesystem safety guard for symlinked temp directories (flutter/flutter#187320) 2026-05-29 30870216+gaaclarke@users.noreply.github.com Brings linux tests out of bringup. (flutter/flutter#187271) 2026-05-29 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#187321) 2026-05-29 engine-flutter-autoroll@skia.org Roll Fuchsia GN SDK from SEfYx3xgueX3aFAY3... to oOAcFhkoE2_-Sy67z... (flutter/flutter#187310) 2026-05-29 36861262+QuncCccccc@users.noreply.github.com Fix mismatch between hit-test tree and traversal tree (flutter/flutter#186826) 2026-05-29 jason-simmons@users.noreply.github.com [Impeller] Ensure that the TextureGLES destructor cleans up all objects that it holds including the sync fence (flutter/flutter#187216) 2026-05-29 engine-flutter-autoroll@skia.org Roll Packages from 10cbdc5 to e930ced (3 revisions) (flutter/flutter#187306) 2026-05-29 engine-flutter-autoroll@skia.org Roll Skia from d9d6b440c4e7 to c480ba2eb2eb (1 revision) (flutter/flutter#187305) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC stuartmorgan@google.com,tarrinneal@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Packages: 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
flutter#187246 added a kOpenGLESSDF variant to PlaygroundBackend after this PR's CI had last run. CanRenderToMipLevel only skipped kOpenGLES, so it ran on kOpenGLESSDF and aborted because the GLES test backend does not support rendering into non-zero mip levels. Match the skip pattern that every other GLES-skipping test in this file already uses.
…ices (flutter#187470) Relands flutter#187066, reverted in flutter#187445. The original PR passed every pre-submit check and merged cleanly, but broke post-submit on Mac and Linux because a concurrent change (flutter#187246, `b4e5291940c` "add sdf golden variants for OpenGL") added a `kOpenGLESSDF` variant to `PlaygroundBackend` that was not present when this PR's CI last ran. `CanRenderToMipLevel` only skipped `kOpenGLES`, so on the post-submit master it ran on `kOpenGLESSDF` and aborted with SIGABRT because the GLES test backend does not support rendering into non-zero mip levels. This reland is identical to flutter#187066 plus the missing `kOpenGLESSDF` skip in `CanRenderToMipLevel`, matching the skip pattern that every other GLES-skipping test in `renderer_unittests.cc` already uses after flutter#187246. Failing test seen post-submit (Mac mac_unopt build 12910, Linux linux_unopt build 18302): `Play/RendererTest.CanRenderToMipLevel/OpenGLESSDF` returned/aborted with exit code -6. --- Fixes flutter#145014 (the attachment half; uploading specific mip levels and slices already landed). Impeller could only attach the base mip level and slice of a texture as a render target. This adds `mip_level` and `slice` to the HAL `Attachment` struct so a render pass can target a specific mip level, cube map face, or array layer. The render target size follows the selected mip level. - Metal: sets the attachment descriptor's level and slice. - Vulkan: creates one 2D attachment view per mip level and layer, and the framebuffer cache is keyed on `(sample_count, mip_level, slice)` so non-base subresources reuse cached framebuffers. - OpenGL ES: attaches the cube face target and mip level, allocates the subresource on demand, and gates non-zero mip levels on ES 3.0 or `GL_OES_fbo_render_mipmap`. Rendering to cube faces works down to ES 2.0. Tests cover attachment validation and cross-backend rendering to a slice and to a mip level. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools. - [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. - [ ] All existing and new tests are passing. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [AI contribution guidelines]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines [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/ [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
Adds SDF variants for OpenGL golden tests
Pre-launch Checklist
///).