Donner SVG 0.8.0-pre
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
SubregionClip.h File Reference

The subregion-clip compute program, expressed in the donner::gpu::shader IR. More...

Include dependency graph for SubregionClip.h:

Namespaces

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

Functions

ShaderResult< IrModule > donner::gpu::shader::programs::BuildSubregionClipModule ()
 Builds the subregion-clip compute program: one @compute @workgroup_size(8, 8, 1) entry point named cs_main that copies texels inside a rectangle and writes transparent black outside it.
ShaderResult< IrModule > donner::gpu::shader::programs::BuildFilterResolveModule ()
 Builds the final filter clip, resolving premultiplied float channels to RGBA8 with half-up rounding. Uses the same clipping parameters and entry point as BuildSubregionClipModule. The pad0 word selects linear-to-sRGB conversion through the shared table at binding 3.

Detailed Description

The subregion-clip compute program, expressed in the donner::gpu::shader IR.

Function Documentation

◆ BuildSubregionClipModule()

ShaderResult< IrModule > donner::gpu::shader::programs::BuildSubregionClipModule ( )

Builds the subregion-clip compute program: one @compute @workgroup_size(8, 8, 1) entry point named cs_main that copies texels inside a rectangle and writes transparent black outside it.

The rectangle is axis-aligned in user space, not in the destination's pixel space, so the test runs on the pixel center mapped back through the uniform's inverse transform. That is what makes the clip correct under a rotated transform, where a pixel-space rectangle would not describe the same region. The rectangle is half-open on both axes: a coordinate equal to the low edge is inside, one equal to the high edge is outside, so abutting subregions neither overlap nor leave a seam.

Invocations outside the destination extent return without writing, so a dispatch rounded up to whole workgroups is safe.