FastUIDraw
|
A PainterBrushShaderGLSL is a PainterBrushShader whose shader code fragment is via GLSL.The vertex shader code needs to implement the function: More...
#include <painter_brush_shader_glsl.hpp>
Classes | |
class | DependencyList |
If one wishes to make use of other PainterBrushShaderGLSL fastuidraw_gl_vert_brush_main()/fastuidraw_gl_frag_brush_main() of other shaders (for example to have a simple shader that adds on to a previous shader), a DependencyList provides the means to do so. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from fastuidraw::reference_counted_base< T, Counter > | |
static void | add_reference (const reference_counted_base< T, Counter > *p) |
static void | remove_reference (const reference_counted_base< T, Counter > *p) |
A PainterBrushShaderGLSL is a PainterBrushShader whose shader code fragment is via GLSL.The vertex shader code needs to implement the function:
where
The fragment shader code needs to implement the function:
which returns the color value, pre-multiplied by alpha, by which to modulate the outgoing fragment color.
Available to only the vertex shader are the following:
Available to only the fragment shader are the following:
Available to both the vertex and fragment shader are the following:
For both stages, the value of the argument of shader_data_block is which 128-bit block into the data store (PainterDraw::m_store) of the shader data to be read with the GLSL macro fastuidraw_fetch_data. On exit, this value must be updated to the location just past the shader data of the shader.
For both stages, the value of the argument of sub_shader() is the value of PainterShader::sub_shader() of the active shader.
Also, if one defines macros in any of the passed ShaderSource objects, those macros MUST be undefined at the end. In addition, if one has local helper functions, to avoid global name collision, those function names should be wrapped in the macro FASTUIDRAW_LOCAL() to make sure that the function is given a unique global name within the uber-shader.
Lastly, one can use the class UnpackSourceGenerator to generate shader code to unpack values from the data in the data store buffer. That machine generated code uses the macro fastuidraw_fetch_data().
Definition at line 92 of file painter_brush_shader_glsl.hpp.
fastuidraw::glsl::PainterBrushShaderGLSL::PainterBrushShaderGLSL | ( | unsigned int | number_context_textures, |
const ShaderSource & | vertex_src, | ||
const ShaderSource & | fragment_src, | ||
const symbol_list & | symbols, | ||
unsigned int | num_sub_shaders = 1 , |
||
const DependencyList & | dependencies = DependencyList() |
||
) |
Ctor.
number_context_textures | number of context textures the shader specified in vertex_src/fragment_src uses; i.e., this value does NOT include the number of context textures any dependencies use |
vertex_src | GLSL source holding vertex shader routine |
fragment_src | GLSL source holding fragment shader routine |
symbols | list of symbols of the shader |
num_sub_shaders | the number of sub-shaders it supports |
dependencies | list of other PainterBrushShaderGLSL that are used directly. |
fastuidraw::glsl::PainterBrushShaderGLSL::PainterBrushShaderGLSL | ( | unsigned int | number_context_textures, |
const ShaderSource & | vertex_src, | ||
const ShaderSource & | fragment_src, | ||
const symbol_list & | symbols, | ||
const DependencyList & | dependencies, | ||
unsigned int | num_sub_shaders = 1 |
||
) |
Ctor.
number_context_textures | number of context textures the shader specified in vertex_src/fragment_src uses; i.e., this value does NOT include the number of context textures any dependencies use |
vertex_src | GLSL source holding vertex shader routine |
fragment_src | GLSL source holding fragment shader routine |
symbols | list of symbols of the shader |
num_sub_shaders | the number of sub-shaders it supports |
dependencies | list of other PainterBrushShaderGLSL that are used directly. |
unsigned int fastuidraw::glsl::PainterBrushShaderGLSL::context_texture_start | ( | void | ) | const |
This is the sum across dependency_list_shaders() of number_context_textures() which in turn gives the value of fastuidraw_brush_start_context_texture for the shader code passed in the ctor.
c_array<const c_string> fastuidraw::glsl::PainterBrushShaderGLSL::dependency_list_names | ( | void | ) | const |
Returns the names that each shader listed in dependency_list_shaders() is referenced by, i.e. the i'th element of dependency_list_shaders() is referenced as the i'th element of dependency_list_names().
c_array<const reference_counted_ptr<const PainterBrushShaderGLSL> > fastuidraw::glsl::PainterBrushShaderGLSL::dependency_list_shaders | ( | void | ) | const |
Return the list of shaders on which this shader is dependent.
const ShaderSource& fastuidraw::glsl::PainterBrushShaderGLSL::fragment_src | ( | void | ) | const |
Return the GLSL source of the fragment shader
unsigned int fastuidraw::glsl::PainterBrushShaderGLSL::number_context_textures | ( | void | ) | const |
Number of external textures the custum brush uses.
const symbol_list& fastuidraw::glsl::PainterBrushShaderGLSL::symbols | ( | void | ) | const |
Returns the symbol of the shader
|
inline |
Returns the varyings of the shader, equivalent to
Definition at line 245 of file painter_brush_shader_glsl.hpp.
const ShaderSource& fastuidraw::glsl::PainterBrushShaderGLSL::vertex_src | ( | void | ) | const |
Return the GLSL source of the vertex shader