|
|
Donner SVG 0.8.0-pre
SVG editor and embeddable C++20 engine.
|
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 | |
| GeodeFilterEngine & | operator= (const GeodeFilterEngine &)=delete |
| wgpu::Texture | execute (const svg::components::FilterGraph &graph, const wgpu::Texture &sourceGraphic, const Box2d &filterRegion, const Transform2d &deviceFromFilter, FilterTextureAllocator &textureAllocator, ScopedWgpuHandle< wgpu::CommandEncoder > &commandEncoder, svg::components::FilterExecutionBudget *executionBudget=nullptr) |
| Execute a filter graph against the source-graphic texture. | |
| void | beginFrame () |
| Begin a new frame for this engine: reset the frame-scoped chunk pass counter (so the 64-pass command-buffer bound covers every filter graph recorded into the frame's shared encoder, not just one execute() call) and reset the per-frame uniform scratch cursor. | |
Friends | |
| struct | FilterGraphExecution |
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:
Unsupported primitives pass the current buffer through unchanged.
|
explicit |
| device | The Geode device (owns wgpu::Device + queue). |
| verbose | If true, emit one-shot warnings for unsupported primitives. |
| void donner::geode::GeodeFilterEngine::beginFrame | ( | ) |
Begin a new frame for this engine: reset the frame-scoped chunk pass counter (so the 64-pass command-buffer bound covers every filter graph recorded into the frame's shared encoder, not just one execute() call) and reset the per-frame uniform scratch cursor.
The renderer calls this once per frame from its own beginFrame, BEFORE the filter texture pool runs its stale-bucket eviction, and before any filter pass of the frame records. Uniform slots written after this call reuse stable (buffer, offset) pairs across frames. The cursor itself is mutex-guarded, but callers must still serialize one frame per device at a time: two sibling renderers drawing concurrently on the same device would alias uniform slots and rewind the cursor under recorded passes (the renderer's architecture already serializes the render worker per device).
| wgpu::Texture donner::geode::GeodeFilterEngine::execute | ( | const svg::components::FilterGraph & | graph, |
| const wgpu::Texture & | sourceGraphic, | ||
| const Box2d & | filterRegion, | ||
| const Transform2d & | deviceFromFilter, | ||
| FilterTextureAllocator & | textureAllocator, | ||
| ScopedWgpuHandle< wgpu::CommandEncoder > & | commandEncoder, | ||
| svg::components::FilterExecutionBudget * | executionBudget = nullptr ) |
Execute a filter graph against the source-graphic texture.
The source texture must be RGBA8Unorm with TextureBinding usage. The returned texture is an RGBA8Unorm texture sized to the filter region (or the source dimensions if no region is given). Its lifetime is retained by textureAllocator until the frame command buffer has submitted.
| graph | The filter graph to execute. |
| sourceGraphic | The input texture (layer snapshot). |
| filterRegion | The filter region in user-space coordinates. |
| deviceFromFilter | The 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. |
| textureAllocator | Renderer-owned filter texture pool boundary. |
| commandEncoder | The frame command encoder slot. Filter compute passes are recorded after the source render pass and before the filtered result is composited. Pathological filter graphs (for example a huge-radius feMorphology decomposing into thousands of passes) chunk this slot: the current command buffer is submitted and a fresh encoder is installed in the slot every 64 passes, so no single command buffer grows without bound while small filters keep the two-submissions-per-frame shape. |
| executionBudget | Optional shared per-frame budget. Direct callers may omit it to apply only the graph-local limit. |