|
|
Donner SVG 0.8.0-pre
SVG editor and embeddable C++20 engine.
|
WebGPU texture snapshot exported by RendererGeode. More...
#include "donner/svg/renderer/RendererGeode.h"
Public Member Functions | |
| RendererGeodeTextureSnapshot (std::shared_ptr< geode::GeodeDevice > device, wgpu::Texture texture, Vector2i dimensions, wgpu::TextureFormat format, AlphaType alphaType=AlphaType::Premultiplied) | |
| Construct a Geode texture snapshot. | |
| RendererGeodeTextureSnapshot (const RendererGeodeTextureSnapshot &)=delete | |
| RendererGeodeTextureSnapshot & | operator= (const RendererGeodeTextureSnapshot &)=delete |
| RendererGeodeTextureSnapshot (RendererGeodeTextureSnapshot &&) noexcept=default | |
| RendererGeodeTextureSnapshot & | operator= (RendererGeodeTextureSnapshot &&other) noexcept |
| RendererTextureSnapshotBackend | backend () const override |
| Renderer backend that produced this texture. | |
| Vector2i | dimensions () const override |
| Valid content extent in device pixels, anchored at the texture origin. Sampling and readback are confined to this region even when the backing texture is larger. | |
| AlphaType | alphaType () const override |
| Alpha interpretation of the texture contents. | |
| RendererBitmap | takeSnapshot () const override |
| Capture a CPU-readable copy of this texture. | |
| void | setDimensions (Vector2i dimensions) |
| Re-point the snapshot at a different content extent inside the same backing texture. | |
| const wgpu::Texture & | texture () const |
| Resolved single-sample WebGPU texture. | |
| const wgpu::TextureView & | textureView () const |
| Lazily-created texture view suitable for ImGui_ImplWGPU's ImTextureID. | |
| wgpu::TextureFormat | format () const |
| WebGPU texture format. | |
Static Public Member Functions | |
| static RendererGeodeTextureSnapshot | AdoptRuntimeTexture (std::shared_ptr< geode::GeodeDevice > device, gpu::Texture texture, Vector2i dimensions, wgpu::TextureFormat format, AlphaType alphaType) |
| Takes over a target the runtime allocated, so the snapshot keeps it alive after the renderer has let go of it. | |
Friends | |
| class | RendererGeode |
WebGPU texture snapshot exported by RendererGeode.
The snapshot keeps the backing geode::GeodeDevice and texture alive so editor presentation code can sample the texture after the renderer has moved on to a later frame.
The snapshot is also the single owner for host-uploaded CPU bitmaps that presentation code wants to draw through Geode. Those uploads keep an oversized backing allocation so a resized payload can reuse the texture, so dimensions() reports the valid content extent rather than the allocation, and alphaType() reports the uploaded pixel format.
| donner::svg::RendererGeodeTextureSnapshot::RendererGeodeTextureSnapshot | ( | std::shared_ptr< geode::GeodeDevice > | device, |
| wgpu::Texture | texture, | ||
| Vector2i | dimensions, | ||
| wgpu::TextureFormat | format, | ||
| AlphaType | alphaType = AlphaType::Premultiplied ) |
Construct a Geode texture snapshot.
| device | Shared Geode device that owns the WebGPU handle lifetime. |
| texture | Resolved single-sample texture containing the rendered frame. |
| dimensions | Valid content dimensions in device pixels, anchored at the texture origin. May be smaller than the texture when the producer keeps an oversized allocation. |
| format | Texture format. |
| alphaType | Alpha interpretation of the stored texels. Geode render targets are premultiplied; host-uploaded CPU bitmaps generally are not. |
|
static |
Takes over a target the runtime allocated, so the snapshot keeps it alive after the renderer has let go of it.
| device | Device the texture belongs to. |
| texture | Runtime texture handle to take ownership of. |
| dimensions | Texture dimensions in pixels. |
| format | Texel format. |
| alphaType | Alpha interpretation of the stored pixels. |
|
inlinenodiscardoverridevirtual |
Alpha interpretation of the texture contents.
Implements donner::svg::RendererTextureSnapshot.
|
inlinenodiscardoverridevirtual |
Renderer backend that produced this texture.
Reimplemented from donner::svg::RendererTextureSnapshot.
|
inlinenodiscardoverridevirtual |
Valid content extent in device pixels, anchored at the texture origin. Sampling and readback are confined to this region even when the backing texture is larger.
Implements donner::svg::RendererTextureSnapshot.
|
inline |
Re-point the snapshot at a different content extent inside the same backing texture.
Uploaders that keep an oversized allocation alive across re-uploads call this after writing a payload whose dimensions changed. The new extent must fit within the backing texture.
| dimensions | Valid content dimensions in device pixels. |
|
nodiscardoverridevirtual |
Capture a CPU-readable copy of this texture.
Backends that cannot read texture snapshots return an empty bitmap. The operation may submit GPU work and block for completion, so presentation code should keep using the texture directly and reserve readback for explicit capture, diagnostics, and tests.
Reimplemented from donner::svg::RendererTextureSnapshot.