[][src]Struct luminance::shader::program::Program

pub struct Program<S, Out, Uni> { /* fields omitted */ }

A typed shader program.

Typed shader programs represent their inputs, outputs and environment (uniforms) directly in their types. This is very interesting as it adds more static safety and enables such programs to “store” information like the uniform interface and such.

Methods

impl<S, Out, Uni> Program<S, Out, Uni> where
    S: Semantics
[src]

pub fn from_stages<'a, T, G>(
    tess: T,
    vertex: &Stage,
    geometry: G,
    fragment: &Stage
) -> Result<(Self, Vec<ProgramWarning>), ProgramError> where
    Uni: UniformInterface,
    T: Into<Option<(&'a Stage, &'a Stage)>>,
    G: Into<Option<&'a Stage>>, 
[src]

Create a new program by consuming Stages.

pub fn from_strings<'a, T, G>(
    tess: T,
    vertex: &str,
    geometry: G,
    fragment: &str
) -> Result<(Self, Vec<ProgramWarning>), ProgramError> where
    Uni: UniformInterface,
    T: Into<Option<(&'a str, &'a str)>>,
    G: Into<Option<&'a str>>, 
[src]

Create a new program by consuming strings.

pub fn from_stages_env<'a, E, T, G>(
    tess: T,
    vertex: &Stage,
    geometry: G,
    fragment: &Stage,
    env: E
) -> Result<(Self, Vec<ProgramWarning>), ProgramError> where
    Uni: UniformInterface<E>,
    T: Into<Option<(&'a Stage, &'a Stage)>>,
    G: Into<Option<&'a Stage>>, 
[src]

Create a new program by consuming Stages and by looking up an environment.

pub fn from_strings_env<'a, E, T, G>(
    tess: T,
    vertex: &str,
    geometry: G,
    fragment: &str,
    env: E
) -> Result<(Self, Vec<ProgramWarning>), ProgramError> where
    Uni: UniformInterface<E>,
    T: Into<Option<(&'a str, &'a str)>>,
    G: Into<Option<&'a str>>, 
[src]

Create a new program by consuming strings.

pub fn adapt<Q>(
    self
) -> Result<(Program<S, Out, Q>, Vec<UniformWarning>), (ProgramError, Self)> where
    Q: UniformInterface
[src]

Transform the program to adapt the uniform interface.

This function will not re-allocate nor recreate the GPU data. It will try to change the uniform interface and if the new uniform interface is correctly generated, return the same shader program updated with the new uniform interface. If the generation of the new uniform interface fails, this function will return the program with the former uniform interface.

pub fn adapt_env<Q, E>(
    self,
    env: E
) -> Result<(Program<S, Out, Q>, Vec<UniformWarning>), (ProgramError, Self)> where
    Q: UniformInterface<E>, 
[src]

Transform the program to adapt the uniform interface by looking up an environment.

This function will not re-allocate nor recreate the GPU data. It will try to change the uniform interface and if the new uniform interface is correctly generated, return the same shader program updated with the new uniform interface. If the generation of the new uniform interface fails, this function will return the program with the former uniform interface.

pub fn readapt_env<E>(
    self,
    env: E
) -> Result<(Self, Vec<UniformWarning>), (ProgramError, Self)> where
    Uni: UniformInterface<E>, 
[src]

A version of Program::adapt_env that doesn’t change the uniform interface type.

This function might be needed for when you want to update the uniform interface but still enforce that the type must remain the same.

Trait Implementations

impl<S, Out, Uni> Deref for Program<S, Out, Uni>[src]

type Target = RawProgram

The resulting type after dereferencing.

Auto Trait Implementations

impl<S, Out, Uni> Unpin for Program<S, Out, Uni> where
    Uni: Unpin

impl<S, Out, Uni> !Sync for Program<S, Out, Uni>

impl<S, Out, Uni> !Send for Program<S, Out, Uni>

impl<S, Out, Uni> UnwindSafe for Program<S, Out, Uni> where
    Out: RefUnwindSafe,
    S: RefUnwindSafe,
    Uni: UnwindSafe

impl<S, Out, Uni> RefUnwindSafe for Program<S, Out, Uni> where
    Out: RefUnwindSafe,
    S: RefUnwindSafe,
    Uni: RefUnwindSafe

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]