Donner SVG main
0.8.0 ยท 766e862a0.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
donner::geode::GeodeResidentGradientSlot Struct Reference

GPU-resident geometry for one gradient-painted fill. Mirrors GeodeResidentSlot. A combined-usage buffer holds the same eight analytic dual-ray SSBO regions, but the uniform region holds the 704-byte gradient uniform block (stops inline, donner/gpu/shader/programs/SlugGradientSource.h) and the cached bind group uses the reflected gradient pipeline layout with the active clip mask's view (or the device-owned placeholder) and the placeholder stop-ramp texture. Residence is not taken while a mask pass is open, exactly like the solid-fill residence gate; a draw under a clip polygon stays resident, its uniform carrying the polygon's planes. More...

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

Classes

struct  Region
 A byte sub-range of buffer (same semantics as GeodeResidentSlot::Region). More...

Public Member Functions

void replaceRamp (std::shared_ptr< const GeodeGradientRamp > newRamp, gpu::BindGroup newBindGroup)
 Replace ramp and rampBindGroup, parking the old ones in the slab until the next frame boundary.
bool reserveUniformMirror (uint64_t bytes)
 Replace the cached gradient uniform's CPU-byte reservation.
 GeodeResidentGradientSlot (const GeodeResidentGradientSlot &)=delete
GeodeResidentGradientSlot & operator= (const GeodeResidentGradientSlot &)=delete
 GeodeResidentGradientSlot (GeodeResidentGradientSlot &&other) noexcept=default
 Transfer slab handles, cached bindings, and CPU reservations.
GeodeResidentGradientSlot & operator= (GeodeResidentGradientSlot &&other) noexcept
 Release the current slot and take ownership of another gradient slot's resources.
void reset ()
 Return the slab allocation and drop the bind group + borrowed handle. Never calls Buffer::destroy(); see GeodeResidentSlot::reset.

Public Attributes

gpu::BufferRef buffer
 Combined Storage|Uniform|CopyDst buffer, borrowed from the owning GeodeResidentSlab chunk; region offsets are ABSOLUTE buffer offsets. Region layout matches GeodeResidentSlot, with the uniform region sized for GradientUniforms (704 bytes).
uint64_t bufferId = 0
 Stable identity of buffer (see GeodeDevice::AllocateBufferId), so returning the allocation matches the owning chunk by identity rather than by a handle address the allocator can recycle.
std::shared_ptr< GeodeResidentSlab > slab
 Slab that owns buffer, this device's geometry slab for the document; null until residence is established. Held by shared_ptr so the slab outlives every slot allocated from it, whichever of the two the document lets go of first.
uint64_t allocationOffset = 0
 Whole-slot allocation inside the slab, returned via free on reset.
uint64_t allocationSize = 0
 Number of bytes occupied by this gradient slot's allocation.
gpu::BindGroup bindGroup
 Cached gradient bind group. All bindings reference stable objects (this slot's buffer sub-ranges, boundClipMaskView, and the device-owned placeholder stop-ramp texture), so it survives frames and encoders. A gradient with more stops than the uniform carries inline binds rampBindGroup instead.
gpu::TextureViewRef boundClipMaskView
 Clip-mask view both cached groups bind: the active path-clip mask's view, which the renderer keeps across frames, or the device's identity-coverage dummy. A draw under a different mask drops both groups and builds them again.
std::shared_ptr< const GeodeGradientRamp > ramp
 Stop ramp of the last draw whose gradient had more stops than the uniform carries inline, and the cached group that binds it with this slot's regions. Both are replaced only when the stops or the geometry change.
gpu::BindGroup rampBindGroup
 Gradient bind group binding ramp.
Region bands
 Horizontal band SSBO (binding 1).
Region curves
 Horizontal curve SSBO (binding 2).
Region hRefs
 Horizontal curve-reference SSBO (binding 9).
Region vBands
 Vertical band SSBO (binding 5).
Region vCurves
 Vertical curve SSBO (binding 6).
Region vRefs
 Vertical curve-reference SSBO (binding 10).
Region hGrid
 Horizontal band grid (binding 7).
Region vGrid
 Vertical band grid (binding 8).
Region uniform
 Per-draw gradient uniform block (binding 0, 256-aligned).
uint32_t vertexCount = 0
 Triangle-fan draw count generated from vertex_index.
uint64_t lastResidentFrame = ~uint64_t{0}
 Frame index in which this slot was last drawn via the resident path. A slot's single uniform buffer + cached bind group can only serve ONE draw per frame; see GeodeResidentSlot::lastResidentFrame.
uint64_t owningDeviceId = 0
 Process-unique device id of the device that created the resources; see GeodeResidentSlot::owningDeviceId.
bool resident = false
 True once buffer + bindGroup hold the current encode.
const void * encodedKey = nullptr
 Identity guard: address + cheap fingerprint of the uploaded encode.
uint64_t encodedFingerprint = 0
 Size-based fingerprint of the last uploaded encoded gradient path.
std::vector< uint8_t > lastUniform
 Bytes last written to the uniform region; unchanged draws skip the write.
GeodeGeometryCacheReservation cpuMirrorReservation
 Charged CPU uniform mirror storage.
uint64_t cpuUniformBytes = 0
 Capacity bytes reserved for the cached uniform.

Detailed Description

GPU-resident geometry for one gradient-painted fill. Mirrors GeodeResidentSlot. A combined-usage buffer holds the same eight analytic dual-ray SSBO regions, but the uniform region holds the 704-byte gradient uniform block (stops inline, donner/gpu/shader/programs/SlugGradientSource.h) and the cached bind group uses the reflected gradient pipeline layout with the active clip mask's view (or the device-owned placeholder) and the placeholder stop-ramp texture. Residence is not taken while a mask pass is open, exactly like the solid-fill residence gate; a draw under a clip polygon stays resident, its uniform carrying the polygon's planes.


Class Documentation

◆ donner::geode::GeodeResidentGradientSlot::Region

struct donner::geode::GeodeResidentGradientSlot::Region

A byte sub-range of buffer (same semantics as GeodeResidentSlot::Region).

Class Members
uint64_t offset = 0
uint64_t size = 0

Constructor & Destructor Documentation

◆ GeodeResidentGradientSlot()

donner::geode::GeodeResidentGradientSlot::GeodeResidentGradientSlot ( GeodeResidentGradientSlot && other)
defaultnoexcept

Transfer slab handles, cached bindings, and CPU reservations.

Parameters
otherGradient slot whose resource ownership is transferred.

Member Function Documentation

◆ operator=()

GeodeResidentGradientSlot & donner::geode::GeodeResidentGradientSlot::operator= ( GeodeResidentGradientSlot && other)
inlinenoexcept

Release the current slot and take ownership of another gradient slot's resources.

Parameters
otherSlot whose resources are moved into this one.
Returns
This gradient slot after the transfer.

◆ replaceRamp()

void donner::geode::GeodeResidentGradientSlot::replaceRamp ( std::shared_ptr< const GeodeGradientRamp > newRamp,
gpu::BindGroup newBindGroup )
inline

Replace ramp and rampBindGroup, parking the old ones in the slab until the next frame boundary.

Parameters
newRampRamp to keep.
newBindGroupGroup binding it with this slot's regions.

◆ reserveUniformMirror()

bool donner::geode::GeodeResidentGradientSlot::reserveUniformMirror ( uint64_t bytes)
inline

Replace the cached gradient uniform's CPU-byte reservation.

Parameters
bytesNew uniform mirror capacity in bytes.
Returns
False if the document budget refuses the replacement charge.

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