AssetManager

Struct AssetManager 

Source
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

Source

pub fn new() -> Self

Create a new asset manager with GPU initialization

Source

pub fn gpu_info(&self) -> AdapterInfo

Get GPU info

Source

pub fn add_shader( &mut self, name: impl Into<String>, source: &str, stage: ShaderStage, language: Language, ) -> Result<(), String>

Add a shader from source code

Source

pub fn add_shader_object( &mut self, name: impl Into<String>, shader_obj: ShaderObject, )

Add a pre-compiled shader object

Source

pub fn get_shader(&self, name: &str) -> Option<&ShaderObject>

Get a reference to a shader by name

Source

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

Source

pub fn get_pipeline(&self, name: &str) -> Option<&Duo>

Get a reference to a pipeline Duo by name

Source

pub fn get_pipeline_mut(&mut self, name: &str) -> Option<&mut Duo>

Get a mutable reference to a pipeline Duo by name

Source

pub fn list_shaders(&self) -> Vec<&String>

List all registered shader names

Source

pub fn list_pipelines(&self) -> Vec<&String>

List all registered pipeline names

Source

pub fn device(&self) -> &Device

Get reference to the GPU device

Source

pub fn queue(&self) -> &Queue

Get reference to the GPU queue

Source

pub fn adapter(&self) -> &Adapter

Get reference to the adapter

Source

pub fn instance(&self) -> &Instance

Get reference to the instance

Trait Implementations§

Source§

impl Default for AssetManager

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,