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

Depth texture overflows device limits #4869

Open
micahscopes opened this issue May 29, 2022 · 3 comments
Open

Depth texture overflows device limits #4869

micahscopes opened this issue May 29, 2022 · 3 comments
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-Web Specific to web (WASM) builds

Comments

@micahscopes
Copy link

micahscopes commented May 29, 2022

Bevy version

0.8.0-dev (d353fbc)

Operating system & version

Chrome 101 + Android 8 (LG G8 ThinQ)

What you did

  • Tried opening a simple example application on my phone's browser (compiled Bevy 0.8.0-dev).
  • Tried opening https://bevyengine.org/examples/ on my phone (probably v0.7)

What you expected to happen

I expected to be able to view the examples

What actually happened

The render pipeline failed to initialize the depth buffer texture. It tried creating a texture larger than my device's limits:

(index):869 panicked at 'wgpu error: Validation Error

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

Additional information

My phone's physical resolution is 3120x1440 so I'm not sure why winit is giving Bevy such a large scaling factor. Maybe this is a winit issue?

But even so, if winit is passing an impossible scale factor maybe the renderer should be able to handle it?

When I add:

    app
        .insert_resource(WindowDescriptor {
            scale_factor_override: Some(1.0),
            ..WindowDescriptor::default()
        })

It gets rid of the texture size limitation but totally messes up canvas sizing/resizing:

image

other questions

  • I wonder also if the device rotation is being correctly taken into consideration?
  • If winit is passing wonky large scale factors, wouldn't this potentially cause performance issues on mobile devices by forcing them to render to enormous canvases?
@micahscopes micahscopes added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels May 29, 2022
@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen A-Windowing Platform-agnostic interface layer to run your app in O-Web Specific to web (WASM) builds and removed S-Needs-Triage This issue needs to be labelled labels May 29, 2022
@micahscopes
Copy link
Author

To follow up. I noticed #4726 and tried out adding:

 app.insert_resource(WindowDescriptor {
    scale_factor_override: Some(1.0),
    fit_canvas_to_parent: true,
    canvas: Some("canvas".to_string()),
    ..default()
  })

When I put the phone in landscape mode it actually looks to be drawing correctly!

Screenshot_20220529-180558

Whereas in portrait mode I get:
Screenshot_20220529-180750

@vultix
Copy link

vultix commented Dec 25, 2022

I'm seeing the same issue, this time on my 16" m1 macbook pro.

Steps to reproduce:

  • Checkout bevy_hanabi
  • Run cargo run --example spawn --features=bevy/bevy_winit,bevy/bevy_pbr,3d

This is the error I get:

2022-12-25T15:02:28.965779Z ERROR wgpu::backend::direct: Handling wgpu errors as fatal by default    
thread 'Compute Task Pool (0)' panicked at 'wgpu error: Validation Error

Caused by:
    In Device::create_texture
      note: label = `view_depth_texture`
    Dimension X value 2560 exceeds the limit of 2048

@vultix
Copy link

vultix commented Dec 25, 2022

Ah, looks like my issue above wasn't because of bevy, but bevy_hanabi. The example was artificially setting the limit to 2048 using WgpuLimits::downlevel_defaults()

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-Web Specific to web (WASM) builds
Projects
None yet
Development

No branches or pull requests

3 participants