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

Read/Write and Read-Only Storage Texture Error Message Doesn't Say Why #2735

Closed
OneKnightOnly opened this issue Jun 6, 2022 · 4 comments · Fixed by #2745
Closed

Read/Write and Read-Only Storage Texture Error Message Doesn't Say Why #2735

OneKnightOnly opened this issue Jun 6, 2022 · 4 comments · Fixed by #2745
Labels
area: validation Issues related to validation, diagnostics, and error handling good first issue Good for newcomers help required We need community help to make this happen. type: enhancement New feature or request
Milestone

Comments

@OneKnightOnly
Copy link

Description
R32Uint StorageTexture requires TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES to be enabled.

Repro steps

    let texture = ctx.device.create_texture(&wgpu::TextureDescriptor {
        size: wgpu::Extent3d {
            width: 2,
            height: 2,
            depth_or_array_layers: 2,
        },
        mip_level_count: 1,
        sample_count: 1,
        dimension: wgpu::TextureDimension::D3,
        format: wgpu::TextureFormat::R32Uint,
        usage: wgpu::TextureUsages::TEXTURE_BINDING
            | wgpu::TextureUsages::STORAGE_BINDING
            | wgpu::TextureUsages::COPY_DST,
        label: None,
    });

    let bind_group_layout =
        ctx.device
            .create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
                entries: &[wgpu::BindGroupLayoutEntry {
                    binding: 0,
                    visibility: wgpu::ShaderStages::COMPUTE,
                    ty: wgpu::BindingType::StorageTexture {
                        access: wgpu::StorageTextureAccess::ReadWrite,
                        format: wgpu::TextureFormat::R32Uint,
                        view_dimension: wgpu::TextureViewDimension::D3,
                    },
                    count: None,
                }],
                label: None,
            });

Expected vs observed behavior
R32Uint is part of webgpu spec and shouldn't require special features enabled.

Error Messge
In Device::create_bind_group_layout
binding 0 entry is invalid
Features TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES are required but not enabled on the device.

@cwfitzgerald
Copy link
Member

Ahh, that's the problem, you're making a read_write storage texture, something that isn't supported in baseline webgpu. The way we current guard this is by the custom features flag. As is obvious, the error message really could be improved for this case. Going to rename and leave open.

@cwfitzgerald cwfitzgerald changed the title R32Uint StorageTexture requires specific feature enabled. Read/Write and Read-Only Storage Texture Error Message Doesn't Say Why Jun 6, 2022
@cwfitzgerald cwfitzgerald added area: validation Issues related to validation, diagnostics, and error handling type: enhancement New feature or request help required We need community help to make this happen. good first issue Good for newcomers labels Jun 6, 2022
@OneKnightOnly
Copy link
Author

Oh thats what it is, I just changed the access to writeonly and it works perfectly thanks.

@feresr
Copy link

feresr commented May 14, 2023

Is there no way to read a texture from a compute shader? (without the feature flag)
how is this usually done in webGPU?

@cwfitzgerald
Copy link
Member

If you want to read from a texture, bind it as a normal texture (not a storage texture) and use textureLoad on it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: validation Issues related to validation, diagnostics, and error handling good first issue Good for newcomers help required We need community help to make this happen. type: enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants