00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef PIPELINE_H
00016 #define PIPELINE_H
00017
00018 #include "pandabase.h"
00019 #include "pipelineCyclerLinks.h"
00020 #include "namable.h"
00021 #include "pset.h"
00022 #include "reMutex.h"
00023 #include "reMutexHolder.h"
00024 #include "selectThreadImpl.h"
00025
00026 struct PipelineCyclerTrueImpl;
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 class EXPCL_PANDA_PIPELINE Pipeline : public Namable {
00042 public:
00043 Pipeline(const string &name, int num_stages);
00044 ~Pipeline();
00045
00046 INLINE static Pipeline *get_render_pipeline();
00047
00048 void cycle();
00049
00050 void set_num_stages(int num_stages);
00051 INLINE void set_min_stages(int min_stages);
00052 INLINE int get_num_stages() const;
00053
00054 #ifdef THREADED_PIPELINE
00055 void add_cycler(PipelineCyclerTrueImpl *cycler);
00056 void add_dirty_cycler(PipelineCyclerTrueImpl *cycler);
00057 void remove_cycler(PipelineCyclerTrueImpl *cycler);
00058
00059 INLINE int get_num_cyclers() const;
00060 INLINE int get_num_dirty_cyclers() const;
00061
00062 #ifdef DEBUG_THREADS
00063 typedef void CallbackFunc(TypeHandle type, int count, void *data);
00064 void iterate_all_cycler_types(CallbackFunc *func, void *data) const;
00065 void iterate_dirty_cycler_types(CallbackFunc *func, void *data) const;
00066 #endif // DEBUG_THREADS
00067
00068 #endif // THREADED_PIPELINE
00069
00070 private:
00071 int _num_stages;
00072
00073 static void make_render_pipeline();
00074 static Pipeline *_render_pipeline;
00075
00076 #ifdef THREADED_PIPELINE
00077 PipelineCyclerLinks _clean;
00078 PipelineCyclerLinks _dirty;
00079
00080 int _num_cyclers;
00081 int _num_dirty_cyclers;
00082
00083 #ifdef DEBUG_THREADS
00084 typedef pmap<TypeHandle, int> TypeCount;
00085 TypeCount _all_cycler_types, _dirty_cycler_types;
00086
00087 static void inc_cycler_type(TypeCount &count, TypeHandle type, int addend);
00088 #endif // DEBUG_THREADS
00089
00090
00091 bool _cycling;
00092
00093 ReMutex _lock;
00094 #endif // THREADED_PIPELINE
00095 };
00096
00097 #include "pipeline.I"
00098
00099 #endif
00100