pub struct ComputeShader { /* private fields */ }
Expand description
A combination of compute shaders linked together.
Implementations§
Source§impl ComputeShader
impl ComputeShader
Sourcepub fn is_supported<C>(ctxt: &C) -> boolwhere
C: CapabilitiesSource + ?Sized,
pub fn is_supported<C>(ctxt: &C) -> boolwhere
C: CapabilitiesSource + ?Sized,
Returns true if the backend supports compute shaders.
Sourcepub fn from_source<F>(
facade: &F,
src: &str,
) -> Result<ComputeShader, ProgramCreationError>
pub fn from_source<F>( facade: &F, src: &str, ) -> Result<ComputeShader, ProgramCreationError>
Builds a new compute shader from some source code.
Sourcepub fn from_spirv<F>(
facade: &F,
spirv: &SpirvEntryPoint<'_>,
) -> Result<ComputeShader, ProgramCreationError>
pub fn from_spirv<F>( facade: &F, spirv: &SpirvEntryPoint<'_>, ) -> Result<ComputeShader, ProgramCreationError>
Builds a new compute shader from SPIR-V module.
Sourcepub fn from_binary<F>(
facade: &F,
data: Binary,
) -> Result<ComputeShader, ProgramCreationError>
pub fn from_binary<F>( facade: &F, data: Binary, ) -> Result<ComputeShader, ProgramCreationError>
Builds a new compute shader from some binary.
Sourcepub fn execute<U>(&self, uniforms: U, x: u32, y: u32, z: u32)where
U: Uniforms,
pub fn execute<U>(&self, uniforms: U, x: u32, y: u32, z: u32)where
U: Uniforms,
Executes the compute shader.
x * y * z
work groups will be started. The current work group can be retrieved with
gl_WorkGroupID
. Inside each work group, additional local work groups can be started
depending on the attributes of the compute shader itself.
Sourcepub fn execute_indirect<U>(
&self,
uniforms: U,
buffer: BufferSlice<'_, ComputeCommand>,
)where
U: Uniforms,
pub fn execute_indirect<U>(
&self,
uniforms: U,
buffer: BufferSlice<'_, ComputeCommand>,
)where
U: Uniforms,
Executes the compute shader.
This is similar to execute
, except that the parameters are stored in a buffer.
Sourcepub fn get_binary(&self) -> Result<Binary, GetBinaryError>
pub fn get_binary(&self) -> Result<Binary, GetBinaryError>
Returns the program’s compiled binary.
You can store the result in a file, then reload it later. This avoids having to compile the source code every time.
Sourcepub fn get_uniform(&self, name: &str) -> Option<&Uniform>
pub fn get_uniform(&self, name: &str) -> Option<&Uniform>
Returns informations about a uniform variable, if it exists.
Sourcepub fn uniforms(&self) -> Iter<'_, String, Uniform>
pub fn uniforms(&self) -> Iter<'_, String, Uniform>
Returns an iterator to the list of uniforms.
§Example
for (name, uniform) in program.uniforms() {
println!("Name: {} - Type: {:?}", name, uniform.ty);
}
Sourcepub fn get_uniform_blocks(
&self,
) -> &HashMap<String, UniformBlock, BuildHasherDefault<FnvHasher>>
pub fn get_uniform_blocks( &self, ) -> &HashMap<String, UniformBlock, BuildHasherDefault<FnvHasher>>
Returns a list of uniform blocks.
§Example
for (name, uniform) in program.get_uniform_blocks() {
println!("Name: {}", name);
}
Sourcepub fn get_shader_storage_blocks(
&self,
) -> &HashMap<String, UniformBlock, BuildHasherDefault<FnvHasher>>
pub fn get_shader_storage_blocks( &self, ) -> &HashMap<String, UniformBlock, BuildHasherDefault<FnvHasher>>
Returns the list of shader storage blocks.
§Example
fn example(program: glium::Program) {
for (name, uniform) in program.get_shader_storage_blocks() {
println!("Name: {}", name);
}
Trait Implementations§
Source§impl Debug for ComputeShader
impl Debug for ComputeShader
Auto Trait Implementations§
impl !Freeze for ComputeShader
impl !RefUnwindSafe for ComputeShader
impl !Send for ComputeShader
impl !Sync for ComputeShader
impl Unpin for ComputeShader
impl !UnwindSafe for ComputeShader
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
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>
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>
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)
&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)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.