Panda3D
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Friends | List of all members
GraphicsStateGuardian Class Reference

Encapsulates all the communication with a particular instance of a given rendering backend. More...

#include "graphicsStateGuardian.h"

Inheritance diagram for GraphicsStateGuardian:
GraphicsStateGuardianBase TypedWritableReferenceCount TypedWritable ReferenceCount TypedObject MemoryBase MemoryBase DXGraphicsStateGuardian9

Public Types

enum  ShaderModel {
  SM_00, SM_11, SM_20, SM_2X,
  SM_30, SM_40, SM_50, SM_51
}
 
typedef bool TextureCallback(TextureContext *tc, void *callback_arg)
 

Public Member Functions

 GraphicsStateGuardian (CoordinateSystem internal_coordinate_system, GraphicsEngine *engine, GraphicsPipe *pipe)
 
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 data for rendering. More...
 
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 beginning the frame. More...
 
virtual void begin_occlusion_query ()
 Begins a new occlusion query. More...
 
virtual bool begin_scene ()
 Called between begin_frame() and end_frame() to mark the beginning of drawing commands for a "scene" (usually a particular DisplayRegion) within a frame. More...
 
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, this should set up the associated hardware light with the light's properties. More...
 
virtual void bind_light (DirectionalLight *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, this should set up the associated hardware light with the light's properties. More...
 
virtual void bind_light (Spotlight *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, this should set up the associated hardware light with the light's properties. More...
 
virtual void clear (DrawableRegion *clearable)
 Clears the framebuffer within the current DisplayRegion, according to the flags indicated by the given DrawableRegion object. More...
 
virtual void clear_before_callback ()
 Resets any non-standard graphics state that might give a callback apoplexy. More...
 
void clear_flash_texture ()
 Resets the "flash texture", so that no textures will flash. More...
 
virtual void clear_state_and_transform ()
 Forgets the current graphics state and current transform, so that the next call to set_state_and_transform() will have to reload everything. More...
 
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, from the camera plane. More...
 
virtual CPT (TransformState) calc_projection_mat(const Lens *lens)
 
virtual CPT (RenderState) begin_decal_base_first()
 
virtual CPT (RenderState) begin_decal_nested()
 
virtual CPT (RenderState) begin_decal_base_second()
 
 CPT (TransformState) get_external_transform() const
 
 CPT (TransformState) get_internal_transform() const
 
virtual CPT (TransformState) get_cs_transform_for(CoordinateSystem cs) const
 
virtual CPT (TransformState) get_cs_transform() const
 
 CPT (TransformState) get_inv_cs_transform() const
 
virtual bool depth_offset_decals ()
 Returns true if this GSG can implement decals using a DepthOffsetAttrib, or false if that is unreliable and the three-step rendering process should be used instead. More...
 
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. More...
 
void do_issue_clip_plane ()
 
void do_issue_color ()
 This method is defined in the base class because it is likely that this functionality will be used for all (or at least most) kinds of GraphicsStateGuardians–it's not specific to any one rendering backend. More...
 
void do_issue_color_scale ()
 
virtual void do_issue_light ()
 This implementation of do_issue_light() assumes we have a limited number of hardware lights available. More...
 
virtual bool draw_lines (const GeomPrimitivePipelineReader *reader, bool force)
 Draws a series of disconnected line segments. More...
 
virtual bool draw_lines_adj (const GeomPrimitivePipelineReader *reader, bool force)
 Draws a series of disconnected line segments with adjacency information. More...
 
virtual bool draw_linestrips (const GeomPrimitivePipelineReader *reader, bool force)
 Draws a series of line strips. More...
 
virtual bool draw_linestrips_adj (const GeomPrimitivePipelineReader *reader, bool force)
 Draws a series of line strips with adjacency information. More...
 
virtual bool draw_patches (const GeomPrimitivePipelineReader *reader, bool force)
 Draws a series of "patches", which can only be processed by a tessellation shader. More...
 
virtual bool draw_points (const GeomPrimitivePipelineReader *reader, bool force)
 Draws a series of disconnected points. More...
 
virtual bool draw_triangles (const GeomPrimitivePipelineReader *reader, bool force)
 Draws a series of disconnected triangles. More...
 
virtual bool draw_triangles_adj (const GeomPrimitivePipelineReader *reader, bool force)
 Draws a series of disconnected triangles with adjacency information. More...
 
virtual bool draw_trifans (const GeomPrimitivePipelineReader *reader, bool force)
 Draws a series of triangle fans. More...
 
virtual bool draw_tristrips (const GeomPrimitivePipelineReader *reader, bool force)
 Draws a series of triangle strips. More...
 
virtual bool draw_tristrips_adj (const GeomPrimitivePipelineReader *reader, bool force)
 Draws a series of triangle strips with adjacency information. More...
 
virtual void end_draw_primitives ()
 Called after a sequence of draw_primitive() functions are called, this should do whatever cleanup is appropriate. More...
 
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 rendering the frame, and before the window flips. More...
 
virtual void end_scene ()
 Called between begin_frame() and end_frame() to mark the end of drawing commands for a "scene" (usually a particular DisplayRegion) within a frame. More...
 
virtual void ensure_generated_shader (const RenderState *state)
 Ensures that an appropriate shader has been generated for the given state. More...
 
virtual bool extract_texture_data (Texture *tex)
 This method should only be called by the GraphicsEngine. More...
 
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 member. More...
 
const LMatrix4 * fetch_specified_part (Shader::ShaderMatInput input, InternalName *name, LMatrix4 &t, int index)
 See fetch_specified_value. More...
 
const LMatrix4 * fetch_specified_value (Shader::ShaderMatSpec &spec, int altered)
 The gsg contains a large number of useful matrices: More...
 
virtual void finish_decal ()
 Called during draw to clean up after decals are finished. More...
 
void flush_timer_queries ()
 Called by the graphics engine on the draw thread to check the status of the running timer queries and submit their results to the PStats server. More...
 
virtual TypeHandle force_init_type ()
 
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, not texture memory. More...
 
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. More...
 
bool get_alpha_scale_via_texture () const
 Returns true if this particular GSG can implement (or would prefer to implement) an alpha scale via an additional Texture layer, or false if we need to actually munge the alpha. More...
 
bool get_alpha_scale_via_texture (const TextureAttrib *tex_attrib) const
 This variant of get_alpha_scale_via_texture() answers the question of whether the GSG can implement an alpha scale via an additional Texture layer, considering the current TextureAttrib that will be in effect. More...
 
bool get_color_scale_via_lighting () const
 Returns true if this particular GSG can implement (or would prefer to implement) set color and/or color scale using materials and/or ambient lights, or false if we need to actually munge the color. More...
 
CoordinateSystem get_coordinate_system () const
 
bool get_copy_texture_inverted () const
 
const DisplayRegionget_current_display_region () const
 
const Lensget_current_lens () const
 
Lens::StereoChannel get_current_stereo_channel () const
 
int get_current_tex_view_offset () const
 
virtual std::string get_driver_renderer ()
 
virtual int get_driver_shader_version_major ()
 
virtual int get_driver_shader_version_minor ()
 
virtual std::string get_driver_vendor ()
 
virtual std::string get_driver_version ()
 
virtual int get_driver_version_major ()
 
virtual int get_driver_version_minor ()
 
virtual bool get_effective_incomplete_render () const
 
GraphicsEngineget_engine () const
 Returns the graphics engine that created this GSG. More...
 
Textureget_flash_texture () const
 
PN_stdfloat get_gamma () const
 
virtual bool get_incomplete_render () const
 
virtual CoordinateSystem get_internal_coordinate_system () const
 Returns the coordinate system used internally by the GSG. More...
 
Loaderget_loader () const
 
int get_max_2d_texture_array_layers () const
 
int get_max_3d_texture_dimension () const
 
int get_max_buffer_texture_size () const
 
int get_max_clip_planes () const
 
int get_max_color_targets () const
 
int get_max_cube_map_dimension () const
 
int get_max_lights () const
 
virtual int get_max_texture_dimension () const
 
int get_max_texture_stages () const
 
int get_max_vertex_transform_indices () const
 
int get_max_vertex_transforms () const
 
virtual int get_max_vertices_per_array () const
 
virtual int get_max_vertices_per_primitive () const
 
int get_maximum_simultaneous_render_targets () const
 Deprecated. More...
 
GraphicsPipeget_pipe () const
 
virtual PreparedGraphicsObjectsget_prepared_objects ()
 
RenderBuffer get_render_buffer (int buffer_type, const FrameBufferProperties &prop)
 Returns a RenderBuffer object suitable for operating on the requested set of buffers. More...
 
bool get_runtime_color_scale () const
 Returns true if this particular GSG can implement (or would prefer to implement) set color and/or color scale directly, without requiring any munging of vertices or tricks with lighting. More...
 
virtual SceneSetupget_scene () const final
 
ShaderGeneratorget_shader_generator () const
 
ShaderModel get_shader_model () const
 
virtual int get_supported_geom_rendering () const
 Returns the union of Geom::GeomRendering values that this particular GSG can support directly. More...
 
bool get_supports_2d_texture_array () const
 
bool get_supports_3d_texture () const
 
bool get_supports_basic_shaders () const
 
bool get_supports_buffer_texture () const
 
virtual bool get_supports_cg_profile (const std::string &name) const
 Returns true if this particular GSG supports the specified Cg Shader Profile. More...
 
bool get_supports_compressed_texture () const
 
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. More...
 
bool get_supports_compute_shaders () const
 
bool get_supports_cube_map () const
 
bool get_supports_cube_map_array () const
 
bool get_supports_depth_stencil () const
 
bool get_supports_depth_texture () const
 
bool get_supports_dual_source_blending () const
 
bool get_supports_generate_mipmap () const
 
bool get_supports_geometry_instancing () const
 
bool get_supports_geometry_shaders () const
 
bool get_supports_glsl () const
 
bool get_supports_hlsl () const
 
bool get_supports_indirect_draw () const
 
bool get_supports_luminance_texture () const
 
virtual bool get_supports_multisample () const
 
bool get_supports_occlusion_query () const
 
bool get_supports_sampler_objects () const
 
bool get_supports_shadow_filter () const
 
bool get_supports_stencil () const
 
bool get_supports_tessellation_shaders () const
 
bool get_supports_tex_non_pow2 () const
 
bool get_supports_texture_combine () const
 
bool get_supports_texture_dot3 () const
 
bool get_supports_texture_saved_result () const
 
bool get_supports_texture_srgb () const
 
bool get_supports_timer_query () const
 
bool get_supports_two_sided_stencil () const
 
Texture::QualityLevel get_texture_quality_override () const
 
const GraphicsThreadingModelget_threading_model () const
 Returns the threading model that was used to create this GSG. More...
 
bool get_timer_queries_active () const
 
virtual TypeHandle get_type () const
 
virtual bool has_extension (const std::string &extension) const
 Returns true if the GSG implements the extension identified by the given string. More...
 
bool is_active () const
 
bool is_hardware () const
 Returns true if this GSG appears to be hardware-accelerated, or false if it is known to be software only. More...
 
bool is_valid () const
 
void mark_new ()
 Marks the GSG as "new", so that the next call to reset_if_new() will be effective. More...
 
bool needs_reset () const
 Returns true if the gsg is marked as needing a reset. More...
 
virtual bool prefers_triangle_strips () const
 Returns true if this GSG strongly prefers triangle strips to individual triangles (such as SGI), or false if it prefers to minimize the number of primitive batches, even at the expense of triangle strips (such as most PC hardware). More...
 
virtual void prepare_display_region (DisplayRegionPipelineReader *dr)
 Makes the specified DisplayRegion current. More...
 
virtual GeomContextprepare_geom (Geom *geom)
 Prepares the indicated Geom for retained-mode rendering, by creating whatever structures are necessary in the GSG (for instance, vertex buffers). More...
 
virtual IndexBufferContextprepare_index_buffer (GeomPrimitive *data)
 Prepares the indicated buffer for retained-mode rendering. More...
 
virtual bool prepare_lens ()
 Makes the current lens (whichever lens was most recently specified with set_scene()) active, so that it will transform future rendered geometry. More...
 
virtual SamplerContextprepare_sampler (const SamplerState &sampler)
 Creates whatever structures the GSG requires to represent the sampler internally, and returns a newly-allocated SamplerContext object with this data. More...
 
virtual ShaderContextprepare_shader (Shader *shader)
 Compile a vertex/fragment shader body. More...
 
virtual BufferContextprepare_shader_buffer (ShaderBuffer *data)
 Prepares the indicated buffer for retained-mode rendering. More...
 
virtual TextureContextprepare_texture (Texture *tex, int view)
 Creates whatever structures the GSG requires to represent the texture internally, and returns a newly-allocated TextureContext object with this data. More...
 
virtual VertexBufferContextprepare_vertex_buffer (GeomVertexArrayData *data)
 Prepares the indicated buffer for retained-mode rendering. More...
 
virtual PT (OcclusionQueryContext) end_occlusion_query()
 
virtual PT (TimerQueryContext) issue_timer_query(int pstats_index)
 
virtual PT (GeomMunger) get_geom_munger(const RenderState *state
 
virtual PT (GeomMunger) make_geom_munger(const RenderState *state
 
 PT (Texture) get_shadow_map(const NodePath &light_np
 
void release_all ()
 Releases all prepared objects. More...
 
int release_all_geoms ()
 Frees the resources for all geoms associated with this GSG. More...
 
int release_all_index_buffers ()
 Frees the resources for all index buffers associated with this GSG. More...
 
int release_all_samplers ()
 Frees the resources for all samplers associated with this GSG. More...
 
int release_all_shader_buffers ()
 Frees the resources for all index buffers associated with this GSG. More...
 
int release_all_textures ()
 Frees the resources for all textures associated with this GSG. More...
 
int release_all_vertex_buffers ()
 Frees the resources for all vertex buffers associated with this GSG. More...
 
virtual void release_geom (GeomContext *gc)
 Frees the resources previously allocated via a call to prepare_geom(), including deleting the GeomContext itself, if it is non-NULL. More...
 
virtual void release_index_buffer (IndexBufferContext *ibc)
 Frees the resources previously allocated via a call to prepare_data(), including deleting the IndexBufferContext itself, if necessary. More...
 
virtual void release_sampler (SamplerContext *sc)
 Frees the resources previously allocated via a call to prepare_sampler(), including deleting the SamplerContext itself, if it is non-NULL. More...
 
virtual void release_shader (ShaderContext *sc)
 Releases the resources allocated by prepare_shader. More...
 
virtual void release_shader_buffer (BufferContext *ibc)
 Frees the resources previously allocated via a call to prepare_data(), including deleting the BufferContext itself, if necessary. More...
 
virtual void release_texture (TextureContext *tc)
 Frees the resources previously allocated via a call to prepare_texture(), including deleting the TextureContext itself, if it is non-NULL. More...
 
virtual void release_vertex_buffer (VertexBufferContext *vbc)
 Frees the resources previously allocated via a call to prepare_data(), including deleting the VertexBufferContext itself, if necessary. More...
 
virtual void remove_window (GraphicsOutputBase *window)
 This is simply a transparent call to GraphicsEngine::remove_window(). More...
 
virtual void reset ()
 Resets all internal state as if the gsg were newly created. More...
 
bool reset_if_new ()
 Calls reset() to initialize the GSG, but only if it hasn't been called yet. More...
 
virtual void restore_gamma ()
 Restore original gamma setting. More...
 
void set_active (bool active)
 
void set_coordinate_system (CoordinateSystem cs)
 
void set_current_properties (const FrameBufferProperties *properties)
 
void set_flash_texture (Texture *tex)
 
virtual bool set_gamma (PN_stdfloat gamma)
 
void set_incomplete_render (bool incomplete_render)
 
void set_loader (Loader *loader)
 
bool set_scene (SceneSetup *scene_setup)
 
void set_shader_generator (ShaderGenerator *shader_generator)
 
void set_shader_model (ShaderModel shader_model)
 
virtual void set_state_and_transform (const RenderState *state, const TransformState *transform)
 Simultaneously resets the render state and the transform state. More...
 
void set_texture_quality_override (Texture::QualityLevel quality_level)
 
void traverse_prepared_textures (TextureCallback *func, void *callback_arg)
 Calls the indicated function on all currently-prepared textures, or until the callback function returns false. More...
 
virtual bool update_texture (TextureContext *tc, bool force)
 Ensures that the current Texture data is refreshed onto the GSG. More...
 
- Public Member Functions inherited from GraphicsStateGuardianBase
virtual void pop_group_marker ()
 
virtual void push_group_marker (const std::string &marker)
 
- Public Member Functions inherited from TypedWritableReferenceCount
 TypedWritableReferenceCount (const TypedWritableReferenceCount &copy)
 
virtual ReferenceCountas_reference_count ()
 Returns the pointer cast to a ReferenceCount pointer, if it is in fact of that type. More...
 
void operator= (const TypedWritableReferenceCount &copy)
 
- Public Member Functions inherited from TypedWritable
 TypedWritable (const TypedWritable &copy)
 
virtual int complete_pointers (TypedWritable **p_list, BamReader *manager)
 Receives an array of pointers, one for each time manager->read_pointer() was called in fillin(). More...
 
vector_uchar encode_to_bam_stream () const
 Converts the TypedWritable object into a single stream of data using a BamWriter, and returns that data as a bytes object. More...
 
bool encode_to_bam_stream (vector_uchar &data, BamWriter *writer=nullptr) const
 Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string. More...
 
virtual void fillin (DatagramIterator &scan, BamReader *manager)
 This internal function is intended to be called by each class's make_from_bam() method to read in all of the relevant data from the BamFile for the new object. More...
 
virtual void finalize (BamReader *manager)
 Called by the BamReader to perform any final actions needed for setting up the object after all objects have been read and all pointers have been completed. More...
 
UpdateSeq get_bam_modified () const
 Returns the current bam_modified counter. More...
 
void mark_bam_modified ()
 Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams. More...
 
void operator= (const TypedWritable &copy)
 
virtual bool require_fully_complete () const
 Some objects require all of their nested pointers to have been completed before the objects themselves can be completed. More...
 
virtual void update_bam_nested (BamWriter *manager)
 Called by the BamWriter when this object has not itself been modified recently, but it should check its nested objects for updates. More...
 
virtual void write_datagram (BamWriter *manager, Datagram &dg)
 Writes the contents of this object to the datagram for shipping out to a Bam file. More...
 
- Public Member Functions inherited from TypedObject
 TypedObject (const TypedObject &copy)=default
 
TypedObjectas_typed_object ()
 Returns the object, upcast (if necessary) to a TypedObject pointer. More...
 
const TypedObjectas_typed_object () const
 Returns the object, upcast (if necessary) to a TypedObject pointer. More...
 
int get_best_parent_from_Set (const std::set< int > &) const
 
int get_type_index () const
 Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. More...
 
bool is_exact_type (TypeHandle handle) const
 Returns true if the current object is the indicated type exactly. More...
 
bool is_of_type (TypeHandle handle) const
 Returns true if the current object is or derives from the indicated type. More...
 
TypedObjectoperator= (const TypedObject &copy)=default
 
- Public Member Functions inherited from ReferenceCount
int get_ref_count () const
 
WeakReferenceListget_weak_list () const
 Returns the WeakReferenceList associated with this ReferenceCount object. More...
 
bool has_weak_list () const
 Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise. More...
 
void local_object ()
 This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack. More...
 
void ref () const
 Explicitly increments the reference count. More...
 
bool ref_if_nonzero () const
 Atomically increases the reference count of this object if it is not zero. More...
 
bool test_ref_count_integrity () const
 Does some easy checks to make sure that the reference count isn't completely bogus. More...
 
bool test_ref_count_nonzero () const
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus. More...
 
virtual bool unref () const
 Explicitly decrements the reference count. More...
 
WeakReferenceListweak_ref ()
 Adds the indicated PointerToVoid as a weak reference to this object. More...
 
void weak_unref ()
 Removes the indicated PointerToVoid as a weak reference to this object. More...
 

Static Public Member Functions

static void create_gamma_table (PN_stdfloat gamma, unsigned short *red_table, unsigned short *green_table, unsigned short *blue_table)
 Create a gamma table. More...
 
static TextureStageget_alpha_scale_texture_stage ()
 Returns the TextureStage that will be used to apply an alpha scale, if get_alpha_scale_via_texture() returns true. More...
 
static TypeHandle get_class_type ()
 
static void init_type ()
 
- Static Public Member Functions inherited from GraphicsStateGuardianBase
static void add_gsg (GraphicsStateGuardianBase *gsg)
 Called by a GSG after it has been initialized, to add a new GSG to the available list. More...
 
static TypeHandle get_class_type ()
 
static GraphicsStateGuardianBaseget_default_gsg ()
 Returns a pointer to the "default" GSG. More...
 
static GraphicsStateGuardianBaseget_gsg (size_t n)
 
static size_t get_num_gsgs ()
 
static void init_type ()
 
static void mark_rehash_generated_shaders ()
 
static void remove_gsg (GraphicsStateGuardianBase *gsg)
 Called by a GSG destructor to remove a GSG from the available list. More...
 
static void set_default_gsg (GraphicsStateGuardianBase *default_gsg)
 Specifies a particular GSG to use as the "default" GSG. More...
 
- Static Public Member Functions inherited from TypedWritableReferenceCount
static TypeHandle get_class_type ()
 
static void init_type ()
 
static PT (TypedWritableReferenceCount) decode_from_bam_stream(vector_uchar data
 
- Static Public Member Functions inherited from TypedWritable
static bool decode_raw_from_bam_stream (TypedWritable *&ptr, ReferenceCount *&ref_ptr, vector_uchar data, BamReader *reader=nullptr)
 Reads the bytes created by a previous call to encode_to_bam_stream(), and extracts the single object on those bytes. More...
 
static TypeHandle get_class_type ()
 
static void init_type ()
 
- Static Public Member Functions inherited from TypedObject
static TypeHandle get_class_type ()
 
static void init_type ()
 This function is declared non-inline to work around a compiler bug in g++ 2.96. More...
 
- Static Public Member Functions inherited from ReferenceCount
static TypeHandle get_class_type ()
 
static void init_type ()
 

Public Attributes

virtual Threadcurrent_thread
 
 get_coordinate_system
 Returns the coordinate system in effect on this particular gsg. More...
 
 get_copy_texture_inverted
 Returns true if this particular GSG has the property that any framebuffer- to-texture copy results in a texture that is upside-down and backwards from Panda's usual convention; that is, it copies into a texture from the bottom up instead of from the top down. More...
 
 get_driver_renderer
 Returns GL_Renderer. More...
 
 get_driver_shader_version_major
 Returns the major version of the shader model. More...
 
 get_driver_shader_version_minor
 Returns the minor version of the shader model. More...
 
 get_driver_vendor
 Returns the vendor of the video card driver. More...
 
 get_driver_version
 Returns driver version This has an implementation-defined meaning, and may be "" if the particular graphics implementation does not provide a way to query this information. More...
 
 get_driver_version_major
 Returns major version of the video driver. More...
 
 get_driver_version_minor
 Returns the minor version of the video driver. More...
 
 get_effective_incomplete_render
 Returns true if the GSG is effectively in incomplete_render state, considering both the GSG's incomplete_render and its current DisplayRegion's incomplete_render flags. More...
 
 get_flash_texture
 Returns the current "flash texture", if any, or NULL if none. More...
 
 get_gamma
 Get the current gamma setting. More...
 
 get_incomplete_render
 Returns the incomplete_render flag. More...
 
 get_loader
 Returns the Loader object that will be used by this GSG to load textures when necessary, if get_incomplete_render() is true. More...
 
 get_max_2d_texture_array_layers
 Returns the largest possible number of pages, or -1 if there is no particular limit. More...
 
 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 no particular limit. More...
 
 get_max_buffer_texture_size
 Returns the largest possible buffer texture size, or -1 if there is no particular limit. More...
 
 get_max_clip_planes
 Returns the maximum number of simultaneous clip planes that may be applied to geometry, or -1 if there is no particular limit. More...
 
 get_max_color_targets
 Returns the maximum number of simultaneous color textures that may be attached for render-to-texture, as supported by this particular GSG. More...
 
 get_max_cube_map_dimension
 Returns the largest possible texture size in any one dimension for a cube map texture, or -1 if there is no particular limit. More...
 
 get_max_lights
 Returns the maximum number of simultaneous lights that may be rendered on geometry, or -1 if there is no particular limit. More...
 
 get_max_texture_dimension
 Returns the largest possible texture size in any one dimension supported by the GSG, or -1 if there is no particular limit. More...
 
 get_max_texture_stages
 Returns the maximum number of simultaneous textures that may be applied to geometry with multitexturing, as supported by this particular GSG. More...
 
 get_max_vertex_transform_indices
 Returns the maximum number of transforms there may be in a single TransformTable for this graphics hardware. More...
 
 get_max_vertex_transforms
 Returns the maximum number of transform matrices that may be simultaneously used to transform any one vertex by the graphics hardware. More...
 
 get_max_vertices_per_array
 Returns the maximum number of vertices that should be put into any one GeomVertexData object for use with this GSG. More...
 
 get_max_vertices_per_primitive
 Returns the maximum number of vertex indices that should be put into any one GeomPrimitive object for use with this GSG. More...
 
 get_pipe
 Returns the graphics pipe on which this GSG was created. More...
 
 get_prepared_objects
 Returns the set of texture and geom objects that have been prepared with this GSG (and possibly other GSG's that share objects). More...
 
 get_scene
 Returns the current SceneSetup object. More...
 
 get_shader_generator
 Returns the ShaderGenerator object that will be used by this GSG to generate shaders when necessary. More...
 
 get_shader_model
 Returns the ShaderModel. More...
 
 get_supports_2d_texture_array
 Returns true if this GSG can render 2-d textures array. More...
 
 get_supports_3d_texture
 Returns true if this GSG can render 3-d (volumetric) textures. More...
 
 get_supports_basic_shaders
 Returns true if this particular GSG supports arbfp1+arbvp1 or above. More...
 
 get_supports_buffer_texture
 Returns true if this GSG can render buffer textures. More...
 
 get_supports_compressed_texture
 Returns true if this GSG can compress textures as it loads them into texture memory, and/or accept pre-compressed textures for storing. More...
 
 get_supports_compute_shaders
 Returns true if this particular GSG supports compute shaders. More...
 
 get_supports_cube_map
 Returns true if this GSG can render cube map textures. More...
 
 get_supports_cube_map_array
 Returns true if this GSG can render cube map arrays. More...
 
 get_supports_depth_stencil
 Returns true if this particular GSG supports textures whose format is F_depth_stencil. More...
 
 get_supports_depth_texture
 Returns true if this particular GSG supports textures whose format is F_depth_stencil. More...
 
 get_supports_dual_source_blending
 Returns true if dual source (incoming1_color and incoming1_alpha) blend operands are supported by this GSG. More...
 
 get_supports_generate_mipmap
 Returns true if this particular GSG can generate mipmaps for a texture automatically, or if they must be generated in software. More...
 
 get_supports_geometry_instancing
 Returns true if this particular GSG supports hardware geometry instancing: the ability to render multiple copies of a model. More...
 
 get_supports_geometry_shaders
 Returns true if this particular GSG supports geometry shaders. More...
 
 get_supports_glsl
 Returns true if this particular GSG supports GLSL shaders. More...
 
 get_supports_hlsl
 Returns true if this particular GSG supports HLSL shaders. More...
 
 get_supports_indirect_draw
 Returns true if this particular GSG supports draw calls for which the information comes from a buffer. More...
 
 get_supports_luminance_texture
 Returns true if this particular GSG supports luminance textures. More...
 
 get_supports_multisample
 Returns true if this particular GSG supports using the multisample bits to provide antialiasing, and also supports M_multisample and M_multisample_mask transparency modes. More...
 
 get_supports_occlusion_query
 Returns true if this GSG supports an occlusion query. More...
 
 get_supports_sampler_objects
 Returns true if this particular GSG supports the use of sampler objects to record texture sampling parameters separately from the texture objects. More...
 
 get_supports_shadow_filter
 Returns true if this particular GSG supports the filter mode FT_shadow for depth textures. More...
 
 get_supports_stencil
 Returns true if this particular GSG supports stencil buffers at all. More...
 
 get_supports_tessellation_shaders
 Returns true if this particular GSG supports tesselation shaders. More...
 
 get_supports_tex_non_pow2
 Returns true if this GSG can handle non power of two sized textures. More...
 
 get_supports_texture_combine
 Returns true if this particular GSG can use the TextureStage::M_combine mode, which includes all of the texture blend modes specified by set_combine_rgb() and/or set_combine_alpha(). More...
 
 get_supports_texture_dot3
 Returns true if this GSG can use the TextureStage::CM_dot3_rgb or CM_dot3_rgba combine modes. More...
 
 get_supports_texture_saved_result
 Returns true if this GSG can use the TextureStage::CS_last_saved_result source, which allows you to save the result of a TextureStage and re-use it for multiple inputs. More...
 
 get_supports_texture_srgb
 Returns true if this GSG can handle sRGB textures. More...
 
 get_supports_timer_query
 Returns true if this GSG supports a timer query. More...
 
 get_supports_two_sided_stencil
 Returns true if this particular GSG supports two sided stencil: different stencil settings for the front and back side of the same polygon. More...
 
 get_texture_quality_override
 Returns the global quality_level override specified by set_texture_quality_override. More...
 
 get_timer_queries_active
 Returns true if timer queries are currently enabled on this GSG. More...
 
GraphicsOutputBasehost =nullptr)
 
 is_active
 Returns the active flag associated with the GraphicsStateGuardian. More...
 
 is_valid
 Returns true if the GSG has been correctly initialized within a graphics context, false if there has been some problem or it hasn't been initialized yet. More...
 
 set_active
 Sets the active flag associated with the GraphicsStateGuardian. More...
 
 set_coordinate_system
 Changes the coordinate system in effect on this particular gsg. More...
 
 set_flash_texture
 Sets the "flash texture". More...
 
 set_gamma
 Set gamma. More...
 
 set_incomplete_render
 Sets the incomplete_render flag. More...
 
 set_loader
 Sets the Loader object that will be used by this GSG to load textures when necessary, if get_incomplete_render() is true. More...
 
 set_scene
 Sets the SceneSetup object that indicates the initial camera position, etc. More...
 
 set_shader_generator
 Sets the ShaderGenerator object that will be used by this GSG to generate shaders when necessary. More...
 
 set_shader_model
 Sets the ShaderModel. More...
 
 set_texture_quality_override
 Specifies the global quality_level to be imposed for all Textures rendered by this GSG. More...
 
- Public Attributes inherited from GraphicsStateGuardianBase
size_t _id
 
virtual Threadcurrent_thread =0
 
 get_gsg
 Returns the nth GSG in the universe. More...
 
 get_num_gsgs
 Returns the total number of GSG's in the universe. More...
 
- Public Attributes inherited from TypedWritableReferenceCount
static BamReaderreader = nullptr)
 
- Public Attributes inherited from TypedObject
 get_type
 
- Public Attributes inherited from ReferenceCount
 get_ref_count
 Returns the current reference count. More...
 

Static Public Attributes

static PStatCollector _command_latency_pcollector
 
static PStatCollector _compute_dispatch_pcollector
 
static PStatCollector _create_index_buffer_pcollector
 
static PStatCollector _create_shader_buffer_pcollector
 
static PStatCollector _create_vertex_buffer_pcollector
 
static PStatCollector _data_transferred_pcollector
 
static PStatCollector _draw_primitive_pcollector
 
static PStatCollector _draw_set_state_alpha_test_pcollector
 
static PStatCollector _draw_set_state_antialias_pcollector
 
static PStatCollector _draw_set_state_blending_pcollector
 
static PStatCollector _draw_set_state_clip_plane_pcollector
 
static PStatCollector _draw_set_state_color_pcollector
 
static PStatCollector _draw_set_state_cull_face_pcollector
 
static PStatCollector _draw_set_state_depth_offset_pcollector
 
static PStatCollector _draw_set_state_depth_test_pcollector
 
static PStatCollector _draw_set_state_depth_write_pcollector
 
static PStatCollector _draw_set_state_fog_pcollector
 
static PStatCollector _draw_set_state_light_pcollector
 
static PStatCollector _draw_set_state_material_pcollector
 
static PStatCollector _draw_set_state_pcollector
 
static PStatCollector _draw_set_state_render_mode_pcollector
 
static PStatCollector _draw_set_state_rescale_normal_pcollector
 
static PStatCollector _draw_set_state_scissor_pcollector
 
static PStatCollector _draw_set_state_shade_model_pcollector
 
static PStatCollector _draw_set_state_shader_parameters_pcollector
 
static PStatCollector _draw_set_state_shader_pcollector
 
static PStatCollector _draw_set_state_stencil_pcollector
 
static PStatCollector _draw_set_state_tex_gen_pcollector
 
static PStatCollector _draw_set_state_tex_matrix_pcollector
 
static PStatCollector _draw_set_state_texture_pcollector
 
static PStatCollector _draw_set_state_transform_pcollector
 
static PStatCollector _flush_pcollector
 
static PStatCollector _index_buffer_switch_pcollector
 
static PStatCollector _load_index_buffer_pcollector
 
static PStatCollector _load_shader_buffer_pcollector
 
static PStatCollector _load_texture_pcollector
 
static PStatCollector _load_vertex_buffer_pcollector
 
static PStatCollector _prepare_geom_pcollector
 
static PStatCollector _prepare_index_buffer_pcollector
 
static PStatCollector _prepare_pcollector
 
static PStatCollector _prepare_sampler_pcollector
 
static PStatCollector _prepare_shader_buffer_pcollector
 
static PStatCollector _prepare_shader_pcollector
 
static PStatCollector _prepare_texture_pcollector
 
static PStatCollector _prepare_vertex_buffer_pcollector
 
static PStatCollector _primitive_batches_other_pcollector
 
static PStatCollector _primitive_batches_patch_pcollector
 
static PStatCollector _primitive_batches_pcollector
 
static PStatCollector _primitive_batches_tri_pcollector
 
static PStatCollector _primitive_batches_trifan_pcollector
 
static PStatCollector _primitive_batches_tristrip_pcollector
 
static PStatCollector _shader_buffer_switch_pcollector
 
static PStatCollector _state_pcollector
 
static PStatCollector _texmgrmem_resident_pcollector
 
static PStatCollector _texmgrmem_total_pcollector
 
static PStatCollector _texture_state_pcollector
 
static PStatCollector _timer_queries_pcollector
 
static PStatCollector _transform_state_pcollector
 
static PStatCollector _vertex_buffer_switch_pcollector
 
static PStatCollector _vertices_indexed_tristrip_pcollector
 
static PStatCollector _vertices_other_pcollector
 
static PStatCollector _vertices_patch_pcollector
 
static PStatCollector _vertices_tri_pcollector
 
static PStatCollector _vertices_trifan_pcollector
 
static PStatCollector _vertices_tristrip_pcollector
 
static PStatCollector _wait_occlusion_pcollector
 
static PStatCollector _wait_timer_pcollector
 
- Static Public Attributes inherited from TypedWritable
static TypedWritable *const Null = nullptr
 

Friends

class GraphicsEngine
 
class GraphicsPipe
 
class GraphicsWindow
 

Detailed Description

Encapsulates all the communication with a particular instance of a given rendering backend.

Tries to guarantee that redundant state-change requests are not issued (hence "state guardian").

There will be one of these objects for each different graphics context active in the system.

Definition at line 65 of file graphicsStateGuardian.h.

Member Function Documentation

◆ begin_draw_primitives()

bool GraphicsStateGuardian::begin_draw_primitives ( const GeomPipelineReader geom_reader,
const GeomVertexDataPipelineReader data_reader,
bool  force 
)
virtual

Called before a sequence of draw_primitive() functions are called, this should prepare the vertex data for rendering.

It returns true if the vertices are ok, false to abort this group of primitives.

Implements GraphicsStateGuardianBase.

Reimplemented in DXGraphicsStateGuardian9.

Definition at line 2376 of file graphicsStateGuardian.cxx.

Referenced by DXGraphicsStateGuardian9::begin_draw_primitives().

◆ begin_frame()

bool GraphicsStateGuardian::begin_frame ( Thread current_thread)
virtual

Called before each frame is rendered, to allow the GSG a chance to do any internal cleanup before beginning the frame.

The return value is true if successful (in which case the frame will be drawn and end_frame() will be called later), or false if unsuccessful (in which case nothing will be drawn and end_frame() will not be called).

Reimplemented in DXGraphicsStateGuardian9.

Definition at line 2042 of file graphicsStateGuardian.cxx.

References BitMask< WType, nbits >::clear(), flush_timer_queries(), ClockObject::get_frame_count, and ClockObject::get_global_clock().

Referenced by DXGraphicsStateGuardian9::begin_frame().

◆ begin_occlusion_query()

void GraphicsStateGuardian::begin_occlusion_query ( )
virtual

Begins a new occlusion query.

After this call, you may call begin_draw_primitives() and draw_triangles()/draw_whatever() repeatedly. Eventually, you should call end_occlusion_query() before the end of the frame; that will return a new OcclusionQueryContext object that will tell you how many pixels represented by the bracketed geometry passed the depth test.

It is not valid to call begin_occlusion_query() between another begin_occlusion_query() .. end_occlusion_query() sequence.

Reimplemented in DXGraphicsStateGuardian9.

Definition at line 713 of file graphicsStateGuardian.cxx.

Referenced by PT().

◆ begin_scene()

bool GraphicsStateGuardian::begin_scene ( )
virtual

Called between begin_frame() and end_frame() to mark the beginning of drawing commands for a "scene" (usually a particular DisplayRegion) within a frame.

All 3-D drawing commands, except the clear operation, must be enclosed within begin_scene() .. end_scene(). This must be called in the draw thread.

The return value is true if successful (in which case the scene will be drawn and end_scene() will be called later), or false if unsuccessful (in which case nothing will be drawn and end_scene() will not be called).

Reimplemented in DXGraphicsStateGuardian9.

Definition at line 2090 of file graphicsStateGuardian.cxx.

Referenced by DXGraphicsStateGuardian9::begin_scene(), and DisplayRegionDrawCallbackData::upcall().

◆ bind_light() [1/3]

void GraphicsStateGuardian::bind_light ( PointLight light_obj,
const NodePath light,
int  light_id 
)
virtual

Called the first time a particular light has been bound to a given id within a frame, this should set up the associated hardware light with the light's properties.

Reimplemented from GraphicsStateGuardianBase.

Reimplemented in DXGraphicsStateGuardian9.

Definition at line 2866 of file graphicsStateGuardian.cxx.

◆ bind_light() [2/3]

void GraphicsStateGuardian::bind_light ( DirectionalLight light_obj,
const NodePath light,
int  light_id 
)
virtual

Called the first time a particular light has been bound to a given id within a frame, this should set up the associated hardware light with the light's properties.

Reimplemented from GraphicsStateGuardianBase.

Reimplemented in DXGraphicsStateGuardian9.

Definition at line 2875 of file graphicsStateGuardian.cxx.

◆ bind_light() [3/3]

void GraphicsStateGuardian::bind_light ( Spotlight light_obj,
const NodePath light,
int  light_id 
)
virtual

Called the first time a particular light has been bound to a given id within a frame, this should set up the associated hardware light with the light's properties.

Reimplemented from GraphicsStateGuardianBase.

Reimplemented in DXGraphicsStateGuardian9.

Definition at line 2884 of file graphicsStateGuardian.cxx.

◆ clear()

void GraphicsStateGuardian::clear ( DrawableRegion clearable)
virtual

Clears the framebuffer within the current DisplayRegion, according to the flags indicated by the given DrawableRegion object.

This does not set the DisplayRegion first. You should call prepare_display_region() to specify the region you wish the clear operation to apply to.

Reimplemented in DXGraphicsStateGuardian9.

Definition at line 2553 of file graphicsStateGuardian.cxx.

◆ clear_before_callback()

void GraphicsStateGuardian::clear_before_callback ( )
virtual

Resets any non-standard graphics state that might give a callback apoplexy.

Some drivers require that the graphics state be restored to neutral before performing certain operations. In OpenGL, for instance, this closes any open vertex buffers.

Implements GraphicsStateGuardianBase.

Definition at line 1970 of file graphicsStateGuardian.cxx.

◆ clear_flash_texture()

void GraphicsStateGuardian::clear_flash_texture ( )

Resets the "flash texture", so that no textures will flash.

See set_flash_texture().

Definition at line 494 of file graphicsStateGuardian.cxx.

◆ clear_state_and_transform()

void GraphicsStateGuardian::clear_state_and_transform ( )
virtual

Forgets the current graphics state and current transform, so that the next call to set_state_and_transform() will have to reload everything.

This is a good thing to call when you are no longer sure what the graphics state is. This should only be called from the draw thread.

Implements GraphicsStateGuardianBase.

Definition at line 1980 of file graphicsStateGuardian.cxx.

References BitMask< WType, nbits >::clear().

Referenced by DisplayRegionDrawCallbackData::upcall().

◆ compute_distance_to()

PN_stdfloat GraphicsStateGuardian::compute_distance_to ( const LPoint3 &  point) const
virtual

This function will compute the distance to the indicated point, assumed to be in eye coordinates, from the camera plane.

The point is assumed to be in the GSG's internal coordinate system.

Implements GraphicsStateGuardianBase.

Definition at line 811 of file graphicsStateGuardian.cxx.

◆ create_gamma_table()

void GraphicsStateGuardian::create_gamma_table ( PN_stdfloat  gamma,
unsigned short *  red_table,
unsigned short *  green_table,
unsigned short *  blue_table 
)
static

Create a gamma table.

Definition at line 2922 of file graphicsStateGuardian.cxx.

◆ depth_offset_decals()

bool GraphicsStateGuardian::depth_offset_decals ( )
virtual

Returns true if this GSG can implement decals using a DepthOffsetAttrib, or false if that is unreliable and the three-step rendering process should be used instead.

Implements GraphicsStateGuardianBase.

Definition at line 2293 of file graphicsStateGuardian.cxx.

◆ dispatch_compute()

void GraphicsStateGuardian::dispatch_compute ( int  size_x,
int  size_y,
int  size_z 
)
virtual

Dispatches a currently bound compute shader using the given work group counts.

Implements GraphicsStateGuardianBase.

Definition at line 745 of file graphicsStateGuardian.cxx.

◆ do_issue_color()

void GraphicsStateGuardian::do_issue_color ( )

This method is defined in the base class because it is likely that this functionality will be used for all (or at least most) kinds of GraphicsStateGuardians–it's not specific to any one rendering backend.

The ColorAttribute just changes the interpretation of the color on the vertices, and fiddles with _vertex_colors_enabled, etc.

Definition at line 2663 of file graphicsStateGuardian.cxx.

References BitMask< WType, nbits >::clear_bit(), ColorAttrib::get_color, and ColorAttrib::get_color_type.

Referenced by DXGraphicsStateGuardian9::set_state_and_transform().

◆ do_issue_light()

void GraphicsStateGuardian::do_issue_light ( )
virtual

This implementation of do_issue_light() assumes we have a limited number of hardware lights available.

This function assigns each light to a different hardware light id, trying to keep each light associated with the same id where possible, but reusing id's when necessary. When it is no longer possible to reuse existing id's (e.g. all id's are in use), the next sequential id is assigned (if available).

It will call apply_light() each time a light is assigned to a particular id for the first time in a given frame, and it will subsequently call enable_light() to enable or disable each light as the frame is rendered, as well as enable_lighting() to enable or disable overall lighting.

Definition at line 2757 of file graphicsStateGuardian.cxx.

Referenced by DXGraphicsStateGuardian9::set_state_and_transform().

◆ draw_lines()

bool GraphicsStateGuardian::draw_lines ( const GeomPrimitivePipelineReader reader,
bool  force 
)
virtual

Draws a series of disconnected line segments.

Implements GraphicsStateGuardianBase.

Reimplemented in DXGraphicsStateGuardian9.

Definition at line 2440 of file graphicsStateGuardian.cxx.

◆ draw_lines_adj()

bool GraphicsStateGuardian::draw_lines_adj ( const GeomPrimitivePipelineReader reader,
bool  force 
)
virtual

Draws a series of disconnected line segments with adjacency information.

Implements GraphicsStateGuardianBase.

Definition at line 2448 of file graphicsStateGuardian.cxx.

◆ draw_linestrips()

bool GraphicsStateGuardian::draw_linestrips ( const GeomPrimitivePipelineReader reader,
bool  force 
)
virtual

Draws a series of line strips.

Implements GraphicsStateGuardianBase.

Reimplemented in DXGraphicsStateGuardian9.

Definition at line 2456 of file graphicsStateGuardian.cxx.

◆ draw_linestrips_adj()

bool GraphicsStateGuardian::draw_linestrips_adj ( const GeomPrimitivePipelineReader reader,
bool  force 
)
virtual

Draws a series of line strips with adjacency information.

Implements GraphicsStateGuardianBase.

Definition at line 2464 of file graphicsStateGuardian.cxx.

◆ draw_patches()

bool GraphicsStateGuardian::draw_patches ( const GeomPrimitivePipelineReader reader,
bool  force 
)
virtual

Draws a series of "patches", which can only be processed by a tessellation shader.

Implements GraphicsStateGuardianBase.

Definition at line 2432 of file graphicsStateGuardian.cxx.

◆ draw_points()

bool GraphicsStateGuardian::draw_points ( const GeomPrimitivePipelineReader reader,
bool  force 
)
virtual

Draws a series of disconnected points.

Implements GraphicsStateGuardianBase.

Reimplemented in DXGraphicsStateGuardian9.

Definition at line 2472 of file graphicsStateGuardian.cxx.

◆ draw_triangles()

bool GraphicsStateGuardian::draw_triangles ( const GeomPrimitivePipelineReader reader,
bool  force 
)
virtual

Draws a series of disconnected triangles.

Implements GraphicsStateGuardianBase.

Reimplemented in DXGraphicsStateGuardian9.

Definition at line 2390 of file graphicsStateGuardian.cxx.

◆ draw_triangles_adj()

bool GraphicsStateGuardian::draw_triangles_adj ( const GeomPrimitivePipelineReader reader,
bool  force 
)
virtual

Draws a series of disconnected triangles with adjacency information.

Implements GraphicsStateGuardianBase.

Definition at line 2399 of file graphicsStateGuardian.cxx.

◆ draw_trifans()

bool GraphicsStateGuardian::draw_trifans ( const GeomPrimitivePipelineReader reader,
bool  force 
)
virtual

Draws a series of triangle fans.

Implements GraphicsStateGuardianBase.

Reimplemented in DXGraphicsStateGuardian9.

Definition at line 2423 of file graphicsStateGuardian.cxx.

◆ draw_tristrips()

bool GraphicsStateGuardian::draw_tristrips ( const GeomPrimitivePipelineReader reader,
bool  force 
)
virtual

Draws a series of triangle strips.

Implements GraphicsStateGuardianBase.

Reimplemented in DXGraphicsStateGuardian9.

Definition at line 2407 of file graphicsStateGuardian.cxx.

◆ draw_tristrips_adj()

bool GraphicsStateGuardian::draw_tristrips_adj ( const GeomPrimitivePipelineReader reader,
bool  force 
)
virtual

Draws a series of triangle strips with adjacency information.

Implements GraphicsStateGuardianBase.

Definition at line 2415 of file graphicsStateGuardian.cxx.

◆ end_draw_primitives()

void GraphicsStateGuardian::end_draw_primitives ( )
virtual

Called after a sequence of draw_primitive() functions are called, this should do whatever cleanup is appropriate.

Implements GraphicsStateGuardianBase.

Reimplemented in DXGraphicsStateGuardian9.

Definition at line 2481 of file graphicsStateGuardian.cxx.

◆ end_frame()

void GraphicsStateGuardian::end_frame ( Thread current_thread)
virtual

Called after each frame is rendered, to allow the GSG a chance to do any internal cleanup after rendering the frame, and before the window flips.

Reimplemented in DXGraphicsStateGuardian9.

Definition at line 2133 of file graphicsStateGuardian.cxx.

◆ end_scene()

void GraphicsStateGuardian::end_scene ( )
virtual

Called between begin_frame() and end_frame() to mark the end of drawing commands for a "scene" (usually a particular DisplayRegion) within a frame.

All 3-D drawing commands, except the clear operation, must be enclosed within begin_scene() .. end_scene().

Reimplemented in DXGraphicsStateGuardian9.

Definition at line 2101 of file graphicsStateGuardian.cxx.

Referenced by DXGraphicsStateGuardian9::end_scene(), PipeOcclusionCullTraverser::end_traverse(), and DisplayRegionDrawCallbackData::upcall().

◆ ensure_generated_shader()

void GraphicsStateGuardian::ensure_generated_shader ( const RenderState state)
virtual

Ensures that an appropriate shader has been generated for the given state.

This is stored in the _generated_shader field on the RenderState.

Implements GraphicsStateGuardianBase.

Definition at line 3420 of file graphicsStateGuardian.cxx.

References ShaderAttrib::auto_shader(), and GeomVertexAnimationSpec::set_hardware().

◆ extract_texture_data()

bool GraphicsStateGuardian::extract_texture_data ( Texture tex)
virtual

This method should only be called by the GraphicsEngine.

Do not call it directly; call GraphicsEngine::extract_texture_data() instead.

This method will be called in the draw thread to download the texture memory's image into its ram_image value. It returns true on success, false otherwise.

Implements GraphicsStateGuardianBase.

Reimplemented in DXGraphicsStateGuardian9.

Definition at line 589 of file graphicsStateGuardian.cxx.

Referenced by GraphicsEngine::extract_texture_data().

◆ fetch_specified_member()

const LMatrix4 * GraphicsStateGuardian::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 member.

Definition at line 1512 of file graphicsStateGuardian.cxx.

References PandaNode::as_light(), NodePath::is_empty(), and NodePath::node().

◆ fetch_specified_part()

const LMatrix4 * GraphicsStateGuardian::fetch_specified_part ( Shader::ShaderMatInput  input,
InternalName name,
LMatrix4 &  t,
int  index 
)

See fetch_specified_value.

Definition at line 918 of file graphicsStateGuardian.cxx.

References ClockObject::get_dt, ClockObject::get_frame_time, and ClockObject::get_global_clock().

Referenced by fetch_specified_value().

◆ fetch_specified_value()

const LMatrix4 * GraphicsStateGuardian::fetch_specified_value ( Shader::ShaderMatSpec spec,
int  altered 
)

The gsg contains a large number of useful matrices:

* the world transform, * the modelview matrix, * the cs_transform, * etc, etc.

A shader can request any of these values, and furthermore, it can request that various compositions, inverses, and transposes be performed. The ShaderMatSpec is a data structure indicating what datum is desired and what conversions to perform. This routine, fetch_specified_value, is responsible for doing the actual retrieval and conversions.

Some values, like the following, aren't matrices:

* window size * texture coordinates of card center

This routine can fetch these values as well, by shoehorning them into a matrix. In this way, we avoid the need for a separate routine to fetch these values.

The "altered" bits indicate what parts of the state_and_transform have changed since the last time this particular ShaderMatSpec was evaluated. This may allow data to be cached and not reevaluated.

Definition at line 859 of file graphicsStateGuardian.cxx.

References fetch_specified_part().

◆ finish_decal()

void GraphicsStateGuardian::finish_decal ( )
virtual

Called during draw to clean up after decals are finished.

Implements GraphicsStateGuardianBase.

Definition at line 2366 of file graphicsStateGuardian.cxx.

◆ flush_timer_queries()

void GraphicsStateGuardian::flush_timer_queries ( )

Called by the graphics engine on the draw thread to check the status of the running timer queries and submit their results to the PStats server.

Definition at line 2165 of file graphicsStateGuardian.cxx.

Referenced by begin_frame().

◆ framebuffer_copy_to_ram()

bool GraphicsStateGuardian::framebuffer_copy_to_ram ( Texture tex,
int  view,
int  z,
const DisplayRegion dr,
const RenderBuffer rb 
)
virtual

Copy the pixels within the indicated display region from the framebuffer into system memory, not texture memory.

Returns true on success, false on failure.

This completely redefines the ram image of the indicated texture.

Implements GraphicsStateGuardianBase.

Reimplemented in DXGraphicsStateGuardian9.

Definition at line 2855 of file graphicsStateGuardian.cxx.

◆ framebuffer_copy_to_texture()

bool GraphicsStateGuardian::framebuffer_copy_to_texture ( Texture tex,
int  view,
int  z,
const DisplayRegion dr,
const RenderBuffer rb 
)
virtual

Copy the pixels within the indicated display region from the framebuffer into texture memory.

If z > -1, it is the cube map index into which to copy.

Implements GraphicsStateGuardianBase.

Reimplemented in DXGraphicsStateGuardian9.

Definition at line 2841 of file graphicsStateGuardian.cxx.

◆ get_alpha_scale_texture_stage()

TextureStage * GraphicsStateGuardian::get_alpha_scale_texture_stage ( )
inlinestatic

Returns the TextureStage that will be used to apply an alpha scale, if get_alpha_scale_via_texture() returns true.

Definition at line 779 of file graphicsStateGuardian.I.

◆ get_alpha_scale_via_texture() [1/2]

bool GraphicsStateGuardian::get_alpha_scale_via_texture ( ) const
inline

Returns true if this particular GSG can implement (or would prefer to implement) an alpha scale via an additional Texture layer, or false if we need to actually munge the alpha.

Definition at line 756 of file graphicsStateGuardian.I.

Referenced by StandardMunger::StandardMunger().

◆ get_alpha_scale_via_texture() [2/2]

bool GraphicsStateGuardian::get_alpha_scale_via_texture ( const TextureAttrib tex_attrib) const
inline

This variant of get_alpha_scale_via_texture() answers the question of whether the GSG can implement an alpha scale via an additional Texture layer, considering the current TextureAttrib that will be in effect.

This considers whether there is at least one additional texture slot available on the GSG.

Definition at line 768 of file graphicsStateGuardian.I.

References get_max_texture_stages, and TextureAttrib::get_num_on_stages.

◆ get_color_scale_via_lighting()

bool GraphicsStateGuardian::get_color_scale_via_lighting ( ) const
inline

Returns true if this particular GSG can implement (or would prefer to implement) set color and/or color scale using materials and/or ambient lights, or false if we need to actually munge the color.

Definition at line 746 of file graphicsStateGuardian.I.

Referenced by StandardMunger::StandardMunger().

◆ get_engine()

GraphicsEngine * GraphicsStateGuardian::get_engine ( ) const

Returns the graphics engine that created this GSG.

Since there is normally only one GraphicsEngine object in an application, this is usually the same as the global GraphicsEngine.

Definition at line 318 of file graphicsStateGuardian.cxx.

◆ get_internal_coordinate_system()

CoordinateSystem GraphicsStateGuardian::get_internal_coordinate_system ( ) const
virtual

Returns the coordinate system used internally by the GSG.

This may be the same as the external coordinate system reported by get_coordinate_system(), or it may be something different.

In any case, vertices that have been transformed before being handed to the GSG (that is, vertices with a contents value of C_clip_point) will be expected to be in this coordinate system.

Implements GraphicsStateGuardianBase.

Definition at line 407 of file graphicsStateGuardian.cxx.

◆ get_maximum_simultaneous_render_targets()

int GraphicsStateGuardian::get_maximum_simultaneous_render_targets ( ) const
inline

Deprecated.

Use get_max_color_targets() instead, which returns the exact same value.

Definition at line 717 of file graphicsStateGuardian.I.

References get_max_color_targets.

◆ get_render_buffer()

RenderBuffer GraphicsStateGuardian::get_render_buffer ( int  buffer_type,
const FrameBufferProperties prop 
)

Returns a RenderBuffer object suitable for operating on the requested set of buffers.

buffer_type is the union of all the desired RenderBuffer::Type values.

Definition at line 2562 of file graphicsStateGuardian.cxx.

References FrameBufferProperties::get_buffer_mask().

◆ get_runtime_color_scale()

bool GraphicsStateGuardian::get_runtime_color_scale ( ) const
inline

Returns true if this particular GSG can implement (or would prefer to implement) set color and/or color scale directly, without requiring any munging of vertices or tricks with lighting.

Definition at line 793 of file graphicsStateGuardian.I.

Referenced by StandardMunger::StandardMunger().

◆ get_supported_geom_rendering()

int GraphicsStateGuardian::get_supported_geom_rendering ( ) const
virtual

Returns the union of Geom::GeomRendering values that this particular GSG can support directly.

If a Geom needs to be rendered that requires some additional properties, the StandardMunger and/or the CullableObject will convert it as needed.

This method is declared virtual solely so that it can be queried from cullableObject.cxx.

Implements GraphicsStateGuardianBase.

Definition at line 347 of file graphicsStateGuardian.cxx.

◆ get_supports_cg_profile()

bool GraphicsStateGuardian::get_supports_cg_profile ( const std::string &  name) const
virtual

Returns true if this particular GSG supports the specified Cg Shader Profile.

Reimplemented in DXGraphicsStateGuardian9.

Definition at line 356 of file graphicsStateGuardian.cxx.

◆ get_supports_compressed_texture_format()

bool GraphicsStateGuardian::get_supports_compressed_texture_format ( int  compression_mode) const
inlinevirtual

Returns true if this GSG can accept textures pre-compressed in the indicated format.

compression_mode may be any of the Texture::CompressionMode enums.

Implements GraphicsStateGuardianBase.

Definition at line 429 of file graphicsStateGuardian.I.

References BitMask< WType, nbits >::get_bit().

Referenced by DXGraphicsStateGuardian9::prepare_texture(), and DXGraphicsStateGuardian9::upload_texture().

◆ get_threading_model()

const GraphicsThreadingModel & GraphicsStateGuardian::get_threading_model ( ) const
inline

Returns the threading model that was used to create this GSG.

Definition at line 206 of file graphicsStateGuardian.I.

Referenced by GraphicsEngine::extract_texture_data(), and PT().

◆ has_extension()

bool GraphicsStateGuardian::has_extension ( const std::string &  extension) const
virtual

Returns true if the GSG implements the extension identified by the given string.

This currently is only implemented by the OpenGL back-end.

Definition at line 3457 of file graphicsStateGuardian.cxx.

◆ is_hardware()

bool GraphicsStateGuardian::is_hardware ( ) const
inline

Returns true if this GSG appears to be hardware-accelerated, or false if it is known to be software only.

Definition at line 215 of file graphicsStateGuardian.I.

◆ mark_new()

void GraphicsStateGuardian::mark_new ( )
inline

Marks the GSG as "new", so that the next call to reset_if_new() will be effective.

Definition at line 851 of file graphicsStateGuardian.I.

◆ needs_reset()

bool GraphicsStateGuardian::needs_reset ( ) const
inline

Returns true if the gsg is marked as needing a reset.

Definition at line 106 of file graphicsStateGuardian.I.

Referenced by GraphicsEngine::make_output().

◆ prefers_triangle_strips()

bool GraphicsStateGuardian::prefers_triangle_strips ( ) const
inlinevirtual

Returns true if this GSG strongly prefers triangle strips to individual triangles (such as SGI), or false if it prefers to minimize the number of primitive batches, even at the expense of triangle strips (such as most PC hardware).

Implements GraphicsStateGuardianBase.

Definition at line 226 of file graphicsStateGuardian.I.

◆ prepare_display_region()

void GraphicsStateGuardian::prepare_display_region ( DisplayRegionPipelineReader dr)
virtual

◆ prepare_geom()

GeomContext * GraphicsStateGuardian::prepare_geom ( Geom geom)
virtual

Prepares the indicated Geom for retained-mode rendering, by creating whatever structures are necessary in the GSG (for instance, vertex buffers).

Returns the newly-allocated GeomContext that can be used to render the geom.

Implements GraphicsStateGuardianBase.

Definition at line 623 of file graphicsStateGuardian.cxx.

◆ prepare_index_buffer()

IndexBufferContext * GraphicsStateGuardian::prepare_index_buffer ( GeomPrimitive data)
virtual

Prepares the indicated buffer for retained-mode rendering.

Implements GraphicsStateGuardianBase.

Reimplemented in DXGraphicsStateGuardian9.

Definition at line 673 of file graphicsStateGuardian.cxx.

◆ prepare_lens()

bool GraphicsStateGuardian::prepare_lens ( )
virtual

Makes the current lens (whichever lens was most recently specified with set_scene()) active, so that it will transform future rendered geometry.

Normally this is only called from the draw process, and usually it is called by set_scene().

The return value is true if the lens is acceptable, false if it is not.

Reimplemented in DXGraphicsStateGuardian9.

Definition at line 2011 of file graphicsStateGuardian.cxx.

◆ prepare_sampler()

SamplerContext * GraphicsStateGuardian::prepare_sampler ( const SamplerState sampler)
virtual

Creates whatever structures the GSG requires to represent the sampler internally, and returns a newly-allocated SamplerContext object with this data.

It is the responsibility of the calling function to later call release_sampler() with this same pointer (which will also delete the pointer).

This function should not be called directly to prepare a sampler. Instead, call Texture::prepare().

Implements GraphicsStateGuardianBase.

Definition at line 604 of file graphicsStateGuardian.cxx.

◆ prepare_shader()

ShaderContext * GraphicsStateGuardian::prepare_shader ( Shader shader)
virtual

Compile a vertex/fragment shader body.

Implements GraphicsStateGuardianBase.

Reimplemented in DXGraphicsStateGuardian9.

Definition at line 642 of file graphicsStateGuardian.cxx.

◆ prepare_shader_buffer()

BufferContext * GraphicsStateGuardian::prepare_shader_buffer ( ShaderBuffer data)
virtual

Prepares the indicated buffer for retained-mode rendering.

Implements GraphicsStateGuardianBase.

Definition at line 689 of file graphicsStateGuardian.cxx.

◆ prepare_texture()

TextureContext * GraphicsStateGuardian::prepare_texture ( Texture tex,
int  view 
)
virtual

Creates whatever structures the GSG requires to represent the texture internally, and returns a newly-allocated TextureContext object with this data.

It is the responsibility of the calling function to later call release_texture() with this same pointer (which will also delete the pointer).

This function should not be called directly to prepare a texture. Instead, call Texture::prepare().

Implements GraphicsStateGuardianBase.

Reimplemented in DXGraphicsStateGuardian9.

Definition at line 553 of file graphicsStateGuardian.cxx.

◆ prepare_vertex_buffer()

VertexBufferContext * GraphicsStateGuardian::prepare_vertex_buffer ( GeomVertexArrayData data)
virtual

Prepares the indicated buffer for retained-mode rendering.

Implements GraphicsStateGuardianBase.

Reimplemented in DXGraphicsStateGuardian9.

Definition at line 657 of file graphicsStateGuardian.cxx.

◆ release_all()

void GraphicsStateGuardian::release_all ( )
inline

Releases all prepared objects.

Definition at line 21 of file graphicsStateGuardian.I.

◆ release_all_geoms()

int GraphicsStateGuardian::release_all_geoms ( )
inline

Frees the resources for all geoms associated with this GSG.

Definition at line 45 of file graphicsStateGuardian.I.

◆ release_all_index_buffers()

int GraphicsStateGuardian::release_all_index_buffers ( )
inline

Frees the resources for all index buffers associated with this GSG.

Definition at line 61 of file graphicsStateGuardian.I.

◆ release_all_samplers()

int GraphicsStateGuardian::release_all_samplers ( )
inline

Frees the resources for all samplers associated with this GSG.

Definition at line 37 of file graphicsStateGuardian.I.

◆ release_all_shader_buffers()

int GraphicsStateGuardian::release_all_shader_buffers ( )
inline

Frees the resources for all index buffers associated with this GSG.

Definition at line 69 of file graphicsStateGuardian.I.

◆ release_all_textures()

int GraphicsStateGuardian::release_all_textures ( )
inline

Frees the resources for all textures associated with this GSG.

Definition at line 29 of file graphicsStateGuardian.I.

◆ release_all_vertex_buffers()

int GraphicsStateGuardian::release_all_vertex_buffers ( )
inline

Frees the resources for all vertex buffers associated with this GSG.

Definition at line 53 of file graphicsStateGuardian.I.

◆ release_geom()

void GraphicsStateGuardian::release_geom ( GeomContext gc)
virtual

Frees the resources previously allocated via a call to prepare_geom(), including deleting the GeomContext itself, if it is non-NULL.

This function should not be called directly to prepare a Geom. Instead, call Geom::prepare().

Implements GraphicsStateGuardianBase.

Definition at line 635 of file graphicsStateGuardian.cxx.

◆ release_index_buffer()

void GraphicsStateGuardian::release_index_buffer ( IndexBufferContext ibc)
virtual

Frees the resources previously allocated via a call to prepare_data(), including deleting the IndexBufferContext itself, if necessary.

Implements GraphicsStateGuardianBase.

Reimplemented in DXGraphicsStateGuardian9.

Definition at line 682 of file graphicsStateGuardian.cxx.

◆ release_sampler()

void GraphicsStateGuardian::release_sampler ( SamplerContext sc)
virtual

Frees the resources previously allocated via a call to prepare_sampler(), including deleting the SamplerContext itself, if it is non-NULL.

Implements GraphicsStateGuardianBase.

Definition at line 613 of file graphicsStateGuardian.cxx.

◆ release_shader()

void GraphicsStateGuardian::release_shader ( ShaderContext sc)
virtual

Releases the resources allocated by prepare_shader.

Implements GraphicsStateGuardianBase.

Reimplemented in DXGraphicsStateGuardian9.

Definition at line 650 of file graphicsStateGuardian.cxx.

◆ release_shader_buffer()

void GraphicsStateGuardian::release_shader_buffer ( BufferContext ibc)
virtual

Frees the resources previously allocated via a call to prepare_data(), including deleting the BufferContext itself, if necessary.

Implements GraphicsStateGuardianBase.

Definition at line 698 of file graphicsStateGuardian.cxx.

◆ release_texture()

void GraphicsStateGuardian::release_texture ( TextureContext tc)
virtual

Frees the resources previously allocated via a call to prepare_texture(), including deleting the TextureContext itself, if it is non-NULL.

Implements GraphicsStateGuardianBase.

Reimplemented in DXGraphicsStateGuardian9.

Definition at line 577 of file graphicsStateGuardian.cxx.

◆ release_vertex_buffer()

void GraphicsStateGuardian::release_vertex_buffer ( VertexBufferContext vbc)
virtual

Frees the resources previously allocated via a call to prepare_data(), including deleting the VertexBufferContext itself, if necessary.

Implements GraphicsStateGuardianBase.

Reimplemented in DXGraphicsStateGuardian9.

Definition at line 666 of file graphicsStateGuardian.cxx.

◆ remove_window()

void GraphicsStateGuardian::remove_window ( GraphicsOutputBase window)
virtual

This is simply a transparent call to GraphicsEngine::remove_window().

It exists primary to support removing a window from that compiles before the display module, and therefore has no knowledge of a GraphicsEngine object.

Implements GraphicsStateGuardianBase.

Definition at line 1995 of file graphicsStateGuardian.cxx.

◆ reset()

void GraphicsStateGuardian::reset ( )
virtual

Resets all internal state as if the gsg were newly created.

Reimplemented in DXGraphicsStateGuardian9.

Definition at line 2489 of file graphicsStateGuardian.cxx.

References BitMask< WType, nbits >::clear().

Referenced by DXGraphicsStateGuardian9::reset(), and reset_if_new().

◆ reset_if_new()

bool GraphicsStateGuardian::reset_if_new ( )
inline

Calls reset() to initialize the GSG, but only if it hasn't been called yet.

Returns true if the GSG was new, false otherwise.

Definition at line 838 of file graphicsStateGuardian.I.

References reset().

◆ restore_gamma()

void GraphicsStateGuardian::restore_gamma ( )
virtual

Restore original gamma setting.

Reimplemented in DXGraphicsStateGuardian9.

Definition at line 442 of file graphicsStateGuardian.cxx.

◆ set_state_and_transform()

void GraphicsStateGuardian::set_state_and_transform ( const RenderState state,
const TransformState trans 
)
virtual

Simultaneously resets the render state and the transform state.

This transform specified is the "internal" net transform, already converted into the GSG's internal coordinate space by composing it to get_cs_transform(). (Previously, this used to be the "external" net transform, with the assumption that that GSG would convert it internally, but that is no longer the case.)

Special case: if (state==NULL), then the target state is already stored in _target.

Implements GraphicsStateGuardianBase.

Reimplemented in DXGraphicsStateGuardian9.

Definition at line 2540 of file graphicsStateGuardian.cxx.

◆ traverse_prepared_textures()

void GraphicsStateGuardian::traverse_prepared_textures ( GraphicsStateGuardian::TextureCallback *  func,
void *  callback_arg 
)

Calls the indicated function on all currently-prepared textures, or until the callback function returns false.

Definition at line 450 of file graphicsStateGuardian.cxx.

◆ update_texture()

bool GraphicsStateGuardian::update_texture ( TextureContext tc,
bool  force 
)
virtual

Ensures that the current Texture data is refreshed onto the GSG.

This means updating the texture properties and/or re-uploading the texture image, if necessary. This should only be called within the draw thread.

If force is true, this function will not return until the texture has been fully uploaded. If force is false, the function may choose to upload a simple version of the texture instead, if the texture is not fully resident (and if get_incomplete_render() is true).

Implements GraphicsStateGuardianBase.

Reimplemented in DXGraphicsStateGuardian9.

Definition at line 568 of file graphicsStateGuardian.cxx.

Member Data Documentation

◆ get_coordinate_system

CoordinateSystem GraphicsStateGuardian::get_coordinate_system
inline

Returns the coordinate system in effect on this particular gsg.

Normally, this will be the default coordinate system, but it might be set differently at runtime.

Definition at line 243 of file graphicsStateGuardian.h.

◆ get_copy_texture_inverted

bool GraphicsStateGuardian::get_copy_texture_inverted
inline

Returns true if this particular GSG has the property that any framebuffer- to-texture copy results in a texture that is upside-down and backwards from Panda's usual convention; that is, it copies into a texture from the bottom up instead of from the top down.

If this is true, then on offscreen GraphicsBuffer created for the purposes of rendering into a texture should be created with the invert flag set true, to compensate. Panda will do this automatically if you create an offscreen buffer using GraphicsOutput::make_texture_buffer().

Definition at line 202 of file graphicsStateGuardian.h.

◆ get_driver_renderer

string GraphicsStateGuardian::get_driver_renderer

Returns GL_Renderer.

Definition at line 281 of file graphicsStateGuardian.h.

◆ get_driver_shader_version_major

int GraphicsStateGuardian::get_driver_shader_version_major

Returns the major version of the shader model.

Definition at line 285 of file graphicsStateGuardian.h.

◆ get_driver_shader_version_minor

int GraphicsStateGuardian::get_driver_shader_version_minor

Returns the minor version of the shader model.

Definition at line 286 of file graphicsStateGuardian.h.

◆ get_driver_vendor

string GraphicsStateGuardian::get_driver_vendor

Returns the vendor of the video card driver.

Definition at line 280 of file graphicsStateGuardian.h.

◆ get_driver_version

string GraphicsStateGuardian::get_driver_version

Returns driver version This has an implementation-defined meaning, and may be "" if the particular graphics implementation does not provide a way to query this information.

Definition at line 282 of file graphicsStateGuardian.h.

◆ get_driver_version_major

int GraphicsStateGuardian::get_driver_version_major

Returns major version of the video driver.

This has an implementation- defined meaning, and may be -1 if the particular graphics implementation does not provide a way to query this information.

Definition at line 283 of file graphicsStateGuardian.h.

◆ get_driver_version_minor

int GraphicsStateGuardian::get_driver_version_minor

Returns the minor version of the video driver.

This has an implementation- defined meaning, and may be -1 if the particular graphics implementation does not provide a way to query this information.

Definition at line 284 of file graphicsStateGuardian.h.

◆ get_effective_incomplete_render

bool GraphicsStateGuardian::get_effective_incomplete_render
inline

Returns true if the GSG is effectively in incomplete_render state, considering both the GSG's incomplete_render and its current DisplayRegion's incomplete_render flags.

It only makes sense to call this during the draw traversal; at other times this return value will be meaningless.

See CullTraverser::get_effective_incomplete_render() for this same information during the cull traversal.

Definition at line 104 of file graphicsStateGuardian.h.

◆ get_flash_texture

Texture * GraphicsStateGuardian::get_flash_texture

Returns the current "flash texture", if any, or NULL if none.

See set_flash_texture().

Definition at line 266 of file graphicsStateGuardian.h.

◆ get_gamma

PN_stdfloat GraphicsStateGuardian::get_gamma

Get the current gamma setting.

Definition at line 251 of file graphicsStateGuardian.h.

◆ get_incomplete_render

bool GraphicsStateGuardian::get_incomplete_render
inline

Returns the incomplete_render flag.

See set_incomplete_render().

Definition at line 103 of file graphicsStateGuardian.h.

◆ get_loader

Loader * GraphicsStateGuardian::get_loader
inline

Returns the Loader object that will be used by this GSG to load textures when necessary, if get_incomplete_render() is true.

Definition at line 108 of file graphicsStateGuardian.h.

◆ get_max_2d_texture_array_layers

int GraphicsStateGuardian::get_max_2d_texture_array_layers
inline

Returns the largest possible number of pages, or -1 if there is no particular limit.

Returns 0 if 2-d texture arrays not supported.

The value returned may not be meaningful until after the graphics context has been fully created (e.g. the window has been opened).

Definition at line 184 of file graphicsStateGuardian.h.

◆ get_max_3d_texture_dimension

int GraphicsStateGuardian::get_max_3d_texture_dimension
inline

Returns the largest possible texture size in any one dimension for a 3-d texture, or -1 if there is no particular limit.

Returns 0 if 3-d textures are not supported.

The value returned may not be meaningful until after the graphics context has been fully created (e.g. the window has been opened).

Definition at line 183 of file graphicsStateGuardian.h.

◆ get_max_buffer_texture_size

int GraphicsStateGuardian::get_max_buffer_texture_size
inline

Returns the largest possible buffer texture size, or -1 if there is no particular limit.

Returns 0 if cube map textures are not supported.

The value returned may not be meaningful until after the graphics context has been fully created (e.g. the window has been opened).

Definition at line 186 of file graphicsStateGuardian.h.

◆ get_max_clip_planes

int GraphicsStateGuardian::get_max_clip_planes
inline

Returns the maximum number of simultaneous clip planes that may be applied to geometry, or -1 if there is no particular limit.

The value returned may not be meaningful until after the graphics context has been fully created (e.g. the window has been opened).

Definition at line 199 of file graphicsStateGuardian.h.

◆ get_max_color_targets

int GraphicsStateGuardian::get_max_color_targets
inline

Returns the maximum number of simultaneous color textures that may be attached for render-to-texture, as supported by this particular GSG.

If you exceed this number, the lowest-priority render targets will not be applied. Use RenderTarget::set_priority() to adjust the relative importance of the different render targets.

The value returned may not be meaningful until after the graphics context has been fully created (e.g. the window has been opened).

Definition at line 223 of file graphicsStateGuardian.h.

Referenced by get_maximum_simultaneous_render_targets().

◆ get_max_cube_map_dimension

int GraphicsStateGuardian::get_max_cube_map_dimension
inline

Returns the largest possible texture size in any one dimension for a cube map texture, or -1 if there is no particular limit.

Returns 0 if cube map textures are not supported.

The value returned may not be meaningful until after the graphics context has been fully created (e.g. the window has been opened).

Definition at line 185 of file graphicsStateGuardian.h.

Referenced by GraphicsOutput::make_cube_map().

◆ get_max_lights

int GraphicsStateGuardian::get_max_lights
inline

Returns the maximum number of simultaneous lights that may be rendered on geometry, or -1 if there is no particular limit.

The value returned may not be meaningful until after the graphics context has been fully created (e.g. the window has been opened).

Definition at line 198 of file graphicsStateGuardian.h.

◆ get_max_texture_dimension

int GraphicsStateGuardian::get_max_texture_dimension
inline

Returns the largest possible texture size in any one dimension supported by the GSG, or -1 if there is no particular limit.

The value returned may not be meaningful until after the graphics context has been fully created (e.g. the window has been opened).

Definition at line 182 of file graphicsStateGuardian.h.

◆ get_max_texture_stages

int GraphicsStateGuardian::get_max_texture_stages
inline

Returns the maximum number of simultaneous textures that may be applied to geometry with multitexturing, as supported by this particular GSG.

If you exceed this number, the lowest-priority texture stages will not be applied. Use TextureStage::set_priority() to adjust the relative importance of the different texture stages.

The value returned may not be meaningful until after the graphics context has been fully created (e.g. the window has been opened).

Definition at line 181 of file graphicsStateGuardian.h.

Referenced by get_alpha_scale_via_texture().

◆ get_max_vertex_transform_indices

int GraphicsStateGuardian::get_max_vertex_transform_indices
inline

Returns the maximum number of transforms there may be in a single TransformTable for this graphics hardware.

If this number is 0 (but get_max_transforms() is nonzero), then the graphics hardware (or API) doesn't support indexed transforms, but can support direct transform references.

The value returned may not be meaningful until after the graphics context has been fully created (e.g. the window has been opened).

Definition at line 201 of file graphicsStateGuardian.h.

◆ get_max_vertex_transforms

int GraphicsStateGuardian::get_max_vertex_transforms
inline

Returns the maximum number of transform matrices that may be simultaneously used to transform any one vertex by the graphics hardware.

If this number is 0, then the hardware (or the graphics backend) doesn't support soft- skinned vertices (in which case Panda will animate the vertices in software).

The value returned may not be meaningful until after the graphics context has been fully created (e.g. the window has been opened).

Definition at line 200 of file graphicsStateGuardian.h.

◆ get_max_vertices_per_array

int GraphicsStateGuardian::get_max_vertices_per_array
inline

Returns the maximum number of vertices that should be put into any one GeomVertexData object for use with this GSG.

Definition at line 179 of file graphicsStateGuardian.h.

◆ get_max_vertices_per_primitive

int GraphicsStateGuardian::get_max_vertices_per_primitive
inline

Returns the maximum number of vertex indices that should be put into any one GeomPrimitive object for use with this GSG.

Definition at line 180 of file graphicsStateGuardian.h.

◆ get_pipe

GraphicsPipe * GraphicsStateGuardian::get_pipe
inline

Returns the graphics pipe on which this GSG was created.

Definition at line 117 of file graphicsStateGuardian.h.

Referenced by GraphicsEngine::make_buffer().

◆ get_prepared_objects

PreparedGraphicsObjects * GraphicsStateGuardian::get_prepared_objects

Returns the set of texture and geom objects that have been prepared with this GSG (and possibly other GSG's that share objects).

Definition at line 246 of file graphicsStateGuardian.h.

Referenced by DXGraphicsStateGuardian9::extract_texture_data(), DXGraphicsStateGuardian9::framebuffer_copy_to_texture(), and DXGraphicsStateGuardian9::setup_array_data().

◆ get_scene

SceneSetup * GraphicsStateGuardian::get_scene

Returns the current SceneSetup object.

Definition at line 290 of file graphicsStateGuardian.h.

◆ get_shader_generator

ShaderGenerator * GraphicsStateGuardian::get_shader_generator
inline

Returns the ShaderGenerator object that will be used by this GSG to generate shaders when necessary.

Definition at line 112 of file graphicsStateGuardian.h.

◆ get_shader_model

GraphicsStateGuardian::ShaderModel GraphicsStateGuardian::get_shader_model
inline

Returns the ShaderModel.

Definition at line 228 of file graphicsStateGuardian.h.

◆ get_supports_2d_texture_array

bool GraphicsStateGuardian::get_supports_2d_texture_array
inline

Returns true if this GSG can render 2-d textures array.

Definition at line 191 of file graphicsStateGuardian.h.

◆ get_supports_3d_texture

bool GraphicsStateGuardian::get_supports_3d_texture
inline

Returns true if this GSG can render 3-d (volumetric) textures.

Definition at line 190 of file graphicsStateGuardian.h.

◆ get_supports_basic_shaders

bool GraphicsStateGuardian::get_supports_basic_shaders
inline

Returns true if this particular GSG supports arbfp1+arbvp1 or above.

Definition at line 210 of file graphicsStateGuardian.h.

◆ get_supports_buffer_texture

bool GraphicsStateGuardian::get_supports_buffer_texture
inline

Returns true if this GSG can render buffer textures.

Definition at line 193 of file graphicsStateGuardian.h.

◆ get_supports_compressed_texture

bool GraphicsStateGuardian::get_supports_compressed_texture
inline

Returns true if this GSG can compress textures as it loads them into texture memory, and/or accept pre-compressed textures for storing.

Definition at line 197 of file graphicsStateGuardian.h.

◆ get_supports_compute_shaders

bool GraphicsStateGuardian::get_supports_compute_shaders
inline

Returns true if this particular GSG supports compute shaders.

Definition at line 213 of file graphicsStateGuardian.h.

◆ get_supports_cube_map

bool GraphicsStateGuardian::get_supports_cube_map
inline

Returns true if this GSG can render cube map textures.

Definition at line 192 of file graphicsStateGuardian.h.

Referenced by GraphicsOutput::make_cube_map().

◆ get_supports_cube_map_array

bool GraphicsStateGuardian::get_supports_cube_map_array
inline

Returns true if this GSG can render cube map arrays.

Definition at line 194 of file graphicsStateGuardian.h.

◆ get_supports_depth_stencil

bool GraphicsStateGuardian::get_supports_depth_stencil
inline

Returns true if this particular GSG supports textures whose format is F_depth_stencil.

This only returns true if the GSG supports the full packed depth-stencil functionality.

Definition at line 206 of file graphicsStateGuardian.h.

◆ get_supports_depth_texture

bool GraphicsStateGuardian::get_supports_depth_texture
inline

Returns true if this particular GSG supports textures whose format is F_depth_stencil.

This returns true if the GSG supports GL_DEPTH_COMPONENT textures, which are considered a limited but still valid case of F_depth_stencil.

Definition at line 205 of file graphicsStateGuardian.h.

◆ get_supports_dual_source_blending

bool GraphicsStateGuardian::get_supports_dual_source_blending
inline

Returns true if dual source (incoming1_color and incoming1_alpha) blend operands are supported by this GSG.

Definition at line 224 of file graphicsStateGuardian.h.

◆ get_supports_generate_mipmap

bool GraphicsStateGuardian::get_supports_generate_mipmap
inline

Returns true if this particular GSG can generate mipmaps for a texture automatically, or if they must be generated in software.

If this is true, then mipmaps can safely be enabled for rendered textures (e.g. using the MultitexReducer).

Definition at line 204 of file graphicsStateGuardian.h.

◆ get_supports_geometry_instancing

bool GraphicsStateGuardian::get_supports_geometry_instancing
inline

Returns true if this particular GSG supports hardware geometry instancing: the ability to render multiple copies of a model.

In OpenGL, this is done using the EXT_draw_instanced extension.

Definition at line 218 of file graphicsStateGuardian.h.

◆ get_supports_geometry_shaders

bool GraphicsStateGuardian::get_supports_geometry_shaders
inline

Returns true if this particular GSG supports geometry shaders.

Definition at line 211 of file graphicsStateGuardian.h.

◆ get_supports_glsl

bool GraphicsStateGuardian::get_supports_glsl
inline

Returns true if this particular GSG supports GLSL shaders.

Definition at line 214 of file graphicsStateGuardian.h.

◆ get_supports_hlsl

bool GraphicsStateGuardian::get_supports_hlsl
inline

Returns true if this particular GSG supports HLSL shaders.

Definition at line 215 of file graphicsStateGuardian.h.

◆ get_supports_indirect_draw

bool GraphicsStateGuardian::get_supports_indirect_draw
inline

Returns true if this particular GSG supports draw calls for which the information comes from a buffer.

Definition at line 219 of file graphicsStateGuardian.h.

◆ get_supports_luminance_texture

bool GraphicsStateGuardian::get_supports_luminance_texture
inline

Returns true if this particular GSG supports luminance textures.

Definition at line 207 of file graphicsStateGuardian.h.

◆ get_supports_multisample

bool GraphicsStateGuardian::get_supports_multisample

Returns true if this particular GSG supports using the multisample bits to provide antialiasing, and also supports M_multisample and M_multisample_mask transparency modes.

If this is not true for a particular GSG, Panda will map the M_multisample modes to M_binary.

This method is declared virtual solely so that it can be queried from cullResult.cxx.

Definition at line 203 of file graphicsStateGuardian.h.

◆ get_supports_occlusion_query

bool GraphicsStateGuardian::get_supports_occlusion_query

Returns true if this GSG supports an occlusion query.

If this is true, then begin_occlusion_query() and end_occlusion_query() may be called to bracket a sequence of draw_triangles() (or whatever) calls to measure pixels that pass the depth test.

Definition at line 220 of file graphicsStateGuardian.h.

◆ get_supports_sampler_objects

bool GraphicsStateGuardian::get_supports_sampler_objects
inline

Returns true if this particular GSG supports the use of sampler objects to record texture sampling parameters separately from the texture objects.

This doesn't really affect functionality, but if this is false, it may mean that using the same texture with different SamplerState objects will result in reduced performance.

Definition at line 209 of file graphicsStateGuardian.h.

◆ get_supports_shadow_filter

bool GraphicsStateGuardian::get_supports_shadow_filter
inline

Returns true if this particular GSG supports the filter mode FT_shadow for depth textures.

Definition at line 208 of file graphicsStateGuardian.h.

◆ get_supports_stencil

bool GraphicsStateGuardian::get_supports_stencil
inline

Returns true if this particular GSG supports stencil buffers at all.

Definition at line 216 of file graphicsStateGuardian.h.

◆ get_supports_tessellation_shaders

bool GraphicsStateGuardian::get_supports_tessellation_shaders
inline

Returns true if this particular GSG supports tesselation shaders.

Definition at line 212 of file graphicsStateGuardian.h.

◆ get_supports_tex_non_pow2

bool GraphicsStateGuardian::get_supports_tex_non_pow2
inline

Returns true if this GSG can handle non power of two sized textures.

Definition at line 195 of file graphicsStateGuardian.h.

◆ get_supports_texture_combine

bool GraphicsStateGuardian::get_supports_texture_combine
inline

Returns true if this particular GSG can use the TextureStage::M_combine mode, which includes all of the texture blend modes specified by set_combine_rgb() and/or set_combine_alpha().

If this is false, you must limit yourself to using the simpler blend modes.

Definition at line 187 of file graphicsStateGuardian.h.

◆ get_supports_texture_dot3

bool GraphicsStateGuardian::get_supports_texture_dot3
inline

Returns true if this GSG can use the TextureStage::CM_dot3_rgb or CM_dot3_rgba combine modes.

Definition at line 189 of file graphicsStateGuardian.h.

◆ get_supports_texture_saved_result

bool GraphicsStateGuardian::get_supports_texture_saved_result
inline

Returns true if this GSG can use the TextureStage::CS_last_saved_result source, which allows you to save the result of a TextureStage and re-use it for multiple inputs.

Definition at line 188 of file graphicsStateGuardian.h.

◆ get_supports_texture_srgb

bool GraphicsStateGuardian::get_supports_texture_srgb
inline

Returns true if this GSG can handle sRGB textures.

Definition at line 196 of file graphicsStateGuardian.h.

◆ get_supports_timer_query

bool GraphicsStateGuardian::get_supports_timer_query

Returns true if this GSG supports a timer query.

Definition at line 221 of file graphicsStateGuardian.h.

◆ get_supports_two_sided_stencil

bool GraphicsStateGuardian::get_supports_two_sided_stencil
inline

Returns true if this particular GSG supports two sided stencil: different stencil settings for the front and back side of the same polygon.

Definition at line 217 of file graphicsStateGuardian.h.

◆ get_texture_quality_override

Texture::QualityLevel GraphicsStateGuardian::get_texture_quality_override
inline

Returns the global quality_level override specified by set_texture_quality_override.

This is mainly useful for the tinydisplay software renderer. See Texture::set_quality_level().

Definition at line 256 of file graphicsStateGuardian.h.

◆ get_timer_queries_active

bool GraphicsStateGuardian::get_timer_queries_active

Returns true if timer queries are currently enabled on this GSG.

Definition at line 222 of file graphicsStateGuardian.h.

◆ is_active

bool GraphicsStateGuardian::is_active
inline

Returns the active flag associated with the GraphicsStateGuardian.

Definition at line 97 of file graphicsStateGuardian.h.

◆ is_valid

bool GraphicsStateGuardian::is_valid
inline

Returns true if the GSG has been correctly initialized within a graphics context, false if there has been some problem or it hasn't been initialized yet.

Definition at line 98 of file graphicsStateGuardian.h.

Referenced by GraphicsEngine::make_output().

◆ set_active

void GraphicsStateGuardian::set_active
inline

Sets the active flag associated with the GraphicsStateGuardian.

If the GraphicsStateGuardian is marked inactive, nothing is rendered. This is not normally turned off unless there is a problem with the rendering detected at a low level.

Definition at line 97 of file graphicsStateGuardian.h.

◆ set_coordinate_system

void GraphicsStateGuardian::set_coordinate_system

Changes the coordinate system in effect on this particular gsg.

This is also called the "external" coordinate system, since it is the coordinate system used by the scene graph, external to to GSG.

Normally, this will be the default coordinate system, but it might be set differently at runtime. It will automatically be copied from the current lens's coordinate system as each DisplayRegion is rendered.

Definition at line 243 of file graphicsStateGuardian.h.

◆ set_flash_texture

void GraphicsStateGuardian::set_flash_texture

Sets the "flash texture".

This is a debug feature; when enabled, the specified texture will begin flashing in the scene, helping you to find it visually.

The texture also flashes with a color code: blue for mipmap level 0, yellow for mipmap level 1, and red for mipmap level 2 or higher (even for textures that don't have mipmaps). This gives you an idea of the choice of the texture size. If it is blue, the texture is being drawn the proper size or magnified; if it is yellow, it is being minified a little bit; and if it red, it is being minified considerably. If you see a red texture when you are right in front of it, you should consider reducing the size of the texture to avoid wasting texture memory.

Not all rendering backends support the flash_texture feature. Presently, it is only supported by OpenGL.

Definition at line 266 of file graphicsStateGuardian.h.

◆ set_gamma

bool GraphicsStateGuardian::set_gamma

Set gamma.

Returns true on success.

Definition at line 251 of file graphicsStateGuardian.h.

◆ set_incomplete_render

void GraphicsStateGuardian::set_incomplete_render
inline

Sets the incomplete_render flag.

When this is true, the frame will be rendered even if some of the geometry or textures in the scene are not available (e.g. they have been temporarily paged out). When this is false, the frame will be held up while this data is reloaded.

Setting this true allows for a smoother frame rate, but occasionally parts of the frame will be invisible or missing (they will generally come in within a second or two). Setting this false guarantees that every frame will be complete, but may cause more chugs as things are loaded up at runtime.

You may want to set this false during loading screens, to guarantee that all of your assets are available by the time you take the loading screen down.

This flag may also be set individually on each DisplayRegion. It will be considered true for a given DisplayRegion only if it is true on both the GSG and on the DisplayRegion.

Definition at line 103 of file graphicsStateGuardian.h.

◆ set_loader

void GraphicsStateGuardian::set_loader
inline

Sets the Loader object that will be used by this GSG to load textures when necessary, if get_incomplete_render() is true.

Definition at line 108 of file graphicsStateGuardian.h.

◆ set_scene

bool GraphicsStateGuardian::set_scene

Sets the SceneSetup object that indicates the initial camera position, etc.

This must be called before traversal begins. Returns true if the scene is acceptable, false if something's wrong. This should be called in the draw thread only.

Definition at line 290 of file graphicsStateGuardian.h.

Referenced by DisplayRegionDrawCallbackData::upcall().

◆ set_shader_generator

void GraphicsStateGuardian::set_shader_generator
inline

Sets the ShaderGenerator object that will be used by this GSG to generate shaders when necessary.

Definition at line 112 of file graphicsStateGuardian.h.

◆ set_shader_model

void GraphicsStateGuardian::set_shader_model
inline

Sets the ShaderModel.

This will override the auto- detected shader model during GSG reset. Useful for testing lower-end shaders.

Definition at line 228 of file graphicsStateGuardian.h.

◆ set_texture_quality_override

void GraphicsStateGuardian::set_texture_quality_override
inline

Specifies the global quality_level to be imposed for all Textures rendered by this GSG.

This overrides the value set on individual textures via Texture::set_quality_level(). Set this to Texture::QL_default in order to allow the individual texture quality levels to be respected.

This is mainly useful for the tinydisplay software renderer. See Texture::set_quality_level().

Definition at line 256 of file graphicsStateGuardian.h.


The documentation for this class was generated from the following files: