Enum cogl::SnippetHook [−][src]
SnippetHook
is used to specify a location within a
Pipeline
where the code of the snippet should be used when it
is attached to a pipeline.
<glosslist>
<glossentry>
<glossterm>``SnippetHook::VertexGlobals``</glossterm>
<glossdef>
<para>
Adds a shader snippet at the beginning of the global section of the
shader for the vertex processing. Any declarations here can be
shared with all other snippets that are attached to a vertex hook.
Only the ‘declarations’ string is used and the other strings are
ignored.
</para>
</glossdef>
</glossentry>
<glossentry>
<glossterm>``SnippetHook::FragmentGlobals``</glossterm>
<glossdef>
<para>
Adds a shader snippet at the beginning of the global section of the
shader for the fragment processing. Any declarations here can be
shared with all other snippets that are attached to a fragment
hook. Only the ‘declarations’ string is used and the other strings
are ignored.
</para>
</glossdef>
</glossentry>
<glossentry>
<glossterm>``SnippetHook::Vertex``</glossterm>
<glossdef>
<para>
Adds a shader snippet that will hook on to the vertex processing
stage of the pipeline. This gives a chance for the application to
modify the vertex attributes generated by the shader. Typically the
snippet will modify cogl_color_out or cogl_position_out builtins.
</para>
<para>
The ‘declarations’ string in snippet
will be inserted in the
global scope of the shader. Use this to declare any uniforms,
attributes or functions that the snippet requires.
</para>
<para>
The ‘pre’ string in snippet
will be inserted at the top of the
main
function before any vertex processing is done.
</para>
<para>
The ‘replace’ string in snippet
will be used instead of the
generated vertex processing if it is present. This can be used if
the application wants to provide a complete vertex shader and
doesn’t need the generated output from Cogl.
</para>
<para>
The ‘post’ string in snippet
will be inserted after all of the
standard vertex processing is done. This can be used to modify the
outputs.
</para>
</glossdef>
</glossentry>
<glossentry>
<glossterm>``SnippetHook::VertexTransform``</glossterm>
<glossdef>
<para>
Adds a shader snippet that will hook on to the vertex transform stage.
Typically the snippet will use the cogl_modelview_matrix,
cogl_projection_matrix and cogl_modelview_projection_matrix matrices and the
cogl_position_in attribute. The hook must write to cogl_position_out.
The default processing for this hook will multiply cogl_position_in by
the combined modelview-projection matrix and store it on cogl_position_out.
</para>
<para>
The ‘declarations’ string in snippet
will be inserted in the
global scope of the shader. Use this to declare any uniforms,
attributes or functions that the snippet requires.
</para>
<para>
The ‘pre’ string in snippet
will be inserted at the top of the
main
function before the vertex transform is done.
</para>
<para>
The ‘replace’ string in snippet
will be used instead of the
generated vertex transform if it is present.
</para>
<para>
The ‘post’ string in snippet
will be inserted after all of the
standard vertex transformation is done. This can be used to modify the
cogl_position_out in addition to the default processing.
</para>
</glossdef>
</glossentry>
<glossentry>
<glossterm>``SnippetHook::PointSize``</glossterm>
<glossdef>
<para>
Adds a shader snippet that will hook on to the point size
calculation step within the vertex shader stage. The snippet should
write to the builtin cogl_point_size_out with the new point size.
The snippet can either read cogl_point_size_in directly and write a
new value or first read an existing value in cogl_point_size_out
that would be set by a previous snippet. Note that this hook is
only used if Pipeline::set_per_vertex_point_size
is enabled
on the pipeline.
</para>
<para>
The ‘declarations’ string in snippet
will be inserted in the
global scope of the shader. Use this to declare any uniforms,
attributes or functions that the snippet requires.
</para>
<para>
The ‘pre’ string in snippet
will be inserted just before
calculating the point size.
</para>
<para>
The ‘replace’ string in snippet
will be used instead of the
generated point size calculation if it is present.
</para>
<para>
The ‘post’ string in snippet
will be inserted after the
standard point size calculation is done. This can be used to modify
cogl_point_size_out in addition to the default processing.
</para>
</glossdef>
</glossentry>
<glossentry>
<glossterm>``SnippetHook::Fragment``</glossterm>
<glossdef>
<para>
Adds a shader snippet that will hook on to the fragment processing
stage of the pipeline. This gives a chance for the application to
modify the fragment color generated by the shader. Typically the
snippet will modify cogl_color_out.
</para>
<para>
The ‘declarations’ string in snippet
will be inserted in the
global scope of the shader. Use this to declare any uniforms,
attributes or functions that the snippet requires.
</para>
<para>
The ‘pre’ string in snippet
will be inserted at the top of the
main
function before any fragment processing is done.
</para>
<para>
The ‘replace’ string in snippet
will be used instead of the
generated fragment processing if it is present. This can be used if
the application wants to provide a complete fragment shader and
doesn’t need the generated output from Cogl.
</para>
<para>
The ‘post’ string in snippet
will be inserted after all of the
standard fragment processing is done. At this point the generated
value for the rest of the pipeline state will already be in
cogl_color_out so the application can modify the result by altering
this variable.
</para>
</glossdef>
</glossentry>
<glossentry>
<glossterm>``SnippetHook::TextureCoordTransform``</glossterm>
<glossdef>
<para>
Adds a shader snippet that will hook on to the texture coordinate
transformation of a particular layer. This can be used to replace
the processing for a layer or to modify the results.
</para>
<para>
Within the snippet code for this hook there are two extra
variables. The first is a mat4 called cogl_matrix which represents
the user matrix for this layer. The second is called cogl_tex_coord
and represents the incoming and outgoing texture coordinate. On
entry to the hook, cogl_tex_coord contains the value of the
corresponding texture coordinate attribute for this layer. The hook
is expected to modify this variable. The output will be passed as a
varying to the fragment processing stage. The default code will
just multiply cogl_matrix by cogl_tex_coord and store the result in
cogl_tex_coord.
</para>
<para>
The ‘declarations’ string in snippet
will be inserted in the
global scope of the shader. Use this to declare any uniforms,
attributes or functions that the snippet requires.
</para>
<para>
The ‘pre’ string in snippet
will be inserted just before the
fragment processing for this layer. At this point cogl_tex_coord
still contains the value of the texture coordinate attribute.
</para>
<para>
If a ‘replace’ string is given then this will be used instead of
the default fragment processing for this layer. The snippet can
modify cogl_tex_coord or leave it as is to apply no transformation.
</para>
<para>
The ‘post’ string in snippet
will be inserted just after the
transformation. At this point cogl_tex_coord will contain the
results of the transformation but it can be further modified by the
snippet.
</para>
</glossdef>
</glossentry>
<glossentry>
<glossterm>``SnippetHook::LayerFragment``</glossterm>
<glossdef>
<para>
Adds a shader snippet that will hook on to the fragment processing
of a particular layer. This can be used to replace the processing
for a layer or to modify the results.
</para>
<para>
Within the snippet code for this hook there is an extra vec4
variable called ‘cogl_layer’. This contains the resulting color
that will be used for the layer. This can be modified in the ‘post’
section or it the default processing can be replaced entirely using
the ‘replace’ section.
</para>
<para>
The ‘declarations’ string in snippet
will be inserted in the
global scope of the shader. Use this to declare any uniforms,
attributes or functions that the snippet requires.
</para>
<para>
The ‘pre’ string in snippet
will be inserted just before the
fragment processing for this layer.
</para>
<para>
If a ‘replace’ string is given then this will be used instead of
the default fragment processing for this layer. The snippet must write to
the ‘cogl_layer’ variable in that case.
</para>
<para>
The ‘post’ string in snippet
will be inserted just after the
fragment processing for the layer. The results can be modified by changing
the value of the ‘cogl_layer’ variable.
</para>
</glossdef>
</glossentry>
<glossentry>
<glossterm>``SnippetHook::TextureLookup``</glossterm>
<glossdef>
<para>
Adds a shader snippet that will hook on to the texture lookup part
of a given layer. This gives a chance for the application to modify
the coordinates that will be used for the texture lookup or to
alter the returned texel.
</para>
<para>
Within the snippet code for this hook there are three extra
variables available. ‘cogl_sampler’ is a sampler object
representing the sampler for the layer where the snippet is
attached. ‘cogl_tex_coord’ is a vec4 which contains the texture
coordinates that will be used for the texture lookup. This can be
modified. ‘cogl_texel’ will contain the result of the texture
lookup. This can also be modified.
</para>
<para>
The ‘declarations’ string in snippet
will be inserted in the
global scope of the shader. Use this to declare any uniforms,
attributes or functions that the snippet requires.
</para>
<para>
The ‘pre’ string in snippet
will be inserted at the top of the
main
function before any fragment processing is done. This is a
good place to modify the cogl_tex_coord variable.
</para>
<para>
If a ‘replace’ string is given then this will be used instead of a
the default texture lookup. The snippet would typically use its own
sampler in this case.
</para>
<para>
The ‘post’ string in snippet
will be inserted after texture lookup
has been preformed. Here the snippet can modify the cogl_texel
variable to alter the returned texel.
</para>
</glossdef>
</glossentry>
</glosslist>
Variants (Non-exhaustive)
A hook for the entire vertex processing stage of the pipeline.
A hook for the vertex transformation.
A hook for declaring global data that can be shared with all other snippets that are on a vertex hook.
A hook for manipulating the point
size of a vertex. This is only used if
Pipeline::set_per_vertex_point_size
is enabled on the
pipeline.
A hook for the entire fragment processing stage of the pipeline.
A hook for declaring global data wthat can be shared with all other snippets that are on a fragment hook.
A hook for applying the layer matrix to a texture coordinate for a layer.
A hook for the fragment processing of a particular layer.
A hook for the texture lookup stage of a given layer in a pipeline.
Trait Implementations
impl Clone for SnippetHook
[src]
fn clone(&self) -> SnippetHook
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for SnippetHook
[src]
impl Debug for SnippetHook
[src]
impl Display for SnippetHook
[src]
impl Eq for SnippetHook
[src]
impl Hash for SnippetHook
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for SnippetHook
[src]
fn cmp(&self, other: &SnippetHook) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl PartialEq<SnippetHook> for SnippetHook
[src]
fn eq(&self, other: &SnippetHook) -> bool
[src]
fn ne(&self, other: &SnippetHook) -> bool
[src]
impl PartialOrd<SnippetHook> for SnippetHook
[src]
fn partial_cmp(&self, other: &SnippetHook) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl StructuralEq for SnippetHook
[src]
impl StructuralPartialEq for SnippetHook
[src]
Auto Trait Implementations
impl RefUnwindSafe for SnippetHook
impl Send for SnippetHook
impl Sync for SnippetHook
impl Unpin for SnippetHook
impl UnwindSafe for SnippetHook
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,
pub 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> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
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.
pub 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>,