Donner SVG 0.8.0
0.8.0 ยท ebf353960.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
donner::geode::GeodeCheckerboardPipeline Class Reference

Caches the compiled render pipeline that draws the transparency checkerboard behind see-through document regions, plus its bind group layout. More...

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

Public Types

enum class  BlendMode {
  Replace ,
  DestinationOver
}
 How the emitted checkerboard combines with whatever is already in the target. More...
using Uniforms = gpu::shader::programs::CheckerboardParams
 Uniform block consumed by the checkerboard shader; its layout is verified against the compiled artifact.

Public Member Functions

 GeodeCheckerboardPipeline (gpu::Device &device, gpu::TextureFormat colorFormat, BlendMode blendMode=BlendMode::Replace)
 Create the checkerboard pipeline for the given device and target format.
 GeodeCheckerboardPipeline (const GeodeCheckerboardPipeline &)=delete
GeodeCheckerboardPipeline & operator= (const GeodeCheckerboardPipeline &)=delete
 GeodeCheckerboardPipeline (GeodeCheckerboardPipeline &&) noexcept=default
 Move constructor.
GeodeCheckerboardPipeline & operator= (GeodeCheckerboardPipeline &&) noexcept=default
 Move assignment operator.
bool valid () const
 True when the shader, bind group layout, and pipeline all compiled.
const gpu::RenderPipeline & pipeline () const
 The compiled render pipeline.
const gpu::BindGroupLayout & bindGroupLayout () const
 Bind group layout used by the pipeline.
uint32_t uniformBinding () const
 Reflected binding of the Uniforms buffer within group 0.

Detailed Description

Caches the compiled render pipeline that draws the transparency checkerboard behind see-through document regions, plus its bind group layout.

Owned by GeodeDevice (lazily, via GeodeDevice::checkerboardPipeline() and GeodeDevice::checkerboardUnderlayPipeline()) so every consumer sharing the device reuses one compiled pipeline per blend mode - the backend retains every pipeline ever constructed, so per-consumer construction leaks (issue #575).

The bind group layout holds one uniform buffer (Uniforms) at the slot the precompiled artifact reflects; see uniformBinding.

The pipeline takes no vertex buffer - the shader emits a fullscreen triangle from @builtin(vertex_index). A draw call is pass.draw(3, 1, 0, 0). The caller owns its uniform buffer and bind group; Uniforms pins the layout contract between the two.

Member Enumeration Documentation

◆ BlendMode

How the emitted checkerboard combines with whatever is already in the target.

Enumerator
Replace 

Overwrite the target.

Used when the checkerboard is drawn first, before any document pixels land on top of it, which is what the editor's window framebuffer does.

DestinationOver 

Composite the checkerboard under the target's existing premultiplied content: result = dst + checker * (1 - dst.alpha).

For a target that already holds composed document pixels, where the checkerboard has to fill whatever alpha they left behind instead of going in first.

Constructor & Destructor Documentation

◆ GeodeCheckerboardPipeline()

donner::geode::GeodeCheckerboardPipeline::GeodeCheckerboardPipeline ( gpu::Device & device,
gpu::TextureFormat colorFormat,
BlendMode blendMode = BlendMode::Replace )

Create the checkerboard pipeline for the given device and target format.

Parameters
deviceRuntime device the pipeline and its layouts are created on.
colorFormatThe pixel format of the render target this pipeline will draw into. Must match the target texture's format at draw time.
blendModeHow the emitted checkerboard combines with the target.

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