FastUIDraw
Classes | Public Member Functions | Friends | List of all members
fastuidraw::PainterShader Class Reference

A PainterShader encapsulates how to draw or blend. More...

#include <painter_shader.hpp>

Inheritance diagram for fastuidraw::PainterShader:
Inheritance graph
[legend]

Classes

class  Tag
 A Tag is how a PainterShader is described for and by a PainterShaderRegistrar. More...
 

Public Member Functions

 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)
 

Friends

class PainterShaderRegistrar
 

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 PainterShader encapsulates how to draw or blend.

The real meat of a PainterShader is dependent on the backend. Typically it is a shader source code -fragment- that is placed into a large uber-shader.

Definition at line 40 of file painter_shader.hpp.

Constructor & Destructor Documentation

◆ PainterShader() [1/2]

fastuidraw::PainterShader::PainterShader ( unsigned int  num_sub_shaders = 1)
explicit

Ctor for creating a PainterShader which has multiple sub-shaders. The purpose of sub-shaders is for the case where multiple shaders almost same code and those code differences can be realized by examining a sub-shader ID.

Parameters
num_sub_shadersnumber of sub-shaders

◆ PainterShader() [2/2]

fastuidraw::PainterShader::PainterShader ( reference_counted_ptr< PainterShader parent,
unsigned int  sub_shader 
)

Ctor to create a PainterShader realized as a sub-shader of an existing PainterShader.

Parameters
parentparent PainterShader that has sub-shaders.
sub_shaderwhich sub-shader of the parent PainterShader The parent PainterShader MUST already be registered to a PainterShaderRegistrar.

Member Function Documentation

◆ group()

uint32_t fastuidraw::PainterShader::group ( const PainterShaderRegistrar ) const

Returns the shader group to which the shader belongs. A different value in group() triggers a call to PainterDraw:draw_break() to note that the shader group changed. The shader must be registered to the passed PainterShaderRegistrar to have a value from the registrar.

◆ ID()

uint32_t fastuidraw::PainterShader::ID ( const PainterShaderRegistrar ) const

Returns the ID of the shader, the shader must be registered to the passed PainterShaderRegistrar to have an ID value for the passed registrar.

◆ number_sub_shaders()

unsigned int fastuidraw::PainterShader::number_sub_shaders ( void  ) const

Returns the number of sub-shaders the PainterShader supports.

◆ parent()

const reference_counted_ptr<PainterShader>& fastuidraw::PainterShader::parent ( void  ) const

If the PainterShader is a sub-shader returns the parent shader, otherwise returns nullptr.

◆ registered_to()

bool fastuidraw::PainterShader::registered_to ( const PainterShaderRegistrar ) const

Returns true if this shader has been registered the the passed PainterShaderRegistrar.

◆ sub_shader()

uint32_t fastuidraw::PainterShader::sub_shader ( void  ) const

Returns the sub-shader value as passed in ctor if a sub-shader, otherwise returns 0.

◆ tag()

Tag fastuidraw::PainterShader::tag ( const PainterShaderRegistrar ) const

Returns the Tag of the shader which holds the value for ID() in Tag::m_ID and group() in Tag::m_group. The shader must be registered to the passed PainterShaderRegistrar to have a Tag value from the registrar.


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