Skip to content

ludus::graphics::renderer::RenderGraphCapture

Ludus Wiki · API overview · Browse API

Class

Renders a frozen scene through a private RenderGraph until a target sample count and reads back the linear mean of the Accumulate that feeds the chosen output.
The capture owns its RenderGraph, so an interactive graph on the same device keeps its drawable output, accumulation and pending samples. It sets RenderGraph::SetAccumulationLimitOverride to the target, so the target may exceed the authored Accumulate limit. Only ray outputs with an Accumulate are captured: raster outputs are display-encoded, not linear radiance. Owner thread only, between frames; never waits for the GPU. The device and surface outlive the capture or Release runs first. The surface's frames are submitted like RenderGraph::Render; use an offscreen surface where presentation is unwanted.

Declared in modules/graphics/renderer/include/ludus/graphics/renderer/render_graph_capture.hpp

#include <ludus/graphics/renderer/render_graph_capture.hpp>
class ludus::graphics::renderer::RenderGraphCapture final

Methods

RenderGraphCapture

ludus::graphics::renderer::RenderGraphCapture::RenderGraphCapture() noexcept
Construct an idle capture.

Declared in modules/graphics/renderer/include/ludus/graphics/renderer/render_graph_capture.hpp

~RenderGraphCapture

ludus::graphics::renderer::RenderGraphCapture::~RenderGraphCapture() noexcept
Release; see Release.

Declared in modules/graphics/renderer/include/ludus/graphics/renderer/render_graph_capture.hpp

RenderGraphCapture

ludus::graphics::renderer::RenderGraphCapture::RenderGraphCapture(const RenderGraphCapture &)=delete
Ownership is noncopyable.

Declared in modules/graphics/renderer/include/ludus/graphics/renderer/render_graph_capture.hpp

operator=

RenderGraphCapture & ludus::graphics::renderer::RenderGraphCapture::operator=(const RenderGraphCapture &)=delete
Ownership is nonassignable.

Related types: RenderGraphCapture

Declared in modules/graphics/renderer/include/ludus/graphics/renderer/render_graph_capture.hpp

Start

rhi::RasterStatus ludus::graphics::renderer::RenderGraphCapture::Start(rhi::DeviceHandle device, rhi::SurfaceHandle surface, const RenderGraphPlan &plan, const RenderGraphPrograms &programs, foundation::uint32 referenceWidth, foundation::uint32 referenceHeight, const RenderGraphCaptureSettings &settings) noexcept
Resolve the captured route and begin initializing a private graph. Any earlier capture is released.
ParameterDescription
device
Ready owned device without an open frame.
surface
Surface whose frames the capture submits.
plan
Numeric plan; copied by the graph.
programs
Cooked stages; their storage stays alive until the phase leaves Initializing.
referenceWidth
Drawable view width for view-relative resources.
referenceHeight
Drawable view height for view-relative resources.
settings
Output, target and identities; copied.

Returns

Ready or Pending when initialization started; InvalidDescription with GetProblem set when the route or settings are rejected; the graph's failure otherwise. Failure leaves the capture Failed.

Related types: foundation::uint32 · rhi::RasterStatus · RenderGraphCaptureSettings · RenderGraphPlan · RenderGraphPrograms · rhi::DeviceHandle · rhi::SurfaceHandle

Declared in modules/graphics/renderer/include/ludus/graphics/renderer/render_graph_capture.hpp

SubmitScene

rhi::RasterStatus ludus::graphics::renderer::RenderGraphCapture::SubmitScene(foundation::BorrowedView< const RenderGraphMesh > meshes, foundation::BorrowedView< const RenderGraphItem > items, foundation::BorrowedView< const ViewDescription > cameras, foundation::uint64 sceneRevision, const SceneShaderInputs *sceneInputsOrNull=nullptr) noexcept
Submit the frozen scene once the phase is AwaitingScene. Inputs are borrowed only for this call, as with RenderGraph::Update; the scene and camera then belong to the capture.
ParameterDescription
meshes
Static geometry table.
items
Instances, transforms and material bindings.
cameras
Complete camera table of the plan.
sceneRevision
Nonzero identity; equal inputs and revision reproduce the capture bit for bit.
sceneInputsOrNull
Optional material, light and environment inputs.

Returns

Ready or Pending when accepted; InvalidState outside AwaitingScene; the graph's rejection otherwise, which fails the capture.

