pub trait GraphicsApi: Sync + Send {
// Required methods
fn dispatch_any(&self, objects: &[Arc<Object>]) -> GraphicsResult<()>;
fn dispatch_compute(&self, objects: &[Arc<Object>]) -> GraphicsResult<()>;
fn resize_resources(&self, width: u32, height: u32) -> GraphicsResult<()>;
fn get_presentation_render_target(&self) -> Arc<dyn RenderTarget>;
fn create_layout(
&self,
double_buffering: bool,
texture_num: usize,
sampler_num: usize,
uniform_num: usize,
storage_num: usize,
) -> GraphicsResult<Arc<dyn Layout>>;
fn create_buffer(
&self,
size: u64,
uniform: bool,
transfer: bool,
enable_sync: bool,
) -> GraphicsResult<Arc<dyn Buffer>>;
fn create_buffer_mesh(
&self,
mesh: Arc<Mesh>,
) -> GraphicsResult<Arc<MeshBuffer>>;
fn create_sampler_set(
&self,
textures: &[(u32, Arc<dyn Texture>)],
) -> GraphicsResult<Arc<GpuSamplerSet>>;
fn create_texture(
&self,
buffer: Arc<dyn Buffer>,
data: [u32; 3],
anisotropy_texels: f32,
) -> GraphicsResult<Arc<dyn Texture>>;
fn get_delta_time(&self) -> Duration;
}Expand description
GraphicsApi is the main trait used for creation of graphics resources and using this wrapper
Required Methods§
Sourcefn dispatch_any(&self, objects: &[Arc<Object>]) -> GraphicsResult<()>
fn dispatch_any(&self, objects: &[Arc<Object>]) -> GraphicsResult<()>
Executes all operations permitted with objects passed in this method
Sourcefn dispatch_compute(&self, objects: &[Arc<Object>]) -> GraphicsResult<()>
fn dispatch_compute(&self, objects: &[Arc<Object>]) -> GraphicsResult<()>
Executes all compute operations permitted with objects passed in this method
Sourcefn resize_resources(&self, width: u32, height: u32) -> GraphicsResult<()>
fn resize_resources(&self, width: u32, height: u32) -> GraphicsResult<()>
Resizes resources
Sourcefn get_presentation_render_target(&self) -> Arc<dyn RenderTarget>
fn get_presentation_render_target(&self) -> Arc<dyn RenderTarget>
Returns RenderTarget created on presentation init. Panics if API was initialized without presentation
Sourcefn create_layout(
&self,
double_buffering: bool,
texture_num: usize,
sampler_num: usize,
uniform_num: usize,
storage_num: usize,
) -> GraphicsResult<Arc<dyn Layout>>
fn create_layout( &self, double_buffering: bool, texture_num: usize, sampler_num: usize, uniform_num: usize, storage_num: usize, ) -> GraphicsResult<Arc<dyn Layout>>
Creates shader layout
Sourcefn create_buffer(
&self,
size: u64,
uniform: bool,
transfer: bool,
enable_sync: bool,
) -> GraphicsResult<Arc<dyn Buffer>>
fn create_buffer( &self, size: u64, uniform: bool, transfer: bool, enable_sync: bool, ) -> GraphicsResult<Arc<dyn Buffer>>
Creates GPU buffer
Sourcefn create_buffer_mesh(&self, mesh: Arc<Mesh>) -> GraphicsResult<Arc<MeshBuffer>>
fn create_buffer_mesh(&self, mesh: Arc<Mesh>) -> GraphicsResult<Arc<MeshBuffer>>
Creates a set of GPU buffers used for meshes
Sourcefn create_sampler_set(
&self,
textures: &[(u32, Arc<dyn Texture>)],
) -> GraphicsResult<Arc<GpuSamplerSet>>
fn create_sampler_set( &self, textures: &[(u32, Arc<dyn Texture>)], ) -> GraphicsResult<Arc<GpuSamplerSet>>
Creates sampler set
Sourcefn create_texture(
&self,
buffer: Arc<dyn Buffer>,
data: [u32; 3],
anisotropy_texels: f32,
) -> GraphicsResult<Arc<dyn Texture>>
fn create_texture( &self, buffer: Arc<dyn Buffer>, data: [u32; 3], anisotropy_texels: f32, ) -> GraphicsResult<Arc<dyn Texture>>
Creates texture
Sourcefn get_delta_time(&self) -> Duration
fn get_delta_time(&self) -> Duration
Returns the duration of previous frame