Panda3D
Public Member Functions | List of all members
GraphicsThreadingModel Class Reference

This represents the user's specification of how a particular frame is handled by the various threads. More...

#include "graphicsThreadingModel.h"

Public Member Functions

 GraphicsThreadingModel (const string &model=string())
 The threading model accepts a string representing the names of the two threads that will process cull and draw for the given window, separated by a slash. More...
 
 GraphicsThreadingModel (const GraphicsThreadingModel &copy)
 
const string & get_cull_name () const
 Returns the name of the thread that will handle culling in this model. More...
 
bool get_cull_sorting () const
 Returns true if the model involves a separate cull pass, or false if culling happens implicitly, at the same time as draw. More...
 
int get_cull_stage () const
 Returns the pipeline stage from which the cull thread should access data. More...
 
const string & get_draw_name () const
 Returns the name of the thread that will handle sending the actual graphics primitives to the graphics API in this model. More...
 
int get_draw_stage () const
 Returns the pipeline stage from which the draw thread should access data. More...
 
string get_model () const
 Returns the string that describes the threading model. More...
 
bool is_default () const
 Returns true if the threading model is the default, cull-then-draw single-threaded model, or false otherwise. More...
 
bool is_single_threaded () const
 Returns true if the threading model is a single-threaded model, or false if it involves threads. More...
 
void operator= (const GraphicsThreadingModel &copy)
 
void output (ostream &out) const
 
void set_cull_name (const string &cull_name)
 Changes the name of the thread that will handle culling in this model. More...
 
void set_cull_sorting (bool cull_sorting)
 Changes the flag that indicates whether the threading model involves a separate cull pass. More...
 
void set_draw_name (const string &cull_name)
 Changes the name of the thread that will handle drawing in this model. More...
 

Detailed Description

This represents the user's specification of how a particular frame is handled by the various threads.

Definition at line 25 of file graphicsThreadingModel.h.

Constructor & Destructor Documentation

◆ GraphicsThreadingModel()

GraphicsThreadingModel::GraphicsThreadingModel ( const string &  model = string())

The threading model accepts a string representing the names of the two threads that will process cull and draw for the given window, separated by a slash.

The names are completely arbitrary and are used only to differentiate threads. The two names may be the same, meaning the same thread, or each may be the empty string, which represents the previous thread.

Thus, for example, "cull/draw" indicates that the window will be culled in a thread called "cull", and drawn in a separate thread called "draw". "draw/draw" or simply "draw" indicates the window will be culled and drawn in the same thread, "draw". On the other hand, "/draw" indicates the thread will be culled in the main, or app thread, and drawn in a separate thread named "draw". The empty string, "" or "/", indicates the thread will be culled and drawn in the main thread; that is to say, a single-process model.

Finally, if the threading model begins with a "-" character, then cull and draw are run simultaneously, in the same thread, with no binning or state sorting. It simplifies the cull process but it forces the scene to render in scene graph order; state sorting and alpha sorting is lost.

Definition at line 48 of file graphicsThreadingModel.cxx.

References get_model().

Member Function Documentation

◆ get_cull_name()

const string & GraphicsThreadingModel::get_cull_name ( ) const
inline

Returns the name of the thread that will handle culling in this model.

Definition at line 52 of file graphicsThreadingModel.I.

References set_cull_name().

Referenced by GraphicsEngine::do_cull(), and get_model().

◆ get_cull_sorting()

bool GraphicsThreadingModel::get_cull_sorting ( ) const
inline

Returns true if the model involves a separate cull pass, or false if culling happens implicitly, at the same time as draw.

Definition at line 131 of file graphicsThreadingModel.I.

References set_cull_sorting().

Referenced by GraphicsEngine::do_cull(), get_draw_stage(), and get_model().

◆ get_cull_stage()

int GraphicsThreadingModel::get_cull_stage ( ) const
inline

Returns the pipeline stage from which the cull thread should access data.

This will be 0 if the cull is run in the same thread as app, or 1 if it is its own thread.

Definition at line 79 of file graphicsThreadingModel.I.

References get_draw_name().

Referenced by GraphicsEngine::do_cull(), and set_cull_name().

◆ get_draw_name()

const string & GraphicsThreadingModel::get_draw_name ( ) const
inline

Returns the name of the thread that will handle sending the actual graphics primitives to the graphics API in this model.

Definition at line 91 of file graphicsThreadingModel.I.

References set_draw_name().

Referenced by GraphicsEngine::dispatch_compute(), GraphicsEngine::do_cull(), GraphicsEngine::extract_texture_data(), get_cull_stage(), get_model(), and GraphicsEngine::make_output().

◆ get_draw_stage()

int GraphicsThreadingModel::get_draw_stage ( ) const
inline

Returns the pipeline stage from which the draw thread should access data.

This will be the same value as get_cull_stage() if cull and draw are run in the same thread, or one more than that value if draw should be in its own thread.

Definition at line 119 of file graphicsThreadingModel.I.

References get_cull_sorting().

Referenced by GraphicsEngine::do_cull(), and set_draw_name().

◆ get_model()

string GraphicsThreadingModel::get_model ( ) const

Returns the string that describes the threading model.

See the constructor.

Definition at line 74 of file graphicsThreadingModel.cxx.

References get_cull_name(), get_cull_sorting(), and get_draw_name().

Referenced by GraphicsThreadingModel(), and is_default().

◆ is_default()

bool GraphicsThreadingModel::is_default ( ) const
inline

Returns true if the threading model is the default, cull-then-draw single-threaded model, or false otherwise.

Definition at line 171 of file graphicsThreadingModel.I.

References get_model(), and is_single_threaded().

Referenced by GraphicsEngine::GraphicsEngine(), and is_single_threaded().

◆ is_single_threaded()

bool GraphicsThreadingModel::is_single_threaded ( ) const
inline

Returns true if the threading model is a single-threaded model, or false if it involves threads.

Definition at line 159 of file graphicsThreadingModel.I.

References is_default().

Referenced by is_default(), set_cull_sorting(), and GraphicsEngine::set_threading_model().

◆ set_cull_name()

void GraphicsThreadingModel::set_cull_name ( const string &  cull_name)
inline

Changes the name of the thread that will handle culling in this model.

This won't change any windows that were already created with this model; this only has an effect on newly-opened windows.

Definition at line 65 of file graphicsThreadingModel.I.

References get_cull_stage().

Referenced by get_cull_name().

◆ set_cull_sorting()

void GraphicsThreadingModel::set_cull_sorting ( bool  cull_sorting)
inline

Changes the flag that indicates whether the threading model involves a separate cull pass.

This won't change any windows that were already created with this model; this only has an effect on newly-opened windows.

Definition at line 146 of file graphicsThreadingModel.I.

References is_single_threaded().

Referenced by get_cull_sorting().

◆ set_draw_name()

void GraphicsThreadingModel::set_draw_name ( const string &  draw_name)
inline

Changes the name of the thread that will handle drawing in this model.

This won't change any windows that were already created with this model; this only has an effect on newly-opened windows.

Definition at line 104 of file graphicsThreadingModel.I.

References get_draw_stage().

Referenced by get_draw_name().


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