run method
Returns linear RGBA for attachment zero. Null discards the fragment.
Implementation
@override
Vector4? run(Float32List v, ShaderBindings b, FragmentContext c) {
final accumulation = b.textures['accumulation_texture'];
final revealage = b.textures['revealage_texture'];
// Nothing bound covers nothing, which source-over leaves alone.
if (accumulation == null || revealage == null) return Vector4.zero();
final sum = accumulation.sample(v[0], v[1]);
final coverage = 1.0 - revealage.sample(v[0], v[1]).x;
final weight = sum.w.clamp(1e-5, 65504.0);
return Vector4(
math.min(sum.x, 65504.0) / weight * coverage,
math.min(sum.y, 65504.0) / weight * coverage,
math.min(sum.z, 65504.0) / weight * coverage,
coverage,
);
}