{
R"wgsl(@group(0) @binding(0) var sourceTexture: texture_2d<f32>;
@group(0) @binding(1) var destinationTexture: texture_2d<f32>;
@group(0) @binding(2) var outputTexture: texture_storage_2d<rgba32float, write>;
@compute @workgroup_size(8, 8, 1)
fn cs_main(@builtin(global_invocation_id) gid: vec3<u32>) {
let extent = textureDimensions(outputTexture);
if (((gid.x >= extent.x) || (gid.y >= extent.y))) {
return;
}
let coords = vec2<i32>(gid.xy);
let source = textureLoad(sourceTexture, coords, 0i);
let destination = textureLoad(destinationTexture, coords, 0i);
let remainingSourceAlpha = (1f - source.w);
let result = (source + (destination * remainingSourceAlpha));
textureStore(outputTexture, coords, saturate(result));
}
)wgsl"}
Authoritative WGSL for one feMerge source-over pass.