Panda3D
graphicsStateGuardian.I
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file graphicsStateGuardian.I
10  * @author drose
11  * @date 1999-09-24
12  * @author fperazzi, PandaSE
13  * @date 2010-04-29
14  * get_max_2d_texture_array_layers and related)
15  */
16 
17 /**
18  * Releases all prepared objects.
19  */
21 release_all() {
22  _prepared_objects->release_all();
23 }
24 
25 /**
26  * Frees the resources for all textures associated with this GSG.
27  */
30  return _prepared_objects->release_all_textures();
31 }
32 
33 /**
34  * Frees the resources for all samplers associated with this GSG.
35  */
38  return _prepared_objects->release_all_samplers();
39 }
40 
41 /**
42  * Frees the resources for all geoms associated with this GSG.
43  */
46  return _prepared_objects->release_all_geoms();
47 }
48 
49 /**
50  * Frees the resources for all vertex buffers associated with this GSG.
51  */
54  return _prepared_objects->release_all_vertex_buffers();
55 }
56 
57 /**
58  * Frees the resources for all index buffers associated with this GSG.
59  */
62  return _prepared_objects->release_all_index_buffers();
63 }
64 
65 /**
66  * Frees the resources for all index buffers associated with this GSG.
67  */
70  return _prepared_objects->release_all_shader_buffers();
71 }
72 
73 /**
74  * Sets the active flag associated with the GraphicsStateGuardian. If the
75  * GraphicsStateGuardian is marked inactive, nothing is rendered. This is not
76  * normally turned off unless there is a problem with the rendering detected
77  * at a low level.
78  */
79 INLINE void GraphicsStateGuardian::
80 set_active(bool active) {
81  _active = active;
82 }
83 
84 /**
85  * Returns the active flag associated with the GraphicsStateGuardian.
86  */
87 INLINE bool GraphicsStateGuardian::
88 is_active() const {
89  return _active && _is_valid;
90 }
91 
92 /**
93  * Returns true if the GSG has been correctly initialized within a graphics
94  * context, false if there has been some problem or it hasn't been initialized
95  * yet.
96  */
97 INLINE bool GraphicsStateGuardian::
98 is_valid() const {
99  return _is_valid;
100 }
101 
102 /**
103  * Returns true if the gsg is marked as needing a reset.
104  */
106 needs_reset() const {
107  return _needs_reset;
108 }
109 
110 /**
111  * Sets the incomplete_render flag. When this is true, the frame will be
112  * rendered even if some of the geometry or textures in the scene are not
113  * available (e.g. they have been temporarily paged out). When this is
114  * false, the frame will be held up while this data is reloaded.
115  *
116  * Setting this true allows for a smoother frame rate, but occasionally parts
117  * of the frame will be invisible or missing (they will generally come in
118  * within a second or two). Setting this false guarantees that every frame
119  * will be complete, but may cause more chugs as things are loaded up at
120  * runtime.
121  *
122  * You may want to set this false during loading screens, to guarantee that
123  * all of your assets are available by the time you take the loading screen
124  * down.
125  *
126  * This flag may also be set individually on each DisplayRegion. It will be
127  * considered true for a given DisplayRegion only if it is true on both the
128  * GSG and on the DisplayRegion.
129  */
130 INLINE void GraphicsStateGuardian::
131 set_incomplete_render(bool incomplete_render) {
132  _incomplete_render = incomplete_render;
133 }
134 
135 /**
136  * Returns the incomplete_render flag. See set_incomplete_render().
137  */
138 INLINE bool GraphicsStateGuardian::
139 get_incomplete_render() const {
140  return _incomplete_render;
141 }
142 
143 /**
144  * Returns true if the GSG is effectively in incomplete_render state,
145  * considering both the GSG's incomplete_render and its current
146  * DisplayRegion's incomplete_render flags. It only makes sense to call this
147  * during the draw traversal; at other times this return value will be
148  * meaningless.
149  *
150  * See CullTraverser::get_effective_incomplete_render() for this same
151  * information during the cull traversal.
152  */
153 INLINE bool GraphicsStateGuardian::
155  return _effective_incomplete_render;
156 }
157 
158 /**
159  * Sets the Loader object that will be used by this GSG to load textures when
160  * necessary, if get_incomplete_render() is true.
161  */
162 INLINE void GraphicsStateGuardian::
163 set_loader(Loader *loader) {
164  _loader = loader;
165 }
166 
167 /**
168  * Returns the Loader object that will be used by this GSG to load textures
169  * when necessary, if get_incomplete_render() is true.
170  */
172 get_loader() const {
173  return _loader;
174 }
175 
176 /**
177  * Sets the ShaderGenerator object that will be used by this GSG to generate
178  * shaders when necessary.
179  */
180 INLINE void GraphicsStateGuardian::
181 set_shader_generator(ShaderGenerator *shader_generator) {
182  _shader_generator = shader_generator;
183 }
184 
185 /**
186  * Returns the ShaderGenerator object that will be used by this GSG to
187  * generate shaders when necessary.
188  */
190 get_shader_generator() const {
191  return _shader_generator;
192 }
193 
194 /**
195  * Returns the graphics pipe on which this GSG was created.
196  */
198 get_pipe() const {
199  return _pipe;
200 }
201 
202 /**
203  * Returns the threading model that was used to create this GSG.
204  */
206 get_threading_model() const {
207  return _threading_model;
208 }
209 
210 /**
211  * Returns true if this GSG appears to be hardware-accelerated, or false if it
212  * is known to be software only.
213  */
215 is_hardware() const {
216  return _is_hardware;
217 }
218 
219 /**
220  * Returns true if this GSG strongly prefers triangle strips to individual
221  * triangles (such as SGI), or false if it prefers to minimize the number of
222  * primitive batches, even at the expense of triangle strips (such as most PC
223  * hardware).
224  */
226 prefers_triangle_strips() const {
227  return _prefers_triangle_strips;
228 }
229 
230 /**
231  * Returns the maximum number of vertices that should be put into any one
232  * GeomVertexData object for use with this GSG.
233  */
234 INLINE int GraphicsStateGuardian::
236  return _max_vertices_per_array;
237 }
238 
239 /**
240  * Returns the maximum number of vertex indices that should be put into any
241  * one GeomPrimitive object for use with this GSG.
242  */
243 INLINE int GraphicsStateGuardian::
245  return _max_vertices_per_primitive;
246 }
247 
248 /**
249  * Returns the maximum number of simultaneous textures that may be applied to
250  * geometry with multitexturing, as supported by this particular GSG. If you
251  * exceed this number, the lowest-priority texture stages will not be applied.
252  * Use TextureStage::set_priority() to adjust the relative importance of the
253  * different texture stages.
254  *
255  * The value returned may not be meaningful until after the graphics context
256  * has been fully created (e.g. the window has been opened).
257  */
258 INLINE int GraphicsStateGuardian::
259 get_max_texture_stages() const {
260  if (max_texture_stages > 0) {
261  return std::min(_max_texture_stages, (int)max_texture_stages);
262  }
263  return _max_texture_stages;
264 }
265 
266 /**
267  * Returns the largest possible texture size in any one dimension supported by
268  * the GSG, or -1 if there is no particular limit.
269  *
270  * The value returned may not be meaningful until after the graphics context
271  * has been fully created (e.g. the window has been opened).
272  */
273 INLINE int GraphicsStateGuardian::
275  return _max_texture_dimension;
276 }
277 
278 /**
279  * Returns the largest possible texture size in any one dimension for a 3-d
280  * texture, or -1 if there is no particular limit. Returns 0 if 3-d textures
281  * are not supported.
282  *
283  * The value returned may not be meaningful until after the graphics context
284  * has been fully created (e.g. the window has been opened).
285  */
286 INLINE int GraphicsStateGuardian::
288  return _max_3d_texture_dimension;
289 }
290 
291 /**
292  * Returns the largest possible number of pages, or -1 if there is no
293  * particular limit. Returns 0 if 2-d texture arrays not supported.
294  *
295  * The value returned may not be meaningful until after the graphics context
296  * has been fully created (e.g. the window has been opened).
297  */
298 INLINE int GraphicsStateGuardian::
300  return _max_2d_texture_array_layers;
301 }
302 
303 /**
304  * Returns the largest possible texture size in any one dimension for a cube
305  * map texture, or -1 if there is no particular limit. Returns 0 if cube map
306  * textures are not supported.
307  *
308  * The value returned may not be meaningful until after the graphics context
309  * has been fully created (e.g. the window has been opened).
310  */
311 INLINE int GraphicsStateGuardian::
313  return _max_cube_map_dimension;
314 }
315 
316 /**
317  * Returns the largest possible buffer texture size, or -1 if there is no
318  * particular limit. Returns 0 if cube map textures are not supported.
319  *
320  * The value returned may not be meaningful until after the graphics context
321  * has been fully created (e.g. the window has been opened).
322  */
323 INLINE int GraphicsStateGuardian::
325  return _max_buffer_texture_size;
326 }
327 
328 /**
329  * Returns true if this particular GSG can use the TextureStage::M_combine
330  * mode, which includes all of the texture blend modes specified by
331  * set_combine_rgb() and/or set_combine_alpha(). If this is false, you must
332  * limit yourself to using the simpler blend modes.
333  */
334 INLINE bool GraphicsStateGuardian::
336  return _supports_texture_combine;
337 }
338 
339 /**
340  * Returns true if this GSG can use the TextureStage::CS_last_saved_result
341  * source, which allows you to save the result of a TextureStage and re-use it
342  * for multiple inputs.
343  */
344 INLINE bool GraphicsStateGuardian::
346  return _supports_texture_saved_result;
347 }
348 
349 /**
350  * Returns true if this GSG can use the TextureStage::CM_dot3_rgb or
351  * CM_dot3_rgba combine modes.
352  */
353 INLINE bool GraphicsStateGuardian::
355  return _supports_texture_dot3;
356 }
357 
358 /**
359  * Returns true if this GSG can render 3-d (volumetric) textures.
360  */
361 INLINE bool GraphicsStateGuardian::
362 get_supports_3d_texture() const {
363  return _supports_3d_texture;
364 }
365 
366 /**
367  * Returns true if this GSG can render 2-d textures array.
368  */
369 INLINE bool GraphicsStateGuardian::
371  return _supports_2d_texture_array;
372 }
373 
374 /**
375  * Returns true if this GSG can render cube map textures.
376  */
377 INLINE bool GraphicsStateGuardian::
378 get_supports_cube_map() const {
379  return _supports_cube_map;
380 }
381 
382 /**
383  * Returns true if this GSG can render buffer textures.
384  */
385 INLINE bool GraphicsStateGuardian::
387  return _supports_buffer_texture;
388 }
389 
390 /**
391  * Returns true if this GSG can render cube map arrays.
392  */
393 INLINE bool GraphicsStateGuardian::
395  return _supports_cube_map_array;
396 }
397 
398 /**
399  * Returns true if this GSG can handle non power of two sized textures.
400  */
401 INLINE bool GraphicsStateGuardian::
403  return _supports_tex_non_pow2;
404 }
405 
406 /**
407  * Returns true if this GSG can handle sRGB textures.
408  */
409 INLINE bool GraphicsStateGuardian::
411  return _supports_texture_srgb;
412 }
413 
414 /**
415  * Returns true if this GSG can compress textures as it loads them into
416  * texture memory, and/or accept pre-compressed textures for storing.
417  */
418 INLINE bool GraphicsStateGuardian::
420  return _supports_compressed_texture;
421 }
422 
423 /**
424  * Returns true if this GSG can accept textures pre-compressed in the
425  * indicated format. compression_mode may be any of the
426  * Texture::CompressionMode enums.
427  */
429 get_supports_compressed_texture_format(int compression_mode) const {
430  return _compressed_texture_formats.get_bit(compression_mode);
431 }
432 
433 /**
434  * Returns the maximum number of simultaneous lights that may be rendered on
435  * geometry, or -1 if there is no particular limit.
436  *
437  * The value returned may not be meaningful until after the graphics context
438  * has been fully created (e.g. the window has been opened).
439  */
440 INLINE int GraphicsStateGuardian::
441 get_max_lights() const {
442  return _max_lights;
443 }
444 
445 /**
446  * Returns the maximum number of simultaneous clip planes that may be applied
447  * to geometry, or -1 if there is no particular limit.
448  *
449  * The value returned may not be meaningful until after the graphics context
450  * has been fully created (e.g. the window has been opened).
451  */
452 INLINE int GraphicsStateGuardian::
453 get_max_clip_planes() const {
454  return _max_clip_planes;
455 }
456 
457 /**
458  * Returns the maximum number of transform matrices that may be simultaneously
459  * used to transform any one vertex by the graphics hardware. If this number
460  * is 0, then the hardware (or the graphics backend) doesn't support soft-
461  * skinned vertices (in which case Panda will animate the vertices in
462  * software).
463  *
464  * The value returned may not be meaningful until after the graphics context
465  * has been fully created (e.g. the window has been opened).
466  */
467 INLINE int GraphicsStateGuardian::
469  return _max_vertex_transforms;
470 }
471 
472 /**
473  * Returns the maximum number of transforms there may be in a single
474  * TransformTable for this graphics hardware. If this number is 0 (but
475  * get_max_transforms() is nonzero), then the graphics hardware (or API)
476  * doesn't support indexed transforms, but can support direct transform
477  * references.
478  *
479  * The value returned may not be meaningful until after the graphics context
480  * has been fully created (e.g. the window has been opened).
481  */
482 INLINE int GraphicsStateGuardian::
484  return _max_vertex_transform_indices;
485 }
486 
487 /**
488  * Returns true if this particular GSG has the property that any framebuffer-
489  * to-texture copy results in a texture that is upside-down and backwards from
490  * Panda's usual convention; that is, it copies into a texture from the bottom
491  * up instead of from the top down.
492  *
493  * If this is true, then on offscreen GraphicsBuffer created for the purposes
494  * of rendering into a texture should be created with the invert flag set
495  * true, to compensate. Panda will do this automatically if you create an
496  * offscreen buffer using GraphicsOutput::make_texture_buffer().
497  */
498 INLINE bool GraphicsStateGuardian::
500  // If this is set from a Config variable, that overrides.
501  if (copy_texture_inverted.has_value()) {
502  return copy_texture_inverted;
503  }
504 
505  // Otherwise, use whatever behavior the GSG figured for itself.
506  return _copy_texture_inverted;
507 }
508 
509 /**
510  * Returns true if this particular GSG can generate mipmaps for a texture
511  * automatically, or if they must be generated in software. If this is true,
512  * then mipmaps can safely be enabled for rendered textures (e.g. using the
513  * MultitexReducer).
514  */
515 INLINE bool GraphicsStateGuardian::
517  return _supports_generate_mipmap;
518 }
519 
520 /**
521  * Returns true if this particular GSG supports textures whose format is
522  * F_depth_stencil. This returns true if the GSG supports GL_DEPTH_COMPONENT
523  * textures, which are considered a limited but still valid case of
524  * F_depth_stencil.
525  */
526 INLINE bool GraphicsStateGuardian::
528  return _supports_depth_texture;
529 }
530 
531 /**
532  * Returns true if this particular GSG supports textures whose format is
533  * F_depth_stencil. This only returns true if the GSG supports the full
534  * packed depth-stencil functionality.
535  */
536 INLINE bool GraphicsStateGuardian::
538  return _supports_depth_stencil;
539 }
540 
541 /**
542  * Returns true if this particular GSG supports luminance textures.
543  */
544 INLINE bool GraphicsStateGuardian::
546  return _supports_luminance_texture;
547 }
548 
549 /**
550  * Returns true if this particular GSG supports the filter mode FT_shadow for
551  * depth textures.
552  */
553 INLINE bool GraphicsStateGuardian::
555  return _supports_shadow_filter;
556 }
557 
558 /**
559  * Returns true if this particular GSG supports the use of sampler objects to
560  * record texture sampling parameters separately from the texture objects.
561  * This doesn't really affect functionality, but if this is false, it may mean
562  * that using the same texture with different SamplerState objects will result
563  * in reduced performance.
564  */
565 INLINE bool GraphicsStateGuardian::
567  return _supports_sampler_objects;
568 }
569 
570 /**
571  * Returns true if this particular GSG supports arbfp1+arbvp1 or above.
572  */
573 INLINE bool GraphicsStateGuardian::
575  return _supports_basic_shaders;
576 }
577 
578 /**
579  * Returns true if this particular GSG supports geometry shaders.
580  */
581 INLINE bool GraphicsStateGuardian::
583  return _supports_geometry_shaders;
584 }
585 
586 /**
587  * Returns true if this particular GSG supports tesselation shaders.
588  */
589 INLINE bool GraphicsStateGuardian::
591  return _supports_tessellation_shaders;
592 }
593 
594 /**
595  * Returns true if this particular GSG supports compute shaders.
596  */
597 INLINE bool GraphicsStateGuardian::
599  return _supports_compute_shaders;
600 }
601 
602 /**
603  * Returns true if this particular GSG supports GLSL shaders.
604  */
605 INLINE bool GraphicsStateGuardian::
606 get_supports_glsl() const {
607  return _supports_glsl;
608 }
609 
610 /**
611  * Returns true if this particular GSG supports HLSL shaders.
612  */
613 INLINE bool GraphicsStateGuardian::
614 get_supports_hlsl() const {
615  return _supports_hlsl;
616 }
617 
618 /**
619  * Returns true if this particular GSG supports stencil buffers at all.
620  */
621 INLINE bool GraphicsStateGuardian::
622 get_supports_stencil() const {
623  return _supports_stencil;
624 }
625 
626 /**
627  * Returns true if this particular GSG supports two sided stencil: different
628  * stencil settings for the front and back side of the same polygon.
629  */
630 INLINE bool GraphicsStateGuardian::
632  return _supports_two_sided_stencil;
633 }
634 
635 /**
636  * Returns true if this particular GSG supports hardware geometry instancing:
637  * the ability to render multiple copies of a model. In OpenGL, this is done
638  * using the EXT_draw_instanced extension.
639  */
640 INLINE bool GraphicsStateGuardian::
642  return _supports_geometry_instancing;
643 }
644 
645 /**
646  * Returns true if this particular GSG supports draw calls for which the
647  * information comes from a buffer.
648  */
649 INLINE bool GraphicsStateGuardian::
651  return _supports_indirect_draw;
652 }
653 
654 /**
655  * Returns true if this GSG supports an occlusion query. If this is true,
656  * then begin_occlusion_query() and end_occlusion_query() may be called to
657  * bracket a sequence of draw_triangles() (or whatever) calls to measure
658  * pixels that pass the depth test.
659  */
662  return _supports_occlusion_query;
663 }
664 
665 /**
666  * Returns true if this GSG supports a timer query.
667  */
669 get_supports_timer_query() const {
670  return _supports_timer_query;
671 }
672 
673 /**
674  * Returns true if timer queries are currently enabled on this GSG.
675  */
677 get_timer_queries_active() const {
678 #ifdef DO_PSTATS
679  return _timer_queries_active;
680 #else
681  return false;
682 #endif
683 }
684 
685 /**
686  * Returns the maximum number of simultaneous color textures that may be
687  * attached for render-to-texture, as supported by this particular GSG. If
688  * you exceed this number, the lowest-priority render targets will not be
689  * applied. Use RenderTarget::set_priority() to adjust the relative
690  * importance of the different render targets.
691  *
692  * The value returned may not be meaningful until after the graphics context
693  * has been fully created (e.g. the window has been opened).
694  */
695 INLINE int GraphicsStateGuardian::
696 get_max_color_targets() const {
697  if (max_color_targets > 0) {
698  return std::min(_max_color_targets, (int)max_color_targets);
699  }
700  return _max_color_targets;
701 }
702 
703 /**
704  * Returns true if dual source (incoming1_color and incoming1_alpha) blend
705  * operands are supported by this GSG.
706  */
707 INLINE bool GraphicsStateGuardian::
709  return _supports_dual_source_blending;
710 }
711 
712 /**
713  * Deprecated. Use get_max_color_targets() instead, which returns the exact
714  * same value.
715  */
718  return get_max_color_targets();
719 }
720 
721 /**
722  * Returns the ShaderModel
723  */
724 INLINE GraphicsStateGuardian::ShaderModel GraphicsStateGuardian::
725 get_shader_model() const {
726  return _shader_model;
727 }
728 
729 /**
730  * Sets the ShaderModel. This will override the auto- detected shader model
731  * during GSG reset. Useful for testing lower-end shaders.
732  */
733 INLINE void GraphicsStateGuardian::
734 set_shader_model(ShaderModel shader_model) {
735  if (shader_model <= _auto_detect_shader_model) {
736  _shader_model = shader_model;
737  }
738 }
739 
740 /**
741  * Returns true if this particular GSG can implement (or would prefer to
742  * implement) set color and/or color scale using materials and/or ambient
743  * lights, or false if we need to actually munge the color.
744  */
747  return _color_scale_via_lighting;
748 }
749 
750 /**
751  * Returns true if this particular GSG can implement (or would prefer to
752  * implement) an alpha scale via an additional Texture layer, or false if we
753  * need to actually munge the alpha.
754  */
757  return _alpha_scale_via_texture;
758 }
759 
760 /**
761  * This variant of get_alpha_scale_via_texture() answers the question of
762  * whether the GSG can implement an alpha scale via an additional Texture
763  * layer, considering the current TextureAttrib that will be in effect. This
764  * considers whether there is at least one additional texture slot available
765  * on the GSG.
766  */
768 get_alpha_scale_via_texture(const TextureAttrib *tex_attrib) const {
769  return _alpha_scale_via_texture &&
770  (tex_attrib == nullptr ||
771  tex_attrib->get_num_on_stages() < get_max_texture_stages());
772 }
773 
774 /**
775  * Returns the TextureStage that will be used to apply an alpha scale, if
776  * get_alpha_scale_via_texture() returns true.
777  */
780  if (_alpha_scale_texture_stage == nullptr) {
781  _alpha_scale_texture_stage = new TextureStage("alpha-scale");
782  _alpha_scale_texture_stage->set_sort(1000000000);
783  }
784  return _alpha_scale_texture_stage;
785 }
786 
787 /**
788  * Returns true if this particular GSG can implement (or would prefer to
789  * implement) set color and/or color scale directly, without requiring any
790  * munging of vertices or tricks with lighting.
791  */
793 get_runtime_color_scale() const {
794  return _runtime_color_scale;
795 }
796 
797 /**
798  * Returns the coordinate system in effect on this particular gsg. Normally,
799  * this will be the default coordinate system, but it might be set differently
800  * at runtime.
801  */
802 INLINE CoordinateSystem GraphicsStateGuardian::
803 get_coordinate_system() const {
804  return _coordinate_system;
805 }
806 
807 /**
808  * Specifies the global quality_level to be imposed for all Textures rendered
809  * by this GSG. This overrides the value set on individual textures via
810  * Texture::set_quality_level(). Set this to Texture::QL_default in order to
811  * allow the individual texture quality levels to be respected.
812  *
813  * This is mainly useful for the tinydisplay software renderer. See
814  * Texture::set_quality_level().
815  */
816 INLINE void GraphicsStateGuardian::
817 set_texture_quality_override(Texture::QualityLevel quality_level) {
818  _texture_quality_override = quality_level;
819 }
820 
821 /**
822  * Returns the global quality_level override specified by
823  * set_texture_quality_override.
824  *
825  * This is mainly useful for the tinydisplay software renderer. See
826  * Texture::set_quality_level().
827  */
828 INLINE Texture::QualityLevel GraphicsStateGuardian::
830  return _texture_quality_override;
831 }
832 
833 /**
834  * Calls reset() to initialize the GSG, but only if it hasn't been called yet.
835  * Returns true if the GSG was new, false otherwise.
836  */
838 reset_if_new() {
839  if (_needs_reset) {
840  reset();
841  return true;
842  }
843  return false;
844 }
845 
846 /**
847  * Marks the GSG as "new", so that the next call to reset_if_new() will be
848  * effective.
849  */
851 mark_new() {
852  _needs_reset = true;
853 }
854 
855 /**
856  * Fetches the external net transform. This transform is generally only set
857  * when geometry is about to be rendered. Therefore, this "get" function is
858  * typically only meaningful during the geometry rendering process.
859  */
860 INLINE CPT(TransformState) GraphicsStateGuardian::
861 get_external_transform() const {
862  return _inv_cs_transform->compose(_internal_transform);
863 }
864 
865 /**
866  * Fetches the external net transform. This transform is generally only set
867  * when geometry is about to be rendered. Therefore, this "get" function is
868  * typically only meaningful during the geometry rendering process.
869  */
870 INLINE CPT(TransformState) GraphicsStateGuardian::
871 get_internal_transform() const {
872  return _internal_transform;
873 }
874 
875 /**
876  * Returns the current display region being rendered to, as set by the last
877  * call to prepare_display_region().
878  */
879 INLINE const DisplayRegion *GraphicsStateGuardian::
880 get_current_display_region() const {
881  return _current_display_region;
882 }
883 
884 /**
885  * Returns the current stereo channel being rendered to, as set by the last
886  * call to prepare_display_region().
887  */
888 INLINE Lens::StereoChannel GraphicsStateGuardian::
889 get_current_stereo_channel() const {
890  return _current_stereo_channel;
891 }
892 
893 /**
894  * Returns the current tex view offset, as set by the last call to
895  * prepare_display_region(). This is read from the current DisplayRegion.
896  */
897 INLINE int GraphicsStateGuardian::
898 get_current_tex_view_offset() const {
899  return _current_tex_view_offset;
900 }
901 
902 /**
903  * Returns the current lens being used to render, according to the scene
904  * specified via the last call to set_scene().
905  */
906 INLINE const Lens *GraphicsStateGuardian::
907 get_current_lens() const {
908  return _current_lens;
909 }
910 
911 /**
912  * Returns the inverse of the transform returned by get_cs_transform().
913  */
914 INLINE CPT(TransformState) GraphicsStateGuardian::
915 get_inv_cs_transform() const {
916  return _inv_cs_transform;
917 }
918 
919 /**
920  * Notifies the gsg that it is about to render into a window/buffer with the
921  * given FrameBufferProperties
922  */
923 INLINE void GraphicsStateGuardian::
924 set_current_properties(const FrameBufferProperties *prop) {
925  _current_properties = prop;
926 }
bool get_bit(int index) const
Returns true if the nth bit is set, false if it is cleared.
Definition: bitMask.I:109
bool has_value() const
Returns true if this variable has an explicit value, either from a prc file or locally set,...
A rectangular subregion within a window for rendering into.
Definition: displayRegion.h:57
A container for the various kinds of properties we might ask to have on a graphics frameBuffer before...
An object to create GraphicsOutputs that share a particular 3-D API.
Definition: graphicsPipe.h:52
get_incomplete_render
Returns the incomplete_render flag.
get_supports_depth_texture
Returns true if this particular GSG supports textures whose format is F_depth_stencil.
get_max_lights
Returns the maximum number of simultaneous lights that may be rendered on geometry,...
int get_maximum_simultaneous_render_targets() const
Deprecated.
is_valid
Returns true if the GSG has been correctly initialized within a graphics context, false if there has ...
get_supports_3d_texture
Returns true if this GSG can render 3-d (volumetric) textures.
get_pipe
Returns the graphics pipe on which this GSG was created.
void release_all()
Releases all prepared objects.
int release_all_geoms()
Frees the resources for all geoms associated with this GSG.
get_supports_basic_shaders
Returns true if this particular GSG supports arbfp1+arbvp1 or above.
static TextureStage * get_alpha_scale_texture_stage()
Returns the TextureStage that will be used to apply an alpha scale, if get_alpha_scale_via_texture() ...
bool needs_reset() const
Returns true if the gsg is marked as needing a reset.
bool is_hardware() const
Returns true if this GSG appears to be hardware-accelerated, or false if it is known to be software o...
get_shader_model
Returns the ShaderModel.
get_max_vertices_per_primitive
Returns the maximum number of vertex indices that should be put into any one GeomPrimitive object for...
get_supports_2d_texture_array
Returns true if this GSG can render 2-d textures array.
get_supports_texture_combine
Returns true if this particular GSG can use the TextureStage::M_combine mode, which includes all of t...
get_max_vertices_per_array
Returns the maximum number of vertices that should be put into any one GeomVertexData object for use ...
get_texture_quality_override
Returns the global quality_level override specified by set_texture_quality_override.
get_max_texture_dimension
Returns the largest possible texture size in any one dimension supported by the GSG,...
set_active
Sets the active flag associated with the GraphicsStateGuardian.
get_supports_occlusion_query
Returns true if this GSG supports an occlusion query.
virtual bool get_supports_compressed_texture_format(int compression_mode) const
Returns true if this GSG can accept textures pre-compressed in the indicated format.
get_supports_tex_non_pow2
Returns true if this GSG can handle non power of two sized textures.
is_active
Returns the active flag associated with the GraphicsStateGuardian.
virtual bool prefers_triangle_strips() const
Returns true if this GSG strongly prefers triangle strips to individual triangles (such as SGI),...
bool get_alpha_scale_via_texture() const
Returns true if this particular GSG can implement (or would prefer to implement) an alpha scale via a...
int release_all_shader_buffers()
Frees the resources for all index buffers associated with this GSG.
get_supports_cube_map_array
Returns true if this GSG can render cube map arrays.
get_supports_generate_mipmap
Returns true if this particular GSG can generate mipmaps for a texture automatically,...
set_loader
Sets the Loader object that will be used by this GSG to load textures when necessary,...
get_max_vertex_transform_indices
Returns the maximum number of transforms there may be in a single TransformTable for this graphics ha...
get_supports_texture_srgb
Returns true if this GSG can handle sRGB textures.
get_max_buffer_texture_size
Returns the largest possible buffer texture size, or -1 if there is no particular limit.
set_shader_model
Sets the ShaderModel.
void mark_new()
Marks the GSG as "new", so that the next call to reset_if_new() will be effective.
get_max_2d_texture_array_layers
Returns the largest possible number of pages, or -1 if there is no particular limit.
get_supports_luminance_texture
Returns true if this particular GSG supports luminance textures.
get_copy_texture_inverted
Returns true if this particular GSG has the property that any framebuffer- to-texture copy results in...
get_supports_glsl
Returns true if this particular GSG supports GLSL shaders.
get_shader_generator
Returns the ShaderGenerator object that will be used by this GSG to generate shaders when necessary.
get_supports_compressed_texture
Returns true if this GSG can compress textures as it loads them into texture memory,...
get_supports_indirect_draw
Returns true if this particular GSG supports draw calls for which the information comes from a buffer...
get_supports_dual_source_blending
Returns true if dual source (incoming1_color and incoming1_alpha) blend operands are supported by thi...
get_supports_tessellation_shaders
Returns true if this particular GSG supports tesselation shaders.
get_effective_incomplete_render
Returns true if the GSG is effectively in incomplete_render state, considering both the GSG's incompl...
bool get_runtime_color_scale() const
Returns true if this particular GSG can implement (or would prefer to implement) set color and/or col...
bool get_color_scale_via_lighting() const
Returns true if this particular GSG can implement (or would prefer to implement) set color and/or col...
get_supports_timer_query
Returns true if this GSG supports a timer query.
get_supports_geometry_shaders
Returns true if this particular GSG supports geometry shaders.
get_supports_shadow_filter
Returns true if this particular GSG supports the filter mode FT_shadow for depth textures.
get_supports_stencil
Returns true if this particular GSG supports stencil buffers at all.
get_max_3d_texture_dimension
Returns the largest possible texture size in any one dimension for a 3-d texture, or -1 if there is n...
get_max_vertex_transforms
Returns the maximum number of transform matrices that may be simultaneously used to transform any one...
get_supports_compute_shaders
Returns true if this particular GSG supports compute shaders.
get_supports_geometry_instancing
Returns true if this particular GSG supports hardware geometry instancing: the ability to render mult...
get_max_texture_stages
Returns the maximum number of simultaneous textures that may be applied to geometry with multitexturi...
set_texture_quality_override
Specifies the global quality_level to be imposed for all Textures rendered by this GSG.
int release_all_samplers()
Frees the resources for all samplers associated with this GSG.
get_supports_two_sided_stencil
Returns true if this particular GSG supports two sided stencil: different stencil settings for the fr...
get_max_cube_map_dimension
Returns the largest possible texture size in any one dimension for a cube map texture,...
get_timer_queries_active
Returns true if timer queries are currently enabled on this GSG.
virtual void reset()
Resets all internal state as if the gsg were newly created.
get_supports_sampler_objects
Returns true if this particular GSG supports the use of sampler objects to record texture sampling pa...
int release_all_textures()
Frees the resources for all textures associated with this GSG.
get_supports_texture_dot3
Returns true if this GSG can use the TextureStage::CM_dot3_rgb or CM_dot3_rgba combine modes.
int release_all_vertex_buffers()
Frees the resources for all vertex buffers associated with this GSG.
get_supports_texture_saved_result
Returns true if this GSG can use the TextureStage::CS_last_saved_result source, which allows you to s...
get_loader
Returns the Loader object that will be used by this GSG to load textures when necessary,...
get_max_color_targets
Returns the maximum number of simultaneous color textures that may be attached for render-to-texture,...
get_supports_buffer_texture
Returns true if this GSG can render buffer textures.
set_incomplete_render
Sets the incomplete_render flag.
bool reset_if_new()
Calls reset() to initialize the GSG, but only if it hasn't been called yet.
get_coordinate_system
Returns the coordinate system in effect on this particular gsg.
get_supports_cube_map
Returns true if this GSG can render cube map textures.
set_shader_generator
Sets the ShaderGenerator object that will be used by this GSG to generate shaders when necessary.
get_supports_depth_stencil
Returns true if this particular GSG supports textures whose format is F_depth_stencil.
get_supports_hlsl
Returns true if this particular GSG supports HLSL shaders.
const GraphicsThreadingModel & get_threading_model() const
Returns the threading model that was used to create this GSG.
get_max_clip_planes
Returns the maximum number of simultaneous clip planes that may be applied to geometry,...
int release_all_index_buffers()
Frees the resources for all index buffers associated with this GSG.
This represents the user's specification of how a particular frame is handled by the various threads.
A base class for any number of different kinds of lenses, linear and otherwise.
Definition: lens.h:41
A convenient class for loading models from disk, in bam or egg format (or any of a number of other fo...
Definition: loader.h:42
Indicates the set of TextureStages and their associated Textures that should be applied to (or remove...
Definition: textureAttrib.h:31
get_num_on_stages
Returns the number of stages that are turned on by the attribute.
Definition: textureAttrib.h:55
Defines the properties of a named stage of the multitexture pipeline.
Definition: textureStage.h:35
Indicates a coordinate-system transform on vertices.
CPT(TransformState) GraphicsStateGuardian
Fetches the external net transform.