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 |
| FilterExecutionResult | execute (const svg::components::FilterGraph &graph, const gpu::Texture &sourceGraphic, const gpu::TextureDescriptor &sourceGraphicDesc, const Box2d &filterRegion, const Transform2d &deviceFromFilter, FilterTextureAllocator &textureAllocator, svg::components::FilterExecutionBudget *executionBudget=nullptr, std::optional< FilterTilePlan > admittedPlan=std::nullopt, FrameCommandBufferSink *frameSink=nullptr) |
| Execute a filter graph against the source-graphic texture. | |
| void | beginFrame () |
| Begin a new frame for this engine by resetting the per-frame uniform scratch cursor. | |
| uint64_t | retainedBufferBytes () const |
| Current parameter/table allocation bytes, including buffers awaiting frame completion. | |
| FilterTilePlan | executionPlan (const svg::components::FilterGraph &graph, uint32_t width, uint32_t height, const Transform2d &deviceFromFilter) const |
| Plans bounded working textures without changing sample coordinates or resolution. | |
| void | setMaximumTileExtentForTesting (uint32_t extent) |
| Lower the working extent for deterministic tile-boundary tests. | |
| void | setChunkSubmittedHookForTesting (std::function< void(size_t)> hook) |
| Invokes p hook after each accepted command chunk. Test seam for later-chunk failures. | |
| bool | recordPassesForTesting (size_t passCount, FilterTextureAllocator &textureAllocator, FrameCommandBufferSink *frameSink=nullptr) |
| Records exactly p passCount transparent-clear passes through the chunking state machine. | |
| FilterExecutionMemory | lastExecutionMemory () const |
| Observed allocation footprint of the most recent execution; does not own resources. | |
Friends | |
| struct | FilterResourceArena |
| struct | FilterGraphExecution |
| struct | FilterNodeExecution |
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 context whose runtime device the engine records and submits through. |
| verbose | If true, emit one-shot warnings for unsupported primitives. |
| void donner::geode::GeodeFilterEngine::beginFrame | ( | ) |
Begin a new frame for this engine by resetting 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).
| FilterExecutionResult donner::geode::GeodeFilterEngine::execute | ( | const svg::components::FilterGraph & | graph, |
| const gpu::Texture & | sourceGraphic, | ||
| const gpu::TextureDescriptor & | sourceGraphicDesc, | ||
| const Box2d & | filterRegion, | ||
| const Transform2d & | deviceFromFilter, | ||
| FilterTextureAllocator & | textureAllocator, | ||
| svg::components::FilterExecutionBudget * | executionBudget = nullptr, | ||
| std::optional< FilterTilePlan > | admittedPlan = std::nullopt, | ||
| FrameCommandBufferSink * | frameSink = nullptr ) |
Execute a filter graph against the source-graphic texture.
The source texture must be sampled-capable. A FilterExecutionResult::Kind::Output result owns an RGBA8Unorm texture sized to the filter region (or the source dimensions if no region is given), which the caller releases through textureAllocator once the frame command buffer has submitted. Every intermediate the execution allocated is released back to textureAllocator before this call returns.
Filter compute, copy and clear commands are recorded into command-encoder chunks this execution owns. With a frame sink, each finished chunk joins the frame's single submission, so no chunk of the graph reaches the queue on its own and crossing the per-command-buffer pass bound costs a command buffer rather than a submission. Without one, each chunk is submitted as it closes. The caller restores its following frame encoder before compositing the result.
| graph | The filter graph to execute. |
| sourceGraphic | The input texture (layer snapshot), borrowed for the call. |
| sourceGraphicDesc | Descriptor sourceGraphic was allocated with; its extent, format and usage decide the working resolution and whether tiling can copy from the source. |
| 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. |
| executionBudget | Optional shared per-frame budget. Direct callers may omit it to apply only the graph-local limit. |
| admittedPlan | Optional immutable plan already reserved by the caller. Execution keeps this layout even if shared scratch state or planning preferences change. Invalid plans or failed execution-time budgets fail the execution instead of bypassing the filter. |
| frameSink | Collection point for the caller's open frame, or null when the execution submits on its own. When given, the caller must have closed its own recording into that frame before the call, so the source rendering this graph samples is ordered ahead of it. |
| FilterTilePlan donner::geode::GeodeFilterEngine::executionPlan | ( | const svg::components::FilterGraph & | graph, |
| uint32_t | width, | ||
| uint32_t | height, | ||
| const Transform2d & | deviceFromFilter ) const |
Plans bounded working textures without changing sample coordinates or resolution.
| graph | Graph to execute. |
| width | Source width. |
| height | Source height. |
| deviceFromFilter | Original filter-to-device transform. |
| void donner::geode::GeodeFilterEngine::setMaximumTileExtentForTesting | ( | uint32_t | extent | ) |
Lower the working extent for deterministic tile-boundary tests.
| extent | Maximum dimension, between 16 and 512 pixels. |