Skip to content

ludus::graphics::rhi::ComputeWorkload

Ludus Wiki · API overview · Browse API

Class

Reusable prepared dispatches and persistent buffers, owned by one device/owner thread. All operations, moves and destruction run between frames, before device destruction. Ordered graphs retain their own resource leases, including after Reset or replacement. Metal/Vulkan/WebGPU use ordinary compute; unsupported devices reject explicitly.

Declared in modules/graphics/rhi/include/ludus/graphics/rhi/compute_workload.hpp

#include <ludus/graphics/rhi/compute_workload.hpp>
class ludus::graphics::rhi::ComputeWorkload final

Methods

ComputeWorkload

ludus::graphics::rhi::ComputeWorkload::ComputeWorkload() noexcept
Construct an empty owner without allocation.

Declared in modules/graphics/rhi/include/ludus/graphics/rhi/compute_workload.hpp

~ComputeWorkload

ludus::graphics::rhi::ComputeWorkload::~ComputeWorkload() noexcept
Release public owners; already encoded work retires through the RHI ledger.

Declared in modules/graphics/rhi/include/ludus/graphics/rhi/compute_workload.hpp

ComputeWorkload

ludus::graphics::rhi::ComputeWorkload::ComputeWorkload(ComputeWorkload &&other) noexcept
Transfer the complete device/resource ownership, leaving other empty.

Declared in modules/graphics/rhi/include/ludus/graphics/rhi/compute_workload.hpp

operator=

ComputeWorkload & ludus::graphics::rhi::ComputeWorkload::operator=(ComputeWorkload &&other) noexcept
Release this workload and transfer other, leaving other empty.

Related types: ComputeWorkload

Declared in modules/graphics/rhi/include/ludus/graphics/rhi/compute_workload.hpp

ComputeWorkload

ludus::graphics::rhi::ComputeWorkload::ComputeWorkload(const ComputeWorkload &)=delete
Unique resource ownership forbids copying.

Declared in modules/graphics/rhi/include/ludus/graphics/rhi/compute_workload.hpp

operator=

ComputeWorkload & ludus::graphics::rhi::ComputeWorkload::operator=(const ComputeWorkload &)=delete
Unique resource ownership forbids copy assignment.

Related types: ComputeWorkload

Declared in modules/graphics/rhi/include/ludus/graphics/rhi/compute_workload.hpp

Initialize

RasterStatus ludus::graphics::rhi::ComputeWorkload::Initialize(DeviceHandle device, const ComputeWorkloadDescription &description) noexcept
Validate, upload and prepare an empty owner. Initial data and shader reflection are consumed/copied before return; artifact storage must survive through Poll. Ready/Pending acquires workload ownership; any other result leaves this object empty. Device limits and MaximumBufferBytes bound admission; no GPU wait occurs.

Related types: RasterStatus · ComputeWorkloadDescription · DeviceHandle

Declared in modules/graphics/rhi/include/ludus/graphics/rhi/compute_workload.hpp

Poll

RasterStatus ludus::graphics::rhi::ComputeWorkload::Poll() noexcept
Advance asynchronous shader/pipeline preparation. NotReady for an empty owner. Failure is retained for inspection; Reset releases a failed workload.

Related types: RasterStatus

Declared in modules/graphics/rhi/include/ludus/graphics/rhi/compute_workload.hpp

BuildGraph

RasterStatus ludus::graphics::rhi::ComputeWorkload::BuildGraph(OrderedGraph &outGraph, foundation::BorrowedView< GraphVersion > outVersions={}, bool shouldRootBuffers=true) const noexcept
Build a fresh, uncompiled ordered graph importing each allocation exactly once. By default every mutable final version is a History root. Uses match reflected ranges; read/write hazards are tracked across all kernels. No upload or GPU execution. outGraph must be empty. Failure preserves it and this workload; discard a successful graph with DiscardOrderedGraph if it will not be executed. Optional outVersions must be empty or have one entry per described buffer; success copies final versions for appending consumers without duplicate imports. Failure preserves the supplied version entries.
ParameterDescription
outGraph
Empty output, receives the uncompiled graph on Ready and is preserved on failure.
outVersions
Empty or one entry per buffer; receives final versions on Ready only.
shouldRootBuffers
False lets an appending consumer root the final versions itself; supply outVersions and add roots after all writers when extending the graph.

Related types: foundation::BorrowedView · RasterStatus · GraphVersion · OrderedGraph

Declared in modules/graphics/rhi/include/ludus/graphics/rhi/compute_workload.hpp

GetBuffer

RasterStatus ludus::graphics::rhi::ComputeWorkload::GetBuffer(foundation::usize index, BufferHandle &outBuffer) const noexcept
Borrow a ready allocation for subsequent compute/raster consumers. The handle expires on Reset/replacement; consumers must acquire their own RHI leases. Invalid index, empty or pending owner preserves outBuffer. Never transfer ownership.

Related types: foundation::usize · RasterStatus · BufferHandle

Declared in modules/graphics/rhi/include/ludus/graphics/rhi/compute_workload.hpp

GetBufferCount

foundation::usize ludus::graphics::rhi::ComputeWorkload::GetBufferCount() const noexcept
Number of persistent allocations described by this owner; zero when empty.

Related types: foundation::usize

Declared in modules/graphics/rhi/include/ludus/graphics/rhi/compute_workload.hpp

GetBufferBytes

foundation::usize ludus::graphics::rhi::ComputeWorkload::GetBufferBytes() const noexcept
Total logical allocated buffer bytes; zero for an empty owner. Does not include driver scratch.

Related types: foundation::usize

Declared in modules/graphics/rhi/include/ludus/graphics/rhi/compute_workload.hpp

Reset

void ludus::graphics::rhi::ComputeWorkload::Reset() noexcept
Release all public owners without waiting; requires no open device frame.

Declared in modules/graphics/rhi/include/ludus/graphics/rhi/compute_workload.hpp