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

Caches a compiled wgpu::RenderPipeline for the Slug fill shader, plus its bind group layout. More...

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

Public Member Functions

 GeodePipeline (const wgpu::Device &device, wgpu::TextureFormat colorFormat, bool useAlphaCoverageShader=false, uint32_t sampleCount=4)
 Create a Slug fill pipeline for the given device and color target format.
 GeodePipeline (const GeodePipeline &)=delete
GeodePipelineoperator= (const GeodePipeline &)=delete
 GeodePipeline (GeodePipeline &&) noexcept=default
 Move constructor.
GeodePipelineoperator= (GeodePipeline &&) noexcept=default
 Move assignment operator.
const wgpu::RenderPipeline & pipeline () const
 The compiled render pipeline.
const wgpu::BindGroupLayout & bindGroupLayout () const
 The bind group layout used by the pipeline.
wgpu::TextureFormat colorFormat () const
 Color format the pipeline was built for.

Detailed Description

Caches a compiled wgpu::RenderPipeline for the Slug fill shader, plus its bind group layout.

One GeodePipeline instance is sufficient per (device, render-target-format) pair — the actual data (uniforms, vertex buffers, bands, curves) varies per draw call but the pipeline state object can be reused.

The bind group layout matches the shader in shaders/slug_fill.wgsl:

  • binding 0: uniform buffer (Uniforms struct: mvp, patternFromPath, viewport, tileSize, color, fillRule, paintMode, patternOpacity)
  • binding 1: storage buffer (read-only) — Band[]
  • binding 2: storage buffer (read-only) — curve data (flat f32[])
  • binding 3: pattern tile texture (2D, Float sampleType) — sampled only when paintMode == 1. A 1x1 dummy texture is bound in solid-fill draws.
  • binding 4: pattern sampler (Filtering) — paired with binding 3.

The vertex buffer layout is:

  • location 0: vec2f position (offset 0)
  • location 1: vec2f normal (offset 8)
  • location 2: u32 bandIndex (offset 16) Stride: 20 bytes per vertex.

Constructor & Destructor Documentation

◆ GeodePipeline()

donner::geode::GeodePipeline::GeodePipeline ( const wgpu::Device & device,
wgpu::TextureFormat colorFormat,
bool useAlphaCoverageShader = false,
uint32_t sampleCount = 4 )

Create a Slug fill pipeline for the given device and color target format.

Parameters
deviceThe WebGPU device.
colorFormatThe pixel format of the render target this pipeline will draw into. Must match the target texture's format at draw time.
useAlphaCoverageShaderWhen true, selects the alpha-coverage variant of the fill shader (no @builtin(sample_mask) output).
sampleCountMSAA sample count for the pipeline's multisample state. Pass 1 for the alpha-coverage path (no MSAA), 4 otherwise.

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