-
Notifications
You must be signed in to change notification settings - Fork 329
Closed
Labels
wgslWebGPU Shading Language IssuesWebGPU Shading Language Issues
Milestone
Description
Writing multiple shaders in a single file could benefit from collapsing, or moving module scoped input/output variables.
There are a few different possibilities here depending on how we want to proceed.
Multiple storage classes
[[location(0)]] var<out(vertex), in(fragment)> frag_color : vec4<f32>
Multiple locations
[[location(0, fragment), location(1, vertex)]] var<in(vertex), out(fragment)> colour : vec4<f32>
As structs
struct PerVertex {
[[location(0)]] colour: vec4<f32>;
};
fn vertex() -> PerVertex {... }
fn fragment(v: PerVertex) -> vec4<f32> { .. }
As entry point parameters
fn fragment(
[[location(0)]] colour : vec4<f32>,
) -> [[location(1)]] vec4<f32> {
}
[[stage(fragment)]]
fn frag(
[[buildin(position)]] pos : vec4<f32>) -> void {}
[[stage(compute)]]
fn comp_main(
[[builtin(invocation_id)]] gl_GlobalInvocationId : vec3<u32>,
[[set(0), binding(0), uniform]] params : SimParams,
[[set(0), binding(1), storage]] particlesA : Particles,
[[set(0), binding(2), storage]] particlesB : Particles) -> void {}
kvark
Metadata
Metadata
Assignees
Labels
wgslWebGPU Shading Language IssuesWebGPU Shading Language Issues