pub const SIMPLE_FRAGMENT_SHADER: &str = r#"
struct VertexOutput {
@builtin(position) clip_position: vec4<f32>,
@location(0) color: vec4<f32>,
}
@fragment
fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
return in.color;
}
"#;Expand description
Simple fragment shader (currently used, solid color output)
Pipeline Stage 3: FRAGMENT/PIXEL PROCESSING
- Runs once for each pixel that the point covers
- Receives interpolated color from vertex shader
- Returns color directly (no modifications)
For a scatter plot with 1 million points, this shader may run 1-4 million times per frame (depending on point sizes).
GPU runs these in parallel, which is why we can render so fast!