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

Draws the transparency checkerboard over a Geode-owned render target. More...

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

Public Member Functions

 GeodeCheckerboardPass (const GeodeCheckerboardPass &)=delete
GeodeCheckerboardPass & operator= (const GeodeCheckerboardPass &)=delete
 GeodeCheckerboardPass (GeodeCheckerboardPass &&) noexcept=default
 Move constructor.
GeodeCheckerboardPass & operator= (GeodeCheckerboardPass &&) noexcept=default
 Move assignment operator.
bool draw (GeodeDevice &device, const wgpu::Texture &target, Vector2i targetSizePx, const CheckerboardUnderlayParams &params, GeodeCheckerboardPipeline::BlendMode blendMode)
 Submit one checkerboard pass over target.

Detailed Description

Draws the transparency checkerboard over a Geode-owned render target.

This is the single checkerboard draw in the project. It is deliberately Geode-only: the checkerboard exists so see-through document pixels reach a GPU presentation surface with something behind them, and there is no software presentation path that needs one. Putting it here instead of on RendererInterface keeps a GPU-only concern out of the backend-neutral interface every renderer has to implement.

One instance per consumer: the compiled pipeline and its bind group layout are shared device-wide (issue #575), but the uniform buffer and bind group are per-consumer and are built on the first draw, so a consumer that never draws a checkerboard never allocates them.

Member Function Documentation

◆ draw()

bool donner::geode::GeodeCheckerboardPass::draw ( GeodeDevice & device,
const wgpu::Texture & target,
Vector2i targetSizePx,
const CheckerboardUnderlayParams & params,
GeodeCheckerboardPipeline::BlendMode blendMode )
nodiscard

Submit one checkerboard pass over target.

With GeodeCheckerboardPipeline::BlendMode::Replace the pass overwrites the scissored region, so it must run before any document pixels land in the target. With GeodeCheckerboardPipeline::BlendMode::DestinationOver it goes underneath premultiplied content already in the target: fully-opaque pixels are unchanged, fully-transparent pixels become checkerboard, and partial alpha blends as destination-over does.

Parameters
deviceDevice that owns target and the shared pipeline.
targetRender target owned by the embedding surface. Needs RenderAttachment usage and the device's texture format.
targetSizePxTarget size in device pixels.
paramsCheckerboard placement and appearance.
blendModeHow the checkerboard combines with the target's contents.
Returns
True when the pass was submitted. Degenerate parameters and a failed pipeline or resource creation return false and leave target untouched.

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