Skip to main content

WgpuRenderer

Struct WgpuRenderer 

Source
pub struct WgpuRenderer { /* private fields */ }

Implementations§

Source§

impl WgpuRenderer

Source

pub fn capture_last_frame_rgba( &mut self, window_id: WindowId, ) -> Result<RgbaImage>

Source

pub fn capture_last_frame_debug( &mut self, window_id: WindowId, request: DebugCaptureRequest, ) -> Result<DebugCaptureArtifact>

Capture window_id’s last frame at the requested stage, waiting for the GPU to copy it back. Browsers cannot wait; begin captures there with begin_debug_capture.

Source

pub fn begin_debug_capture( &mut self, window_id: WindowId, request: DebugCaptureRequest, ) -> Result<DebugCaptureId>

Start capturing window_id’s last frame at the requested stage: draw it again offscreen and begin copying it back. Nothing waits for the GPU, so this works in browsers too. Collect the artifact with take_finished_debug_captures once the copy is back.

Source

pub fn has_debug_captures_in_flight(&self, window_id: WindowId) -> bool

Whether captures of window_id are still being copied back.

Source

pub fn take_finished_debug_captures( &mut self, window_id: WindowId, ) -> Vec<(DebugCaptureId, Result<DebugCaptureArtifact>)>

The captures of window_id whose pixels are back, each handed out once. Never waits for the GPU.

Source

pub fn wait_for_debug_captures(&self) -> Result<()>

Wait until the GPU has copied back every capture begun. Browsers cannot wait, so this is native-only.

Source

pub fn capture_debug_frame( &self, window_id: WindowId, request: DebugCaptureRequest, ) -> Result<DebugCaptureArtifact>

Capture the frame last drawn at request’s stage, waiting for the GPU to copy it back.

Source

pub fn capture_rgba(&self, window_id: WindowId) -> Result<RgbaImage>

Source

pub fn capture_hdr_intermediate_rgba_f32( &self, window_id: WindowId, ) -> Result<HdrRgbaImage>

Source§

impl WgpuRenderer

Source

pub fn prepare_device(&mut self)

Start offscreen device preparation while the host constructs/layouts its first frame. Desktop hosts should use prepare_window for surface-aware adapter selection. Other targets retain their existing initialization path.

Source§

impl WgpuRenderer

Source

pub fn new() -> Self

Source

pub fn with_feathering(self, feathering: FeatheringOptions) -> Self

Source

pub fn with_feathering_enabled(self, enabled: bool) -> Self

Source

pub fn with_text_coverage_policy(self, policy: TextCoveragePolicy) -> Self

Source

pub fn with_text_render_mode(self, mode: TextRenderMode) -> Self

Source

pub fn with_text_subpixel_order(self, order: TextSubpixelOrder) -> Self

Source

pub fn with_text_hinting(self, hinting: TextHinting) -> Self

Source

pub fn with_stem_darkening(self, darkening: StemDarkening) -> Self

Source

pub fn with_feather_width(self, feather_width: f32) -> Self

Source

pub fn with_vsync_enabled(self, enabled: bool) -> Self

Source

pub fn with_external_texture_registry( self, registry: WgpuExternalTextureRegistry, ) -> Self

Source

pub fn feathering(&self) -> FeatheringOptions

Source

pub fn feathering_enabled(&self) -> bool

Source

pub fn feather_width(&self) -> f32

Source

pub fn vsync_enabled(&self) -> bool

Source

pub fn external_texture_registry(&self) -> Option<&WgpuExternalTextureRegistry>

Source

pub fn set_external_texture_registry( &mut self, registry: WgpuExternalTextureRegistry, )

Source

pub fn text_coverage_policy(&self) -> TextCoveragePolicy

Source

pub fn text_render_mode(&self) -> TextRenderMode

Source

pub fn text_subpixel_order(&self) -> TextSubpixelOrder

Source

pub fn text_hinting(&self) -> TextHinting

Source

pub fn stem_darkening(&self) -> StemDarkening

Source

pub fn set_feathering(&mut self, feathering: FeatheringOptions)

Source

pub fn set_feathering_enabled(&mut self, enabled: bool)

Source

pub fn set_text_coverage_policy(&mut self, policy: TextCoveragePolicy)

