Donner 0.5.1
Embeddable browser-grade SVG2 engine
Loading...
Searching...
No Matches
donner::svg::compositor::LayerResolver Class Reference

Stateless resolver that collapses CompositorHintComponent entries into ComputedLayerAssignmentComponent assignments, subject to a layer budget. More...

#include "donner/svg/compositor/LayerResolver.h"

Public Member Functions

void resolve (Registry &registry, uint32_t maxLayers, const ResolveOptions &options={})
 Run one resolution pass over registry.
const LayerResolverStatsstats () const
 Stats from the most recent resolve() call. Zeroed before each run.

Detailed Description

Stateless resolver that collapses CompositorHintComponent entries into ComputedLayerAssignmentComponent assignments, subject to a layer budget.

Algorithm (see design doc § Layer Promotion Cascade):

  1. Collect candidates — entities with at least one hint.
  2. Mandatory hints are non-contestable; they always take a layer.
  3. Rank remaining candidates by total weight descending, ties broken by numeric entity id ascending (deterministic; draw-order tie-breaking is a Phase 2 follow-up).
  4. Assign consecutive layerIds starting at 1, up to maxLayers. Losers have their ComputedLayerAssignmentComponent removed (or never attached).

Determinism: repeated calls on unchanged registry state produce identical assignments. ComputedLayerAssignmentComponent is only written when the assigned layerId changes, reducing ECS churn.

Member Function Documentation

◆ resolve()

void donner::svg::compositor::LayerResolver::resolve ( Registry & registry,
uint32_t maxLayers,
const ResolveOptions & options = {} )

Run one resolution pass over registry.

Parameters
registryRegistry to inspect and update.
maxLayersMaximum number of non-root layers to assign. Defaults to kMaxCompositorLayers (see CompositorController.h). The parameter is a bare integer here to keep LayerResolver.h independent of the controller.
optionsPer-source enable/disable flags (default: all sources on).

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