Struct ggez::graphics::ShaderParams
source · pub struct ShaderParams<Uniforms: AsStd140> { /* private fields */ }
Expand description
Parameters that can be passed to a custom shader, including uniforms, images, and samplers.
Create with ShaderParamsBuilder
.
These parameters are bound to group 3. With WGSL, for example,
ⓘ
ggez::graphics::ShaderParamsBuilder::new(&my_uniforms)
.images(&[&image1, &image2], &[sampler1], false)
.build(&mut ctx.gfx)
Corresponds to…
ⓘ
@group(3) @binding(0)
var<uniform> my_uniforms: MyUniforms;
@group(3) @binding(1)
var image1: texture_2d<f32>;
@group(3) @binding(2)
var image2: texture_2d<f32>;
@group(3) @binding(3)
var sampler1: sampler;
Implementations§
source§impl<Uniforms: AsStd140> ShaderParams<Uniforms>
impl<Uniforms: AsStd140> ShaderParams<Uniforms>
sourcepub fn set_uniforms(&mut self, ctx: &mut Context, uniforms: &Uniforms)
pub fn set_uniforms(&mut self, ctx: &mut Context, uniforms: &Uniforms)
Updates the uniform data.
When called, [Canvas::set_shader_params
] (or [Canvas::set_text_shader_params
]) needs to be called again for the new uniforms to take effect.
Trait Implementations§
Auto Trait Implementations§
impl<Uniforms> !RefUnwindSafe for ShaderParams<Uniforms>
impl<Uniforms> Send for ShaderParams<Uniforms>where Uniforms: Send,
impl<Uniforms> Sync for ShaderParams<Uniforms>where Uniforms: Sync,
impl<Uniforms> Unpin for ShaderParams<Uniforms>where Uniforms: Unpin,
impl<Uniforms> !UnwindSafe for ShaderParams<Uniforms>
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
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
source§impl<T> HasMut<T> for T
impl<T> HasMut<T> for T
source§fn retrieve_mut(&mut self) -> &mut T
fn retrieve_mut(&mut self) -> &mut T
Method to retrieve the context type as mutable.