Panda3D
Loading...
Searching...
No Matches
graphicsStateGuardian.h
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.h
10 * @author drose
11 * @date 1999-02-02
12 * @author fperazzi, PandaSE
13 * @date 2010-05-05
14 * _max_2d_texture_array_layers on z axis, get_supports_cg_profile)
15 */
16
17#ifndef GRAPHICSSTATEGUARDIAN_H
18#define GRAPHICSSTATEGUARDIAN_H
19
20#include "pandabase.h"
21
24#include "lens.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"
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
54class DrawableRegion;
55class GraphicsEngine;
56
57/**
58 * Encapsulates all the communication with a particular instance of a given
59 * rendering backend. Tries to guarantee that redundant state-change requests
60 * are not issued (hence "state guardian").
61 *
62 * There will be one of these objects for each different graphics context
63 * active in the system.
64 */
65class EXPCL_PANDA_DISPLAY GraphicsStateGuardian : public GraphicsStateGuardianBase {
66 // Interfaces all GSGs should have
67public:
68 GraphicsStateGuardian(CoordinateSystem internal_coordinate_system,
69 GraphicsEngine *engine, GraphicsPipe *pipe);
70 virtual ~GraphicsStateGuardian();
71
72PUBLISHED:
73
74 enum ShaderModel {
75 SM_00,
76 SM_11,
77 SM_20,
78 SM_2X,
79 SM_30,
80 SM_40,
81 SM_50,
82 SM_51,
83 };
84
85 INLINE void release_all();
86 INLINE int release_all_textures();
87 INLINE int release_all_samplers();
88 INLINE int release_all_geoms();
89 INLINE int release_all_vertex_buffers();
90 INLINE int release_all_index_buffers();
91 INLINE int release_all_shader_buffers();
92
93 INLINE void set_active(bool active);
94 INLINE bool is_active() const;
95 INLINE bool is_valid() const;
96 INLINE bool needs_reset() const;
97 MAKE_PROPERTY(active, is_active, set_active);
98 MAKE_PROPERTY(valid, is_valid);
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 MAKE_PROPERTY(incomplete_render, get_incomplete_render, set_incomplete_render);
104 MAKE_PROPERTY(effective_incomplete_render, get_effective_incomplete_render);
105
106 INLINE void set_loader(Loader *loader);
107 INLINE Loader *get_loader() const;
108 MAKE_PROPERTY(loader, get_loader, set_loader);
109
110 INLINE void set_shader_generator(ShaderGenerator *shader_generator);
112 MAKE_PROPERTY(shader_generator, get_shader_generator, set_shader_generator);
113
114 INLINE GraphicsPipe *get_pipe() const;
115 GraphicsEngine *get_engine() const;
116 INLINE const GraphicsThreadingModel &get_threading_model() const;
117 MAKE_PROPERTY(pipe, get_pipe);
118
119 INLINE bool is_hardware() const;
120 virtual INLINE bool prefers_triangle_strips() const;
121 virtual INLINE int get_max_vertices_per_array() const;
122 virtual INLINE int get_max_vertices_per_primitive() const;
123
124 INLINE int get_max_texture_stages() const;
125 virtual INLINE int get_max_texture_dimension() const;
126 INLINE int get_max_3d_texture_dimension() const;
127 INLINE int get_max_2d_texture_array_layers() const; //z axis
128 INLINE int get_max_cube_map_dimension() const;
129 INLINE int get_max_buffer_texture_size() const;
130
131 INLINE bool get_supports_texture_combine() const;
132 INLINE bool get_supports_texture_saved_result() const;
133 INLINE bool get_supports_texture_dot3() const;
134
135 INLINE bool get_supports_3d_texture() const;
136 INLINE bool get_supports_2d_texture_array() const;
137 INLINE bool get_supports_cube_map() const;
138 INLINE bool get_supports_buffer_texture() const;
139 INLINE bool get_supports_cube_map_array() const;
140 INLINE bool get_supports_tex_non_pow2() const;
141 INLINE bool get_supports_texture_srgb() const;
142
143 INLINE bool get_supports_compressed_texture() const;
144 virtual INLINE bool get_supports_compressed_texture_format(int compression_mode) const;
145
146 INLINE int get_max_lights() const;
147 INLINE int get_max_clip_planes() const;
148
149 INLINE int get_max_vertex_transforms() const;
150 INLINE int get_max_vertex_transform_indices() const;
151
152 INLINE bool get_copy_texture_inverted() const;
153 virtual bool get_supports_multisample() const;
154 INLINE bool get_supports_generate_mipmap() const;
155 INLINE bool get_supports_depth_texture() const;
156 INLINE bool get_supports_depth_stencil() const;
157 INLINE bool get_supports_luminance_texture() const;
158 INLINE bool get_supports_shadow_filter() const;
159 INLINE bool get_supports_sampler_objects() const;
160 INLINE bool get_supports_basic_shaders() const;
161 INLINE bool get_supports_geometry_shaders() const;
162 INLINE bool get_supports_tessellation_shaders() const;
163 INLINE bool get_supports_compute_shaders() const;
164 INLINE bool get_supports_glsl() const;
165 INLINE bool get_supports_hlsl() const;
166 INLINE bool get_supports_stencil() const;
167 INLINE bool get_supports_two_sided_stencil() const;
168 INLINE bool get_supports_geometry_instancing() const;
169 INLINE bool get_supports_indirect_draw() const;
170
171 INLINE bool get_supports_occlusion_query() const;
172 INLINE bool get_supports_timer_query() const;
173 INLINE bool get_timer_queries_active() const;
174
175 INLINE int get_max_color_targets() const;
177 INLINE bool get_supports_dual_source_blending() const;
178
179 MAKE_PROPERTY(max_vertices_per_array, get_max_vertices_per_array);
180 MAKE_PROPERTY(max_vertices_per_primitive, get_max_vertices_per_primitive);
181 MAKE_PROPERTY(max_texture_stages, get_max_texture_stages);
182 MAKE_PROPERTY(max_texture_dimension, get_max_texture_dimension);
183 MAKE_PROPERTY(max_3d_texture_dimension, get_max_3d_texture_dimension);
184 MAKE_PROPERTY(max_2d_texture_array_layers, get_max_2d_texture_array_layers);
185 MAKE_PROPERTY(max_cube_map_dimension, get_max_cube_map_dimension);
186 MAKE_PROPERTY(max_buffer_texture_size, get_max_buffer_texture_size);
187 MAKE_PROPERTY(supports_texture_combine, get_supports_texture_combine);
188 MAKE_PROPERTY(supports_texture_saved_result, get_supports_texture_saved_result);
189 MAKE_PROPERTY(supports_texture_dot3, get_supports_texture_dot3);
190 MAKE_PROPERTY(supports_3d_texture, get_supports_3d_texture);
191 MAKE_PROPERTY(supports_2d_texture_array, get_supports_2d_texture_array);
192 MAKE_PROPERTY(supports_cube_map, get_supports_cube_map);
193 MAKE_PROPERTY(supports_buffer_texture, get_supports_buffer_texture);
194 MAKE_PROPERTY(supports_cube_map_array, get_supports_cube_map_array);
195 MAKE_PROPERTY(supports_tex_non_pow2, get_supports_tex_non_pow2);
196 MAKE_PROPERTY(supports_texture_srgb, get_supports_texture_srgb);
197 MAKE_PROPERTY(supports_compressed_texture, get_supports_compressed_texture);
198 MAKE_PROPERTY(max_lights, get_max_lights);
199 MAKE_PROPERTY(max_clip_planes, get_max_clip_planes);
200 MAKE_PROPERTY(max_vertex_transforms, get_max_vertex_transforms);
201 MAKE_PROPERTY(max_vertex_transform_indices, get_max_vertex_transform_indices);
202 MAKE_PROPERTY(copy_texture_inverted, get_copy_texture_inverted);
203 MAKE_PROPERTY(supports_multisample, get_supports_multisample);
204 MAKE_PROPERTY(supports_generate_mipmap, get_supports_generate_mipmap);
205 MAKE_PROPERTY(supports_depth_texture, get_supports_depth_texture);
206 MAKE_PROPERTY(supports_depth_stencil, get_supports_depth_stencil);
207 MAKE_PROPERTY(supports_luminance_texture, get_supports_luminance_texture);
208 MAKE_PROPERTY(supports_shadow_filter, get_supports_shadow_filter);
209 MAKE_PROPERTY(supports_sampler_objects, get_supports_sampler_objects);
210 MAKE_PROPERTY(supports_basic_shaders, get_supports_basic_shaders);
211 MAKE_PROPERTY(supports_geometry_shaders, get_supports_geometry_shaders);
212 MAKE_PROPERTY(supports_tessellation_shaders, get_supports_tessellation_shaders);
213 MAKE_PROPERTY(supports_compute_shaders, get_supports_compute_shaders);
214 MAKE_PROPERTY(supports_glsl, get_supports_glsl);
215 MAKE_PROPERTY(supports_hlsl, get_supports_hlsl);
216 MAKE_PROPERTY(supports_stencil, get_supports_stencil);
217 MAKE_PROPERTY(supports_two_sided_stencil, get_supports_two_sided_stencil);
218 MAKE_PROPERTY(supports_geometry_instancing, get_supports_geometry_instancing);
219 MAKE_PROPERTY(supports_indirect_draw, get_supports_indirect_draw);
220 MAKE_PROPERTY(supports_occlusion_query, get_supports_occlusion_query);
221 MAKE_PROPERTY(supports_timer_query, get_supports_timer_query);
222 MAKE_PROPERTY(timer_queries_active, get_timer_queries_active);
223 MAKE_PROPERTY(max_color_targets, get_max_color_targets);
224 MAKE_PROPERTY(supports_dual_source_blending, get_supports_dual_source_blending);
225
226 INLINE ShaderModel get_shader_model() const;
227 INLINE void set_shader_model(ShaderModel shader_model);
228 MAKE_PROPERTY(shader_model, get_shader_model, set_shader_model);
229
230 virtual int get_supported_geom_rendering() const;
231 virtual bool get_supports_cg_profile(const std::string &name) const;
232
233 INLINE bool get_color_scale_via_lighting() const;
234 INLINE bool get_alpha_scale_via_texture() const;
235 INLINE bool get_alpha_scale_via_texture(const TextureAttrib *tex_attrib) const;
236 INLINE bool get_runtime_color_scale() const;
237
239
240 void set_coordinate_system(CoordinateSystem cs);
241 INLINE CoordinateSystem get_coordinate_system() const;
242 virtual CoordinateSystem get_internal_coordinate_system() const;
243 MAKE_PROPERTY(coordinate_system, get_coordinate_system, set_coordinate_system);
244
246 MAKE_PROPERTY(prepared_objects, get_prepared_objects);
247
248 virtual bool set_gamma(PN_stdfloat gamma);
249 PN_stdfloat get_gamma() const;
250 virtual void restore_gamma();
251 MAKE_PROPERTY(gamma, get_gamma, set_gamma);
252
253 INLINE void set_texture_quality_override(Texture::QualityLevel quality_level);
254 INLINE Texture::QualityLevel get_texture_quality_override() const;
255 MAKE_PROPERTY(texture_quality_override, get_texture_quality_override,
257
258 EXTENSION(PyObject *get_prepared_textures() const);
259 typedef bool TextureCallback(TextureContext *tc, void *callback_arg);
260 void traverse_prepared_textures(TextureCallback *func, void *callback_arg);
261
262#if !defined(NDEBUG) || !defined(CPPPARSER)
263 void set_flash_texture(Texture *tex);
264 void clear_flash_texture();
265 Texture *get_flash_texture() const;
266 MAKE_PROPERTY(flash_texture, get_flash_texture, set_flash_texture);
267#endif
268
269PUBLISHED:
270 virtual bool has_extension(const std::string &extension) const;
271
272 virtual std::string get_driver_vendor();
273 virtual std::string get_driver_renderer();
274 virtual std::string get_driver_version();
275 virtual int get_driver_version_major();
276 virtual int get_driver_version_minor();
279
280 MAKE_PROPERTY(driver_vendor, get_driver_vendor);
281 MAKE_PROPERTY(driver_renderer, get_driver_renderer);
282 MAKE_PROPERTY(driver_version, get_driver_version);
283 MAKE_PROPERTY(driver_version_major, get_driver_version_major);
284 MAKE_PROPERTY(driver_version_minor, get_driver_version_minor);
285 MAKE_PROPERTY(driver_shader_version_major, get_driver_shader_version_major);
286 MAKE_PROPERTY(driver_shader_version_minor, get_driver_shader_version_minor);
287
288 bool set_scene(SceneSetup *scene_setup);
289 virtual SceneSetup *get_scene() const final;
290 MAKE_PROPERTY(scene, get_scene, set_scene);
291
292public:
293 virtual TextureContext *prepare_texture(Texture *tex, int view);
294 virtual bool update_texture(TextureContext *tc, bool force);
295 virtual void release_texture(TextureContext *tc);
296 virtual bool extract_texture_data(Texture *tex);
297
298 virtual SamplerContext *prepare_sampler(const SamplerState &sampler);
299 virtual void release_sampler(SamplerContext *sc);
300
301 virtual GeomContext *prepare_geom(Geom *geom);
302 virtual void release_geom(GeomContext *gc);
303
304 virtual ShaderContext *prepare_shader(Shader *shader);
305 virtual void release_shader(ShaderContext *sc);
306
309
311 virtual void release_index_buffer(IndexBufferContext *ibc);
312
314 virtual void release_shader_buffer(BufferContext *ibc);
315
316 virtual void begin_occlusion_query();
318
319 virtual PT(TimerQueryContext) issue_timer_query(int pstats_index);
320
321 virtual void dispatch_compute(int size_x, int size_y, int size_z);
322
323 virtual PT(GeomMunger) get_geom_munger(const RenderState *state,
324 Thread *current_thread);
325 virtual PT(GeomMunger) make_geom_munger(const RenderState *state,
326 Thread *current_thread);
327
328 virtual void set_state_and_transform(const RenderState *state,
329 const TransformState *transform);
330
331 PN_stdfloat compute_distance_to(const LPoint3 &point) const;
332
333 virtual void clear(DrawableRegion *clearable);
334
335 const LMatrix4 *fetch_specified_value(Shader::ShaderMatSpec &spec, int altered);
336 const LMatrix4 *fetch_specified_part(Shader::ShaderMatInput input, InternalName *name,
337 LMatrix4 &t, int index);
338 const LMatrix4 *fetch_specified_member(const NodePath &np, CPT_InternalName member, LMatrix4 &t);
339 PT(Texture) fetch_specified_texture(Shader::ShaderTexSpec &spec,
340 SamplerState &sampler, int &view);
341 const Shader::ShaderPtrData *fetch_ptr_parameter(const Shader::ShaderPtrSpec& spec);
342
344 virtual void clear_before_callback();
345 virtual void clear_state_and_transform();
346
347 virtual void remove_window(GraphicsOutputBase *window);
348
349 virtual CPT(TransformState) calc_projection_mat(const Lens *lens);
350 virtual bool prepare_lens();
351
352 virtual bool begin_frame(Thread *current_thread);
353PUBLISHED:
354 virtual bool begin_scene();
355 virtual void end_scene();
356public:
357 virtual void end_frame(Thread *current_thread);
358
359 void flush_timer_queries();
360
361 void set_current_properties(const FrameBufferProperties *properties);
362
363 virtual bool depth_offset_decals();
364 virtual CPT(RenderState) begin_decal_base_first();
365 virtual CPT(RenderState) begin_decal_nested();
367 virtual void finish_decal();
368
369 virtual bool begin_draw_primitives(const GeomPipelineReader *geom_reader,
370 const GeomVertexDataPipelineReader *data_reader,
371 bool force);
372 virtual bool draw_triangles(const GeomPrimitivePipelineReader *reader,
373 bool force);
374 virtual bool draw_triangles_adj(const GeomPrimitivePipelineReader *reader,
375 bool force);
376 virtual bool draw_tristrips(const GeomPrimitivePipelineReader *reader,
377 bool force);
378 virtual bool draw_tristrips_adj(const GeomPrimitivePipelineReader *reader,
379 bool force);
380 virtual bool draw_trifans(const GeomPrimitivePipelineReader *reader,
381 bool force);
382 virtual bool draw_patches(const GeomPrimitivePipelineReader *reader,
383 bool force);
384 virtual bool draw_lines(const GeomPrimitivePipelineReader *reader,
385 bool force);
386 virtual bool draw_lines_adj(const GeomPrimitivePipelineReader *reader,
387 bool force);
388 virtual bool draw_linestrips(const GeomPrimitivePipelineReader *reader,
389 bool force);
390 virtual bool draw_linestrips_adj(const GeomPrimitivePipelineReader *reader,
391 bool force);
392 virtual bool draw_points(const GeomPrimitivePipelineReader *reader,
393 bool force);
394 virtual void end_draw_primitives();
395
396 INLINE bool reset_if_new();
397 INLINE void mark_new();
398 virtual void reset();
399
400 INLINE CPT(TransformState) get_external_transform() const;
401 INLINE CPT(TransformState) get_internal_transform() const;
402
403 RenderBuffer get_render_buffer(int buffer_type, const FrameBufferProperties &prop);
404
405 INLINE const DisplayRegion *get_current_display_region() const;
406 INLINE Lens::StereoChannel get_current_stereo_channel() const;
407 INLINE int get_current_tex_view_offset() const;
408 INLINE const Lens *get_current_lens() const;
409
410 virtual CPT(TransformState) get_cs_transform_for(CoordinateSystem cs) const;
411 virtual CPT(TransformState) get_cs_transform() const;
412 INLINE CPT(TransformState) get_inv_cs_transform() const;
413
414 void do_issue_clip_plane();
415 void do_issue_color();
416 void do_issue_color_scale();
417 virtual void do_issue_light();
418
419 virtual bool framebuffer_copy_to_texture
420 (Texture *tex, int view, int z, const DisplayRegion *dr, const RenderBuffer &rb);
421 virtual bool framebuffer_copy_to_ram
422 (Texture *tex, int view, int z, const DisplayRegion *dr, const RenderBuffer &rb);
423
424 virtual void bind_light(PointLight *light_obj, const NodePath &light,
425 int light_id);
426 virtual void bind_light(DirectionalLight *light_obj, const NodePath &light,
427 int light_id);
428 virtual void bind_light(Spotlight *light_obj, const NodePath &light,
429 int light_id);
430
431 static void create_gamma_table (PN_stdfloat gamma, unsigned short *red_table, unsigned short *green_table, unsigned short *blue_table);
432
433 PT(Texture) get_shadow_map(const NodePath &light_np, GraphicsOutputBase *host=nullptr);
434 PT(Texture) get_dummy_shadow_map(Texture::TextureType texture_type) const;
436
437 virtual void ensure_generated_shader(const RenderState *state);
438
439#ifdef DO_PSTATS
440 static void init_frame_pstats();
441#endif
442
443protected:
444 virtual void reissue_transforms();
445
446 virtual void enable_lighting(bool enable);
447 virtual void set_ambient_light(const LColor &color);
448 virtual void enable_light(int light_id, bool enable);
449 virtual void begin_bind_lights();
450 virtual void end_bind_lights();
451
452 virtual void enable_clip_planes(bool enable);
453 virtual void enable_clip_plane(int plane_id, bool enable);
454 virtual void begin_bind_clip_planes();
455 virtual void bind_clip_plane(const NodePath &plane, int plane_id);
456 virtual void end_bind_clip_planes();
457
458 void determine_target_texture();
459 void determine_target_shader();
460
461 virtual void free_pointers();
462 virtual void close_gsg();
463 void panic_deactivate();
464
465 void determine_light_color_scale();
466
467 static CPT(RenderState) get_unlit_state();
468 static CPT(RenderState) get_unclipped_state();
469 static CPT(RenderState) get_untextured_state();
470
471 AsyncFuture *async_reload_texture(TextureContext *tc);
472
473protected:
474 PT(SceneSetup) _scene_null;
475 PT(SceneSetup) _scene_setup;
476
477 // The current state of the graphics context, as of the last call to
478 // set_state_and_transform().
479 CPT(RenderState) _state_rs;
480
481 // The desired state of the graphics context, during processing of
482 // set_state_and_transform().
483 CPT(RenderState) _target_rs;
484
485 // This bitmask contains a 1 bit everywhere that _state_rs has a known
486 // value. If a bit is 0, the corresponding state must be re-sent. Derived
487 // GSGs should initialize _inv_state_mask in reset() as a mask of 1's where
488 // they don't care, and 0's where they do care, about the state.
489 RenderState::SlotMask _state_mask;
490 RenderState::SlotMask _inv_state_mask;
491
492 // The current transform, as of the last call to set_state_and_transform().
493 CPT(TransformState) _internal_transform;
494
495 // The current TextureAttrib is a special case; we may further restrict it
496 // (according to graphics cards limits) or extend it (according to
497 // ColorScaleAttribs in effect) beyond what is specifically requested in the
498 // scene graph.
499 CPT(TextureAttrib) _target_texture;
500 CPT(TextureAttrib) _state_texture;
501 CPT(TexGenAttrib) _target_tex_gen;
502 CPT(TexGenAttrib) _state_tex_gen;
503
504 // Also, the shader might be the explicitly-requested shader, or it might be
505 // an auto-generated one.
506 CPT(ShaderAttrib) _state_shader;
507 CPT(ShaderAttrib) _target_shader;
508
509 // This is set by begin_draw_primitives(), and are only valid between
510 // begin_draw_primitives() and end_draw_primitives().
511 const GeomVertexDataPipelineReader *_data_reader;
512
513 unsigned int _color_write_mask;
514
515 PT(DisplayRegion) _current_display_region;
516 Lens::StereoChannel _current_stereo_channel;
517 int _current_tex_view_offset;
518 CPT(Lens) _current_lens;
519 CPT(TransformState) _projection_mat;
520 CPT(TransformState) _projection_mat_inv;
521 const FrameBufferProperties *_current_properties;
522
523 CoordinateSystem _coordinate_system;
524 CoordinateSystem _internal_coordinate_system;
525 CPT(TransformState) _cs_transform;
526 CPT(TransformState) _inv_cs_transform;
527
528 LColor _scene_graph_color;
529 bool _has_scene_graph_color;
530 bool _transform_stale;
531 bool _color_blend_involves_color_scale;
532 bool _texture_involves_color_scale;
533 bool _vertex_colors_enabled;
534 bool _lighting_enabled;
535 bool _clip_planes_enabled;
536 bool _color_scale_enabled;
537 LVecBase4 _current_color_scale;
538
539 bool _has_material_force_color;
540 LColor _material_force_color;
541 LVecBase4 _light_color_scale;
542 bool _has_texture_alpha_scale;
543
544 bool _tex_gen_modifies_mat;
545 bool _tex_gen_point_sprite;
546 int _last_max_stage_index;
547
548 bool _needs_reset;
549 bool _is_valid;
550 bool _closing_gsg;
551 bool _active;
552 bool _incomplete_render;
553 bool _effective_incomplete_render;
554 PT(Loader) _loader;
555
556 PT(PreparedGraphicsObjects) _prepared_objects;
557
558 bool _is_hardware;
559 bool _prefers_triangle_strips;
560 int _max_vertices_per_array;
561 int _max_vertices_per_primitive;
562
563 int _max_texture_stages;
564 int _max_texture_dimension;
565 int _max_3d_texture_dimension;
566 int _max_2d_texture_array_layers; //on the z axis
567 int _max_cube_map_dimension;
568 int _max_buffer_texture_size;
569
570 bool _supports_texture_combine;
571 bool _supports_texture_saved_result;
572 bool _supports_texture_dot3;
573
574 bool _supports_3d_texture;
575 bool _supports_2d_texture_array;
576 bool _supports_cube_map;
577 bool _supports_buffer_texture;
578 bool _supports_cube_map_array;
579 bool _supports_tex_non_pow2;
580 bool _supports_texture_srgb;
581
582 bool _supports_compressed_texture;
583 BitMask32 _compressed_texture_formats;
584
585 int _max_lights;
586 int _max_clip_planes;
587
588 int _max_vertex_transforms;
589 int _max_vertex_transform_indices;
590
591 bool _supports_occlusion_query;
592 PT(OcclusionQueryContext) _current_occlusion_query;
593
594 bool _supports_timer_query;
595#ifdef DO_PSTATS
596 int _pstats_gpu_thread;
597 bool _timer_queries_active;
598 PStatFrameData _pstats_gpu_data;
599
600 int _last_query_frame;
601 int _last_num_queried;
602 // double _timer_delta;
603 typedef pdeque<PT(TimerQueryContext)> TimerQueryQueue;
604 TimerQueryQueue _pending_timer_queries;
605#endif
606
607 bool _copy_texture_inverted;
608 bool _supports_multisample;
609 bool _supports_generate_mipmap;
610 bool _supports_depth_texture;
611 bool _supports_depth_stencil;
612 bool _supports_luminance_texture;
613 bool _supports_shadow_filter;
614 bool _supports_sampler_objects;
615 bool _supports_basic_shaders;
616 bool _supports_geometry_shaders;
617 bool _supports_tessellation_shaders;
618 bool _supports_compute_shaders;
619 bool _supports_glsl;
620 bool _supports_hlsl;
621 bool _supports_framebuffer_multisample;
622 bool _supports_framebuffer_blit;
623
624 bool _supports_stencil;
625 bool _supports_stencil_wrap;
626 bool _supports_two_sided_stencil;
627 bool _supports_geometry_instancing;
628 bool _supports_indirect_draw;
629
630 int _max_color_targets;
631 bool _supports_dual_source_blending;
632
633 int _supported_geom_rendering;
634 bool _color_scale_via_lighting;
635 bool _alpha_scale_via_texture;
636 bool _runtime_color_scale;
637
638 int _stereo_buffer_mask;
639
640 ShaderModel _auto_detect_shader_model;
641 ShaderModel _shader_model;
642
643 static PT(TextureStage) _alpha_scale_texture_stage;
644
645 Shader::ShaderCaps _shader_caps;
646
647 PN_stdfloat _gamma;
648 Texture::QualityLevel _texture_quality_override;
649
650 PT(ShaderGenerator) _shader_generator;
651
652#ifndef NDEBUG
653 PT(Texture) _flash_texture;
654#else
655 PT(Texture) _flash_texture_unused;
656#endif
657
658public:
659 // Statistics
660 static PStatCollector _vertex_buffer_switch_pcollector;
661 static PStatCollector _index_buffer_switch_pcollector;
662 static PStatCollector _shader_buffer_switch_pcollector;
663 static PStatCollector _load_vertex_buffer_pcollector;
664 static PStatCollector _load_index_buffer_pcollector;
665 static PStatCollector _load_shader_buffer_pcollector;
666 static PStatCollector _create_vertex_buffer_pcollector;
667 static PStatCollector _create_index_buffer_pcollector;
668 static PStatCollector _create_shader_buffer_pcollector;
669 static PStatCollector _load_texture_pcollector;
670 static PStatCollector _data_transferred_pcollector;
671 static PStatCollector _texmgrmem_total_pcollector;
672 static PStatCollector _texmgrmem_resident_pcollector;
673 static PStatCollector _primitive_batches_pcollector;
674 static PStatCollector _primitive_batches_tristrip_pcollector;
675 static PStatCollector _primitive_batches_trifan_pcollector;
676 static PStatCollector _primitive_batches_tri_pcollector;
677 static PStatCollector _primitive_batches_patch_pcollector;
678 static PStatCollector _primitive_batches_other_pcollector;
679 static PStatCollector _vertices_tristrip_pcollector;
680 static PStatCollector _vertices_trifan_pcollector;
681 static PStatCollector _vertices_tri_pcollector;
682 static PStatCollector _vertices_patch_pcollector;
683 static PStatCollector _vertices_other_pcollector;
684 static PStatCollector _vertices_indexed_tristrip_pcollector;
685 static PStatCollector _state_pcollector;
686 static PStatCollector _transform_state_pcollector;
687 static PStatCollector _texture_state_pcollector;
688 static PStatCollector _draw_primitive_pcollector;
689 static PStatCollector _draw_set_state_pcollector;
690 static PStatCollector _flush_pcollector;
691 static PStatCollector _compute_dispatch_pcollector;
692 static PStatCollector _wait_occlusion_pcollector;
693 static PStatCollector _wait_timer_pcollector;
694 static PStatCollector _timer_queries_pcollector;
695 static PStatCollector _command_latency_pcollector;
696
697 static PStatCollector _prepare_pcollector;
698 static PStatCollector _prepare_texture_pcollector;
699 static PStatCollector _prepare_sampler_pcollector;
700 static PStatCollector _prepare_geom_pcollector;
701 static PStatCollector _prepare_shader_pcollector;
702 static PStatCollector _prepare_vertex_buffer_pcollector;
703 static PStatCollector _prepare_index_buffer_pcollector;
704 static PStatCollector _prepare_shader_buffer_pcollector;
705
706 // A whole slew of collectors to measure the cost of individual state
707 // changes. These are disabled by default.
708 static PStatCollector _draw_set_state_transform_pcollector;
709 static PStatCollector _draw_set_state_alpha_test_pcollector;
710 static PStatCollector _draw_set_state_antialias_pcollector;
711 static PStatCollector _draw_set_state_clip_plane_pcollector;
712 static PStatCollector _draw_set_state_color_pcollector;
713 static PStatCollector _draw_set_state_cull_face_pcollector;
714 static PStatCollector _draw_set_state_depth_offset_pcollector;
715 static PStatCollector _draw_set_state_depth_test_pcollector;
716 static PStatCollector _draw_set_state_depth_write_pcollector;
717 static PStatCollector _draw_set_state_render_mode_pcollector;
718 static PStatCollector _draw_set_state_rescale_normal_pcollector;
719 static PStatCollector _draw_set_state_shade_model_pcollector;
720 static PStatCollector _draw_set_state_blending_pcollector;
721 static PStatCollector _draw_set_state_shader_pcollector;
722 static PStatCollector _draw_set_state_shader_parameters_pcollector;
723 static PStatCollector _draw_set_state_texture_pcollector;
724 static PStatCollector _draw_set_state_tex_matrix_pcollector;
725 static PStatCollector _draw_set_state_tex_gen_pcollector;
726 static PStatCollector _draw_set_state_material_pcollector;
727 static PStatCollector _draw_set_state_light_pcollector;
728 static PStatCollector _draw_set_state_stencil_pcollector;
729 static PStatCollector _draw_set_state_fog_pcollector;
730 static PStatCollector _draw_set_state_scissor_pcollector;
731
732private:
733 int _num_lights_enabled;
734 int _num_clip_planes_enabled;
735
736 PT(GraphicsPipe) _pipe;
737 GraphicsEngine *_engine;
738 GraphicsThreadingModel _threading_model;
739
740public:
741 static TypeHandle get_class_type() {
742 return _type_handle;
743 }
744
745public:
746 static void init_type() {
747 GraphicsStateGuardianBase::init_type();
748 register_type(_type_handle, "GraphicsStateGuardian",
749 GraphicsStateGuardianBase::get_class_type());
750 }
751 virtual TypeHandle get_type() const {
752 return get_class_type();
753 }
754 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
755
756private:
757 static TypeHandle _type_handle;
758
759 friend class GraphicsPipe;
760 friend class GraphicsWindow;
761 friend class GraphicsEngine;
762};
763
764EXPCL_PANDA_DISPLAY std::ostream &operator << (std::ostream &out, GraphicsStateGuardian::ShaderModel sm);
765
767
768#endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This class represents a thread-safe handle to a promised future result of an asynchronous operation,...
Definition asyncFuture.h:61
This is a base class for those kinds of SavedContexts that occupy an easily-measured (and substantial...
This is a const pointer to an InternalName, and should be used in lieu of a CPT(InternalName) in func...
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.
A rectangular subregion within a window for rendering into.
This is a base class for GraphicsWindow (actually, GraphicsOutput) and DisplayRegion,...
A container for the various kinds of properties we might ask to have on a graphics frameBuffer before...
This is a special class object that holds all the information returned by a particular GSG to indicat...
Definition geomContext.h:34
Objects of this class are used to convert vertex data from a Geom into a format suitable for passing ...
Definition geomMunger.h:50
Encapsulates the data from a Geom, pre-fetched for one stage of the pipeline.
Definition geom.h:405
Encapsulates the data from a GeomPrimitive, pre-fetched for one stage of the pipeline.
This is an abstract base class for a family of classes that represent the fundamental geometry primit...
This is the data for one array of a GeomVertexData structure.
Encapsulates the data from a GeomVertexData, pre-fetched for one stage of the pipeline.
A container for geometry primitives.
Definition geom.h:54
This class is the main interface to controlling the render process.
An abstract base class for GraphicsOutput, for all the usual reasons.
This is a base class for the various different classes that represent the result of a frame of render...
This is a base class for the GraphicsStateGuardian class, which is itself a base class for the variou...
virtual bool framebuffer_copy_to_ram(Texture *tex, int view, int z, const DisplayRegion *dr, const RenderBuffer &rb)
Copy the pixels within the indicated display region from the framebuffer into system memory,...
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.
virtual bool draw_points(const GeomPrimitivePipelineReader *reader, bool force)
Draws a series of disconnected points.
virtual bool draw_trifans(const GeomPrimitivePipelineReader *reader, bool force)
Draws a series of triangle fans.
virtual void clear_before_callback()
Resets any non-standard graphics state that might give a callback apoplexy.
virtual ConstPointerTo< TransformState > get_cs_transform_for(CoordinateSystem cs) const
Returns what the cs_transform would be set to after a call to set_coordinate_system(cs).
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.
virtual bool depth_offset_decals()
Returns true if this GSG can implement decals using a DepthOffsetAttrib, or false if that is unreliab...
void release_all()
Releases all prepared objects.
PointerTo< Texture > get_dummy_shadow_map(Texture::TextureType texture_type) const
Returns a dummy shadow map that can be used for a light of the given type that does not cast shadows.
get_gamma
Get the current gamma setting.
virtual bool begin_draw_primitives(const GeomPipelineReader *geom_reader, const GeomVertexDataPipelineReader *data_reader, bool force)
Called before a sequence of draw_primitive() functions are called, this should prepare the vertex dat...
int release_all_geoms()
Frees the resources for all geoms associated with this GSG.
virtual bool update_texture(TextureContext *tc, bool force)
Ensures that the current Texture data is refreshed onto the GSG.
get_supports_basic_shaders
Returns true if this particular GSG supports arbfp1+arbvp1 or above.
set_scene
Sets the SceneSetup object that indicates the initial camera position, etc.
PointerTo< Texture > fetch_specified_texture(Shader::ShaderTexSpec &spec, SamplerState &sampler, int &view)
Like fetch_specified_value, but for texture inputs.
GraphicsEngine * get_engine() const
Returns the graphics engine that created this GSG.
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() ...
virtual TextureContext * prepare_texture(Texture *tex, int view)
Creates whatever structures the GSG requires to represent the texture internally, and returns a newly...
bool needs_reset() const
Returns true if the gsg is marked as needing a reset.
get_supports_multisample
Returns true if this particular GSG supports using the multisample bits to provide antialiasing,...
bool is_hardware() const
Returns true if this GSG appears to be hardware-accelerated, or false if it is known to be software o...
virtual bool draw_triangles(const GeomPrimitivePipelineReader *reader, bool force)
Draws a series of disconnected triangles.
get_shader_model
Returns the ShaderModel.
get_driver_version_minor
Returns the minor version of the video driver.
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.
virtual void bind_light(PointLight *light_obj, const NodePath &light, int light_id)
Called the first time a particular light has been bound to a given id within a frame,...
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.
virtual bool draw_lines(const GeomPrimitivePipelineReader *reader, bool force)
Draws a series of disconnected line segments.
get_max_texture_dimension
Returns the largest possible texture size in any one dimension supported by the GSG,...
virtual void release_shader_buffer(BufferContext *ibc)
Frees the resources previously allocated via a call to prepare_data(), including deleting the BufferC...
set_active
Sets the active flag associated with the GraphicsStateGuardian.
get_supports_occlusion_query
Returns true if this GSG supports an occlusion query.
void traverse_prepared_textures(TextureCallback *func, void *callback_arg)
Calls the indicated function on all currently-prepared textures, or until the callback function retur...
get_flash_texture
Returns the current "flash texture", if any, or NULL if none.
virtual bool prepare_lens()
Makes the current lens (whichever lens was most recently specified with set_scene()) active,...
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.
static void create_gamma_table(PN_stdfloat gamma, unsigned short *red_table, unsigned short *green_table, unsigned short *blue_table)
Create a gamma table.
virtual void clear_state_and_transform()
Forgets the current graphics state and current transform, so that the next call to set_state_and_tran...
get_driver_vendor
Returns the vendor of the video card driver.
virtual ConstPointerTo< RenderState > begin_decal_base_first()
Called during draw to begin a three-step rendering phase to draw decals.
virtual VertexBufferContext * prepare_vertex_buffer(GeomVertexArrayData *data)
Prepares the indicated buffer for retained-mode rendering.
get_supports_generate_mipmap
Returns true if this particular GSG can generate mipmaps for a texture automatically,...
virtual bool draw_patches(const GeomPrimitivePipelineReader *reader, bool force)
Draws a series of "patches", which can only be processed by a tessellation shader.
set_loader
Sets the Loader object that will be used by this GSG to load textures when necessary,...
virtual ConstPointerTo< RenderState > begin_decal_nested()
Called during draw to begin a three-step rendering phase to draw decals.
virtual bool framebuffer_copy_to_texture(Texture *tex, int view, int z, const DisplayRegion *dr, const RenderBuffer &rb)
Copy the pixels within the indicated display region from the framebuffer into texture memory.
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.
virtual void prepare_display_region(DisplayRegionPipelineReader *dr)
Makes the specified DisplayRegion current.
get_driver_shader_version_minor
Returns the minor version of the shader model.
get_max_buffer_texture_size
Returns the largest possible buffer texture size, or -1 if there is no particular limit.
virtual void release_sampler(SamplerContext *sc)
Frees the resources previously allocated via a call to prepare_sampler(), including deleting the Samp...
get_prepared_objects
Returns the set of texture and geom objects that have been prepared with this GSG (and possibly other...
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.
PointerTo< Texture > get_shadow_map(const NodePath &light_np, GraphicsOutputBase *host=nullptr)
Returns a shadow map for the given light source.
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.
virtual void do_issue_light()
This implementation of do_issue_light() assumes we have a limited number of hardware lights available...
get_driver_renderer
Returns GL_Renderer.
void flush_timer_queries()
Called by the graphics engine on the draw thread to check the status of the running timer queries and...
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.
virtual void release_vertex_buffer(VertexBufferContext *vbc)
Frees the resources previously allocated via a call to prepare_data(), including deleting the VertexB...
get_shader_generator
Returns the ShaderGenerator object that will be used by this GSG to generate shaders when necessary.
void do_issue_color()
This method is defined in the base class because it is likely that this functionality will be used fo...
get_supports_compressed_texture
Returns true if this GSG can compress textures as it loads them into texture memory,...
const LMatrix4 * fetch_specified_part(Shader::ShaderMatInput input, InternalName *name, LMatrix4 &t, int index)
See fetch_specified_value.
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...
virtual CoordinateSystem get_internal_coordinate_system() const
Returns the coordinate system used internally by the GSG.
virtual bool extract_texture_data(Texture *tex)
This method should only be called by the GraphicsEngine.
const LMatrix4 * fetch_specified_member(const NodePath &np, CPT_InternalName member, LMatrix4 &t)
Given a NodePath passed into a shader input that is a structure, fetches the value for the given memb...
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...
virtual PointerTo< GeomMunger > get_geom_munger(const RenderState *state, Thread *current_thread)
Looks up or creates a GeomMunger object to munge vertices appropriate to this GSG for the indicated s...
get_driver_version_major
Returns major version of the video driver.
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_driver_shader_version_major
Returns the major version of the shader model.
virtual void release_geom(GeomContext *gc)
Frees the resources previously allocated via a call to prepare_geom(), including deleting the GeomCon...
get_supports_geometry_shaders
Returns true if this particular GSG supports geometry shaders.
virtual ConstPointerTo< TransformState > get_cs_transform() const
Returns a transform that converts from the GSG's external coordinate system (as returned by get_coord...
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...
virtual SamplerContext * prepare_sampler(const SamplerState &sampler)
Creates whatever structures the GSG requires to represent the sampler internally, and returns a newly...
RenderBuffer get_render_buffer(int buffer_type, const FrameBufferProperties &prop)
Returns a RenderBuffer object suitable for operating on the requested set of buffers.
virtual void ensure_generated_shader(const RenderState *state)
Ensures that an appropriate shader has been generated for the given state.
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.
virtual ConstPointerTo< RenderState > begin_decal_base_second()
Called during draw to begin a three-step rendering phase to draw decals.
get_supports_geometry_instancing
Returns true if this particular GSG supports hardware geometry instancing: the ability to render mult...
const Shader::ShaderPtrData * fetch_ptr_parameter(const Shader::ShaderPtrSpec &spec)
Return a pointer to struct ShaderPtrData.
virtual GraphicsOutput * make_shadow_buffer(LightLensNode *light, Texture *tex, GraphicsOutput *host)
Creates a depth buffer for shadow mapping.
get_max_texture_stages
Returns the maximum number of simultaneous textures that may be applied to geometry with multitexturi...
virtual void end_frame(Thread *current_thread)
Called after each frame is rendered, to allow the GSG a chance to do any internal cleanup after rende...
set_texture_quality_override
Specifies the global quality_level to be imposed for all Textures rendered by this GSG.
virtual bool draw_lines_adj(const GeomPrimitivePipelineReader *reader, bool force)
Draws a series of disconnected line segments with adjacency information.
int release_all_samplers()
Frees the resources for all samplers associated with this GSG.
virtual bool has_extension(const std::string &extension) const
Returns true if the GSG implements the extension identified by the given string.
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,...
virtual bool draw_linestrips_adj(const GeomPrimitivePipelineReader *reader, bool force)
Draws a series of line strips with adjacency information.
virtual void end_scene()
Called between begin_frame() and end_frame() to mark the end of drawing commands for a "scene" (usual...
get_timer_queries_active
Returns true if timer queries are currently enabled on this GSG.
virtual void release_shader(ShaderContext *sc)
Releases the resources allocated by prepare_shader.
void do_issue_clip_plane()
This is fundametically similar to do_issue_light(), with calls to apply_clip_plane() and enable_clip_...
virtual GeomContext * prepare_geom(Geom *geom)
Prepares the indicated Geom for retained-mode rendering, by creating whatever structures are necessar...
virtual void reset()
Resets all internal state as if the gsg were newly created.
virtual PointerTo< OcclusionQueryContext > end_occlusion_query()
Ends a previous call to begin_occlusion_query().
virtual ConstPointerTo< TransformState > calc_projection_mat(const Lens *lens)
Given a lens, this function calculates the appropriate projection matrix for this gsg.
virtual int get_supported_geom_rendering() const
Returns the union of Geom::GeomRendering values that this particular GSG can support directly.
get_supports_sampler_objects
Returns true if this particular GSG supports the use of sampler objects to record texture sampling pa...
virtual void release_texture(TextureContext *tc)
Frees the resources previously allocated via a call to prepare_texture(), including deleting the Text...
get_driver_version
Returns driver version This has an implementation-defined meaning, and may be "" if the particular gr...
PN_stdfloat compute_distance_to(const LPoint3 &point) const
This function will compute the distance to the indicated point, assumed to be in eye coordinates,...
virtual void begin_occlusion_query()
Begins a new occlusion query.
const LMatrix4 * fetch_specified_value(Shader::ShaderMatSpec &spec, int altered)
The gsg contains a large number of useful matrices:
virtual IndexBufferContext * prepare_index_buffer(GeomPrimitive *data)
Prepares the indicated buffer for retained-mode rendering.
virtual void finish_decal()
Called during draw to clean up after decals are finished.
virtual bool draw_tristrips(const GeomPrimitivePipelineReader *reader, bool force)
Draws a series of triangle strips.
int release_all_textures()
Frees the resources for all textures associated with this GSG.
get_scene
Returns the current SceneSetup object.
get_supports_texture_dot3
Returns true if this GSG can use the TextureStage::CM_dot3_rgb or CM_dot3_rgba combine modes.
set_flash_texture
Sets the "flash texture".
virtual bool draw_linestrips(const GeomPrimitivePipelineReader *reader, bool force)
Draws a series of line strips.
virtual void set_state_and_transform(const RenderState *state, const TransformState *transform)
Simultaneously resets the render state and the transform state.
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...
virtual bool get_supports_cg_profile(const std::string &name) const
Returns true if this particular GSG supports the specified Cg Shader Profile.
virtual bool draw_tristrips_adj(const GeomPrimitivePipelineReader *reader, bool force)
Draws a series of triangle strips with adjacency information.
get_loader
Returns the Loader object that will be used by this GSG to load textures when necessary,...
virtual void clear(DrawableRegion *clearable)
Clears the framebuffer within the current DisplayRegion, according to the flags indicated by the give...
get_max_color_targets
Returns the maximum number of simultaneous color textures that may be attached for render-to-texture,...
virtual bool begin_frame(Thread *current_thread)
Called before each frame is rendered, to allow the GSG a chance to do any internal cleanup before beg...
set_coordinate_system
Changes the coordinate system in effect on this particular gsg.
get_supports_buffer_texture
Returns true if this GSG can render buffer textures.
virtual PointerTo< TimerQueryContext > issue_timer_query(int pstats_index)
Adds a timer query to the command stream, associated with the given PStats collector index.
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.
virtual BufferContext * prepare_shader_buffer(ShaderBuffer *data)
Prepares the indicated buffer for retained-mode rendering.
virtual void remove_window(GraphicsOutputBase *window)
This is simply a transparent call to GraphicsEngine::remove_window().
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.
virtual void restore_gamma()
Restore original gamma setting.
virtual bool draw_triangles_adj(const GeomPrimitivePipelineReader *reader, bool force)
Draws a series of disconnected triangles with adjacency information.
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.
virtual void dispatch_compute(int size_x, int size_y, int size_z)
Dispatches a currently bound compute shader using the given work group counts.
virtual void release_index_buffer(IndexBufferContext *ibc)
Frees the resources previously allocated via a call to prepare_data(), including deleting the IndexBu...
virtual PointerTo< GeomMunger > make_geom_munger(const RenderState *state, Thread *current_thread)
Creates a new GeomMunger object to munge vertices appropriate to this GSG for the indicated state.
void clear_flash_texture()
Resets the "flash texture", so that no textures will flash.
virtual void end_draw_primitives()
Called after a sequence of draw_primitive() functions are called, this should do whatever cleanup is ...
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.
virtual ShaderContext * prepare_shader(Shader *shader)
Compile a vertex/fragment shader body.
virtual bool begin_scene()
Called between begin_frame() and end_frame() to mark the beginning of drawing commands for a "scene" ...
This represents the user's specification of how a particular frame is handled by the various threads.
This is a special class object that holds all the information returned by a particular GSG to indicat...
Encodes a string name in a hash table, mapping it to a pointer.
A base class for any number of different kinds of lenses, linear and otherwise.
Definition lens.h:41
A derivative of Light and of Camera.
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
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition nodePath.h:159
Returned from a GSG in response to begin_occlusion_query() .
A lightweight class that represents a single element that may be timed and/or counted via stats.
Contains the raw timing and level data for a single frame.
A light originating from a single point in space, and shining in all directions.
Definition pointLight.h:25
A table of objects that are saved within the graphics context for reference by handle later.
A RenderBuffer is an arbitrary subset of the various layers (depth buffer, color buffer,...
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
Definition renderState.h:47
This is a special class object that holds a handle to the sampler state object given by the graphics ...
Represents a set of settings that indicate how a texture is sampled.
This object holds the camera position, etc., and other general setup information for rendering a part...
Definition sceneSetup.h:32
This is a generic buffer object that lives in graphics memory.
The ShaderContext is meant to contain the compiled version of a shader string.
A light originating from a single point in space, and shining in a particular direction,...
Definition spotlight.h:32
Computes texture coordinates for geometry automatically based on vertex position and/or normal.
Indicates the set of TextureStages and their associated Textures that should be applied to (or remove...
This is a special class object that holds all the information returned by a particular GSG to indicat...
Defines the properties of a named stage of the multitexture pipeline.
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
Definition texture.h:72
A thread; that is, a lightweight process.
Definition thread.h:46
Indicates a coordinate-system transform on vertices.
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
This is a special class object that holds all the information returned by a particular GSG to indicat...
This is our own Panda specialization on the default STL deque.
Definition pdeque.h:36
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.