pub fn create_shader(
shaders: &mut ShaderMap,
name: &str,
source: &str,
uniform_defs: UniformDefs,
) -> Result<ShaderId>
Expand description
Creates a new shader and returns its ID. The source
parameter should only contain the
fragment function, as the rest of the shader is automatically generated.
uniform_defs
specifies the uniforms that the shader will use. The keys are the uniform names
that will be also automatically generated and can be directly used in the shader. Meaning users
don’t have to care about WGPU bindings/groups.
For example, if you have a uniform named time
, you simply use it as time
in the shader.
ShaderMap
can be obtained from EngineContext
as c.renderer.shaders.borrow_mut()