rust-gpu icon indicating copy to clipboard operation
rust-gpu copied to clipboard

WIP: VK_EXT_mesh_shader

Open BeastLe9enD opened this issue 2 years ago • 3 comments

This PR adds support for VK_EXT_mesh_shader. At the moment, it depends on my unofficial updated rspirv version.

An example mesh shader looks like this:

#[spirv(mesh_ext(
    threads(1),
    output_vertices = 3,
    output_primitives_ext = 1,
    output_triangles_ext
))]
pub fn my_mesh_shader(
    #[spirv(position)] positions: &mut [Vec4; 3],
    #[spirv(primitive_triangle_indices_ext)] indices: &mut [UVec3; 1],
) {
    unsafe {
        set_mesh_outputs_ext(3, 1);
    }

    positions[0] = Vec4::new(-0.5, 0.5, 0.0, 1.0);
    positions[1] = Vec4::new(0.5, 0.5, 0.0, 1.0);
    positions[2] = Vec4::new(0.0, -0.5, 0.0, 1.0);

    indices[0] = UVec3::new(0, 1, 2);
}

BeastLe9enD avatar Mar 25 '23 23:03 BeastLe9enD

rspirv has gotten an updated version on crates.io 8 days ago! :tada:

Firestar99 avatar Dec 28 '23 18:12 Firestar99

@BeastLe9enD can you rebase (to get rid of the merge commits) and switch to the new rspirv release? If there's other errors to fix from the rspirv bump, ping me so we can get this through.

eddyb avatar Dec 28 '23 20:12 eddyb

I'm giving this a try myself, expect a new PR soonish. I'll split the rspirv update in a separate PR, as it seems to require some small breaking changes due to extension deprecation / removal, like BaryCoordNV -> BaryCoordKHR.

Firestar99 avatar Jan 23 '24 18:01 Firestar99