-
-
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
Mobile WASM not able to load bevy - Dimension X Value Exceeds Limit #7038
Comments
I can get the examples working on my GraphenOS (Android 13) Pixel 6a on Vanadium 108.0 (a Chromium fork of same version) The button shows up, but tapping it seems to result in inconsistent behavior.
|
Is it only something you see on UI examples? They are using some custom settings to only be active when there is user input, meaning you would need to be active in the canvas for them to load. I tried on an android device, it's harder and took longer on Chrome than in Firefox |
Ooh. So the button in the button example on Android only shows up after I tapped once on the screen (though the background has the default bevy bg, rather than dark-blue as on the screenshot). Edit: In the |
Tried multiple devices and it works. This is very odd, I'm only able to reproduce this on Pixel 6 Pro with chromium browsers (brave/chrome). Since this isn't an overall android issue, and it may be something specific with Pixel 6 Pro chrome build, I'm going to close this. |
Just noting that this is still an issue. My Pixel 6 Pro fails to load all Bevy WASM examples, but Firefox works fine. If there's any value in debug data here please let me know what to do. :) |
@MeoMix When i was debugging it, it was because of a screen size error.. maybe because the pixel pro has a curved screen or something and it doesn't interpret it correctly.. I didn't understand at the time an easy solution to fix it. There's probably some javascript magic you can do to override the bad values. |
@miketwenty1 Fascinating. Alright, thanks for the heads up. Here's what I see after inspecting dev tools on my phone. #4869 Related https://groups.google.com/a/chromium.org/g/graphics-dev/c/E3V--C7OPpc Related? DeviceDriver limits on my phone: Limits { max_texture_dimension_1d: 4096, max_texture_dimension_2d: 4096, max_texture_dimension_3d: 4096, max_texture_array_layers: 2048, max_bind_groups: 8, max_bindings_per_bind_group: 65535, max_dynamic_uniform_buffers_per_pipeline_layout: 16, max_dynamic_storage_buffers_per_pipeline_layout: 0, max_sampled_textures_per_shader_stage: 16, max_samplers_per_shader_stage: 16, max_storage_buffers_per_shader_stage: 0, max_storage_textures_per_shader_stage: 0, max_uniform_buffers_per_shader_stage: 16, max_uniform_buffer_binding_size: 65536, max_storage_buffer_binding_size: 0, max_vertex_buffers: 16, max_buffer_size: 2147483647, max_vertex_attributes: 16, max_vertex_buffer_array_stride: 4294967295, min_uniform_buffer_offset_alignment: 32, min_storage_buffer_offset_alignment: 256, max_inter_stage_shader_components: 124, max_compute_workgroup_storage_size: 0, max_compute_invocations_per_workgroup: 0, max_compute_workgroup_size_x: 0, max_compute_workgroup_size_y: 0, max_compute_workgroup_size_z: 0, max_compute_workgroups_per_dimension: 0, max_push_constant_size: 256 } which shows some 4096, but doesn't explain why create_texture is being called in a way that results in exceeding it. bevy/crates/bevy_render/src/view/mod.rs Line 471 in 7132404
So, if I go to https://www.mydevice.io/ on my phone it says my device pixel ratio is 3.5 and my JS screen width/height is 412/892. So, my phone reports having a device pixel ratio of 3.5 and a width/height of 412/892. Applying DPR to these values and all seems fine, right? 412 * 3.5 = 1442 and 892 * 3.5 = 3122 However! If I look at
where its defaults are 1280 * 720. What is 1280 * 3.5? 4480! And that exceeds Limits. So, I think that's what is happening but I dunno how to fix it just yet. It's also the case that if I run |
@MeoMix if you don't mind.. if you do find find a fix, please update with findings.. I would really like to also implement it in my code base. |
reopening to track with you. |
I think we need to sit tight for a while. rust-windowing/winit#2849 winit has fixed the issue already but Bevy isn't using that version of winit. I don't think it's going to make it into Bevy 0.12. So my guess is that it'll work in 0.13, but that one could cherry-pick the change and patch their winit dependency locally if they were so inclined. |
@MeoMix both of those are now closed/merged. What do you think the current blocker is for this? |
There is none AFAIK. winit 0.29 was merged into bevy main a couple of weeks ago. I haven't pulled down bevy main to see if it fixed the issue for me yet though. If you're eager you can do that and report back otherwise will need to wait until bevy 0.13 ships |
Yes this is still an issue while using main. The error is the same but reflects that it's using wgpu version 18 now.
Is there a way I can override fix this? |
Dang. I don't have any more information unfortunately. I was pretty sure that was the fix that needed to make it in, but, if it's not, it'll require triaging again and figuring out what else could be the issue. |
Is there a way to just override it so it doesn't exceed limits? |
If I knew I would tell you. I only have about an hour of experience with this issue back when I triaged it the first time. I have no idea without spending time digging into it. |
I'm going to try a suggestion put here, i'll report back if this work around "works". Edit: Tried, no dice. |
@miketwenty1 which OS and browser are you using? const observer = new ResizeObserver((entries) => console.log(entries[0].devicePixelContentBoxSize[0]))
observer.observe(document.querySelector('canvas')) |
Okay, that looks about right to me. This is the size Winit should be reporting.
That would still be helpful. |
these don't work. chrome and chromium all on the pixel 6 pro OS: note: |
The resolution looks correct for this device. |
Stumbled onto this issue myself when trying to run it in WebGL on a mobile device. Dug around a bit in the code and noticed that
My simple fix was to set it to |
Mobile seems to be sort of broken. At least for brave/chrome on some androids.
Reopening since there is traction here to find a fix it seems & someone else also came across this:
#7038 (comment)
I'm unsure if this is a "known" or an actual issue. I found this when trying to do some WASM stuff of my own, then realized the website examples also won't load for my mobile device.
I'm unable to reproduce this with virtualized chrome devices on desktop (need to use my actual phone). Firefox seems to be working in some cases. Chrome seems to work in less cases.
UiButton is an example where it works with firefox but not chrome. I encourage you to try this on your phone and see if it works. (let me know).
https://bevyengine.org/examples/ui/button/
(version 108.1.0 Build #2015920443)
(verison: 108.0.5359.128)
The text was updated successfully, but these errors were encountered: