Panda3D
Loading...
Searching...
No Matches
Public Member Functions | List of all members
PipelineCycler< CycleDataType > Struct Template Reference

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"

Inheritance diagram for PipelineCycler< CycleDataType >:
PipelineCyclerTrivialImpl

Public Member Functions

 PipelineCycler (const PipelineCycler< CycleDataType > &copy)
 
 PipelineCycler (CycleDataType &&initial_data, Pipeline *pipeline=nullptr)
 
 PipelineCycler (Pipeline *pipeline=nullptr)
 
CycleDataType * cheat () const
 Returns a pointer without counting it.
 
CycleDataType * elevate_read (const CycleDataType *pointer, Thread *current_thread)
 See PipelineCyclerBase::elevate_read().
 
CycleDataType * elevate_read_stage (int pipeline_stage, const CycleDataType *pointer, Thread *current_thread)
 See PipelineCyclerBase::elevate_read_stage().
 
CycleDataType * elevate_read_stage_upstream (int pipeline_stage, const CycleDataType *pointer, bool force_to_0, Thread *current_thread)
 See PipelineCyclerBase::elevate_read_stage_upstream().
 
CycleDataType * elevate_read_upstream (const CycleDataType *pointer, bool force_to_0, Thread *current_thread)
 See PipelineCyclerBase::elevate_read_upstream().
 
void operator= (const PipelineCycler< CycleDataType > &copy)
 
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().
 
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 Member Functions inherited from PipelineCyclerTrivialImpl
 PipelineCyclerTrivialImpl (const PipelineCyclerTrivialImpl &copy)=delete
 
 PipelineCyclerTrivialImpl (CycleData *initial_data, Pipeline *pipeline=nullptr)
 
void acquire (Thread *current_thread=nullptr)
 Grabs an overall lock on the cycler.
 
CycleDatacheat () const
 Returns a pointer without counting it.
 
CycleDataelevate_read (const CycleData *pointer, Thread *current_thread)
 Elevates a currently-held read pointer into a write pointer.
 
CycleDataelevate_read_stage (int pipeline_stage, const CycleData *pointer, Thread *current_thread)
 Elevates a currently-held read pointer into a write pointer.
 
CycleDataelevate_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.
 
CycleDataelevate_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.
 
PipelineCyclerTrivialImploperator= (const PipelineCyclerTrivialImpl &copy)=delete
 
const CycleDataread (Thread *current_thread) const
 Returns a const CycleData pointer, filled with the data for the current stage of the pipeline as seen by this thread.
 
const CycleDataread_stage (int pipeline_stage, Thread *current_thread) const
 Returns a const CycleData pointer, filled with the data for the indicated pipeline stage.
 
const CycleDataread_stage_unlocked (int pipeline_stage) const
 Returns a const CycleData pointer, filled with the data for the indicated stage of the pipeline.
 
const CycleDataread_unlocked (Thread *current_thread) const
 Returns a const CycleData pointer, filled with the data for the current stage of the pipeline as seen by this thread.
 
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().
 
CycleDatawrite (Thread *current_thread)
 Returns a non-const CycleData pointer, filled with a unique copy of the data for the current stage of the pipeline as seen by this thread.
 
CycleDatawrite_stage (int pipeline_stage, Thread *current_thread)
 Returns a pointer suitable for writing to the nth stage of the pipeline.
 
CycleDatawrite_stage_upstream (int pipeline_stage, bool force_to_0, Thread *current_thread)
 Returns a pointer suitable for writing to the nth stage of the pipeline.
 
CycleDatawrite_upstream (bool force_to_0, Thread *current_thread)
 This special variant on write() will automatically propagate changes back to upstream pipeline stages.
 

Additional Inherited Members

- Public Attributes inherited from PipelineCyclerTrivialImpl
CycleData_data
 

Detailed Description

template<class CycleDataType>
struct PipelineCycler< CycleDataType >

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, DO_PIPELINING is not defined), this object compiles to a minimum object that presents the same interface but with minimal runtime overhead.

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 46 of file pipelineCycler.h.

