Panda3D
 All Classes Functions Variables Enumerations
graphicsStateGuardian.h
1 // Filename: graphicsStateGuardian.h
2 // Created by: drose (02eb99)
3 // Updated by: fperazzi, PandaSE (05May10) (added fetch_ptr_parameter,
4 // _max_2d_texture_array_layers on z axis, get_supports_cg_profile)
5 //
6 ////////////////////////////////////////////////////////////////////
7 //
8 // PANDA 3D SOFTWARE
9 // Copyright (c) Carnegie Mellon University. All rights reserved.
10 //
11 // All use of this software is subject to the terms of the revised BSD
12 // license. You should have received a copy of this license along
13 // with this source code in a file named "LICENSE."
14 //
15 ////////////////////////////////////////////////////////////////////
16 
17 #ifndef GRAPHICSSTATEGUARDIAN_H
18 #define GRAPHICSSTATEGUARDIAN_H
19 
20 #include "pandabase.h"
21 
22 #include "frameBufferProperties.h"
23 #include "preparedGraphicsObjects.h"
24 #include "lens.h"
25 #include "graphicsStateGuardianBase.h"
26 #include "graphicsThreadingModel.h"
27 #include "graphicsPipe.h"
28 #include "sceneSetup.h"
29 #include "displayRegion.h"
30 #include "luse.h"
31 #include "coordinateSystem.h"
32 #include "factory.h"
33 #include "pStatCollector.h"
34 #include "transformState.h"
35 #include "renderState.h"
36 #include "light.h"
37 #include "planeNode.h"
38 #include "config_display.h"
39 #include "geomMunger.h"
40 #include "geomVertexData.h"
41 #include "pnotify.h"
42 #include "pvector.h"
43 #include "shaderContext.h"
44 #include "bitMask.h"
45 #include "texture.h"
46 #include "occlusionQueryContext.h"
47 #include "timerQueryContext.h"
48 #include "loader.h"
49 #include "shaderAttrib.h"
50 #include "texGenAttrib.h"
51 #include "textureAttrib.h"
52 #include "shaderGenerator.h"
53 
54 class DrawableRegion;
55 class GraphicsEngine;
56 
57 ////////////////////////////////////////////////////////////////////
58 // Class : GraphicsStateGuardian
59 // Description : Encapsulates all the communication with a particular
60 // instance of a given rendering backend. Tries to
61 // guarantee that redundant state-change requests are
62 // not issued (hence "state guardian").
63 //
64 // There will be one of these objects for each different
65 // graphics context active in the system.
66 ////////////////////////////////////////////////////////////////////
67 class EXPCL_PANDA_DISPLAY GraphicsStateGuardian : public GraphicsStateGuardianBase {
68  //
69  // Interfaces all GSGs should have
70  //
71 public:
72  GraphicsStateGuardian(CoordinateSystem internal_coordinate_system,
73  GraphicsEngine *engine, GraphicsPipe *pipe);
74  virtual ~GraphicsStateGuardian();
75 
76 PUBLISHED:
77 
78  enum ShaderModel {
79  SM_00,
80  SM_11,
81  SM_20,
82  SM_2X,
83  SM_30,
84  SM_40,
85  SM_50,
86  };
87 
88  INLINE void release_all();
89  INLINE int release_all_textures();
90  INLINE int release_all_samplers();
91  INLINE int release_all_geoms();
92  INLINE int release_all_vertex_buffers();
93  INLINE int release_all_index_buffers();
94 
95  INLINE void set_active(bool active);
96  INLINE bool is_active() const;
97  INLINE bool is_valid() const;
98  INLINE bool needs_reset() const;
99 
100  INLINE void set_incomplete_render(bool incomplete_render);
101  virtual INLINE bool get_incomplete_render() const;
102  virtual INLINE bool get_effective_incomplete_render() const;
103 
104  INLINE void set_loader(Loader *loader);
105  INLINE Loader *get_loader() const;
106 
107  INLINE void set_shader_generator(ShaderGenerator *shader_generator);
108  INLINE ShaderGenerator *get_shader_generator() const;
109 
110  INLINE GraphicsPipe *get_pipe() const;
111  GraphicsEngine *get_engine() const;
112  INLINE const GraphicsThreadingModel &get_threading_model() const;
113 
114  INLINE bool is_hardware() const;
115  virtual INLINE bool prefers_triangle_strips() const;
116  virtual INLINE int get_max_vertices_per_array() const;
117  virtual INLINE int get_max_vertices_per_primitive() const;
118 
119  INLINE int get_max_texture_stages() const;
120  virtual INLINE int get_max_texture_dimension() const;
121  INLINE int get_max_3d_texture_dimension() const;
122  INLINE int get_max_2d_texture_array_layers() const; //z axis
123  INLINE int get_max_cube_map_dimension() const;
124 
125  INLINE bool get_supports_texture_combine() const;
126  INLINE bool get_supports_texture_saved_result() const;
127  INLINE bool get_supports_texture_dot3() const;
128 
129  INLINE bool get_supports_3d_texture() const;
130  INLINE bool get_supports_2d_texture_array() const;
131  INLINE bool get_supports_cube_map() const;
132  INLINE bool get_supports_tex_non_pow2() const;
133  INLINE bool get_supports_texture_srgb() const;
134 
135  INLINE bool get_supports_compressed_texture() const;
136  virtual INLINE bool get_supports_compressed_texture_format(int compression_mode) const;
137 
138  INLINE int get_max_lights() const;
139  INLINE int get_max_clip_planes() const;
140 
141  INLINE int get_max_vertex_transforms() const;
142  INLINE int get_max_vertex_transform_indices() const;
143 
144  INLINE bool get_copy_texture_inverted() const;
145  virtual bool get_supports_multisample() const;
146  INLINE bool get_supports_generate_mipmap() const;
147  INLINE bool get_supports_depth_texture() const;
148  INLINE bool get_supports_depth_stencil() const;
149  INLINE bool get_supports_shadow_filter() const;
150  INLINE bool get_supports_sampler_objects() const;
151  INLINE bool get_supports_basic_shaders() const;
152  INLINE bool get_supports_geometry_shaders() const;
153  INLINE bool get_supports_tessellation_shaders() const;
154  INLINE bool get_supports_compute_shaders() const;
155  INLINE bool get_supports_glsl() const;
156  INLINE bool get_supports_stencil() const;
157  INLINE bool get_supports_two_sided_stencil() const;
158  INLINE bool get_supports_geometry_instancing() const;
159 
160  INLINE bool get_supports_occlusion_query() const;
161  INLINE bool get_supports_timer_query() const;
162  INLINE bool get_timer_queries_active() const;
163 
164  INLINE int get_max_color_targets() const;
165  INLINE int get_maximum_simultaneous_render_targets() const;
166 
167  INLINE int get_shader_model() const;
168  INLINE void set_shader_model(int shader_model);
169 
170  virtual int get_supported_geom_rendering() const;
171  virtual bool get_supports_cg_profile(const string &name) const;
172 
173  INLINE bool get_color_scale_via_lighting() const;
174  INLINE bool get_alpha_scale_via_texture() const;
175  INLINE bool get_alpha_scale_via_texture(const TextureAttrib *tex_attrib) const;
176  INLINE bool get_runtime_color_scale() const;
177 
178  INLINE static TextureStage *get_alpha_scale_texture_stage();
179 
180  void set_coordinate_system(CoordinateSystem cs);
181  INLINE CoordinateSystem get_coordinate_system() const;
182  virtual CoordinateSystem get_internal_coordinate_system() const;
183 
184  virtual PreparedGraphicsObjects *get_prepared_objects();
185 
186  virtual bool set_gamma(PN_stdfloat gamma);
187  PN_stdfloat get_gamma(PN_stdfloat gamma);
188  virtual void restore_gamma();
189 
190  INLINE void set_texture_quality_override(Texture::QualityLevel quality_level);
191  INLINE Texture::QualityLevel get_texture_quality_override() const;
192 
193  EXTENSION(PyObject *get_prepared_textures() const);
194  typedef bool TextureCallback(TextureContext *tc, void *callback_arg);
195  void traverse_prepared_textures(TextureCallback *func, void *callback_arg);
196 
197 #ifndef NDEBUG
198  void set_flash_texture(Texture *tex);
199  void clear_flash_texture();
200  Texture *get_flash_texture() const;
201 #endif
202 
203 PUBLISHED:
204  virtual bool has_extension(const string &extension) const;
205 
206  virtual string get_driver_vendor();
207  virtual string get_driver_renderer();
208  virtual string get_driver_version();
209  virtual int get_driver_version_major();
210  virtual int get_driver_version_minor();
211  virtual int get_driver_shader_version_major();
212  virtual int get_driver_shader_version_minor();
213 
214  bool set_scene(SceneSetup *scene_setup);
215  virtual SceneSetup *get_scene() const;
216 
217 public:
218  virtual TextureContext *prepare_texture(Texture *tex);
219  virtual bool update_texture(TextureContext *tc, bool force);
220  virtual void release_texture(TextureContext *tc);
221  virtual bool extract_texture_data(Texture *tex);
222 
223  virtual SamplerContext *prepare_sampler(const SamplerState &sampler);
224  virtual void release_sampler(SamplerContext *sc);
225 
226  virtual GeomContext *prepare_geom(Geom *geom);
227  virtual void release_geom(GeomContext *gc);
228 
229  virtual ShaderContext *prepare_shader(Shader *shader);
230  virtual void release_shader(ShaderContext *sc);
231 
232  virtual VertexBufferContext *prepare_vertex_buffer(GeomVertexArrayData *data);
233  virtual void release_vertex_buffer(VertexBufferContext *vbc);
234 
235  virtual IndexBufferContext *prepare_index_buffer(GeomPrimitive *data);
236  virtual void release_index_buffer(IndexBufferContext *ibc);
237 
238  virtual void begin_occlusion_query();
239  virtual PT(OcclusionQueryContext) end_occlusion_query();
240 
241  virtual PT(TimerQueryContext) issue_timer_query(int pstats_index);
242 
243  virtual void dispatch_compute(int size_x, int size_y, int size_z);
244 
245  virtual PT(GeomMunger) get_geom_munger(const RenderState *state,
246  Thread *current_thread);
247  virtual PT(GeomMunger) make_geom_munger(const RenderState *state,
248  Thread *current_thread);
249 
250  virtual void set_state_and_transform(const RenderState *state,
251  const TransformState *transform);
252 
253  virtual PN_stdfloat compute_distance_to(const LPoint3 &point) const;
254 
255  virtual void clear(DrawableRegion *clearable);
256 
257  const LMatrix4 *fetch_specified_value(Shader::ShaderMatSpec &spec, int altered);
258  const LMatrix4 *fetch_specified_part(Shader::ShaderMatInput input, InternalName *name,
259  LMatrix4 &t, int index);
260  const Shader::ShaderPtrData *fetch_ptr_parameter(const Shader::ShaderPtrSpec& spec);
261 
262  virtual void prepare_display_region(DisplayRegionPipelineReader *dr);
263  virtual void clear_before_callback();
264  virtual void clear_state_and_transform();
265 
266  virtual void remove_window(GraphicsOutputBase *window);
267 
268  virtual CPT(TransformState) calc_projection_mat(const Lens *lens);
269  virtual bool prepare_lens();
270 
271  virtual bool begin_frame(Thread *current_thread);
272 PUBLISHED:
273  virtual bool begin_scene();
274  virtual void end_scene();
275 public:
276  virtual void end_frame(Thread *current_thread);
277 
278  void flush_timer_queries();
279 
280  void set_current_properties(const FrameBufferProperties *properties);
281 
282  virtual bool depth_offset_decals();
283  virtual CPT(RenderState) begin_decal_base_first();
284  virtual CPT(RenderState) begin_decal_nested();
285  virtual CPT(RenderState) begin_decal_base_second();
286  virtual void finish_decal();
287 
288  virtual bool begin_draw_primitives(const GeomPipelineReader *geom_reader,
289  const GeomMunger *munger,
290  const GeomVertexDataPipelineReader *data_reader,
291  bool force);
292  virtual bool draw_triangles(const GeomPrimitivePipelineReader *reader,
293  bool force);
294  virtual bool draw_tristrips(const GeomPrimitivePipelineReader *reader,
295  bool force);
296  virtual bool draw_trifans(const GeomPrimitivePipelineReader *reader,
297  bool force);
298  virtual bool draw_patches(const GeomPrimitivePipelineReader *reader,
299  bool force);
300  virtual bool draw_lines(const GeomPrimitivePipelineReader *reader,
301  bool force);
302  virtual bool draw_linestrips(const GeomPrimitivePipelineReader *reader,
303  bool force);
304  virtual bool draw_points(const GeomPrimitivePipelineReader *reader,
305  bool force);
306  virtual void end_draw_primitives();
307 
308  INLINE bool reset_if_new();
309  INLINE void mark_new();
310  virtual void reset();
311 
312  INLINE CPT(TransformState) get_external_transform() const;
313  INLINE CPT(TransformState) get_internal_transform() const;
314 
315  RenderBuffer get_render_buffer(int buffer_type, const FrameBufferProperties &prop);
316 
317  INLINE const DisplayRegion *get_current_display_region() const;
318  INLINE Lens::StereoChannel get_current_stereo_channel() const;
319  INLINE int get_current_tex_view_offset() const;
320  INLINE const Lens *get_current_lens() const;
321 
322  virtual CPT(TransformState) get_cs_transform_for(CoordinateSystem cs) const;
323  virtual CPT(TransformState) get_cs_transform() const;
324  INLINE CPT(TransformState) get_inv_cs_transform() const;
325 
326  void do_issue_clip_plane();
327  void do_issue_color();
328  void do_issue_color_scale();
329  virtual void do_issue_light();
330 
331  virtual bool framebuffer_copy_to_texture
332  (Texture *tex, int view, int z, const DisplayRegion *dr, const RenderBuffer &rb);
333  virtual bool framebuffer_copy_to_ram
334  (Texture *tex, int view, int z, const DisplayRegion *dr, const RenderBuffer &rb);
335 
336  virtual void bind_light(PointLight *light_obj, const NodePath &light,
337  int light_id);
338  virtual void bind_light(DirectionalLight *light_obj, const NodePath &light,
339  int light_id);
340  virtual void bind_light(Spotlight *light_obj, const NodePath &light,
341  int light_id);
342 
343  static void create_gamma_table (PN_stdfloat gamma, unsigned short *red_table, unsigned short *green_table, unsigned short *blue_table);
344 
345  virtual PT(Texture) make_shadow_buffer(const NodePath &light_np, GraphicsOutputBase *host);
346 
347 #ifdef DO_PSTATS
348  static void init_frame_pstats();
349 #endif
350 
351 protected:
352  virtual void reissue_transforms();
353 
354  virtual void enable_lighting(bool enable);
355  virtual void set_ambient_light(const LColor &color);
356  virtual void enable_light(int light_id, bool enable);
357  virtual void begin_bind_lights();
358  virtual void end_bind_lights();
359 
360  virtual void enable_clip_planes(bool enable);
361  virtual void enable_clip_plane(int plane_id, bool enable);
362  virtual void begin_bind_clip_planes();
363  virtual void bind_clip_plane(const NodePath &plane, int plane_id);
364  virtual void end_bind_clip_planes();
365 
366  void determine_target_texture();
367 
368  virtual void free_pointers();
369  virtual void close_gsg();
370  void panic_deactivate();
371 
372  void determine_light_color_scale();
373 
374  static CPT(RenderState) get_unlit_state();
375  static CPT(RenderState) get_unclipped_state();
376  static CPT(RenderState) get_untextured_state();
377 
378  void async_reload_texture(TextureContext *tc);
379 
380 protected:
381  PT(SceneSetup) _scene_null;
382  PT(SceneSetup) _scene_setup;
383 
384  // The current state of the graphics context, as of the last call to
385  // set_state_and_transform().
386  CPT(RenderState) _state_rs;
387 
388  // The desired state of the graphics context, during processing of
389  // set_state_and_transform().
390  CPT(RenderState) _target_rs;
391 
392  // This bitmask contains a 1 bit everywhere that _state_rs has a
393  // known value. If a bit is 0, the corresponding state must be
394  // re-sent.
395  //
396  // Derived GSGs should initialize _inv_state_mask in reset() as a mask of
397  // 1's where they don't care, and 0's where they do care, about the state.
398  RenderState::SlotMask _state_mask;
399  RenderState::SlotMask _inv_state_mask;
400 
401  // The current transform, as of the last call to
402  // set_state_and_transform().
403  CPT(TransformState) _internal_transform;
404 
405  // The current TextureAttrib is a special case; we may further
406  // restrict it (according to graphics cards limits) or extend it
407  // (according to ColorScaleAttribs in effect) beyond what is
408  // specifically requested in the scene graph.
409  CPT(TextureAttrib) _target_texture;
410  CPT(TextureAttrib) _state_texture;
411  CPT(TexGenAttrib) _target_tex_gen;
412  CPT(TexGenAttrib) _state_tex_gen;
413 
414  // Also, the shader might be the explicitly-requested shader, or it
415  // might be an auto-generated one.
416  CPT(ShaderAttrib) _state_shader;
417  CPT(ShaderAttrib) _target_shader;
418 
419  // These are set by begin_draw_primitives(), and are only valid
420  // between begin_draw_primitives() and end_draw_primitives().
421  CPT(GeomMunger) _munger;
422  const GeomVertexDataPipelineReader *_data_reader;
423 
424  unsigned int _color_write_mask;
425 
426  PT(DisplayRegion) _current_display_region;
427  Lens::StereoChannel _current_stereo_channel;
428  int _current_tex_view_offset;
429  CPT(Lens) _current_lens;
430  CPT(TransformState) _projection_mat;
431  CPT(TransformState) _projection_mat_inv;
432  const FrameBufferProperties *_current_properties;
433 
434  CoordinateSystem _coordinate_system;
435  CoordinateSystem _internal_coordinate_system;
436  CPT(TransformState) _cs_transform;
437  CPT(TransformState) _inv_cs_transform;
438 
439  LColor _scene_graph_color;
440  bool _has_scene_graph_color;
441  bool _transform_stale;
442  bool _color_blend_involves_color_scale;
443  bool _texture_involves_color_scale;
444  bool _vertex_colors_enabled;
445  bool _lighting_enabled;
446  bool _clip_planes_enabled;
447  bool _color_scale_enabled;
448  LVecBase4 _current_color_scale;
449 
450  bool _has_material_force_color;
451  LColor _material_force_color;
452  LVecBase4 _light_color_scale;
453  bool _has_texture_alpha_scale;
454 
455  bool _tex_gen_modifies_mat;
456  bool _tex_gen_point_sprite;
457  int _last_max_stage_index;
458 
459  bool _needs_reset;
460  bool _is_valid;
461  bool _closing_gsg;
462  bool _active;
463  bool _incomplete_render;
464  bool _effective_incomplete_render;
465  PT(Loader) _loader;
466 
467  PT(PreparedGraphicsObjects) _prepared_objects;
468 
469  bool _is_hardware;
470  bool _prefers_triangle_strips;
471  int _max_vertices_per_array;
472  int _max_vertices_per_primitive;
473 
474  int _max_texture_stages;
475  int _max_texture_dimension;
476  int _max_3d_texture_dimension;
477  int _max_2d_texture_array_layers; //on the z axis
478  int _max_cube_map_dimension;
479 
480  bool _supports_texture_combine;
481  bool _supports_texture_saved_result;
482  bool _supports_texture_dot3;
483 
484  bool _supports_3d_texture;
485  bool _supports_2d_texture_array;
486  bool _supports_cube_map;
487  bool _supports_tex_non_pow2;
488  bool _supports_texture_srgb;
489 
490  bool _supports_compressed_texture;
491  BitMask32 _compressed_texture_formats;
492 
493  int _max_lights;
494  int _max_clip_planes;
495 
496  int _max_vertex_transforms;
497  int _max_vertex_transform_indices;
498 
499  bool _supports_occlusion_query;
500  PT(OcclusionQueryContext) _current_occlusion_query;
501 
502  bool _supports_timer_query;
503 #ifdef DO_PSTATS
504  int _pstats_gpu_thread;
505  bool _timer_queries_active;
506  PStatFrameData _pstats_gpu_data;
507 
508  int _last_query_frame;
509  int _last_num_queried;
510  //double _timer_delta;
511  typedef pdeque<PT(TimerQueryContext)> TimerQueryQueue;
512  TimerQueryQueue _pending_timer_queries;
513 #endif
514 
515  bool _copy_texture_inverted;
516  bool _supports_multisample;
517  bool _supports_generate_mipmap;
518  bool _supports_depth_texture;
519  bool _supports_depth_stencil;
520  bool _supports_shadow_filter;
521  bool _supports_sampler_objects;
522  bool _supports_basic_shaders;
523  bool _supports_geometry_shaders;
524  bool _supports_tessellation_shaders;
525  bool _supports_compute_shaders;
526  bool _supports_glsl;
527  bool _supports_framebuffer_multisample;
528  bool _supports_framebuffer_blit;
529 
530  bool _supports_stencil;
531  bool _supports_stencil_wrap;
532  bool _supports_two_sided_stencil;
533  bool _supports_geometry_instancing;
534 
535  int _max_color_targets;
536 
537  int _supported_geom_rendering;
538  bool _color_scale_via_lighting;
539  bool _alpha_scale_via_texture;
540  bool _runtime_color_scale;
541 
542  int _stereo_buffer_mask;
543 
544  int _auto_detect_shader_model;
545  int _shader_model;
546 
547  static PT(TextureStage) _alpha_scale_texture_stage;
548 
549  Shader::ShaderCaps _shader_caps;
550 
551  PN_stdfloat _gamma;
552  Texture::QualityLevel _texture_quality_override;
553 
554  PT(ShaderGenerator) _shader_generator;
555 
556 #ifndef NDEBUG
557  PT(Texture) _flash_texture;
558 #endif
559 
560 public:
561  // Statistics
562  static PStatCollector _vertex_buffer_switch_pcollector;
563  static PStatCollector _index_buffer_switch_pcollector;
564  static PStatCollector _load_vertex_buffer_pcollector;
565  static PStatCollector _load_index_buffer_pcollector;
566  static PStatCollector _create_vertex_buffer_pcollector;
567  static PStatCollector _create_index_buffer_pcollector;
568  static PStatCollector _load_texture_pcollector;
569  static PStatCollector _data_transferred_pcollector;
570  static PStatCollector _texmgrmem_total_pcollector;
571  static PStatCollector _texmgrmem_resident_pcollector;
572  static PStatCollector _primitive_batches_pcollector;
573  static PStatCollector _primitive_batches_tristrip_pcollector;
574  static PStatCollector _primitive_batches_trifan_pcollector;
575  static PStatCollector _primitive_batches_tri_pcollector;
576  static PStatCollector _primitive_batches_patch_pcollector;
577  static PStatCollector _primitive_batches_other_pcollector;
578  static PStatCollector _vertices_tristrip_pcollector;
579  static PStatCollector _vertices_trifan_pcollector;
580  static PStatCollector _vertices_tri_pcollector;
581  static PStatCollector _vertices_patch_pcollector;
582  static PStatCollector _vertices_other_pcollector;
583  static PStatCollector _vertices_indexed_tristrip_pcollector;
584  static PStatCollector _state_pcollector;
585  static PStatCollector _transform_state_pcollector;
586  static PStatCollector _texture_state_pcollector;
587  static PStatCollector _draw_primitive_pcollector;
588  static PStatCollector _draw_set_state_pcollector;
589  static PStatCollector _clear_pcollector;
590  static PStatCollector _flush_pcollector;
591  static PStatCollector _compute_dispatch_pcollector;
592  static PStatCollector _wait_occlusion_pcollector;
593  static PStatCollector _wait_timer_pcollector;
594  static PStatCollector _timer_queries_pcollector;
595  static PStatCollector _command_latency_pcollector;
596 
597  static PStatCollector _prepare_pcollector;
598  static PStatCollector _prepare_texture_pcollector;
599  static PStatCollector _prepare_sampler_pcollector;
600  static PStatCollector _prepare_geom_pcollector;
601  static PStatCollector _prepare_shader_pcollector;
602  static PStatCollector _prepare_vertex_buffer_pcollector;
603  static PStatCollector _prepare_index_buffer_pcollector;
604 
605  // A whole slew of collectors to measure the cost of individual
606  // state changes. These are disabled by default.
607  static PStatCollector _draw_set_state_transform_pcollector;
608  static PStatCollector _draw_set_state_alpha_test_pcollector;
609  static PStatCollector _draw_set_state_antialias_pcollector;
610  static PStatCollector _draw_set_state_clip_plane_pcollector;
611  static PStatCollector _draw_set_state_color_pcollector;
612  static PStatCollector _draw_set_state_cull_face_pcollector;
613  static PStatCollector _draw_set_state_depth_offset_pcollector;
614  static PStatCollector _draw_set_state_depth_test_pcollector;
615  static PStatCollector _draw_set_state_depth_write_pcollector;
616  static PStatCollector _draw_set_state_render_mode_pcollector;
617  static PStatCollector _draw_set_state_rescale_normal_pcollector;
618  static PStatCollector _draw_set_state_shade_model_pcollector;
619  static PStatCollector _draw_set_state_blending_pcollector;
620  static PStatCollector _draw_set_state_shader_pcollector;
621  static PStatCollector _draw_set_state_shader_parameters_pcollector;
622  static PStatCollector _draw_set_state_texture_pcollector;
623  static PStatCollector _draw_set_state_tex_matrix_pcollector;
624  static PStatCollector _draw_set_state_tex_gen_pcollector;
625  static PStatCollector _draw_set_state_material_pcollector;
626  static PStatCollector _draw_set_state_light_pcollector;
627  static PStatCollector _draw_set_state_stencil_pcollector;
628  static PStatCollector _draw_set_state_fog_pcollector;
629  static PStatCollector _draw_set_state_scissor_pcollector;
630 
631 private:
632  int _num_lights_enabled;
633  int _num_clip_planes_enabled;
634 
635  PT(GraphicsPipe) _pipe;
636  GraphicsEngine *_engine;
637  GraphicsThreadingModel _threading_model;
638 
639 public:
640  static TypeHandle get_class_type() {
641  return _type_handle;
642  }
643 
644 public:
645  static void init_type() {
646  GraphicsStateGuardianBase::init_type();
647  register_type(_type_handle, "GraphicsStateGuardian",
648  GraphicsStateGuardianBase::get_class_type());
649  }
650  virtual TypeHandle get_type() const {
651  return get_class_type();
652  }
653  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
654 
655 private:
656  static TypeHandle _type_handle;
657 
658  friend class GraphicsPipe;
659  friend class GraphicsWindow;
660  friend class GraphicsEngine;
661 };
662 
663 #include "graphicsStateGuardian.I"
664 
665 #endif
A light shining from infinitely far away in a particular direction, like sunlight.
Encapsulates the data from a DisplayRegion, pre-fetched for one stage of the pipeline.
This is a special class object that holds all the information returned by a particular GSG to indicat...
Definition: geomContext.h:39
This is a base class for GraphicsWindow (actually, GraphicsOutput) and DisplayRegion, both of which are conceptually rectangular regions into which drawing commands may be issued.
A base class for any number of different kinds of lenses, linear and otherwise.
Definition: lens.h:45
Objects of this class are used to convert vertex data from a Geom into a format suitable for passing ...
Definition: geomMunger.h:57
This is a special class object that holds all the information returned by a particular GSG to indicat...
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
Definition: texture.h:75
This is an abstract base class for a family of classes that represent the fundamental geometry primit...
Definition: geomPrimitive.h:63
Definition: shader.h:50
A convenient class for loading models from disk, in bam or egg format (or any of a number of other fo...
Definition: loader.h:47
This is a special class object that holds all the information returned by a particular GSG to indicat...
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
Definition: lpoint3.h:99
Encapsulates the data from a Geom, pre-fetched for one stage of the pipeline.
Definition: geom.h:401
A table of objects that are saved within the graphics context for reference by handle later...
This is our own Panda specialization on the default STL deque.
Definition: pdeque.h:38
A window, fullscreen or on a desktop, into which a graphics device sends its output for interactive d...
The ShaderContext is meant to contain the compiled version of a shader string.
Definition: shaderContext.h:35
Indicates the set of TextureStages and their associated Textures that should be applied to (or remove...
Definition: textureAttrib.h:34
A lightweight class that represents a single element that may be timed and/or counted via stats...
This is a 4-by-4 transform matrix.
Definition: lmatrix.h:451
Contains the raw timing and level data for a single frame.
An object to create GraphicsOutputs that share a particular 3-D API.
Definition: graphicsPipe.h:58
The ShaderGenerator is a device that effectively replaces the classic fixed function pipeline with a ...
A container for geometry primitives.
Definition: geom.h:58
A light originating from a single point in space, and shining in a particular direction, with a cone-shaped falloff.
Definition: spotlight.h:37
This represents the user&#39;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...
Definition: renderState.h:53
Represents a set of settings that indicate how a texture is sampled.
Definition: samplerState.h:39
This is the base class for all three-component vectors and points.
Definition: lvecBase4.h:111
This is a special class object that holds a handle to the sampler state object given by the graphics ...
This is a base class for the GraphicsStateGuardian class, which is itself a base class for the variou...
A thread; that is, a lightweight process.
Definition: thread.h:51
This is a special class object that holds all the information returned by a particular GSG to indicat...
Encapsulates all the communication with a particular instance of a given rendering backend...
A rectangular subregion within a window for rendering into.
Definition: displayRegion.h:61
Encapsulates the data from a GeomVertexData, pre-fetched for one stage of the pipeline.
An abstract base class for GraphicsOutput, for all the usual reasons.
Returned from a GSG in response to begin_occlusion_query() .
This class is the main interface to controlling the render process.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
This object holds the camera position, etc., and other general setup information for rendering a part...
Definition: sceneSetup.h:35
A container for the various kinds of properties we might ask to have on a graphics frameBuffer before...
Encapsulates the data from a GeomPrimitive, pre-fetched for one stage of the pipeline.
Defines the properties of a named stage of the multitexture pipeline.
Definition: textureStage.h:38
Computes texture coordinates for geometry automatically based on vertex position and/or normal...
Definition: texGenAttrib.h:36
A RenderBuffer is an arbitrary subset of the various layers (depth buffer, color buffer, etc.) of a drawing region.
Definition: renderBuffer.h:30
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition: nodePath.h:165
A light originating from a single point in space, and shining in all directions.
Definition: pointLight.h:27
This is the data for one array of a GeomVertexData structure.