Skip to content

No feature combination allows Metal to use STORAGE_RESOURCE_BINDING_ARRAY. #3249

@AndrewRademacher

Description

@AndrewRademacher

Description
Documentation on features both claims that Metal does and does not support BUFFER_BINDING_ARRAY. At runtime, it appears to be impossible to enable the right features to allow the use of buffer arrays at all.

Under the supported platforms header for Feature::STORAGE_RESOURCE_BINDING_ARRAY, support for Metal is claimed. However, that section of documentation also says that Feature::BUFFER_BINDING_ARRAY is required to use this feature. BUFFER_BINDING_ARRAY does not claim Metal support.

Repro steps
On an M1 Mac the following block completes without error.

let (device, queue) = adapter
        .request_device(
            &wgpu::DeviceDescriptor {
                label: None,
                features: wgpu::Features::STORAGE_RESOURCE_BINDING_ARRAY,
                limits: wgpu::Limits::default(),
            },
            None,
        )
        .await?;

However, attempts to use a buffer array via layout fails:

                wgpu::BindGroupLayoutEntry {
                    binding: 0,
                    visibility: wgpu::ShaderStages::COMPUTE,
                    ty: wgpu::BindingType::Buffer {
                        ty: wgpu::BufferBindingType::Storage { read_only: false },
                        has_dynamic_offset: false,
                        min_binding_size: None,
                    },
                    count: Some(1.try_into().unwrap()),
                },

With the error:

Caused by:
    In Device::create_bind_group_layout
    binding 0 entry is invalid
    Features BUFFER_BINDING_ARRAY | STORAGE_RESOURCE_BINDING_ARRAY are required but not enabled on the device

This confirms the documentations claim that BUFFER_BINDING_ARRAY is required to use STORAGE_RESOURCE_BINDING_ARRAY. However when adding that feature to the request_device call the following error is produced.

2022-12-01T03:53:31.744456Z ERROR wgpu::backend::direct: Error in Adapter::request_device: unsupported features were requested: BUFFER_BINDING_ARRAY
Render Error: Requesting a device failed

Expected vs observed behavior
I actually don't know if M1 does support what is necessary for an array binding, but I would expect to see either of the following:

  • Clear indication that M1/Metal does not support anything that depends on BUFFER_BINDING_ARRAY, since it cannot support BUFFER_BINDING_ARRAY. As well as an error during the request_device call.

or

  • Given that BUFFER_BINDING_ARRAY is required to use STORAGE_RESOURCE_BINDING_ARRAY, it should be marked as supported on M1 and should be allowed during request_device on M1 machines. (assuming that M1s can actually do arrays of buffers)

Platform
2020 M1 MacBook Pro
CPU: Apple M1
Memory: 16GB
MacOs Ventura 13.0.1

Rust: 1.65.0
wgpu: 0.14.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: apiIssues related to API surfacefeature: bindlessIssues with the Bindless Native Featuretype: enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions