pub struct Device { /* private fields */ }
Expand description
Device
is the main struct used for creation of graphics resources and using this wrapper
Implementations§
Source§impl Device
impl Device
Sourcepub fn compute() -> GraphicsResult<Self>
pub fn compute() -> GraphicsResult<Self>
Initializes device with no presentation support
Sourcepub fn graphics<T: HasWindowHandle + HasDisplayHandle>(
settings: &GraphicsApiInitSettings,
window: &T,
) -> GraphicsResult<Self>
pub fn graphics<T: HasWindowHandle + HasDisplayHandle>( settings: &GraphicsApiInitSettings, window: &T, ) -> GraphicsResult<Self>
Initializes device with presentation support
Sourcepub fn dispatch_and_present(
&self,
objects: &[Arc<Object>],
) -> GraphicsResult<()>
pub fn dispatch_and_present( &self, objects: &[Arc<Object>], ) -> GraphicsResult<()>
Executes all operations permitted with objects passed in this method
Sourcepub fn dispatch_compute(&self, objects: &[Arc<Object>]) -> GraphicsResult<()>
pub fn dispatch_compute(&self, objects: &[Arc<Object>]) -> GraphicsResult<()>
Executes all compute operations permitted with objects passed in this method
Sourcepub fn resize_resources(&self, width: u32, height: u32) -> GraphicsResult<()>
pub fn resize_resources(&self, width: u32, height: u32) -> GraphicsResult<()>
Resizes resources
Sourcepub fn get_presentation_render_target(&self) -> Option<RenderTarget>
pub fn get_presentation_render_target(&self) -> Option<RenderTarget>
Returns RenderTarget
created on presentation init
Sourcepub fn create_layout(
&self,
double_buffering: bool,
texture_num: usize,
sampler_num: usize,
uniform_num: usize,
storage_num: usize,
) -> GraphicsResult<Layout>
pub fn create_layout( &self, double_buffering: bool, texture_num: usize, sampler_num: usize, uniform_num: usize, storage_num: usize, ) -> GraphicsResult<Layout>
Creates shader layout
Sourcepub fn create_buffer<T>(
&self,
len: u64,
flags: BufferFlags,
) -> GraphicsResult<Buffer<T>>
pub fn create_buffer<T>( &self, len: u64, flags: BufferFlags, ) -> GraphicsResult<Buffer<T>>
Creates GPU buffer
Sourcepub fn create_buffer_mesh<V: AttributeDescriptor, I>(
&self,
mesh: &Mesh<V, I>,
) -> GraphicsResult<MeshBuffer<V, I>>
pub fn create_buffer_mesh<V: AttributeDescriptor, I>( &self, mesh: &Mesh<V, I>, ) -> GraphicsResult<MeshBuffer<V, I>>
Creates a set of GPU buffers used for meshes
Sourcepub fn create_sampler_set(
&self,
textures: &[(u32, &Texture)],
layouts: &[&Layout],
) -> GraphicsResult<Arc<GpuSamplerSet>>
pub fn create_sampler_set( &self, textures: &[(u32, &Texture)], layouts: &[&Layout], ) -> GraphicsResult<Arc<GpuSamplerSet>>
Creates sampler set
Sourcepub fn create_texture(
&self,
buffer: &Buffer<u8>,
extent: [u32; 2],
anisotropy_texels: f32,
) -> GraphicsResult<Texture>
pub fn create_texture( &self, buffer: &Buffer<u8>, extent: [u32; 2], anisotropy_texels: f32, ) -> GraphicsResult<Texture>
Creates texture from buffers
Sourcepub fn get_delta_time(&self) -> Duration
pub fn get_delta_time(&self) -> Duration
Returns the duration of previous frame
Auto Trait Implementations§
impl Freeze for Device
impl !RefUnwindSafe for Device
impl Send for Device
impl Sync for Device
impl Unpin for Device
impl !UnwindSafe for Device
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