Files
wgpu/tests/out/wgsl/extra.wgsl
T
Jim Blandy 0f36a745cf [wgsl-out] Don't include type parameter in splat expressions. (#2469)
Generate `vec4(1.0)` instead of `vec4<f32>(1.0)`, since WGSL requires
us to infer the type parameter anyway.
2023-09-12 19:34:24 +02:00

22 lines
450 B
WebGPU Shading Language

struct PushConstants {
index: u32,
double: vec2<f64>,
}
struct FragmentIn {
@location(0) color: vec4<f32>,
@builtin(primitive_index) primitive_index: u32,
}
var<push_constant> pc: PushConstants;
@fragment
fn main(in: FragmentIn) -> @location(0) vec4<f32> {
let _e4 = pc.index;
if (in.primitive_index == _e4) {
return in.color;
} else {
return vec4<f32>((vec3(1.0) - in.color.xyz), in.color.w);
}
}