/// This code is prepended to gradient/common.wgsl and is specialised for uniform buffers struct Gradient { colors: array, 16>, ratios: array, 4u>, // secretly array but this let's us squeeze it into alignment gradient_type: i32, num_colors: u32, interpolation: i32, focal_point: f32, }; @group(2) @binding(1) var gradient: Gradient; fn ratio(i: u32) -> f32 { return gradient.ratios[i / 4u][i % 4u]; }