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.
These parameters are bound to group 4. With WGSL, for example,
ⓘ
ggez::graphics::ShaderParams::new(ctx, &my_uniforms, &[&image1, &image2], &[sampler1])
Corresponds to…
ⓘ
@group(4) @binding(0)
var<uniform> my_uniforms: MyUniforms;
@group(4) @binding(1)
var image1: texture_2d<f32>;
@group(4) @binding(2)
var image2: texture_2d<f32>;
@group(4) @binding(3)
var sampler1: sampler;
Implementations
sourceimpl<Uniforms: AsStd140> ShaderParams<Uniforms>
impl<Uniforms: AsStd140> ShaderParams<Uniforms>
sourcepub fn new(
gfx: &mut impl HasMut<GraphicsContext>,
uniforms: &Uniforms,
images: &[&Image],
samplers: &[Sampler]
) -> Self
pub fn new(
gfx: &mut impl HasMut<GraphicsContext>,
uniforms: &Uniforms,
images: &[&Image],
samplers: &[Sampler]
) -> Self
Creates a new ShaderParams, initialized with the given uniforms, images, and samplers.
sourcepub fn set_uniforms(&self, gfx: &impl Has<GraphicsContext>, uniforms: &Uniforms)
pub fn set_uniforms(&self, gfx: &impl Has<GraphicsContext>, uniforms: &Uniforms)
Updates the uniform data.
Trait Implementations
sourceimpl<Uniforms: AsStd140> Clone for ShaderParams<Uniforms>
impl<Uniforms: AsStd140> Clone for ShaderParams<Uniforms>
sourceimpl<Uniforms: Debug + AsStd140> Debug for ShaderParams<Uniforms>
impl<Uniforms: Debug + AsStd140> Debug for ShaderParams<Uniforms>
sourceimpl<Uniforms: PartialEq + AsStd140> PartialEq<ShaderParams<Uniforms>> for ShaderParams<Uniforms>
impl<Uniforms: PartialEq + AsStd140> PartialEq<ShaderParams<Uniforms>> for ShaderParams<Uniforms>
sourcefn eq(&self, other: &ShaderParams<Uniforms>) -> bool
fn eq(&self, other: &ShaderParams<Uniforms>) -> bool
impl<Uniforms: Eq + AsStd140> Eq for ShaderParams<Uniforms>
impl<Uniforms: AsStd140> StructuralEq for ShaderParams<Uniforms>
impl<Uniforms: AsStd140> StructuralPartialEq for ShaderParams<Uniforms>
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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.sourceimpl<T> HasMut<T> for T
impl<T> HasMut<T> for T
sourcefn retrieve_mut(&mut self) -> &mut T
fn retrieve_mut(&mut self) -> &mut T
Method to retrieve the context type as mutable.