pub struct RenderDevice { /* private fields */ }Expand description
GPU 渲染设备
封装 wgpu 的实例、适配器、设备和队列,提供统一的 GPU 资源管理。
§设计理念
- 自动选择: 自动选择最佳的 GPU 适配器
- 特性检测: 检测和启用可用的 GPU 特性
- 错误处理: 完善的错误处理和回退机制
- 跨平台: 支持多种图形后端
§示例
use anvilkit_render::renderer::RenderDevice;
use std::sync::Arc;
use winit::window::Window;
// 创建窗口(示例)
// let window = Arc::new(window);
// 创建渲染设备
// let device = RenderDevice::new(&window).await?;
// 获取设备和队列
// let wgpu_device = device.device();
// let queue = device.queue();Implementations§
Source§impl RenderDevice
impl RenderDevice
Sourcepub fn supports_feature(&self, feature: Features) -> bool
pub fn supports_feature(&self, feature: Features) -> bool
Sourcepub fn get_preferred_format(&self, surface: &Surface<'_>) -> TextureFormat
pub fn get_preferred_format(&self, surface: &Surface<'_>) -> TextureFormat
Auto Trait Implementations§
impl Freeze for RenderDevice
impl !RefUnwindSafe for RenderDevice
impl Send for RenderDevice
impl Sync for RenderDevice
impl Unpin for RenderDevice
impl UnsafeUnpin for RenderDevice
impl !UnwindSafe for RenderDevice
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
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>
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)
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)
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.