ComputeShader

Trait ComputeShader 

Source
pub trait ComputeShader:
    TypePath
    + Send
    + Sync
    + 'static {
    // Required method
    fn shader() -> ShaderRef;

    // Provided methods
    fn layouts<'a>() -> &'a [BindGroupLayout] { ... }
    fn shader_defs<'a>() -> &'a [ShaderDefVal] { ... }
    fn push_constant_ranges<'a>() -> &'a [PushConstantRange] { ... }
    fn entry_point<'a>() -> &'a str { ... }
}
Expand description

Trait to declare your shaders.

Required Methods§

Source

fn shader() -> ShaderRef

Implement your ShaderRef

Usually, it comes from a path:

fn shader() -> ShaderRef {
    "shaders/my_shader.wgsl".into()
}

Provided Methods§

Source

fn layouts<'a>() -> &'a [BindGroupLayout]

If you don’t want to use wgpu’s reflection for your binding layout, you can declare them here.

Source

fn shader_defs<'a>() -> &'a [ShaderDefVal]

Source

fn push_constant_ranges<'a>() -> &'a [PushConstantRange]

Source

fn entry_point<'a>() -> &'a str

By default, the shader entry point is main. You can change it from here.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§