[−][src]Struct luminance::shader::program::Program
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]
S: Semantics,
pub fn from_stages<'a, T, G>(
tess: T,
vertex: &Stage,
geometry: G,
fragment: &Stage
) -> Result<BuiltProgram<S, Out, Uni>, ProgramError> where
Uni: UniformInterface,
T: Into<Option<(&'a Stage, &'a Stage)>>,
G: Into<Option<&'a Stage>>,
[src]
tess: T,
vertex: &Stage,
geometry: G,
fragment: &Stage
) -> Result<BuiltProgram<S, Out, Uni>, ProgramError> where
Uni: UniformInterface,
T: Into<Option<(&'a Stage, &'a Stage)>>,
G: Into<Option<&'a Stage>>,
Create a new program by consuming Stage
s.
pub fn from_strings<'a, T, G>(
tess: T,
vertex: &str,
geometry: G,
fragment: &str
) -> Result<BuiltProgram<S, Out, Uni>, ProgramError> where
Uni: UniformInterface,
T: Into<Option<(&'a str, &'a str)>>,
G: Into<Option<&'a str>>,
[src]
tess: T,
vertex: &str,
geometry: G,
fragment: &str
) -> Result<BuiltProgram<S, Out, Uni>, ProgramError> where
Uni: UniformInterface,
T: Into<Option<(&'a str, &'a str)>>,
G: Into<Option<&'a str>>,
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<BuiltProgram<S, Out, Uni>, ProgramError> where
Uni: UniformInterface<E>,
T: Into<Option<(&'a Stage, &'a Stage)>>,
G: Into<Option<&'a Stage>>,
[src]
tess: T,
vertex: &Stage,
geometry: G,
fragment: &Stage,
env: E
) -> Result<BuiltProgram<S, Out, Uni>, ProgramError> where
Uni: UniformInterface<E>,
T: Into<Option<(&'a Stage, &'a Stage)>>,
G: Into<Option<&'a Stage>>,
Create a new program by consuming Stage
s 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<BuiltProgram<S, Out, Uni>, ProgramError> where
Uni: UniformInterface<E>,
T: Into<Option<(&'a str, &'a str)>>,
G: Into<Option<&'a str>>,
[src]
tess: T,
vertex: &str,
geometry: G,
fragment: &str,
env: E
) -> Result<BuiltProgram<S, Out, Uni>, ProgramError> where
Uni: UniformInterface<E>,
T: Into<Option<(&'a str, &'a str)>>,
G: Into<Option<&'a str>>,
Create a new program by consuming strings.
pub fn adapt<Q>(
self
) -> Result<BuiltProgram<S, Out, Q>, AdaptationFailure<S, Out, Uni>> where
Q: UniformInterface,
[src]
self
) -> Result<BuiltProgram<S, Out, Q>, AdaptationFailure<S, Out, Uni>> where
Q: UniformInterface,
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<BuiltProgram<S, Out, Q>, AdaptationFailure<S, Out, Uni>> where
Q: UniformInterface<E>,
[src]
self,
env: E
) -> Result<BuiltProgram<S, Out, Q>, AdaptationFailure<S, Out, Uni>> where
Q: UniformInterface<E>,
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<BuiltProgram<S, Out, Uni>, AdaptationFailure<S, Out, Uni>> where
Uni: UniformInterface<E>,
[src]
self,
env: E
) -> Result<BuiltProgram<S, Out, Uni>, AdaptationFailure<S, Out, Uni>> where
Uni: UniformInterface<E>,
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.
fn deref(&self) -> &Self::Target
[src]
Auto Trait Implementations
impl<S, Out, Uni> RefUnwindSafe for Program<S, Out, Uni> where
Out: RefUnwindSafe,
S: RefUnwindSafe,
Uni: RefUnwindSafe,
Out: RefUnwindSafe,
S: RefUnwindSafe,
Uni: RefUnwindSafe,
impl<S, Out, Uni> !Send for Program<S, Out, Uni>
impl<S, Out, Uni> !Sync for Program<S, Out, Uni>
impl<S, Out, Uni> Unpin for Program<S, Out, Uni> where
Uni: Unpin,
Uni: Unpin,
impl<S, Out, Uni> UnwindSafe for Program<S, Out, Uni> where
Out: RefUnwindSafe,
S: RefUnwindSafe,
Uni: UnwindSafe,
Out: RefUnwindSafe,
S: RefUnwindSafe,
Uni: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,