logo

Struct luminance::shader::Uniform[][src]

pub struct Uniform<T> where
    T: ?Sized
{ /* fields omitted */ }
Expand description

A GPU shader program environment variable.

A uniform is a special variable that can be used to send data to a GPU. Several forms exist, but the idea is that T represents the data you want to send. Some exceptions exist that allow to pass shared data — such as ShaderDataBinding to pass a ShaderData, or TextureBinding to pass a Texture in order to fetch from it in a shader stage.

You will never be able to store them by your own. Instead, you must use a UniformInterface, which provides a contravariant interface for you. Creation is unsafe and should be avoided. The UniformInterface is the only safe way to create those.

Parametricity

  • T is the type of data you want to be able to set in a shader program.

Implementations

Create a new Uniform.

Safety

This method must be used only by backends. If you end up using it, then you’re doing something wrong. Read on UniformInterface for further information.

Retrieve the internal index.

Even though that function is safe, you have no reason to use it. Read on UniformInterface for further details.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.