Constructor & Destructor Documentation

◆ PipelineCycler() [1/3]

template<class CycleDataType >
PipelineCycler< CycleDataType >::PipelineCycler ( Pipeline * pipeline = nullptr)
inline

Definition at line 189 of file pipelineCycler.I.

◆ PipelineCycler() [2/3]

template<class CycleDataType >
PipelineCycler< CycleDataType >::PipelineCycler ( CycleDataType && initial_data,
Pipeline * pipeline = nullptr )
inline

Definition at line 199 of file pipelineCycler.I.

◆ PipelineCycler() [3/3]

template<class CycleDataType >
PipelineCycler< CycleDataType >::PipelineCycler ( const PipelineCycler< CycleDataType > & copy)
inline

Definition at line 210 of file pipelineCycler.I.

Member Function Documentation

◆ cheat()

template<class CycleDataType >
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.

Definition at line 341 of file pipelineCycler.I.

◆ elevate_read()

template<class CycleDataType >
CycleDataType * PipelineCycler< CycleDataType >::elevate_read ( const CycleDataType * pointer,
Thread * current_thread )
inline

See PipelineCyclerBase::elevate_read().

Definition at line 266 of file pipelineCycler.I.

◆ elevate_read_stage()

template<class CycleDataType >
CycleDataType * PipelineCycler< CycleDataType >::elevate_read_stage ( int pipeline_stage,
const CycleDataType * pointer,
Thread * current_thread )
inline

◆ elevate_read_stage_upstream()

template<class CycleDataType >
CycleDataType * PipelineCycler< CycleDataType >::elevate_read_stage_upstream ( int pipeline_stage,
const CycleDataType * pointer,
bool force_to_0,
Thread * current_thread )
inline

◆ elevate_read_upstream()

template<class CycleDataType >
CycleDataType * PipelineCycler< CycleDataType >::elevate_read_upstream ( const CycleDataType * pointer,
bool force_to_0,
Thread * current_thread )
inline

◆ operator=()

template<class CycleDataType >
void PipelineCycler< CycleDataType >::operator= ( const PipelineCycler< CycleDataType > & copy)
inline

Definition at line 221 of file pipelineCycler.I.

◆ read()

template<class CycleDataType >
const CycleDataType * PipelineCycler< CycleDataType >::read ( Thread * current_thread) const
inline

See PipelineCyclerBase::read().

Definition at line 239 of file pipelineCycler.I.

◆ read_stage()

template<class CycleDataType >
const CycleDataType * PipelineCycler< CycleDataType >::read_stage ( int pipeline_stage,
Thread * current_thread ) const
inline

See PipelineCyclerBase::read_stage().

Definition at line 293 of file pipelineCycler.I.

◆ read_stage_unlocked()

template<class CycleDataType >
const CycleDataType * PipelineCycler< CycleDataType >::read_stage_unlocked ( int pipeline_stage) const
inline

◆ read_unlocked()

template<class CycleDataType >
const CycleDataType * PipelineCycler< CycleDataType >::read_unlocked ( Thread * current_thread) const
inline

◆ write()

template<class CycleDataType >
CycleDataType * PipelineCycler< CycleDataType >::write ( Thread * current_thread)
inline

See PipelineCyclerBase::write().

Definition at line 248 of file pipelineCycler.I.

◆ write_stage()

template<class CycleDataType >
CycleDataType * PipelineCycler< CycleDataType >::write_stage ( int pipeline_stage,
Thread * current_thread )
inline

See PipelineCyclerBase::write_stage().

Definition at line 320 of file pipelineCycler.I.

◆ write_stage_upstream()

template<class CycleDataType >
CycleDataType * PipelineCycler< CycleDataType >::write_stage_upstream ( int pipeline_stage,
bool force_to_0,
Thread * current_thread )
inline

◆ write_upstream()

template<class CycleDataType >
CycleDataType * PipelineCycler< CycleDataType >::write_upstream ( bool force_to_0,
Thread * current_thread )
inline

See PipelineCyclerBase::write_upstream().

Definition at line 257 of file pipelineCycler.I.


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