FastUIDraw
Classes | Public Member Functions | List of all members
fastuidraw::glsl::PainterBrushShaderGLSL Class Reference

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>

Inheritance diagram for fastuidraw::glsl::PainterBrushShaderGLSL:
Inheritance graph
[legend]

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...
 

Public Member Functions

 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())
 
 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)
 
unsigned int context_texture_start (void) const
 
c_array< const c_stringdependency_list_names (void) const
 
c_array< const reference_counted_ptr< const PainterBrushShaderGLSL > > dependency_list_shaders (void) const
 
const ShaderSourcefragment_src (void) const
 
unsigned int number_context_textures (void) const
 
const symbol_listsymbols (void) const
 
const varying_listvaryings (void) const
 
const ShaderSourcevertex_src (void) const
 
- Public Member Functions inherited from fastuidraw::PainterBrushShader
 PainterBrushShader (unsigned int num_sub_shaders=1)
 
 PainterBrushShader (reference_counted_ptr< PainterBrushShader > parent, unsigned int sub_shader)
 
- Public Member Functions inherited from fastuidraw::PainterShader
 PainterShader (unsigned int num_sub_shaders=1)
 
 PainterShader (reference_counted_ptr< PainterShader > parent, unsigned int sub_shader)
 
uint32_t group (const PainterShaderRegistrar &) const
 
uint32_t ID (const PainterShaderRegistrar &) const
 
unsigned int number_sub_shaders (void) const
 
const reference_counted_ptr< PainterShader > & parent (void) const
 
bool registered_to (const PainterShaderRegistrar &) const
 
uint32_t sub_shader (void) const
 
Tag tag (const PainterShaderRegistrar &) const
 
- Public Member Functions inherited from fastuidraw::reference_counted_base< T, Counter >
 reference_counted_base (void)
 

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)
 

Detailed Description

A PainterBrushShaderGLSL is a PainterBrushShader whose shader code fragment is via GLSL.The vertex shader code needs to implement the function:

void
fastuidraw_gl_vert_brush_main(in uint sub_shader,
inout uint shader_data_block,
in vec2 brush_p)

where

The fragment shader code needs to implement the function:

fastuidraw_gl_frag_brush_main(in uint sub_shader,
inout uint shader_data_block)

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.

Constructor & Destructor Documentation

◆ PainterBrushShaderGLSL() [1/2]

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.

Parameters
number_context_texturesnumber 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_srcGLSL source holding vertex shader routine
fragment_srcGLSL source holding fragment shader routine
symbolslist of symbols of the shader
num_sub_shadersthe number of sub-shaders it supports
dependencieslist of other PainterBrushShaderGLSL that are used directly.

◆ PainterBrushShaderGLSL() [2/2]

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.

Parameters
number_context_texturesnumber 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_srcGLSL source holding vertex shader routine
fragment_srcGLSL source holding fragment shader routine
symbolslist of symbols of the shader
num_sub_shadersthe number of sub-shaders it supports
dependencieslist of other PainterBrushShaderGLSL that are used directly.

Member Function Documentation

◆ context_texture_start()

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.

◆ dependency_list_names()

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().

◆ dependency_list_shaders()

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.

◆ fragment_src()

const ShaderSource& fastuidraw::glsl::PainterBrushShaderGLSL::fragment_src ( void  ) const

Return the GLSL source of the fragment shader

◆ number_context_textures()

unsigned int fastuidraw::glsl::PainterBrushShaderGLSL::number_context_textures ( void  ) const

Number of external textures the custum brush uses.

◆ symbols()

const symbol_list& fastuidraw::glsl::PainterBrushShaderGLSL::symbols ( void  ) const

Returns the symbol of the shader

◆ varyings()

const varying_list& fastuidraw::glsl::PainterBrushShaderGLSL::varyings ( void  ) const
inline

Returns the varyings of the shader, equivalent to

Definition at line 245 of file painter_brush_shader_glsl.hpp.

◆ vertex_src()

const ShaderSource& fastuidraw::glsl::PainterBrushShaderGLSL::vertex_src ( void  ) const

Return the GLSL source of the vertex shader


The documentation for this class was generated from the following file: