Donner SVG 0.8.0-pre
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
donner::geode::GeodePipeline Class Reference

Caches a compiled render pipeline for the Slug fill shader, plus its bind group layout. More...

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

Public Member Functions

 GeodePipeline (GeodeWgpuAdapterDevice &adapterDevice, gpu::TextureFormat colorFormat)
 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 gpu::RenderPipelinepipeline () const
 The compiled render pipeline. Its entry points take the draw's paint and geometry parameters from the uniform, which serves every draw whose instances share one paint and one encoded path.
const gpu::RenderPipelinebatchedPipeline () const
 The cross-entity batch variant of pipeline: same layout, same shader module and same blending, but the entry points that take paint and geometry from each instance's record.
const gpu::BindGroupLayoutbindGroupLayout () const
 The bind group layout used by both pipelines.
gpu::TextureFormat colorFormat () const
 Color format the pipeline was built for.

Detailed Description

Caches a compiled render pipeline 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, bands, curves) varies per draw call but the pipeline state object can be reused.

The pipeline is created through the donner::gpu runtime, which owns it through RAII

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

  • binding 0: uniform buffer (Uniforms struct: mvp, patternFromPath, viewport, tileSize, clip state, and the draw-level copy of the paint / geometry parameters)
  • 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.
  • binding 5: nested clip-mask texture.
  • binding 6: nested clip-mask sampler.
  • binding 7: per-instance records. Only a cross-entity batch reads more than the transform here; every other draw binds the device's shared identity record.
  • bindings 8 and 9: vertical Band[] and canonical curve data.
  • binding 10: the four dense grid arrays in one combined storage range, indexed through the per-draw or per-instance element bases.
  • binding 11: gradient paint blocks, addressed by each record's element base.

The pipeline has no vertex buffer. Its shader expands the uniform bounding polygon into a triangle fan from vertex_index and applies the half-pixel AA halo in device space.

Constructor & Destructor Documentation

◆ GeodePipeline()

donner::geode::GeodePipeline::GeodePipeline ( GeodeWgpuAdapterDevice & adapterDevice,
gpu::TextureFormat colorFormat )

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

Parameters
adapterDeviceThe Donner GPU device (wgpu adapter) owned by the GeodeDevice.
colorFormatThe pixel format of the render target this pipeline will draw into. Must match the target texture's format at draw time.

Member Function Documentation

◆ batchedPipeline()

const gpu::RenderPipeline & donner::geode::GeodePipeline::batchedPipeline ( ) const

The cross-entity batch variant of pipeline: same layout, same shader module and same blending, but the entry points that take paint and geometry from each instance's record.

Compiled on first call, because only a cross-entity batch needs it.


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