Donner SVG 0.8.0
0.8.0 ยท ebf353960.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
MergeSource.h File Reference

Authoritative WGSL for one feMerge source-over pass. More...

#include "donner/gpu/shader/wgsl/Compiler.h"
Include dependency graph for MergeSource.h:

Namespaces

namespace  donner
 Top-level Donner namespace, which is split into different sub-namespaces such as donner::svg and donner::css.

Variables

constexpr wgsl::SourceText donner::gpu::shader::programs::kMergeSource
 Authoritative WGSL for one feMerge source-over pass.

Detailed Description

Authoritative WGSL for one feMerge source-over pass.

Variable Documentation

◆ kMergeSource

wgsl::SourceText donner::gpu::shader::programs::kMergeSource
inlineconstexpr
Initial value:
{
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.