Trait GraphicsApi

Source
pub trait GraphicsApi: Sync + Send {
    // Required methods
    fn dispatch_and_present(
        &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) -> Option<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>)],
        layouts: &[Arc<dyn Layout>],
    ) -> GraphicsResult<Arc<GpuSamplerSet>>;
    fn create_texture(
        &self,
        buffer: Arc<dyn Buffer>,
        extent: [u32; 2],
        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§

Source

fn dispatch_and_present(&self, objects: &[Arc<Object>]) -> GraphicsResult<()>

Executes all operations permitted with objects passed in this method

Source

fn dispatch_compute(&self, objects: &[Arc<Object>]) -> GraphicsResult<()>

Executes all compute operations permitted with objects passed in this method

Source

fn resize_resources(&self, width: u32, height: u32) -> GraphicsResult<()>

Resizes resources

Source

fn get_presentation_render_target(&self) -> Option<Arc<dyn RenderTarget>>

Returns RenderTarget created on presentation init

Source

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

Source

fn create_buffer( &self, size: u64, uniform: bool, transfer: bool, enable_sync: bool, ) -> GraphicsResult<Arc<dyn Buffer>>

Creates GPU buffer

Source

fn create_buffer_mesh(&self, mesh: Arc<Mesh>) -> GraphicsResult<Arc<MeshBuffer>>

Creates a set of GPU buffers used for meshes

Source

fn create_sampler_set( &self, textures: &[(u32, Arc<dyn Texture>)], layouts: &[Arc<dyn Layout>], ) -> GraphicsResult<Arc<GpuSamplerSet>>

Creates sampler set

Source

fn create_texture( &self, buffer: Arc<dyn Buffer>, extent: [u32; 2], anisotropy_texels: f32, ) -> GraphicsResult<Arc<dyn Texture>>

Creates texture from buffers

Source

fn get_delta_time(&self) -> Duration

Returns the duration of previous frame

Implementors§