Source

pub fn set_text_render_mode(&mut self, mode: TextRenderMode)

Source

pub fn set_text_subpixel_order(&mut self, order: TextSubpixelOrder)

Source

pub fn set_text_hinting(&mut self, hinting: TextHinting)

Source

pub fn set_stem_darkening(&mut self, darkening: StemDarkening)

Source

pub fn set_feather_width(&mut self, feather_width: f32)

Source

pub fn set_vsync_enabled(&mut self, enabled: bool)

Source

pub fn set_window_display_capabilities( &mut self, window_id: WindowId, capabilities: DisplayCapabilities, ) -> Result<()>

Source

pub fn window_display_capabilities( &self, window_id: WindowId, ) -> Option<DisplayCapabilities>

Source

pub fn set_window_color_management( &mut self, window_id: WindowId, color_management: ColorManagementMode, ) -> Result<()>

Source

pub fn window_color_management( &self, window_id: WindowId, ) -> ColorManagementMode

The color management window_id renders with.

Source

pub fn window_output_strategy( &self, window_id: WindowId, ) -> Option<OutputStrategy>

The strategy window_id presents with. A window without a surface reports the strategy it would use on the display it was given.

Source

pub fn window_surface_formats( &self, window_id: WindowId, ) -> Option<Vec<TextureFormat>>

Source

pub fn set_runtime_feathering_override( &mut self, feathering: Option<FeatheringOptions>, )

Source

pub fn set_runtime_text_subpixel_order_override( &mut self, order: Option<TextSubpixelOrder>, )

Source

pub fn set_runtime_system_text_smoothing_enabled(&mut self, enabled: bool)

Whether the window being rendered follows the system’s text smoothing: LCD text in the order its display capabilities report (DisplayCapabilities::text_subpixel_order). On by default.

Source

pub fn set_runtime_text_hinting_override( &mut self, hinting: Option<TextHinting>, )

Source

pub fn set_runtime_stem_darkening_override( &mut self, darkening: Option<StemDarkening>, )

Source

pub fn set_runtime_text_coverage_policy_override( &mut self, policy: Option<TextCoveragePolicy>, )

Source

pub fn set_runtime_diagnostics_enabled(&mut self, enabled: bool)

Source

pub fn trim_memory(&mut self, level: MemoryTrimLevel)

Give up retained memory the renderer can rebuild.

MemoryTrimLevel::Background keeps what makes the next frame cheap, the retained scene and its GPU geometry, and frees textures and staging memory that are quick to recreate. Call it when the app is backgrounded. MemoryTrimLevel::Critical frees everything that can be rebuilt, at the cost of rebuilding it on the next frame. Call it when the system reports memory pressure.

Source

pub fn suspend_window(&mut self, window_id: WindowId)

Release only window_id’s surface, as a mobile host must when the app is backgrounded. Everything retained for the window stays, so the first frame after register_window reuses it instead of rebuilding the whole scene.

Source

pub fn remove_window(&mut self, window_id: WindowId)

Source

pub fn render(&mut self, frame: &SceneFrame) -> Result<()>

Source

pub fn capabilities(&self) -> RendererCapabilities

Source

pub fn adapter_info(&self) -> Option<AdapterInfo>

Adapter metadata after initialization, without requiring an interop registry.

Source

pub fn frames_rendered(&self) -> usize

Source

pub fn last_frame(&self, window_id: WindowId) -> Option<&SceneFrame>

Source

pub fn last_frame_stats( &self, window_id: WindowId, ) -> Option<RendererFrameStats>

Source

pub fn text_cache_snapshot( &self, window_id: WindowId, ) -> RendererTextCacheSnapshot

Source§

impl WgpuRenderer

Source

pub fn prepare_window( &mut self, window_id: WindowId, window: Arc<Window>, ) -> Result<()>

Begin device setup using this native surface before the first CPU layout. Call register_window afterwards to finish configuration. Preparation is optional, idempotent, and cancelled when the window/renderer is removed.

Source

pub fn register_window( &mut self, window_id: WindowId, window: Arc<Window>, ) -> Result<()>

Trait Implementations§

Source§

impl Debug for WgpuRenderer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for WgpuRenderer

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more