Struct ComputeShader

Source
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) -> bool

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_spirv<F>( facade: &F, spirv: &SpirvEntryPoint<'_>, ) -> Result<ComputeShader, ProgramCreationError>
where F: Facade + ?Sized,

Builds a new compute shader from SPIR-V module.

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 retrieved 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
fn example(program: glium::Program) {
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

Source§

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 T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

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>

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)

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)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where 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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more