wgpu/naga/tests/in/push-constants.wgsl
Connor Fitzgerald 1df98d9888
Test And Normalize Vertex Behavior on All Backends (#4723)
Co-authored-by: teoxoy <28601907+teoxoy@users.noreply.github.com>
2023-11-21 22:11:24 +00:00

23 lines
478 B
WebGPU Shading Language

struct PushConstants {
multiplier: f32
}
var<push_constant> pc: PushConstants;
struct FragmentIn {
@location(0) color: vec4<f32>
}
@vertex
fn vert_main(
@location(0) pos : vec2<f32>,
@builtin(instance_index) ii: u32,
@builtin(vertex_index) vi: u32,
) -> @builtin(position) vec4<f32> {
return vec4<f32>(f32(ii) * f32(vi) * pc.multiplier * pos, 0.0, 1.0);
}
@fragment
fn main(in: FragmentIn) -> @location(0) vec4<f32> {
return in.color * pc.multiplier;
}