pub struct AssetManager { /* private fields */ }Expand description
AssetManager handles shader compilation and pipeline creation Stores everything by name for easy retrieval
Implementations§
Source§impl AssetManager
impl AssetManager
Sourcepub fn gpu_info(&self) -> AdapterInfo
pub fn gpu_info(&self) -> AdapterInfo
Get GPU info
Sourcepub fn add_shader(
&mut self,
name: impl Into<String>,
source: &str,
stage: ShaderStage,
language: Language,
) -> Result<(), String>
pub fn add_shader( &mut self, name: impl Into<String>, source: &str, stage: ShaderStage, language: Language, ) -> Result<(), String>
Add a shader from source code
Sourcepub fn add_shader_object(
&mut self,
name: impl Into<String>,
shader_obj: ShaderObject,
)
pub fn add_shader_object( &mut self, name: impl Into<String>, shader_obj: ShaderObject, )
Add a pre-compiled shader object
Sourcepub fn get_shader(&self, name: &str) -> Option<&ShaderObject>
pub fn get_shader(&self, name: &str) -> Option<&ShaderObject>
Get a reference to a shader by name
Sourcepub fn create_pipeline(
&mut self,
pipeline_name: impl Into<String>,
vertex_shader_name: &str,
fragment_shader_name: Option<&str>,
vertex_buffers: Vec<VertexBufferLayout<'static>>,
color_format: TextureFormat,
) -> Result<(), String>
pub fn create_pipeline( &mut self, pipeline_name: impl Into<String>, vertex_shader_name: &str, fragment_shader_name: Option<&str>, vertex_buffers: Vec<VertexBufferLayout<'static>>, color_format: TextureFormat, ) -> Result<(), String>
Create a render pipeline from vertex and optional fragment shaders Stores the pipeline with shader objects in a Duo
Sourcepub fn get_pipeline(&self, name: &str) -> Option<&Duo>
pub fn get_pipeline(&self, name: &str) -> Option<&Duo>
Get a reference to a pipeline Duo by name
Sourcepub fn get_pipeline_mut(&mut self, name: &str) -> Option<&mut Duo>
pub fn get_pipeline_mut(&mut self, name: &str) -> Option<&mut Duo>
Get a mutable reference to a pipeline Duo by name
Sourcepub fn list_shaders(&self) -> Vec<&String>
pub fn list_shaders(&self) -> Vec<&String>
List all registered shader names
Sourcepub fn list_pipelines(&self) -> Vec<&String>
pub fn list_pipelines(&self) -> Vec<&String>
List all registered pipeline names
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AssetManager
impl !RefUnwindSafe for AssetManager
impl Send for AssetManager
impl Sync for AssetManager
impl Unpin for AssetManager
impl !UnwindSafe for AssetManager
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