-
-
Notifications
You must be signed in to change notification settings - Fork 3.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
Fix WebGL mode for Adreno GPUs #8508
Conversation
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 can't verify this myself, but the comments are good and the fix is reasonable.
//NOTE: When running bevy on Adreno GPU chipsets in WebGL, any value above 1 will result in a crash | ||
// when loading the wgsl "pbr_functions.wgsl" in the function apply_fog. | ||
#[cfg(feature = "webgl")] | ||
pub const MAX_DIRECTIONAL_LIGHTS: usize = 1; |
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.
Hmm, is this the case for all WebGL2? Or just with some Adreno GPU drivers?
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.
Its actually only the case for Adreno GPU drivers, but I am not sure how to address that.
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 don't think it's possible if we're using a const here, since you have to query the gpu driver at runtime.
edit: Also, is this for all Adreno GPUs, or only certain ones? Do you know if it's an issue on just Android, or does it also impact Linux?
edit2: I should've read the linked issues first...
so the question is, do we want to reduce functionality for all webgl2 app for a few android devices? |
If we make this not a const, it's possible to detect the driver at runtime using https://github.com/gfx-rs/wgpu/blob/2571af9557eeba59f00f69649ae6bcd9d5a62392/wgpu-types/src/lib.rs#L1303 |
Yeah, I agree, its not the ideal solution. And getting a feature to start tweaking rendering paths depending on which adaptor is detected, will probably be the best solution. But then again, this is at least a third of all android devices (Adreno marketshare is approx 33% from what I can tell), not really only a few. And we are talking about a hard crash on approx 1/3 of android devices, that was not there before 10.0 vs having 9 extra directional lights available for webgl targets. I still think that speaks in favor of this. Even if not ideal. And it will not crash WebGL targets that use more directional lights. |
In addition to this, I also do not think that more directional lights works as intended on WebGL regardless, from what I can tell, shadows does not seem to work at least on my computer. |
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.
If we make this not a const, it's possible to detect the driver at runtime using https://github.com/gfx-rs/wgpu/blob/2571af9557eeba59f00f69649ae6bcd9d5a62392/wgpu-types/src/lib.rs#L1303
I briefly poked around with this. Making it non-const is non-trivial and will require a bit of elbow grease.
I do think thats the best long-term strategy though. We should investigate it. I created #8992 to track that.
I just resolved merge conflicts.
Co-authored-by: François <[email protected]>
Objective
Solution