Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/putil/pipelineCycler.h

Go to the documentation of this file.
00001 // Filename: pipelineCycler.h
00002 // Created by:  drose (21Feb02)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #ifndef PIPELINECYCLER_H
00020 #define PIPELINECYCLER_H
00021 
00022 #include "pandabase.h"
00023 
00024 #include "pipelineCyclerBase.h"
00025 
00026 ////////////////////////////////////////////////////////////////////
00027 //       Class : PipelineCycler
00028 // Description : This class maintains different copies of a page of
00029 //               data between stages of the graphics pipeline (or any
00030 //               other pipelining context).
00031 //
00032 //               The class object maintains up to n copies of a
00033 //               CycleData structure, one for each stage of the
00034 //               pipeline.  The head of the pipeline is responsible
00035 //               for making changes to its copy, which are then cycled
00036 //               through the pipeline at each frame.
00037 //
00038 //               To access the data, you must first ask for a readable
00039 //               pointer.  In order to make changes to the data, you
00040 //               must ask for a writable pointer.  Both kinds of
00041 //               pointers should be released when you are done, as a
00042 //               sanity check.  The CycleDataReader and
00043 //               CycleDataWriter classes transparently handle this.
00044 //
00045 //               If pipelining support is not enabled at compile time
00046 //               (that is, SUPPORT_PIPELINING is not defined), this
00047 //               object compiles to a minimum object that presents the
00048 //               same interface but with minimal runtime overhead.
00049 //               (Actually, this isn't true yet, but it will be one
00050 //               day.)
00051 //
00052 //               We define this as a struct instead of a class to
00053 //               guarantee byte placement within the object, so that
00054 //               (particularly for the trivial implementation) the
00055 //               inherited struct's data is likely to be placed by the
00056 //               compiler at the "this" pointer.
00057 ////////////////////////////////////////////////////////////////////
00058 template<class CycleDataType>
00059 struct PipelineCycler : public PipelineCyclerBase {
00060 public:
00061   INLINE PipelineCycler(Pipeline *pipeline = NULL);
00062   INLINE PipelineCycler(const PipelineCycler<CycleDataType> &copy);
00063   INLINE void operator = (const PipelineCycler<CycleDataType> &copy);
00064 
00065   INLINE const CycleDataType *read() const;
00066   INLINE CycleDataType *write();
00067   INLINE CycleDataType *elevate_read(const CycleDataType *pointer);
00068   INLINE CycleDataType *write_stage(int n);
00069 
00070   INLINE CycleDataType *cheat() const;
00071 
00072 #ifndef DO_PIPELINING
00073 private:
00074   // If we are *not* compiling in support for pipelining, we just
00075   // store the CycleData object right here.  No pointers needed.
00076   CycleDataType _typed_data;
00077 #endif  // !DO_PIPELINING
00078 };
00079 
00080 #include "pipelineCycler.I"
00081 
00082 #endif
00083 

Generated on Fri May 2 00:43:41 2003 for Panda by doxygen1.3