pub struct ComputeShader { /* private fields */ }
Expand description

A combination of compute shaders linked together.

Implementations§

source§

impl ComputeShader

source

pub fn is_supported<C>(ctxt: &C) -> boolwhere C: CapabilitiesSource + ?Sized,

Returns true if the backend supports compute shaders.

source

pub fn from_source<F>( facade: &F, src: &str ) -> Result<ComputeShader, ProgramCreationError>where F: Facade + ?Sized,

Builds a new compute shader from some source code.

source

pub fn from_binary<F>( facade: &F, data: Binary ) -> Result<ComputeShader, ProgramCreationError>where F: Facade + ?Sized,

Builds a new compute shader from some binary.

source

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 retreived with gl_WorkGroupID. Inside each work group, additional local work groups can be started depending on the attributes of the compute shader itself.

source

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.

source

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.

source

pub fn get_uniform(&self, name: &str) -> Option<&Uniform>

Returns informations about a uniform variable, if it exists.

source

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);
}
source

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);
}
source

pub fn get_shader_storage_blocks( &self ) -> &HashMap<String, UniformBlock, BuildHasherDefault<FnvHasher>>

Returns the list of shader storage blocks.

Example
for (name, uniform) in program.get_shader_storage_blocks() {
    println!("Name: {}", name);
}

Trait Implementations§

source§

impl Debug for ComputeShader

source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl GlObject for ComputeShader

§

type Id = Handle

The type of identifier for this object.
source§

fn get_id(&self) -> Handle

Returns the id of the object.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.