-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Add setImageSampler (for replacing setSampler) #37821
Conversation
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
I'm working on testing this against the example apps we have floating around. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm w/ nit.
lib/ui/painting.dart
Outdated
@@ -4314,13 +4314,27 @@ class FragmentShader extends Shader { | |||
_floats[index] = value; | |||
} | |||
|
|||
/// Sets the sampler uniform at [index] to [image]. | |||
/// | |||
/// The index provided to setSampler is the index of the sampler uniform defined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// The index provided to setSampler is the index of the sampler uniform defined | |
/// The index provided to setImageSampler is the index of the sampler uniform defined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
lib/ui/painting.dart
Outdated
/// Sets the sampler uniform at [index] to [sampler]. | ||
/// | ||
/// The index provided to setSampler is the index of the sampler uniform defined | ||
/// in the fragment program, excluding all non-sampler uniforms. | ||
/// | ||
/// All the sampler uniforms that a shader expects must be provided or the | ||
/// results will be undefined. | ||
/// | ||
/// Use of this method may result in poor performance with the Impeller backend. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would be careful about describing something as having poor performance with no refernce point. I've seen users go to extensive lengths to avoid invoking apis that have warnings like this, sometimes exceeding the original performance cost.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SGTM, removed this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Added implementation for canvaskit |
Smoke tested this on iOS and fixed an issue where the engine handle wasn't being passed in and it's working as expected now. Attempting to smoke test canvaskit. |
I wouldn't worry about canvaskit right now, the required Skia API isn't available in most engines and I'll probably disable shader compilation for the next stable |
Alrighty, I'll go ahead and merge after this CI run then. |
auto label is removed for flutter/engine, pr: 37821, due to - The status or check suite Mac Unopt has failed. Please fix the issues identified (or deflake) before re-applying this label. |
…115842) * eba7ecddc Add setImageSampler (for replacing setSampler) (flutter/engine#37821) * 15dce5e11 Roll Skia from 57b4252cf211 to 550fd51bd254 (3 revisions) (flutter/engine#37830) * 9b07044e7 Revert "[impeller] Remove declare_undefined_values (#37829)" (flutter/engine#37831) * 1a6180869 Roll Dart SDK from 6b8e98070f26 to 27c45cd51796 (1 revision) (flutter/engine#37833) * 8bc415423 Roll Skia from 550fd51bd254 to 94c63addc990 (1 revision) (flutter/engine#37834) * 7b4291548 Roll Skia from 94c63addc990 to 0dec6d1823b3 (4 revisions) (flutter/engine#37836) * a7fa7c6ec Roll Fuchsia Linux SDK from xBfEjlXUsix6Wka-i... to 5Xd8MJTM-pWPWCgUa... (flutter/engine#37840) * b6e33b527 Roll Fuchsia Mac SDK from oaqX39ssn3PUxE9it... to mwKdD1jX_KVP1U76z... (flutter/engine#37844) * 37e2aaa90 Roll Skia from 0dec6d1823b3 to 3b2d9e4bf668 (1 revision) (flutter/engine#37845)
…lutter#115842) * eba7ecddc Add setImageSampler (for replacing setSampler) (flutter/engine#37821) * 15dce5e11 Roll Skia from 57b4252cf211 to 550fd51bd254 (3 revisions) (flutter/engine#37830) * 9b07044e7 Revert "[impeller] Remove declare_undefined_values (flutter#37829)" (flutter/engine#37831) * 1a6180869 Roll Dart SDK from 6b8e98070f26 to 27c45cd51796 (1 revision) (flutter/engine#37833) * 8bc415423 Roll Skia from 550fd51bd254 to 94c63addc990 (1 revision) (flutter/engine#37834) * 7b4291548 Roll Skia from 94c63addc990 to 0dec6d1823b3 (4 revisions) (flutter/engine#37836) * a7fa7c6ec Roll Fuchsia Linux SDK from xBfEjlXUsix6Wka-i... to 5Xd8MJTM-pWPWCgUa... (flutter/engine#37840) * b6e33b527 Roll Fuchsia Mac SDK from oaqX39ssn3PUxE9it... to mwKdD1jX_KVP1U76z... (flutter/engine#37844) * 37e2aaa90 Roll Skia from 0dec6d1823b3 to 3b2d9e4bf668 (1 revision) (flutter/engine#37845)
…lutter#115842) * eba7ecddc Add setImageSampler (for replacing setSampler) (flutter/engine#37821) * 15dce5e11 Roll Skia from 57b4252cf211 to 550fd51bd254 (3 revisions) (flutter/engine#37830) * 9b07044e7 Revert "[impeller] Remove declare_undefined_values (flutter#37829)" (flutter/engine#37831) * 1a6180869 Roll Dart SDK from 6b8e98070f26 to 27c45cd51796 (1 revision) (flutter/engine#37833) * 8bc415423 Roll Skia from 550fd51bd254 to 94c63addc990 (1 revision) (flutter/engine#37834) * 7b4291548 Roll Skia from 94c63addc990 to 0dec6d1823b3 (4 revisions) (flutter/engine#37836) * a7fa7c6ec Roll Fuchsia Linux SDK from xBfEjlXUsix6Wka-i... to 5Xd8MJTM-pWPWCgUa... (flutter/engine#37840) * b6e33b527 Roll Fuchsia Mac SDK from oaqX39ssn3PUxE9it... to mwKdD1jX_KVP1U76z... (flutter/engine#37844) * 37e2aaa90 Roll Skia from 0dec6d1823b3 to 3b2d9e4bf668 (1 revision) (flutter/engine#37845)
setImageSampler
guarantees we don't need an additional texture/render pass per-sampler. It's possible for users to emulate the functionality ofsetSampler
in-shader.The intention is to do the following before the stable branch cut:
setSampler
tosetImageSampler
.setSampler
.I filed flutter/flutter#115794 along the way.