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

[gles] create_bind_group fails for buffers with MAP_WRITE #3058

Closed
Wumpf opened this issue Oct 4, 2022 · 3 comments
Closed

[gles] create_bind_group fails for buffers with MAP_WRITE #3058

Wumpf opened this issue Oct 4, 2022 · 3 comments

Comments

@Wumpf
Copy link
Member

Wumpf commented Oct 4, 2022

Description
Gles backend crashes when creating a bind group for a freshly created buffer that has MAP_WRITE usage.

Only got a vague wasm callstack, but pretty sure it's this unwrap here https://github.com/gfx-rs/wgpu/blob/v0.13/wgpu-hal/src/gles/device.rs#L903 failing because when going this early out path we don't have a raw buffer just yet https://github.com/gfx-rs/wgpu/blob/v0.13/wgpu-hal/src/gles/device.rs#L364

Repro steps

  • create buffer with wgpu::BufferUsages::MAP_WRITE and wgpu::BufferUsages::UNIFORM
  • create simple bindgroup like this
        let bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor {
            label: None,
            layout: &bind_group_layout,
            entries: &[wgpu::BindGroupEntry {
                binding: 0,
                resource: uniform_buffer.as_entire_binding(),
            }],
        });

observe crash on unwrap.

Platform
Tested with webgl on the web

@Imberflur
Copy link
Contributor

This may be related to some missing validation that I recently fixed: #3023.

Part of what this validation ensures is that MAP_WRITE can only be paired with COPY_SRC unless wgpu::Features::MAPPABLE_PRIMARY_BUFFERS is enabled.

Although MAPPABLE_PRIMARY_BUFFERS documentation claims it should be supported on all native platforms, but the gles and dx11 backends don't add it to the list of supported features so I'm not sure if that is true.

@Imberflur
Copy link
Contributor

From #wgpu-users:matrix.org discussion it seems that MAPPABLE_PRIMARY_BUFFERS isn't supported on dx11 and gles and the docs are out of date.

@Imberflur
Copy link
Contributor

In 0.14 this should now emit a validation error when trying to create the buffer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants