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

Usage of a depth/stencil state is not possible for large resolutions in WebGL2 #2271

Closed
maxammann opened this issue Dec 9, 2021 · 3 comments
Labels
area: ecosystem Help the connected projects grow and prosper

Comments

@maxammann
Copy link
Contributor

Description
I'm trying to run a simple example using the WebGL2 backend. The validation fails with the following error:

index.js:1642 panicked at 'wgpu error: Validation Error
Caused by:
    In Device::create_texture
      note: label = `Depth texture`
    Dimension 2573 value 2573 exceeds the limit of 2048

', /home/max/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.11.0/src/backend/direct.rs:2195:5

The issue is a texture I'm using for the depth buffer. The texture is created as follows:

        let depth_texture = device.create_texture(&wgpu::TextureDescriptor {
            label: Some("Depth texture"),
            size: wgpu::Extent3d {
                width: config.width,
                height: config.height,
                depth_or_array_layers: 1,
            },
            mip_level_count: 1,
            sample_count,
            dimension: wgpu::TextureDimension::D2,
            format: wgpu::TextureFormat::Depth24PlusStencil8,
            usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
        });
        let view = depth_texture.create_view(&wgpu::TextureViewDescriptor::default());

In my example config.width or config.height exceeds 2048.
We are hitting here "normal" limitations of WebGL2. It could also be that depth testing is just not possible with WebGL2.

Repro steps
Not available right now.

Expected vs observed behavior
I expect to be able to use depth testing for arbitrary screen resolutions.

Extra materials
None

Platform

  • Tested Browsers: Chrome on Linux/Chrome on Android
@kvark
Copy link
Member

kvark commented Dec 9, 2021

What limits are you requesting? The downlevel and WebGL2 limits that we offer here are just on the safe side. If you need a depth buffer, and need it larger, you should request bigger limits.
I.e. just set max_texture_dimension_2d: 4096 if your canvas size is bigger than 2K, and that should be good.

@kvark kvark added the area: ecosystem Help the connected projects grow and prosper label Dec 9, 2021
@maxammann
Copy link
Contributor Author

In fact this is working :) so everything here is like it should be, right?

I'm just starting with WebGPU and also with WebGL so I'm unsure what is a bug and what not.

@kvark
Copy link
Member

kvark commented Dec 9, 2021

Yes, it's as expected. wgpu respects the limits you are requesting. The limit presets, like downlevel_defaults() are just for your convenience, they aren't anything special.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: ecosystem Help the connected projects grow and prosper
Projects
None yet
Development

No branches or pull requests

2 participants