Panda3D
|
This class maintains different copies of a page of data between stages of the graphics pipeline (or any other pipelining context). More...
#include "pipelineCycler.h"
Public Member Functions | |
PipelineCycler (Pipeline *pipeline=NULL) | |
PipelineCycler (const PipelineCycler< CycleDataType > ©) | |
void | acquire (Thread *current_thread=NULL) |
Grabs an overall lock on the cycler. | |
CycleDataType * | cheat () const |
Returns a pointer without counting it. | |
CycleDataType * | elevate_read (const CycleDataType *pointer, Thread *current_thread) |
See PipelineCyclerBase::elevate_read(). | |
CycleData * | elevate_read (const CycleData *pointer, Thread *current_thread) |
Elevates a currently-held read pointer into a write pointer. | |
CycleDataType * | elevate_read_stage (int pipeline_stage, const CycleDataType *pointer, Thread *current_thread) |
See PipelineCyclerBase::elevate_read_stage(). | |
CycleData * | elevate_read_stage (int pipeline_stage, const CycleData *pointer, Thread *current_thread) |
Elevates a currently-held read pointer into a write pointer. | |
CycleDataType * | elevate_read_stage_upstream (int pipeline_stage, const CycleDataType *pointer, bool force_to_0, Thread *current_thread) |
See PipelineCyclerBase::elevate_read_stage_upstream(). | |
CycleData * | elevate_read_stage_upstream (int pipeline_stage, const CycleData *pointer, bool force_to_0, Thread *current_thread) |
Elevates a currently-held read pointer into a write pointer. | |
CycleDataType * | elevate_read_upstream (const CycleDataType *pointer, bool force_to_0, Thread *current_thread) |
See PipelineCyclerBase::elevate_read_upstream(). | |
CycleData * | elevate_read_upstream (const CycleData *pointer, bool force_to_0, Thread *current_thread) |
Elevates a currently-held read pointer into a write pointer, like elevate_read(), but also propagates the pointer back to upstream stages, like write_upstream(). | |
int | get_num_stages () |
Returns the number of stages in the pipeline. | |
TypeHandle | get_parent_type () const |
Returns the type of object that owns this cycler, as reported by CycleData::get_parent_type(). | |
int | get_read_count () const |
Returns the number of handles currently outstanding to read the current stage of the data. | |
int | get_write_count () const |
Returns the number of handles currently outstanding to read the current stage of the data. | |
void | increment_read (const CycleData *pointer) const |
Increments the count on a pointer previously retrieved by read(); now the pointer will need to be released twice. | |
void | increment_write (CycleData *pointer) const |
Increments the count on a pointer previously retrieved by write(); now the pointer will need to be released twice. | |
void | operator= (const PipelineCycler< CycleDataType > ©) |
const CycleDataType * | read (Thread *current_thread) const |
See PipelineCyclerBase::read(). | |
const CycleDataType * | read_stage (int pipeline_stage, Thread *current_thread) const |
See PipelineCyclerBase::read_stage(). | |
const CycleDataType * | read_stage_unlocked (int pipeline_stage) const |
See PipelineCyclerBase::read_stage_unlocked(). | |
const CycleDataType * | read_unlocked (Thread *current_thread) const |
See PipelineCyclerBase::read_unlocked(). | |
void | release () |
Release the overall lock on the cycler that was grabbed via acquire(). | |
void | release_read (const CycleData *pointer) const |
Releases a pointer previously obtained via a call to read(). | |
void | release_read_stage (int pipeline_stage, const CycleData *pointer) const |
Releases a pointer previously obtained via a call to read_stage(). | |
void | release_write (CycleData *pointer) |
Releases a pointer previously obtained via a call to write(). | |
void | release_write_stage (int pipeline_stage, CycleData *pointer) |
Releases a pointer previously obtained via a call to write_stage(). | |
CycleDataType * | write (Thread *current_thread) |
See PipelineCyclerBase::write(). | |
CycleDataType * | write_stage (int pipeline_stage, Thread *current_thread) |
See PipelineCyclerBase::write_stage(). | |
CycleDataType * | write_stage_upstream (int pipeline_stage, bool force_to_0, Thread *current_thread) |
See PipelineCyclerBase::write_stage_upstream(). | |
CycleDataType * | write_upstream (bool force_to_0, Thread *current_thread) |
See PipelineCyclerBase::write_upstream(). | |
Public Attributes | |
CycleData * | _data |
This class maintains different copies of a page of data between stages of the graphics pipeline (or any other pipelining context).
The class object maintains up to n copies of a CycleData structure, one for each stage of the pipeline. The head of the pipeline is responsible for making changes to its copy, which are then cycled through the pipeline at each frame.
To access the data, you must first ask for a readable pointer. In order to make changes to the data, you must ask for a writable pointer. Both kinds of pointers should be released when you are done, as a sanity check. The CycleDataReader and CycleDataWriter classes transparently handle this.
If pipelining support is not enabled at compile time (that is, SUPPORT_PIPELINING is not defined), this object compiles to a minimum object that presents the same interface but with minimal runtime overhead. (Actually, this isn't true yet, but it will be one day.)
We define this as a struct instead of a class to guarantee byte placement within the object, so that (particularly for the trivial implementation) the inherited struct's data is likely to be placed by the compiler at the "this" pointer.
Definition at line 56 of file pipelineCycler.h.
void PipelineCyclerTrivialImpl::acquire | ( | Thread * | current_thread = NULL | ) | [inline, inherited] |
Grabs an overall lock on the cycler.
Release it with a call to release(). This lock should be held while walking the list of stages.
Definition at line 84 of file pipelineCyclerTrivialImpl.I.
CycleDataType * PipelineCycler< CycleDataType >::cheat | ( | ) | const [inline] |
Returns a pointer without counting it.
This is only intended for use as the return value for certain nassertr() functions, so the application can recover after a failure to manage the read and write pointers correctly. You should never call this function directly.
Reimplemented from PipelineCyclerTrivialImpl.
Definition at line 392 of file pipelineCycler.I.
CycleData * PipelineCyclerTrivialImpl::elevate_read | ( | const CycleData * | pointer, |
Thread * | current_thread | ||
) | [inline, inherited] |
Elevates a currently-held read pointer into a write pointer.
This may or may not change the value of the pointer. It is only valid to do this if this is the only currently-outstanding read pointer on the current stage.
Definition at line 231 of file pipelineCyclerTrivialImpl.I.
CycleDataType * PipelineCycler< CycleDataType >::elevate_read | ( | const CycleDataType * | pointer, |
Thread * | current_thread | ||
) | [inline] |
See PipelineCyclerBase::elevate_read().
Definition at line 299 of file pipelineCycler.I.
CycleDataType * PipelineCycler< CycleDataType >::elevate_read_stage | ( | int | pipeline_stage, |
const CycleDataType * | pointer, | ||
Thread * | current_thread | ||
) | [inline] |
See PipelineCyclerBase::elevate_read_stage().
Definition at line 343 of file pipelineCycler.I.
CycleData * PipelineCyclerTrivialImpl::elevate_read_stage | ( | int | pipeline_stage, |
const CycleData * | pointer, | ||
Thread * | current_thread | ||
) | [inline, inherited] |
Elevates a currently-held read pointer into a write pointer.
This may or may not change the value of the pointer. It is only valid to do this if this is the only currently-outstanding read pointer on the current stage.
Definition at line 379 of file pipelineCyclerTrivialImpl.I.
CycleDataType * PipelineCycler< CycleDataType >::elevate_read_stage_upstream | ( | int | pipeline_stage, |
const CycleDataType * | pointer, | ||
bool | force_to_0, | ||
Thread * | current_thread | ||
) | [inline] |
See PipelineCyclerBase::elevate_read_stage_upstream().
Definition at line 354 of file pipelineCycler.I.
CycleData * PipelineCyclerTrivialImpl::elevate_read_stage_upstream | ( | int | pipeline_stage, |
const CycleData * | pointer, | ||
bool | force_to_0, | ||
Thread * | current_thread | ||
) | [inline, inherited] |
Elevates a currently-held read pointer into a write pointer.
This may or may not change the value of the pointer. It is only valid to do this if this is the only currently-outstanding read pointer on the current stage.
Definition at line 397 of file pipelineCyclerTrivialImpl.I.
CycleData * PipelineCyclerTrivialImpl::elevate_read_upstream | ( | const CycleData * | pointer, |
bool | force_to_0, | ||
Thread * | current_thread | ||
) | [inline, inherited] |
Elevates a currently-held read pointer into a write pointer, like elevate_read(), but also propagates the pointer back to upstream stages, like write_upstream().
Definition at line 248 of file pipelineCyclerTrivialImpl.I.
CycleDataType * PipelineCycler< CycleDataType >::elevate_read_upstream | ( | const CycleDataType * | pointer, |
bool | force_to_0, | ||
Thread * | current_thread | ||
) | [inline] |
See PipelineCyclerBase::elevate_read_upstream().
Definition at line 310 of file pipelineCycler.I.
int PipelineCyclerTrivialImpl::get_num_stages | ( | ) | [inline, inherited] |
Returns the number of stages in the pipeline.
Definition at line 283 of file pipelineCyclerTrivialImpl.I.
TypeHandle PipelineCyclerTrivialImpl::get_parent_type | ( | ) | const [inline, inherited] |
Returns the type of object that owns this cycler, as reported by CycleData::get_parent_type().
Definition at line 422 of file pipelineCyclerTrivialImpl.I.
References PipelineCyclerTrivialImpl::cheat(), and CycleData::get_parent_type().
int PipelineCyclerTrivialImpl::get_read_count | ( | ) | const [inline, inherited] |
Returns the number of handles currently outstanding to read the current stage of the data.
This should only be used for debugging purposes.
Definition at line 453 of file pipelineCyclerTrivialImpl.I.
int PipelineCyclerTrivialImpl::get_write_count | ( | ) | const [inline, inherited] |
Returns the number of handles currently outstanding to read the current stage of the data.
This will normally only be either 0 or 1. This should only be used for debugging purposes.
Definition at line 466 of file pipelineCyclerTrivialImpl.I.
void PipelineCyclerTrivialImpl::increment_read | ( | const CycleData * | pointer | ) | const [inline, inherited] |
Increments the count on a pointer previously retrieved by read(); now the pointer will need to be released twice.
Definition at line 145 of file pipelineCyclerTrivialImpl.I.
void PipelineCyclerTrivialImpl::increment_write | ( | CycleData * | pointer | ) | const [inline, inherited] |
Increments the count on a pointer previously retrieved by write(); now the pointer will need to be released twice.
Definition at line 264 of file pipelineCyclerTrivialImpl.I.
const CycleDataType * PipelineCycler< CycleDataType >::read | ( | Thread * | current_thread | ) | const [inline] |
See PipelineCyclerBase::read().
Reimplemented from PipelineCyclerTrivialImpl.
Definition at line 266 of file pipelineCycler.I.
const CycleDataType * PipelineCycler< CycleDataType >::read_stage | ( | int | pipeline_stage, |
Thread * | current_thread | ||
) | const [inline] |
See PipelineCyclerBase::read_stage().
Reimplemented from PipelineCyclerTrivialImpl.
Definition at line 332 of file pipelineCycler.I.
const CycleDataType * PipelineCycler< CycleDataType >::read_stage_unlocked | ( | int | pipeline_stage | ) | const [inline] |
See PipelineCyclerBase::read_stage_unlocked().
Reimplemented from PipelineCyclerTrivialImpl.
Definition at line 321 of file pipelineCycler.I.
const CycleDataType * PipelineCycler< CycleDataType >::read_unlocked | ( | Thread * | current_thread | ) | const [inline] |
See PipelineCyclerBase::read_unlocked().
Reimplemented from PipelineCyclerTrivialImpl.
Definition at line 255 of file pipelineCycler.I.
void PipelineCyclerTrivialImpl::release | ( | ) | [inline, inherited] |
Release the overall lock on the cycler that was grabbed via acquire().
Definition at line 94 of file pipelineCyclerTrivialImpl.I.
void PipelineCyclerTrivialImpl::release_read | ( | const CycleData * | pointer | ) | const [inline, inherited] |
Releases a pointer previously obtained via a call to read().
Definition at line 155 of file pipelineCyclerTrivialImpl.I.
Referenced by BamWriter::write_cdata().
void PipelineCyclerTrivialImpl::release_read_stage | ( | int | pipeline_stage, |
const CycleData * | pointer | ||
) | const [inline, inherited] |
Releases a pointer previously obtained via a call to read_stage().
Definition at line 328 of file pipelineCyclerTrivialImpl.I.
void PipelineCyclerTrivialImpl::release_write | ( | CycleData * | pointer | ) | [inline, inherited] |
Releases a pointer previously obtained via a call to write().
Definition at line 274 of file pipelineCyclerTrivialImpl.I.
Referenced by BamReader::read_cdata().
void PipelineCyclerTrivialImpl::release_write_stage | ( | int | pipeline_stage, |
CycleData * | pointer | ||
) | [inline, inherited] |
Releases a pointer previously obtained via a call to write_stage().
Definition at line 412 of file pipelineCyclerTrivialImpl.I.
CycleDataType * PipelineCycler< CycleDataType >::write | ( | Thread * | current_thread | ) | [inline] |
See PipelineCyclerBase::write().
Reimplemented from PipelineCyclerTrivialImpl.
Definition at line 277 of file pipelineCycler.I.
CycleDataType * PipelineCycler< CycleDataType >::write_stage | ( | int | pipeline_stage, |
Thread * | current_thread | ||
) | [inline] |
See PipelineCyclerBase::write_stage().
Reimplemented from PipelineCyclerTrivialImpl.
Definition at line 365 of file pipelineCycler.I.
CycleDataType * PipelineCycler< CycleDataType >::write_stage_upstream | ( | int | pipeline_stage, |
bool | force_to_0, | ||
Thread * | current_thread | ||
) | [inline] |
See PipelineCyclerBase::write_stage_upstream().
Reimplemented from PipelineCyclerTrivialImpl.
Definition at line 376 of file pipelineCycler.I.
CycleDataType * PipelineCycler< CycleDataType >::write_upstream | ( | bool | force_to_0, |
Thread * | current_thread | ||
) | [inline] |
See PipelineCyclerBase::write_upstream().
Reimplemented from PipelineCyclerTrivialImpl.
Definition at line 288 of file pipelineCycler.I.