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

Caches a compiled render pipeline 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 (GeodeWgpuAdapterDevice &adapterDevice, gpu::TextureFormat colorFormat)
 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 gpu::RenderPipelinepipeline () const
 The compiled render pipeline.
const gpu::BindGroupLayoutbindGroupLayout () const
 Bind group layout used by the pipeline.
const gpu::SamplerlinearSampler () 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 gpu::SamplernearestSampler () const
 Nearest-neighbor sampler, clamped to edge. Used when ImageRendering::CrispEdges or its legacy alias is selected.
const gpu::SamplerclipMaskSampler () const
 Linear clamp-to-edge sampler used for path-clip mask textures.
gpu::TextureFormat colorFormat () const
 Color format the pipeline was built for.

Detailed Description

Caches a compiled render pipeline 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 by the pattern renderer: the pattern tile is rendered to an offscreen texture and then sampled with this same pipeline as a repeating fill.

The pipeline and samplers are created through the donner::gpu runtime, which owns them through RAII handles.

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 path-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 ( GeodeWgpuAdapterDevice & adapterDevice,
gpu::TextureFormat colorFormat )

Create an image-blit pipeline for the given device and 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.

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