FastUIDraw
Public Member Functions | List of all members
fastuidraw::PainterBackend Class Referenceabstract

A PainterBackend is an interface that defines the API-specific elements to implement Painter. A fixed PainterBackend will only be used by a single Painter. More...

#include <painter_backend.hpp>

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

Public Member Functions

virtual unsigned int attribs_per_mapping (void) const =0
 
virtual reference_counted_ptr< PainterDrawBreakActionbind_coverage_surface (const reference_counted_ptr< PainterSurface > &cvg_surface)=0
 
virtual reference_counted_ptr< PainterDrawBreakActionbind_image (unsigned int slot, const reference_counted_ptr< const Image > &im)=0
 
virtual unsigned int indices_per_mapping (void) const =0
 
virtual reference_counted_ptr< PainterDrawmap_draw (void)=0
 
virtual void on_painter_begin (void)=0
 
virtual void on_post_draw (void)=0
 
virtual void on_pre_draw (const reference_counted_ptr< PainterSurface > &surface, bool clear_color_buffer, bool begin_new_target)=0
 
- 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 PainterBackend is an interface that defines the API-specific elements to implement Painter. A fixed PainterBackend will only be used by a single Painter.

A Painter will use a Painter Backend as follows within a Painter::begin() and Painter::end() pair.

backend.on_painter_begin();
for (how many surfaces S needed to draw all)
{
std::vector<fastuidraw::reference_counted_ptr<fastuidraw::PainterDraw> > draws;
for (how many PainterDraw objects needed to draw what is drawn in S)
{
p = backend.map_draw();
// fill the buffers on p, potentially calling
// PainterDraw::draw_break() several times.
p.get()->unmap(attributes_written, indices_written, data_store_written);
draws.push_back(p);
}
backend.on_pre_draw(S, maybe_clear_color_buffer, maybe_begin_new_target);
for (p in draws)
{
p.get()->draw();
}
draws.clear();
backend.on_post_draw();
}

Definition at line 74 of file painter_backend.hpp.

Member Function Documentation

◆ attribs_per_mapping()

virtual unsigned int fastuidraw::PainterBackend::attribs_per_mapping ( void  ) const
pure virtual

To be implemented by a derived class to return the number of attributes a PainterDraw returned by map_draw() is guaranteed to hold.

◆ bind_coverage_surface()

virtual reference_counted_ptr<PainterDrawBreakAction> fastuidraw::PainterBackend::bind_coverage_surface ( const reference_counted_ptr< PainterSurface > &  cvg_surface)
pure virtual

Called to return an action to bind a PainterSurface to be used as the read from the deferred coverage buffer.

Parameters
cvg_surfacecoverage surface backing the deferred coverage buffer from which to read

◆ bind_image()

virtual reference_counted_ptr<PainterDrawBreakAction> fastuidraw::PainterBackend::bind_image ( unsigned int  slot,
const reference_counted_ptr< const Image > &  im 
)
pure virtual

Called to return an action to bind an Image whose backing store requires API binding.

Parameters
slotwhich of the external image slots to bind the image to
imImage backed by a gfx API surface that in order to be used, must be bound. In patricular im's Image::type() value is Image::context_texture2d

◆ indices_per_mapping()

virtual unsigned int fastuidraw::PainterBackend::indices_per_mapping ( void  ) const
pure virtual

To be implemented by a derived class to return the number of indices a PainterDraw returned by map_draw() is guaranteed to hold.

◆ map_draw()

virtual reference_counted_ptr<PainterDraw> fastuidraw::PainterBackend::map_draw ( void  )
pure virtual

To be implemented by a derived class to return a PainterDraw for filling of data.

◆ on_painter_begin()

virtual void fastuidraw::PainterBackend::on_painter_begin ( void  )
pure virtual

To be implemented by a derived class to perform any caching or other operations when Painter has Painter::begin().

◆ on_post_draw()

virtual void fastuidraw::PainterBackend::on_post_draw ( void  )
pure virtual

Called just after calling PainterDraw::draw() on a sequence of PainterDraw objects.

◆ on_pre_draw()

virtual void fastuidraw::PainterBackend::on_pre_draw ( const reference_counted_ptr< PainterSurface > &  surface,
bool  clear_color_buffer,
bool  begin_new_target 
)
pure virtual

Called just before calling PainterDraw::draw() on a sequence of PainterDraw objects who have had their PainterDraw::unmap() routine called. An implementation will will clear the depth (aka occlusion) buffer and optionally the color buffer in the viewport of the PainterSurface.

Parameters
surfacethe PainterSurface to which to render content
clear_color_bufferif true, clear the color buffer on the viewport of the surface.
begin_new_targetif true indicates that drawing is to start on the surface (typically this means that when this is true that the backend will clear all auxiliary buffers (such as the depth buffer).

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