Related types: foundation::BorrowedView · foundation::uint64 · rhi::RasterStatus · RenderGraphItem · RenderGraphMesh · SceneShaderInputs · ViewDescription

Declared in modules/graphics/renderer/include/ludus/graphics/renderer/render_graph_capture.hpp

Service

RenderGraphCapturePhase ludus::graphics::renderer::RenderGraphCapture::Service() noexcept
Advance initialization, scene preparation, at most one frame submission, or the read-back. Never waits for the GPU. Returns the resulting phase.

Related types: RenderGraphCapturePhase

Declared in modules/graphics/renderer/include/ludus/graphics/renderer/render_graph_capture.hpp

Stop

void ludus::graphics::renderer::RenderGraphCapture::Stop() noexcept
Submit no further frames and read back the samples already committed; the capture ends Stopped (or Failed). Has no effect after the capture ended.

Declared in modules/graphics/renderer/include/ludus/graphics/renderer/render_graph_capture.hpp

Release

void ludus::graphics::renderer::RenderGraphCapture::Release() noexcept
Cancel outstanding work and release the private graph. Read-back pixels are discarded. Idempotent.

Declared in modules/graphics/renderer/include/ludus/graphics/renderer/render_graph_capture.hpp

GetPhase

RenderGraphCapturePhase ludus::graphics::renderer::RenderGraphCapture::GetPhase() const noexcept
Current phase.

Related types: RenderGraphCapturePhase

Declared in modules/graphics/renderer/include/ludus/graphics/renderer/render_graph_capture.hpp

GetProblem

RenderGraphCaptureProblem ludus::graphics::renderer::RenderGraphCapture::GetProblem() const noexcept
Why the capture failed or rejected its source; None otherwise.

Related types: RenderGraphCaptureProblem

Declared in modules/graphics/renderer/include/ludus/graphics/renderer/render_graph_capture.hpp

GetStatus

rhi::RasterStatus ludus::graphics::renderer::RenderGraphCapture::GetStatus() const noexcept
The RHI status behind a GraphFailure or ReadbackFailure; Ready otherwise.

Related types: rhi::RasterStatus

Declared in modules/graphics/renderer/include/ludus/graphics/renderer/render_graph_capture.hpp

GetInfo

RenderGraphCaptureInfo ludus::graphics::renderer::RenderGraphCapture::GetInfo() const noexcept
Copy progress and provenance.

Related types: RenderGraphCaptureInfo

Declared in modules/graphics/renderer/include/ludus/graphics/renderer/render_graph_capture.hpp

PollRayFailures

rhi::RasterStatus ludus::graphics::renderer::RenderGraphCapture::PollRayFailures(foundation::uint32 pass, RenderGraphRayFailures &outFailures) noexcept
Read the private graph's per-pass shader failure counts, including after a LatchedPixels failure. Owner thread, between Service calls; never waits or changes the captured image.
ParameterDescription
pass
Plan ray-pass index.
outFailures
Receives counts on Ready; preserved otherwise.

Returns

The same asynchronous statuses as RenderGraph::PollRayFailures; NotReady before Start.

Related types: foundation::uint32 · rhi::RasterStatus · RenderGraphRayFailures

Declared in modules/graphics/renderer/include/ludus/graphics/renderer/render_graph_capture.hpp

GetPixels

foundation::BorrowedView< const RenderGraphCapturePixel > ludus::graphics::renderer::RenderGraphCapture::GetPixels() const noexcept
Borrow the read-back pixels in top-left row order until the next Start or Release. Empty until a read-back finished; a Complete, Stopped or LatchedPixels capture has one per pixel.

Related types: foundation::BorrowedView · RenderGraphCapturePixel

Declared in modules/graphics/renderer/include/ludus/graphics/renderer/render_graph_capture.hpp

Encode

rhi::RasterStatus ludus::graphics::renderer::RenderGraphCapture::Encode(foundation::Array< foundation::uint8 > &outBytes) const noexcept
Encode the read-back pixels and provenance as a .lurgcap file (RenderGraphFormat capture.h).
ParameterDescription
outBytes
Receives the file; unchanged on failure.

Returns

Ready; NotReady before a read-back finished; OutOfMemory when the file cannot be allocated.

Related types: foundation::Array · foundation::uint8 · rhi::RasterStatus

Declared in modules/graphics/renderer/include/ludus/graphics/renderer/render_graph_capture.hpp