15 #ifndef GRAPHICSENGINE_H 16 #define GRAPHICSENGINE_H 18 #include "pandabase.h" 19 #include "graphicsWindow.h" 20 #include "graphicsBuffer.h" 21 #include "frameBufferProperties.h" 22 #include "graphicsThreadingModel.h" 23 #include "sceneSetup.h" 24 #include "pointerTo.h" 28 #include "lightReMutex.h" 29 #include "conditionVar.h" 30 #include "pStatCollector.h" 32 #include "ordered_vector.h" 33 #include "indirectLess.h" 35 #include "referenceCount.h" 66 INLINE
const ReMutex &get_render_lock()
const;
68 INLINE
void set_auto_flip(
bool auto_flip);
69 INLINE
bool get_auto_flip()
const;
71 INLINE
void set_portal_cull(
bool value);
72 INLINE
bool get_portal_cull()
const;
74 INLINE
void set_default_loader(
Loader *loader);
75 INLINE
Loader *get_default_loader()
const;
78 const string &name,
int sort,
86 const string &name,
int sort,
87 int x_size,
int y_size);
89 const string &name,
int sort,
90 int x_size,
int y_size);
92 const string &name,
int sort,
93 int x_size,
int y_size);
97 BLOCKING
void remove_all_windows();
98 void reset_all_windows(
bool swapchain);
100 bool is_empty()
const;
101 int get_num_windows()
const;
103 MAKE_SEQ(get_windows, get_num_windows, get_window);
105 BLOCKING
void render_frame();
106 BLOCKING
void open_windows();
107 BLOCKING
void sync_frame();
108 BLOCKING
void ready_flip();
109 BLOCKING
void flip_frame();
112 void dispatch_compute(
const LVecBase3i &work_groups,
129 void texture_uploaded(
Texture *tex);
139 static bool scene_root_func(
const PandaNode *node);
140 bool is_scene_root(
const PandaNode *node);
144 void cull_and_draw_together(
const Windows &wlist,
Thread *current_thread);
148 void cull_to_bins(
const Windows &wlist,
Thread *current_thread);
150 void draw_bins(
const Windows &wlist,
Thread *current_thread);
152 void make_contexts(
const Windows &wlist,
Thread *current_thread);
154 void process_events(
const Windows &wlist,
Thread *current_thread);
155 void ready_flip_windows(
const Windows &wlist,
Thread *current_thread);
156 void flip_windows(
const Windows &wlist,
Thread *current_thread);
157 void do_sync_frame(
Thread *current_thread);
158 void do_ready_flip(
Thread *current_thread);
159 void do_flip_frame(
Thread *current_thread);
172 void do_resort_windows();
173 void terminate_threads(
Thread *current_thread);
177 typedef map<TypeHandle, PStatCollector> CyclerTypeCounters;
178 CyclerTypeCounters _all_cycler_types;
179 CyclerTypeCounters _dirty_cycler_types;
180 static void pstats_count_cycler_type(
TypeHandle type,
int count,
void *data);
181 static void pstats_count_dirty_cycler_type(
TypeHandle type,
int count,
void *data);
184 static const RenderState *get_invert_polygon_state();
264 class WindowRenderer {
266 WindowRenderer(
const string &name);
271 void resort_windows();
279 bool any_done_gsgs()
const;
288 Windows _pending_close;
295 class RenderThread :
public Thread,
public WindowRenderer {
298 virtual void thread_main();
304 ThreadState _thread_state;
307 WindowRenderer *get_window_renderer(
const string &name,
int pipeline_stage);
311 bool _windows_sorted;
312 unsigned int _window_sort_index;
313 bool _needs_open_windows;
320 bool _portal_enabled;
321 PT(
Loader) _default_loader;
328 FlipState _flip_state;
330 bool _singular_warning_last_frame;
331 bool _singular_warning_this_frame;
336 class LoadedTexture {
342 LoadedTextures _loaded_textures;
343 Mutex _loaded_textures_lock;
404 friend class WindowRenderer;
408 #include "graphicsEngine.I"
A basic node of the scene graph or data graph.
Encapsulates the data from a DisplayRegion, pre-fetched for one stage of the pipeline.
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
A convenient class for loading models from disk, in bam or egg format (or any of a number of other fo...
A lightweight reentrant mutex.
A standard mutex, or mutual exclusion lock.
A specialization of ordered_vector that emulates a standard STL set: one copy of each element is allo...
A condition variable, usually used to communicate information about changing state to a thread that i...
A lightweight class that represents a single element that may be timed and/or counted via stats...
A container for the various kinds of properties we might ask to have on a graphics window before we o...
This defines the abstract interface for an object that receives Geoms identified by the CullTraverser...
An object to create GraphicsOutputs that share a particular 3-D API.
This is a base class for the various different classes that represent the result of a frame of render...
This represents the user's specification of how a particular frame is handled by the various threads...
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
This class manages a staged pipeline of data, for instance the render pipeline, so that each stage of...
This is the base class for all three-component vectors and points.
This stores the result of a BinCullHandler traversal: an ordered collection of CullBins, each of which holds a number of Geoms and RenderStates to be rendered in some defined order.
A base class for all things that want to be reference-counted.
A thread; that is, a lightweight process.
Encapsulates all the communication with a particular instance of a given rendering backend...
A rectangular subregion within a window for rendering into.
This class is the main interface to controlling the render process.
TypeHandle is the identifier used to differentiate C++ class types.
This is a sequence number that increments monotonically.
This object holds the camera position, etc., and other general setup information for rendering a part...
A container for the various kinds of properties we might ask to have on a graphics frameBuffer before...