Skip to content

Metal passthrough shaders have limitations #8330

@inner-daemons

Description

@inner-daemons

Metal passthrough shaders don't expose options like wg_memory_sizes, which is required for threadgroup memory to my knowledge. Therefore, passthrough shaders can't use threadgroup memory.

It comes from this code in wgpu_hal::metal::Device::create_compute_pipeline. This will also have an impact on mesh shaders when they arrive.

let cs = if let ShaderModuleSource::Passthrough(desc) = &module.source {
    CompiledShader {
        library: desc.library.clone(),
        function: desc.function.clone(),
        wg_size: MTLSize::new(
            desc.num_workgroups.0 as u64,
            desc.num_workgroups.1 as u64,
            desc.num_workgroups.2 as u64,
        ),
        wg_memory_sizes: vec![],
        sized_bindings: vec![],
        immutable_buffer_mask: 0,
    }
} else {
    self.load_shader(
        &desc.stage,
        &[],
        desc.layout,
        MTLPrimitiveTopologyClass::Unspecified,
        naga::ShaderStage::Compute,
    )?
};

I'm not exactly sure what sized_bindings or immutable_buffer_mask refer to, but they might cause their own limitations as well.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions