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

A PainterBlendShaderGLSL is a PainterBlendShader whose shader code fragment is via GLSL. More...

#include <painter_blend_shader_glsl.hpp>

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

Classes

class  DependencyList
 If one wishes to make use of other PainterBlendShaderGLSL fastuidraw_gl_compute_blend_value(), fastuidraw_gl_compute_blend_factors() or fastuidraw_gl_compute_post_blended_value() routines 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

 PainterBlendShaderGLSL (enum shader_type tp, const ShaderSource &src, unsigned int num_sub_shaders=1, const DependencyList &dependencies=DependencyList())
 
const glsl::ShaderSourceblend_src (void) const
 
c_array< const c_stringdependency_list_names (void) const
 
c_array< const reference_counted_ptr< const PainterBlendShaderGLSL > > dependency_list_shaders (void) const
 
- Public Member Functions inherited from fastuidraw::PainterBlendShader
 PainterBlendShader (enum shader_type tp, unsigned int num_sub_shaders=1)
 
 PainterBlendShader (reference_counted_ptr< PainterBlendShader > parent, unsigned int sub_shader)
 
enum shader_type type (void) const
 
- 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

- Public Types inherited from fastuidraw::PainterBlendShader
enum  shader_type { single_src, dual_src, framebuffer_fetch, number_types }
 Enumeration to specify how blend shader operates. More...
 
- 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 PainterBlendShaderGLSL is a PainterBlendShader whose shader code fragment is via GLSL.

The code to implement is dependent on the PainterBlendShader::type() of the created PainterBlendShaderGLSL.

The GLSL elements in the modules GLSL Vertex Fragment Code and GLSL Fragment Code are available for use.

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.

The value of the argument of shader_data_block is which 128-bit block into the data store (PainterDraw::m_store) of the custom shader data to be read with the GLSL macro fastuidraw_fetch_data.

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 104 of file painter_blend_shader_glsl.hpp.

Constructor & Destructor Documentation

◆ PainterBlendShaderGLSL()

fastuidraw::glsl::PainterBlendShaderGLSL::PainterBlendShaderGLSL ( enum shader_type  tp,
const ShaderSource src,
unsigned int  num_sub_shaders = 1,
const DependencyList dependencies = DependencyList() 
)

Ctor.

Parameters
tpblend shader type
srcGLSL code fragment for blend shading
num_sub_shadersthe number of sub-shaders it supports
dependencieslist of other PainterBlendShaderGLSL that are used directly.

Member Function Documentation

◆ blend_src()

const glsl::ShaderSource& fastuidraw::glsl::PainterBlendShaderGLSL::blend_src ( void  ) const

Return the GLSL source of the blend shader

◆ dependency_list_names()

c_array<const c_string> fastuidraw::glsl::PainterBlendShaderGLSL::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 PainterBlendShaderGLSL> > fastuidraw::glsl::PainterBlendShaderGLSL::dependency_list_shaders ( void  ) const

Return the list of shaders on which this shader is dependent.


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