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§
Sourcefn requirements() -> GpuRequirements
fn requirements() -> GpuRequirements
GPU requirements (features + limits) for this component.
Provided Methods§
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§
impl RenderCapability for BestBatchCapability2D
impl RenderCapability for BindlessBatchCapability2D
impl RenderCapability for DirectBatchCapability2D
impl RenderCapability for IndirectBatchCapability2D
impl RenderCapability for GpuFrameProfiler
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);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_QUERYfeature - 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);
}