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

Caches a compiled wgpu::RenderPipeline for the image-blit shader plus its bind group layout and two reusable samplers (linear and nearest). More...

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

Public Member Functions

 GeodeImagePipeline (const wgpu::Device &device, wgpu::TextureFormat colorFormat, uint32_t sampleCount=4)
 Create an image-blit pipeline for the given device and target format.
 GeodeImagePipeline (const GeodeImagePipeline &)=delete
GeodeImagePipelineoperator= (const GeodeImagePipeline &)=delete
 GeodeImagePipeline (GeodeImagePipeline &&) noexcept=default
 Move constructor.
GeodeImagePipelineoperator= (GeodeImagePipeline &&) noexcept=default
 Move assignment operator.
const wgpu::RenderPipeline & pipeline () const
 The compiled render pipeline.
const wgpu::BindGroupLayout & bindGroupLayout () const
 Bind group layout used by the pipeline.
const wgpu::Sampler & linearSampler () const
 Bilinear (mag/min filter = Linear) sampler, clamped to edge. Used for the default image-rendering and the SVG spec's "smooth" image sampling.
const wgpu::Sampler & nearestSampler () const
 Nearest-neighbor sampler, clamped to edge. Used when ImageParams::imageRenderingPixelated is true.
const wgpu::Sampler & clipMaskSampler () const
 Linear clamp-to-edge sampler used for Phase 3b clip-mask textures.
wgpu::TextureFormat colorFormat () const
 Color format the pipeline was built for.

Detailed Description

Caches a compiled wgpu::RenderPipeline for the image-blit shader plus its bind group layout and two reusable samplers (linear and nearest).

One GeodeImagePipeline is sufficient per (device, render-target-format) pair. It is used both by drawImage (SVG <image> elements) and, in Phase 2H, by the pattern renderer: the pattern tile is rendered to an offscreen texture and then sampled with this same pipeline as a repeating fill.

Bind group layout (matches shaders/image_blit.wgsl):

  • binding 0: uniform buffer (mvp, destRect, srcRect, targetSize, opacity, flags)
  • binding 1: sampler (filter mode chosen at draw time)
  • binding 2: sampled texture 2D (float)
  • binding 3: sampled mask texture for <mask> luminance mode
  • binding 4: sampled destination snapshot for mix-blend-mode
  • binding 5: sampled Phase 3b clip-mask texture
  • binding 6: clip-mask sampler (always linear clamp-to-edge)

The pipeline takes no vertex buffer — the shader generates quad corners from @builtin(vertex_index). A draw call is pass.Draw(6, 1, 0, 0).

Constructor & Destructor Documentation

◆ GeodeImagePipeline()

donner::geode::GeodeImagePipeline::GeodeImagePipeline ( const wgpu::Device & device,
wgpu::TextureFormat colorFormat,
uint32_t sampleCount = 4 )

Create an image-blit pipeline for the given device and 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.
sampleCountMSAA sample count (1 for alpha-coverage, 4 otherwise).

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