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

GPU filter-graph executor. More...

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

Public Member Functions

 GeodeFilterEngine (GeodeDevice &device, bool verbose=false)
 GeodeFilterEngine (const GeodeFilterEngine &)=delete
GeodeFilterEngineoperator= (const GeodeFilterEngine &)=delete
wgpu::Texture execute (const svg::components::FilterGraph &graph, const wgpu::Texture &sourceGraphic, const Box2d &filterRegion, const Transform2d &deviceFromFilter)
 Execute a filter graph against the source-graphic texture.

Detailed Description

GPU filter-graph executor.

Given a FilterGraph and a source-graphic texture (the offscreen layer snapshot captured between pushFilterLayer / popFilterLayer), executes the graph's primitives on the GPU and returns the final output texture.

Intermediate textures between primitives are allocated on demand and keyed by result names.

Currently supports:

  • feGaussianBlur (two-pass separable Gaussian via compute shader)
  • feOffset (pixel shift via compute shader)
  • feColorMatrix (4x5 matrix transform via compute shader)
  • feFlood (constant color fill via compute shader)
  • feMerge (alpha-over composite of N inputs via compute shader)
  • feComposite (Porter-Duff compositing of two inputs via compute shader)
  • feBlend (W3C Compositing 1 blend modes via compute shader)
  • feMorphology (erode / dilate via min / max rectangular kernel)
  • feComponentTransfer (per-channel LUT transform via compute shader)
  • feConvolveMatrix (NxM kernel convolution via compute shader)
  • feTurbulence (Perlin noise / fractal noise via compute shader)
  • feDisplacementMap (per-pixel channel-driven displacement via compute shader)
  • feDiffuseLighting (Lambertian shading with distant/point/spot lights)
  • feSpecularLighting (Phong shading with distant/point/spot lights)
  • feDropShadow (blur alpha + offset + flood-tint + source-over)
  • feImage (bilinear placement of external raster / in-document fragment)
  • feTile (wraparound tiling of input subregion across filter region)

Unsupported primitives pass the current buffer through unchanged.

Constructor & Destructor Documentation

◆ GeodeFilterEngine()

donner::geode::GeodeFilterEngine::GeodeFilterEngine ( GeodeDevice & device,
bool verbose = false )
explicit
Parameters
deviceThe Geode device (owns wgpu::Device + queue).
verboseIf true, emit one-shot warnings for unsupported primitives.

Member Function Documentation

◆ execute()

wgpu::Texture donner::geode::GeodeFilterEngine::execute ( const svg::components::FilterGraph & graph,
const wgpu::Texture & sourceGraphic,
const Box2d & filterRegion,
const Transform2d & deviceFromFilter )

Execute a filter graph against the source-graphic texture.

The source texture must be RGBA8Unorm with TextureBinding usage. The returned texture is a freshly-allocated RGBA8Unorm texture sized to the filter region (or the source dimensions if no region is given).

Parameters
graphThe filter graph to execute.
sourceGraphicThe input texture (layer snapshot).
filterRegionThe filter region in user-space coordinates.
deviceFromFilterThe combined transform from filter/user-space to device-pixel coordinates, captured at pushFilterLayer time. Used to derive per-axis scale factors and to project directional parameters (e.g. feOffset dx/dy) through rotation/skew.
Returns
The filtered output texture (RGBA8Unorm, TextureBinding | CopySrc).

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