Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next gen UI #1494

Merged
merged 51 commits into from Mar 27, 2023
Merged

Next gen UI #1494

merged 51 commits into from Mar 27, 2023

Conversation

domesticmouse
Copy link
Contributor

@domesticmouse domesticmouse commented Mar 21, 2023

First cut at steps. Some of these steps are massive, but I need help in figuring out sane sub-steps.

Pre-launch Checklist

  • I read the Effective Dart: Style recently, and have followed its advice.
  • I signed the CLA.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-devrel channel on Discord.

@domesticmouse domesticmouse marked this pull request as draft March 21, 2023 14:40
Copy link
Member

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

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

No ios directory?

next-gen-ui/step_01/assets/shaders/orb_shader.frag Outdated Show resolved Hide resolved
next-gen-ui/step_01/assets/shaders/orb_shader.frag Outdated Show resolved Hide resolved
next-gen-ui/step_01/assets/shaders/orb_shader.frag Outdated Show resolved Hide resolved
next-gen-ui/final/lib/common/shader_loader.dart Outdated Show resolved Hide resolved
next-gen-ui/final/lib/common/shader_painter.dart Outdated Show resolved Hide resolved
next-gen-ui/final/lib/common/ui_scaler.dart Outdated Show resolved Hide resolved
next-gen-ui/final/lib/orb_shader/orb_shader_widget.dart Outdated Show resolved Hide resolved
Copy link
Member

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

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

The shaders have unused uniforms which is causing runtime problems with impeller. I'd recommend cleaning those up

domesticmouse and others added 3 commits March 22, 2023 07:57
Co-authored-by: Jonah Williams <jonahwilliams@google.com>
Co-authored-by: Jonah Williams <jonahwilliams@google.com>
@jonahwilliams
Copy link
Member

This doesn't currently run on simulators because it has too many bindings.

@jonahwilliams
Copy link
Member

I can no longer find the right line of code to comment on, feel free to address after landing. To make this work on iOS simulators:

--- a/next-gen-ui/final/assets/shaders/orb_shader.frag
+++ b/next-gen-ui/final/assets/shaders/orb_shader.frag
@@ -13,11 +13,12 @@ precision highp float;
 #define RAY_STEPS 30
 
 uniform vec2 uResolution;
-uniform float uTime;
-uniform vec2 uMouse;
-uniform float uExposure;
-uniform float uFov;
-uniform float uRoughness;
+uniform vec4 uPackedData;
+float uTime = uPackedData[0];
+float uExposure = uPackedData[1];
+float uFov = uPackedData[2];
+float uRoughness = uPackedData[3];
+

@jonahwilliams
Copy link
Member

Replace the guts of the litimage with the following, essentially removing the color filter.

  @override
  Widget build(BuildContext context) {
    final hsl = HSLColor.fromColor(color);

    return Image.asset(imgSrc, color: hsl.withLightness(hsl.lightness * energy).toColor(), colorBlendMode: BlendMode.modulate);
  }

@jonahwilliams
Copy link
Member

Another issue: almost all of these images are too big when running on a iPhone 13:

Another exception was thrown: Image assets/images/fg-light-receive.png has a display size of 2080×1170 but a decode size of 3840×2160, which uses an additional 30525KB
(assuming a device pixel ratio of 3.0).
Another exception was thrown: Image assets/images/fg-light-emit.png has a display size of 2080×1170 but a decode size of 3840×2160, which uses an additional 30525KB
(assuming a device pixel ratio of 3.0).
Another exception was thrown: Image assets/images/bg-base.jpg has a display size of 2080×1170 but a decode size of 3840×2160, which uses an additional 30525KB (assuming a
device pixel ratio of 3.0).
Another exception was thrown: Image assets/images/bg-light-receive.png has a display size of 2080×1170 but a decode size of 3840×2160, which uses an additional 30525KB
(assuming a device pixel ratio of 3.0).
Another exception was thrown: Image assets/images/mg-base.png has a display size of 2080×1170 but a decode size of 3840×2160, which uses an additional 30525KB (assuming a
device pixel ratio of 3.0).
Another exception was thrown: Image assets/images/mg-light-receive.png has a display size of 2080×1170 but a decode size of 3840×2160, which uses an additional 30525KB
(assuming a device pixel ratio of 3.0).
Another exception was thrown: Image assets/images/mg-light-emit.png has a display size of 2080×1170 but a decode size of 3840×2160, which uses an additional 30525KB
(assuming a device pixel ratio of 3.0).
Another exception was thrown: Image assets/images/fg-base.png has a display size of 2080×1170 but a decode size of 3840×2160, which uses an additional 30525KB (assuming a
device pixel ratio of 3.0).

@jonahwilliams
Copy link
Member

like waaaay too big

@domesticmouse
Copy link
Contributor Author

like waaaay too big

Images will get shrunk to a width of 2080

@jonahwilliams
Copy link
Member

You could use the resize image API to do it at runtime, but I'd also recommend adding 1x 2x 3x variants if possible?

@domesticmouse
Copy link
Contributor Author

PTAL @jonahwilliams, I've added the Android and iOS runners, and turned on Impeller for iOS. It runs in the iPad simulator on my machine, with the modifications you suggested to the orb shader

@domesticmouse
Copy link
Contributor Author

PTAL @RedBrogdon @craiglabenz, I'd love an LGTM so I can land this =)

Copy link
Member

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

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

LGTM

@domesticmouse domesticmouse merged commit 20c83d0 into flutter:main Mar 27, 2023
8 checks passed
@domesticmouse domesticmouse deleted the next-gen-ui branch March 27, 2023 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants