Files
wgpu/naga/tests/out/wgsl/extra.wgsl
T
Jim Blandy 3ffd5a1e56 [naga wgsl-out] Include the f suffix on f32 literals.
Without the suffix, `Expression::Literal(Literal::F32)` expressions
get written without any suffix on the number, meaning that they get
re-parsed as `AbstractFloat` values. In theory, this should always be
fine, but since we don't actually support abstract types yet in all
the places we should, having them appear in the output causes
validation problems.

See also: #4863, which did the same for `i32` literals.
2023-12-13 13:42:05 +01:00

22 lines
449 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(1f) - in.color.xyz), in.color.w);
}
}