pub struct ComputeProgram { /* private fields */ }Expand description
A compiled and linked compute shader program.
Implementations§
Source§impl ComputeProgram
impl ComputeProgram
Sourcepub fn compile(gl: &Context, source: &ShaderSource) -> Result<Self, String>
pub fn compile(gl: &Context, source: &ShaderSource) -> Result<Self, String>
Compile and link a compute shader from source.
Sourcepub fn compile_specialized(
gl: &Context,
source: &ShaderSource,
constants: &[SpecializationConstant],
) -> Result<Self, String>
pub fn compile_specialized( gl: &Context, source: &ShaderSource, constants: &[SpecializationConstant], ) -> Result<Self, String>
Compile with specialization constants applied.
Sourcepub fn validate(&self, gl: &Context) -> Result<(), String>
pub fn validate(&self, gl: &Context) -> Result<(), String>
Validate the program by checking the link status and info log.
Sourcepub fn set_uniform_int(&self, gl: &Context, name: &str, value: i32)
pub fn set_uniform_int(&self, gl: &Context, name: &str, value: i32)
Set a uniform int value.
Sourcepub fn set_uniform_uint(&self, gl: &Context, name: &str, value: u32)
pub fn set_uniform_uint(&self, gl: &Context, name: &str, value: u32)
Set a uniform uint value.
Sourcepub fn set_uniform_float(&self, gl: &Context, name: &str, value: f32)
pub fn set_uniform_float(&self, gl: &Context, name: &str, value: f32)
Set a uniform float value.
Sourcepub fn set_uniform_vec3(&self, gl: &Context, name: &str, x: f32, y: f32, z: f32)
pub fn set_uniform_vec3(&self, gl: &Context, name: &str, x: f32, y: f32, z: f32)
Set a uniform vec3.
Sourcepub fn set_uniform_vec4(
&self,
gl: &Context,
name: &str,
x: f32,
y: f32,
z: f32,
w: f32,
)
pub fn set_uniform_vec4( &self, gl: &Context, name: &str, x: f32, y: f32, z: f32, w: f32, )
Set a uniform vec4.
Sourcepub fn set_uniform_mat4(&self, gl: &Context, name: &str, data: &[f32; 16])
pub fn set_uniform_mat4(&self, gl: &Context, name: &str, data: &[f32; 16])
Set a uniform mat4 (column-major).
Sourcepub fn local_size(&self) -> [u32; 3]
pub fn local_size(&self) -> [u32; 3]
Get the local workgroup size declared in the shader.
Sourcepub fn raw_program(&self) -> NativeProgram
pub fn raw_program(&self) -> NativeProgram
Get the raw GL program.
Auto Trait Implementations§
impl Freeze for ComputeProgram
impl RefUnwindSafe for ComputeProgram
impl Send for ComputeProgram
impl Sync for ComputeProgram
impl Unpin for ComputeProgram
impl UnsafeUnpin for ComputeProgram
impl UnwindSafe for ComputeProgram
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.