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

[Impeller] Ensure optimized out uniforms don't alter offsets #116900

Open
jonahwilliams opened this issue Dec 12, 2022 · 12 comments
Open

[Impeller] Ensure optimized out uniforms don't alter offsets #116900

jonahwilliams opened this issue Dec 12, 2022 · 12 comments
Labels
e: impeller Impeller rendering backend issues and features requests engine flutter/engine repository. See also e: labels. P2 Important issues not at the top of the work list team-engine Owned by Engine team triaged-engine Triaged by Engine team

Comments

@jonahwilliams
Copy link
Member

Basically if we optimize out a uniform, the existing mappings need to work even if we never set the value in runtime_effect.cc

@jonahwilliams jonahwilliams added engine flutter/engine repository. See also e: labels. P2 Important issues not at the top of the work list e: impeller Impeller rendering backend issues and features requests labels Dec 12, 2022
@jonahwilliams
Copy link
Member Author

From #116850

@jonahwilliams
Copy link
Member Author

Current exception:

(lldb) 2022-12-12 11:14:54.223965-0800 Runner[35304:1789208] [VERBOSE-2:FlutterDarwinContextMetalImpeller.mm(29)] Using the Impeller rendering backend.
flutter: 00:00 +0: mandelbrot
flutter: 00:00 +0: mandelbrot [E]
flutter:   RangeError (index): Index out of range: index should be less than 5: 5
flutter:   dart:typed_data-patch/typed_data_patch.dart 3469:7                 Float32List.[]=
  dart:ui/painting.dart 4326:12                                      FragmentShader.setFloat
  Users/jonahwilliams/Documents/Archive/test/shader_test.dart 37:12  MandelbrotPainter.paint

@jonahwilliams jonahwilliams self-assigned this Dec 12, 2022
@jonahwilliams
Copy link
Member Author

The runtime stage data for the MSL compiler drops the unused variable from the SPIRV ir declaration. The generated shader also skips the offset for the optimized out value. We'd need to update the metadata to retain the unused variable with some additional metadata that informs the runtime how to handle the mapping

@jonahwilliams
Copy link
Member Author

Need to check if this is handled after the re-mapping work

@chinmaygarde
Copy link
Member

Is this still necessary?

@jonahwilliams
Copy link
Member Author

yes

@chinmaygarde chinmaygarde changed the title [impellerc] ensure optimized out uniforms don't alter offsets [Impeller] Ensure optimized out uniforms don't alter offsets Apr 3, 2023
@renanyoy
Copy link

renanyoy commented Jun 14, 2023

would be nice if we could get an ordered list of uniform with their name and type, from a fragmentProgram at runtime.. so the final flutter code can handle all cases directly..

@flutter-triage-bot flutter-triage-bot bot added team-engine Owned by Engine team triaged-engine Triaged by Engine team labels Jul 8, 2023
@DrPaulT
Copy link

DrPaulT commented Aug 23, 2023

This has caught me out too, didn't appreciate that unused uniforms were being removed and subsequent offsets changing.

If there could be a better way to reference the uniform, maybe by name and with type safety, that would be very helpful.

@szmarczak
Copy link

Also encountering this bug :(

@joshliebe
Copy link

This is super annoying, please fix 🙏

@icecandy
Copy link

icecandy commented Feb 2, 2024

Same problem. Completely stuck. Testing on iPhone 12 Pro. iOS 16.3

@renanyoy
Copy link

renanyoy commented Feb 3, 2024

same waiting for a fix to continue my shader flutter project.. working on swift one during this time..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
e: impeller Impeller rendering backend issues and features requests engine flutter/engine repository. See also e: labels. P2 Important issues not at the top of the work list team-engine Owned by Engine team triaged-engine Triaged by Engine team
Projects
No open projects
Status: 🛠️ Internals
Development

No branches or pull requests

7 participants