pub struct FrameGraph { /* private fields */ }Expand description
Long-lived owner of frame identities, transient allocations, and GPU timing state.
Use FrameGraph::new for CPU-only recording and compilation. Use
FrameGraph::with_device when compiled frames will be executed. Only one
Frame may borrow a graph at a time; dropping or compiling it permits the
next recording to begin.
Implementations§
Source§impl FrameGraph
impl FrameGraph
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a CPU-only graph compiler.
Frames from this graph can be recorded, validated, compiled, reported,
and exported, but CompiledFrame::execute
returns FrameGraphError::MissingGpuDevice.
Sourcepub fn with_device(device: &Device) -> Self
pub fn with_device(device: &Device) -> Self
Creates a graph backed by a cloned wgpu device handle.
The graph owns its transient resource pool and GPU timing resources. The queue, imported resources, pipelines, bind groups, and surface remain caller-owned. Native objects supplied for execution must belong to this device. Device-specific limits and native object ownership are checked by wgpu during allocation or execution, not by graph recording. Graph recording still validates logical ranges, content flow, usage contracts, format categories, and bounded planning inputs.
Sourcepub fn resource_pool_stats(&self) -> ResourcePoolStats
pub fn resource_pool_stats(&self) -> ResourcePoolStats
Returns cumulative allocation counters and current retained pool size.
Sourcepub fn clear_resource_pool(&mut self)
pub fn clear_resource_pool(&mut self)
Destroys all transient resources currently retained for reuse.
Cumulative acquire, reuse, and creation counters are preserved.
Sourcepub fn begin_frame(&mut self) -> Frame<'_>
pub fn begin_frame(&mut self) -> Frame<'_>
Begins a fresh, single-use frame recording.
Logical handles returned by the frame cannot outlive this exclusive graph
borrow. Frame::compile consumes the recording and returns a compiled
frame that continues to hold the graph borrow through optional execution.