Skip to main content

RenderCapability

Trait RenderCapability 

Source
pub trait RenderCapability {
    // Required method
    fn requirements() -> GpuRequirements;

    // Provided method
    fn name() -> &'static str { ... }
}
Expand description

A trait for renderers to declare their GPU feature and limit requirements.

Implement this on renderer types (or dedicated marker types) so that crate::GraphicsContextDescriptor::require_capability and crate::GraphicsContextDescriptor::request_capability can automatically gather the necessary GPU configuration.

Required Methods§

Source

fn requirements() -> GpuRequirements

GPU requirements (features + limits) for this component.

Provided Methods§

Source

fn name() -> &'static str

Human-readable name for diagnostics.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl RenderCapability for BestBatchCapability2D

Source§

impl RenderCapability for BindlessBatchCapability2D

Source§

impl RenderCapability for DirectBatchCapability2D

Source§

impl RenderCapability for IndirectBatchCapability2D

Source§

impl RenderCapability for GpuFrameProfiler

Source§

impl RenderCapability for BlitRenderer

A renderer for blitting textures to the screen.

This provides an easy way to render a texture as a fullscreen quad, useful for video backgrounds, splash screens, or post-processing effects.

§Example

let blit_renderer = BlitRenderer::new(context);

// In render loop:
blit_renderer.blit(&mut render_pass, &texture_view);
Source§

impl RenderCapability for GpuProfiler

High-level GPU profiler for measuring execution times.

This profiler uses timestamp queries to measure GPU execution time for different regions of your rendering code.

§Requirements

  • Device must support TIMESTAMP_QUERY feature
  • Must call begin_frame() at the start of each frame
  • Must call resolve() before submitting commands

§Example

let mut profiler = GpuProfiler::new(context.clone(), 256);

// Each frame:
profiler.begin_frame();

let region = profiler.begin_region(&mut encoder, "My Pass");
// ... do rendering ...
profiler.end_region(&mut encoder, region);

profiler.resolve(&mut encoder);

// Read results (may be from previous frame)
for (label, duration_ms) in profiler.read_results() {
    println!("{}: {:.2}ms", label, duration_ms);
}
Source§

impl RenderCapability for LineRenderer

Source§

impl RenderCapability for PointRenderer

Source§

impl RenderCapability for QuadRenderer