FastUIDraw
Classes | Public Member Functions | Public Attributes | Protected Member Functions | List of all members
fastuidraw::PainterDraw Class Referenceabstract

Store for attributes, indices of items and shared data of items for items to draw. Indices (stored in m_indices) are -ALWAYS- in groups of three where each group is a single triangle and each index is an index into m_attributes. The PainterDraw object is NOT thread safe, neither is its reference count. A PainterDraw object is used Painter to send attributer and index data to a Painter Backend. More...

#include <painter_draw.hpp>

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

Classes

class  DelayedAction
 A delayed action is an action that is to be called just before the buffers of a PainterDraw are to be unmapped. Typically, this is used to write values using information that is ready after the original values are written by Painter. A fixed DelayedAction object may only be added to one PainterDraw object, but a single PainterDraw can have many DelayedAction objects added to it. More...
 

Public Member Functions

 PainterDraw (void)
 
void add_action (const reference_counted_ptr< DelayedAction > &h) const
 
virtual void draw (void) const =0
 
virtual bool draw_break (enum PainterSurface::render_type_t render_type, const PainterShaderGroup &old_groups, const PainterShaderGroup &new_groups, unsigned int indices_written)=0
 
virtual bool draw_break (const reference_counted_ptr< const PainterDrawBreakAction > &action, unsigned int indices_written)=0
 
void unmap (unsigned int attributes_written, unsigned int indices_written, unsigned int data_store_written)
 
bool unmapped (void) const
 
- Public Member Functions inherited from fastuidraw::reference_counted_base< T, Counter >
 reference_counted_base (void)
 

Public Attributes

c_array< PainterAttributem_attributes
 
c_array< uint32_t > m_header_attributes
 
c_array< PainterIndexm_indices
 
c_array< uvec4m_store
 

Protected Member Functions

virtual void unmap_implement (unsigned int attributes_written, unsigned int indices_written, unsigned int data_store_written)=0
 

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

Store for attributes, indices of items and shared data of items for items to draw. Indices (stored in m_indices) are -ALWAYS- in groups of three where each group is a single triangle and each index is an index into m_attributes. The PainterDraw object is NOT thread safe, neither is its reference count. A PainterDraw object is used Painter to send attributer and index data to a Painter Backend.

Definition at line 49 of file painter_draw.hpp.

Constructor & Destructor Documentation

◆ PainterDraw()

fastuidraw::PainterDraw::PainterDraw ( void  )

Ctor, a derived class will set m_attributes, m_header_attributes, m_indices and m_store.

Member Function Documentation

◆ add_action()

void fastuidraw::PainterDraw::add_action ( const reference_counted_ptr< DelayedAction > &  h) const

Adds a delayed action to the action list.

Parameters
hhandle to action to add.

◆ draw()

virtual void fastuidraw::PainterDraw::draw ( void  ) const
pure virtual

To be implemented by a derived class to draw the contents. Must be performed after unmap() is called. In addition, may only be called within a PainterBackend::on_pre_draw() / PainterBackend::on_post_draw() pair of the Painter Backend whose PainterBackend::map_draw() created this object.

◆ draw_break() [1/2]

virtual bool fastuidraw::PainterDraw::draw_break ( enum PainterSurface::render_type_t  render_type,
const PainterShaderGroup old_groups,
const PainterShaderGroup new_groups,
unsigned int  indices_written 
)
pure virtual

Called to indicate a change in value to the painter header that this PainterDraw needs to record. The most common case is to insert API state changes (or just break a draw) for when a Painter Backend cannot accomodate a Painter state change without changing the 3D API state.

Parameters
render_typethe render target type of the rendering
old_groupsPainterShaderGroup before state change
new_groupsPainterShaderGroup after state change
indices_writtentotal number of indices written to m_indices -before- the change
Returns
true if the PainterShaderGroup resulted in a draw break

◆ draw_break() [2/2]

virtual bool fastuidraw::PainterDraw::draw_break ( const reference_counted_ptr< const PainterDrawBreakAction > &  action,
unsigned int  indices_written 
)
pure virtual

Called to execute an action (and thus also cause a draw-call break). Implementations are to assume that PainterDrawBreakAction reference is non-null. Implementations are to return true if the draw_break triggers a break in the draw call.

Parameters
actionaction to execute
indices_writtentotal number of indices written to m_indices -before- the break

◆ unmap()

void fastuidraw::PainterDraw::unmap ( unsigned int  attributes_written,
unsigned int  indices_written,
unsigned int  data_store_written 
)

Signals this PainterDraw to be unmapped. Actual unmapping is delayed until all actions that have been added with add_action() have been called.

Parameters
attributes_writtennumber of elements written to m_attributes and m_header_attributes.
indices_writtennumber of elements written to m_indices
data_store_writtennumber of elements written to m_store

◆ unmap_implement()

virtual void fastuidraw::PainterDraw::unmap_implement ( unsigned int  attributes_written,
unsigned int  indices_written,
unsigned int  data_store_written 
)
protectedpure virtual

To be implemented by a derived class to unmap the arrays m_store, m_attributes and m_indices. Once unmapped, the store can no longer be written to.

Parameters
attributes_writtenonly the range [0,floats_written) of m_attributes must be uploaded to 3D API
indices_writtenonly the range [0,uints_written) of m_indices specify indices to use.
data_store_writtenonly the range [0,data_store_written) of m_store must be uploaded to 3D API

◆ unmapped()

bool fastuidraw::PainterDraw::unmapped ( void  ) const

Returns true if and only if this PainterDraw is unmapped.

Member Data Documentation

◆ m_attributes

c_array<PainterAttribute> fastuidraw::PainterDraw::m_attributes

Location to which to place attribute data, the store is understood to be write only.

Definition at line 101 of file painter_draw.hpp.

◆ m_header_attributes

c_array<uint32_t> fastuidraw::PainterDraw::m_header_attributes

Location to which to place the attribute data storing the header locations in m_store. The size of m_header_attributes must be the same as the size of m_attributes, the store is understood to be write only.

Definition at line 110 of file painter_draw.hpp.

◆ m_indices

c_array<PainterIndex> fastuidraw::PainterDraw::m_indices

Location to which to place index data. Values are indices into m_attributes, the store is understood to be write only.

Definition at line 117 of file painter_draw.hpp.

◆ m_store

c_array<uvec4> fastuidraw::PainterDraw::m_store

Generic store for data that is shared between vertices within an item and possibly between items. The store is understood to be write only.

Definition at line 125 of file painter_draw.hpp.


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