// Payload declared here so the WGSL assembler sees it before the wfPayload
// binding, the SHADE dispatch, and the raygen source.
//
// Wavefront model: closesthit_main runs in SHADE and accumulates the
// pixel's color directly (rtAccumulate) instead of writing a payload that
// raygen reads back.

struct Payload {
    color: vec3<f32>,
};

fn closesthit_main(ray: RayDesc, hit: HitInfo, payload: ptr<function, Payload>) {
    let bary = vec3<f32>(1.0 - hit.attribs.x - hit.attribs.y, hit.attribs.x, hit.attribs.y);
    rtAccumulate(bary);
}
