pub struct OverlayRenderer { /* private fields */ }Expand description
The overlay’s renderer, free of any surface: a retention-off
frust_engine::EngineRenderer that records a command range into a
caller-supplied target cleared to transparent.
OverlaySurface wraps one around a swapchain; the spike’s host tests
drive one directly against an offscreen target.
Implementations§
Source§impl OverlayRenderer
impl OverlayRenderer
Sourcepub fn new(
device: &Device,
queue: &Queue,
caps: &TierCaps,
format: TextureFormat,
pipeline_cache: Option<&PipelineCache>,
) -> Result<Self, OverlayError>
pub fn new( device: &Device, queue: &Queue, caps: &TierCaps, format: TextureFormat, pipeline_cache: Option<&PipelineCache>, ) -> Result<Self, OverlayError>
Builds an overlay renderer for format targets on device.
pipeline_cache is the main surface’s persisted driver cache, when it
has one, so the overlay’s pipelines compile as cache hits.
§Errors
OverlayError::Engine when the engine cannot be built on caps.
Sourcepub fn record(
&mut self,
device: &Device,
queue: &Queue,
encoder: &mut CommandEncoder,
scene: &Scene,
range: Range<usize>,
target: EngineTarget<'_>,
) -> Result<RangeCut, OverlayError>
pub fn record( &mut self, device: &Device, queue: &Queue, encoder: &mut CommandEncoder, scene: &Scene, range: Range<usize>, target: EngineTarget<'_>, ) -> Result<RangeCut, OverlayError>
Records the commands of scene in range into encoder, targeting
target cleared to transparent, and returns what the cut did.
Shader quads are prepared over the whole scene (the pre-pass is
per-scene), so a quad outside the range is rendered to its own
offscreen target too and simply never sampled — a spike cost.
§Errors
OverlayError::Engine when the engine refuses the frame; nothing
was recorded into encoder then.
Sourcepub fn end_frame(&mut self, queue: &Queue, submitted: bool)
pub fn end_frame(&mut self, queue: &Queue, submitted: bool)
Closes the frame Self::record recorded, once its encoder was
submitted (submitted) or dropped: the engine’s end-of-frame
maintenance and the timestamp ring’s frame close — or, for an encoder
that was never submitted, the ring’s abandon, so no slot is left
waiting on a resolve that will never run.
Sourcepub fn last_cut(&self) -> Option<RangeCut>
pub fn last_cut(&self) -> Option<RangeCut>
What the last recorded range’s cut did, None before the first.
Sourcepub fn refused_frames(&self) -> u32
pub fn refused_frames(&self) -> u32
How many frames the engine has refused on this overlay.
Sourcepub fn gpu_pass_timings(&self) -> Option<GpuPassTimings>
pub fn gpu_pass_timings(&self) -> Option<GpuPassTimings>
The overlay’s most recent per-pass GPU time, on a device with
TIMESTAMP_QUERY (a perf-trace build); None otherwise — the same
reading SurfaceRenderer::gpu_pass_timings gives the main surface.