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

Uniform buffer and bind group that one textured quad keeps across frames, so drawing it again with unchanged inputs writes no buffer and creates no bind group. More...

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

Public Member Functions

 RetainedQuadBinding (const RetainedQuadBinding &)=delete
RetainedQuadBinding & operator= (const RetainedQuadBinding &)=delete
 RetainedQuadBinding (RetainedQuadBinding &&) noexcept=default
 Move constructor.
RetainedQuadBinding & operator= (RetainedQuadBinding &&) noexcept=default
 Move assignment.
bool holdsTextureViews () const
 Whether this binding holds a texture view or a bind group naming one.
bool viewsTexture (const gpu::ResourceIdentity &texture) const
 Whether this binding holds a view of the texture texture, as its source, mask or backdrop.
bool bindsClipMaskView (const gpu::ResourceIdentity &view) const
 Whether this binding's bind group names the clip-mask view view. The binding does not own that view, so its owner must release this binding's views before it drops the view.
void releaseTextureViews ()
 Release the texture views and the bind group, keeping the uniform buffer and the bytes it holds.

Static Public Attributes

static constexpr uint64_t kRetainedBytes = sizeof(gpu::shader::programs::ImageBlitParams)
 GPU bytes one binding keeps: its uniform buffer. It mirrors the same number of bytes on the CPU to detect unchanged uniforms.

Friends

class GeodeTextureEncoder

Detailed Description

Uniform buffer and bind group that one textured quad keeps across frames, so drawing it again with unchanged inputs writes no buffer and creates no bind group.

The bind group is reused only with the exact textures and clip-mask view it was built from. Each texture is matched by its runtime identity, a slot plus a generation that no later texture ever takes, so a reused bind group cannot sample a texture that was destroyed, nor one whose slot now holds a different texture. A texture returned to a pool and handed out again keeps its identity, so a caller must only pass a binding when the quad's current owner rendered the texture's contents for this draw. The uniform buffer is rewritten only when the quad's uniform bytes change.

A binding serves at most one draw per frame: its uniform write reaches the queue ahead of the frame's command buffers, so a second draw recorded in the same frame would make the first read the second's bytes.

Member Function Documentation

◆ bindsClipMaskView()

bool donner::geode::GeodeTextureEncoder::RetainedQuadBinding::bindsClipMaskView ( const gpu::ResourceIdentity & view) const
nodiscard

Whether this binding's bind group names the clip-mask view view. The binding does not own that view, so its owner must release this binding's views before it drops the view.

Parameters
viewRuntime identity of the clip-mask view.

◆ releaseTextureViews()

void donner::geode::GeodeTextureEncoder::RetainedQuadBinding::releaseTextureViews ( )

Release the texture views and the bind group, keeping the uniform buffer and the bytes it holds.

The next draw through this binding rebuilds them. Call it before a texture this binding views is destroyed: on Vulkan a view is a separate object on the image, and nothing else releases it with the image.

◆ viewsTexture()

bool donner::geode::GeodeTextureEncoder::RetainedQuadBinding::viewsTexture ( const gpu::ResourceIdentity & texture) const
nodiscard

Whether this binding holds a view of the texture texture, as its source, mask or backdrop.

Parameters
textureRuntime identity of the texture.

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