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

[wasm, phone browser] Dimension Y value 5038 exceeds the limit of 4096 #7591

Open
smessmer opened this issue Feb 10, 2023 · 5 comments
Open
Labels
A-Rendering Drawing game state to the screen A-Windowing Platform-agnostic interface layer to run your app in C-Bug An unexpected or incorrect behavior O-Android Specific to the Android mobile operating system O-iOS Specific to the iOS mobile operating system O-Web Specific to web (WASM) builds

Comments

@smessmer
Copy link
Contributor

Bevy version

0.9.1

[Optional] Relevant system information

  • WASM build
  • Running in Mobile Chrome on a Samsung Galaxy S20 phone
AdapterInfo { name: "Adreno (TM) 650", vendor: 20803, device: 0, device_type: IntegratedGpu, driver: "", driver_info: "", backend: Gl }

What you did

  • Running my game in a desktop browser (Chrome) works fine
  • Running it on a mobile browser (Chrome) from the Samsung Galaxy S20 phone fails with
game-902f20548b71ecb7.js:627 panicked at 'wgpu error: Validation Error

Caused by:
    In Device::create_texture
      note: label = `view_depth_texture`
    Dimension Y value 5038 exceeds the limit of 4096

', /home/runner/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/wgpu-0.14.2/src/backend/direct.rs:2403:5

Not sure what is causing this, I'm not loading any explicit depth texture and none of my regular textures are above 4096 in size. Is this a depth texture that bevy loads somehow? Interestingly, the bevy examples from bevyengine.org do work in the same mobile browser though.

@smessmer smessmer added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Feb 10, 2023
@alice-i-cecile alice-i-cecile added O-Web Specific to web (WASM) builds O-Android Specific to the Android mobile operating system O-iOS Specific to the iOS mobile operating system A-Windowing Platform-agnostic interface layer to run your app in A-Rendering Drawing game state to the screen and removed S-Needs-Triage This issue needs to be labelled labels Feb 10, 2023
@jroddev
Copy link

jroddev commented Sep 4, 2023

I did some digging on this back in April, here is what I found rust-windowing/winit#2524 (comment)
I took another look today and was able to fix this on my Pixel device for Vanadium and Brave with Bevy 0.11 by doing a couple of things.

For my use-case I am filling the whole page with my canvas.

.add_plugins(DefaultPlugins.build().set(WindowPlugin {
            primary_window: Some(Window {
                fit_canvas_to_parent: true,
                ..default()
            }),
            ..default()
        }))

This combined with the devicePixelRatio of 2.65 was causing the wgpu texture to be too big.
To fix it I add this meta tag to the html head

    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />

I'm not sure if the winit change was actually required because I hadn't tried the meta tag until today.

side-note: for some reason the body has a margin side by default so in my css I also add

body {
    margin: 0;
}

@miketwenty1
Copy link

@jroddev I'm trying this to no success, is this still working for you using latest tagged bevy? or main branch?

@jroddev
Copy link

jroddev commented Jan 15, 2024

@miketwenty1 I actually can no longer reproduce the problem with my example projects and my device. Tested with Bevy 10, 11, and 12.
I thought maybe it was patched on the device, but Chromium is still reporting window.devicePixelRatio as 2.625.

@miketwenty1
Copy link

I'm on bevy main branch right now. but this was still an issue for me on 10, 11, and 12. the specific device is a pixel 6 pro with a pixel ratio of 3.5.

@jroddev
Copy link

jroddev commented Jan 16, 2024

I'm not sure, sorry. I tried again and cannot reproduce with or without my line anymore.
It could be that the resulting resolution is now supported in wgpu (snuck through in a patch version?) or by my device, but then yours is still over the limit.

Which browser are you using? and is it the stock Android OS that came with the device?
From my original testing Chromium based browsers had the issue but Firefox worked (Firefox devicePixelRatio was 1)

Just checking that the meta tag was added to the head and not the body in your index.html file?

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
    </head>
    <body>
    </body>
</html>

It's not a great solution, but if you just need to get something running you could shrink the size of the canvas on the page enough that it fits within the texture limit. I did this originally by putting a header and some extra buttons on the page until the render surface was small enough. More details on this linked comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen A-Windowing Platform-agnostic interface layer to run your app in C-Bug An unexpected or incorrect behavior O-Android Specific to the Android mobile operating system O-iOS Specific to the iOS mobile operating system O-Web Specific to web (WASM) builds
Projects
None yet
Development

No branches or pull requests

4 participants