Donner 0.5.1
Embeddable browser-grade SVG2 engine
Loading...
Searching...
No Matches
donner::geode::GeodeMaskPipeline Class Reference

Caches a compiled wgpu::RenderPipeline for the path-clip mask shader (shaders/slug_mask.wgsl) plus its bind-group layout. More...

#include "donner/svg/renderer/geode/GeodePipeline.h"

Public Member Functions

 GeodeMaskPipeline (const wgpu::Device &device, bool useAlphaCoverageShader=false, uint32_t sampleCount=4)
 Create a Slug mask pipeline for the given device.
 GeodeMaskPipeline (const GeodeMaskPipeline &)=delete
GeodeMaskPipelineoperator= (const GeodeMaskPipeline &)=delete
 GeodeMaskPipeline (GeodeMaskPipeline &&) noexcept=default
GeodeMaskPipelineoperator= (GeodeMaskPipeline &&) noexcept=default
const wgpu::RenderPipeline & pipeline () const
const wgpu::BindGroupLayout & bindGroupLayout () const
wgpu::TextureFormat colorFormat () const
 The color format the pipeline targets. Always RGBA8Unorm.

Detailed Description

Caches a compiled wgpu::RenderPipeline for the path-clip mask shader (shaders/slug_mask.wgsl) plus its bind-group layout.

The mask pipeline is a stripped-down sibling of GeodePipeline — it reuses the same vertex shader, the same band/curve storage SSBOs, and the same 4× MSAA coverage path, but the fragment stage writes clip coverage into an RGBA8Unorm color attachment. The sample-mask path replicates scalar coverage into all 4 channels; the alpha-coverage path packs one subpixel sample per channel so Max blending unions them exactly. resulting mask texture is then sampled by GeodePipeline and GeodeGradientPipeline as a clip coverage multiplier.

The bind group layout is:

  • binding 0: uniform buffer (mvp, viewport, fillRule).
  • binding 1: storage buffer (read-only) — Band[].
  • binding 2: storage buffer (read-only) — curve data (flat f32[]).

No texture / sampler bindings — the mask pipeline doesn't read from any texture input. Multiple paths belonging to a single clip layer are unioned on the hardware side via BlendOperation::Max.

Constructor & Destructor Documentation

◆ GeodeMaskPipeline()

donner::geode::GeodeMaskPipeline::GeodeMaskPipeline ( const wgpu::Device & device,
bool useAlphaCoverageShader = false,
uint32_t sampleCount = 4 )
explicit

Create a Slug mask pipeline for the given device.

Renders into an RGBA8Unorm texture with 4× MSAA.

Parameters
useAlphaCoverageShaderWhen true, selects the alpha-coverage shader variant.
sampleCountMSAA sample count (1 for alpha-coverage, 4 otherwise).

The documentation for this class was generated from the following file: