Panda3D

Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
DXGraphicsStateGuardian9 Class Reference

A GraphicsStateGuardian for rendering into DirectX9 contexts. More...

`#include "dxGraphicsStateGuardian9.h"`

Inheritance diagram for DXGraphicsStateGuardian9:

## Public Member Functions
| DXGraphicsStateGuardian9 (GraphicsEngine *engine, GraphicsPipe *pipe)
virtual void | apply_fog (Fog *fog)
bool | apply_index_buffer (IndexBufferContext *ibc, const GeomPrimitivePipelineReader *reader, bool force)
| Updates the index buffer with the current data, and makes it the current index buffer for rendering. More...
void | apply_texture (int i, TextureContext *tc, const SamplerState &sampler)
| Makes the texture the currently available texture for rendering on the ith stage. More...
bool | apply_vertex_buffer (VertexBufferContext *vbc, const GeomVertexArrayDataHandle *reader, bool force)
| Updates the vertex buffer with the current data, and makes it the current vertex buffer for rendering. More...
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 (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 (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 (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...
FrameBufferProperties | calc_fb_properties (DWORD cformat, DWORD dformat, DWORD multisampletype, DWORD multisamplequality)
| Convert DirectX framebuffer format ids into a FrameBufferProperties structure. More...
bool | check_dx_allocation (HRESULT result, int allocation_size, int attempts)
| This function is called after the creation of textures, vertex buffers, and index buffers to check if DirectX is out of memory. More...
virtual void | clear (DrawableRegion *clearable)
| Clears all of the indicated buffers to their assigned colors. More...
virtual | CPT (TransformState) calc_projection_mat(const Lens *lens)
bool | do_framebuffer_copy_to_ram (Texture *tex, int view, int z, const DisplayRegion *dr, const RenderBuffer &rb, bool inverted)
| This is the implementation of framebuffer_copy_to_ram(); it adds one additional parameter, which should be true if the framebuffer is to be inverted during the copy (as in the same way it copies to texture memory). More...
virtual bool | draw_lines (const GeomPrimitivePipelineReader *reader, bool force)
| Draws a series of disconnected line segments. More...
virtual bool | draw_linestrips (const GeomPrimitivePipelineReader *reader, bool force)
| Draws a series of line strips. 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_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 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 bool | extract_texture_data (Texture *tex)
| This method should only be called by the GraphicsEngine. 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...
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_render_texture () const
| Returns true if this particular GSG can render from a wdxGraphicsBuffer9 directly into a texture, or false if it must always copy-to-texture at the end of each frame to achieve this effect. More...
virtual TypeHandle | get_type () const
LPDIRECT3DVERTEXBUFFER9 | get_white_vbuffer ()
| Returns a vertex buffer containing only a full-white color. More...
virtual void | prepare_display_region (DisplayRegionPipelineReader *dr)
| Prepare a display region for rendering (set up scissor region and viewport) More...
virtual IndexBufferContext * | prepare_index_buffer (GeomPrimitive *data)
| Creates a new retained-mode representation of the given data, and returns a newly-allocated IndexBufferContext pointer to reference it. 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...
ShaderContext * | prepare_shader (Shader *se)
| Compile a vertex/fragment shader body. More...
virtual TextureContext * | prepare_texture (Texture *tex, int view)
| Creates a new retained-mode representation of the given texture, and returns a newly-allocated TextureContext pointer to reference it. More...
virtual VertexBufferContext * | prepare_vertex_buffer (GeomVertexArrayData *data)
| Creates a new retained-mode representation of the given data, and returns a newly-allocated VertexBufferContext pointer to reference it. More...
virtual | PT (GeomMunger) make_geom_munger(const RenderState *state
virtual | PT (OcclusionQueryContext) end_occlusion_query()
virtual void | release_index_buffer (IndexBufferContext *ibc)
| Frees the GL resources previously allocated for the data. More...
void | release_shader (ShaderContext *sc)
| Releases the resources allocated by prepare_shader. More...
virtual void | release_texture (TextureContext *tc)
| Frees the GL resources previously allocated for the texture. More...
virtual void | release_vertex_buffer (VertexBufferContext *vbc)
| Frees the GL resources previously allocated for the data. More...
virtual void | reset ()
| Resets all internal state as if the gsg were newly created. More...
void | reset_render_states (void)
void | restore_gamma ()
| Restore original gamma. More...
bool | set_gamma (PN_stdfloat gamma)
| Non static version of setting gamma. More...
HRESULT | set_render_state (D3DRENDERSTATETYPE state, DWORD value)
| This function creates a common layer between DX and Panda for SetRenderState. More...
HRESULT | set_sampler_state (DWORD sampler, D3DSAMPLERSTATETYPE type, DWORD value)
| This function creates a common layer between DX and Panda. More...
virtual void | set_state_and_transform (const RenderState *state, const TransformState *transform)
| Simultaneously resets the render state and the transform state. More...
HRESULT | set_texture_stage_state (DWORD stage, D3DTEXTURESTAGESTATETYPE type, DWORD value)
| This function creates a common layer between DX and Panda. More...
bool | setup_array_data (DXVertexBufferContext9 *&vbc, const GeomVertexArrayDataHandle *data, bool force)
| Internal function to bind a buffer object for the indicated data array, if appropriate, or to unbind a buffer object if it should be rendered from client memory. More...
virtual bool | update_texture (TextureContext *tc, bool force)
| Ensures that the current Texture data is refreshed onto the GSG. More...
bool | upload_texture (DXTextureContext9 *dtc, bool force)
| Creates a texture surface on the graphics card and fills it with its pixel data. More...
Public Member Functions inherited from GraphicsStateGuardian
| GraphicsStateGuardian (CoordinateSystem internal_coordinate_system, GraphicsEngine *engine, GraphicsPipe *pipe)
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 (RenderState) begin_decal_base_first()
virtual | CPT (RenderState) begin_decal_base_second()
virtual | CPT (RenderState) begin_decal_nested()
| CPT (TransformState) get_external_transform() const
| CPT (TransformState) get_internal_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_adj (const GeomPrimitivePipelineReader *reader, bool force)
| Draws a series of disconnected line segments with adjacency information. 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_triangles_adj (const GeomPrimitivePipelineReader *reader, bool force)
| Draws a series of disconnected triangles with adjacency information. More...
virtual bool | draw_tristrips_adj (const GeomPrimitivePipelineReader *reader, bool force)
| Draws a series of triangle strips with adjacency information. More...
virtual void | ensure_generated_shader (const RenderState *state)
| Ensures that an appropriate shader has been generated for the given state. 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...
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 DisplayRegion * | get_current_display_region () const
const Lens * | get_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
GraphicsEngine * | get_engine () const
| Returns the graphics engine that created this GSG. More...
Texture * | get_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...
Loader * | get_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...
GraphicsPipe * | get_pipe () const
virtual PreparedGraphicsObjects * | get_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 SceneSetup * | get_scene () const final
ShaderGenerator * | get_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
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 GraphicsThreadingModel & | get_threading_model () const
| Returns the threading model that was used to create this GSG. More...
bool | get_timer_queries_active () 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 GeomContext * | prepare_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 SamplerContext * | prepare_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 BufferContext * | prepare_shader_buffer (ShaderBuffer *data)
| Prepares the indicated buffer for retained-mode rendering. More...
| PT (Texture) get_shadow_map(const NodePath &light_np
virtual | PT (TimerQueryContext) issue_timer_query(int pstats_index)
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_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_buffer (BufferContext *ibc)
| Frees the resources previously allocated via a call to prepare_data(), including deleting the BufferContext itself, if necessary. More...
virtual void | remove_window (GraphicsOutputBase *window)
| This is simply a transparent call to GraphicsEngine::remove_window(). More...
bool | reset_if_new ()
| Calls reset() to initialize the GSG, but only if it hasn't been called yet. 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)
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)
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...
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 ReferenceCount * | as_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
TypedObject * | as_typed_object ()
| Returns the object, upcast (if necessary) to a TypedObject pointer. More...
const TypedObject * | as_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...
TypedObject & | operator= (const TypedObject &copy)=default
Public Member Functions inherited from MemoryBase
void | operator delete (void *, void *)
void | operator delete (void *ptr)
void | operator delete[] (void *, void *)
void | operator delete[] (void *ptr)
void * | operator new (size_t size)
void * | operator new (size_t size, void *ptr)
void * | operator new[] (size_t size)
void * | operator new[] (size_t size, void *ptr)
Public Member Functions inherited from ReferenceCount
int | get_ref_count () const
WeakReferenceList * | get_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...
bool | unref_if_one () const
| Atomically decreases the reference count of this object if it is one. More...
WeakReferenceList * | weak_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 | atexit_function (void)
| This function is passed to the atexit function. More...
static TypeHandle | get_class_type ()
static bool | get_gamma_table (void)
| Static function for getting the original gamma. More...
static D3DFORMAT | get_index_type (Geom::NumericType numeric_type)
| Maps from the Geom's internal numeric type symbols to DirectX's. More...
static void | init_type ()
static DWORD | LColor_to_D3DCOLOR (const LColor &cLColor)
| Converts Panda's floating-point LColor structure to DirectX's D3DCOLOR packed structure. More...
static void | set_cg_device (LPDIRECT3DDEVICE9 cg_device)
| Sets the global Cg device pointer. More...
static bool | static_set_gamma (bool restore, PN_stdfloat gamma)
| Static function for setting gamma which is needed for atexit. More...
Static Public Member Functions inherited from GraphicsStateGuardian
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 TextureStage * | get_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 GraphicsStateGuardianBase * | get_default_gsg ()
| Returns a pointer to the "default" GSG. More...
static GraphicsStateGuardianBase * | get_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
DXScreenData * | _screen
virtual Thread * | current_thread
Public Attributes inherited from GraphicsStateGuardian
virtual Thread * | current_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...
GraphicsOutputBase * | host =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 Thread * | current_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 BamReader * | reader = nullptr)
Public Attributes inherited from TypedObject
| get_type
Public Attributes inherited from ReferenceCount
| get_ref_count
| Returns the current reference count. More...

## Friends
class | DXIndexBufferContext9
class | DXShaderContext9
class | DXTextureContext9
class | DXVertexBufferContext9
class | wdxGraphicsBuffer9
class | wdxGraphicsPipe9
class | wdxGraphicsWindow9
class | wdxGraphicsWindowGroup9

## Additional Inherited Members
Public Types inherited from GraphicsStateGuardian
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)
Static Public Attributes inherited from GraphicsStateGuardian
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

## Detailed Description

A GraphicsStateGuardian for rendering into DirectX9 contexts.

Definition at line 57 of file dxGraphicsStateGuardian9.h.

## Member Function Documentation

## ◆ apply_index_buffer()

bool DXGraphicsStateGuardian9::apply_index_buffer | ( | IndexBufferContext * | ibc,
|  | const GeomPrimitivePipelineReader * | reader,
|  | bool | force
| ) |  |

Updates the index buffer with the current data, and makes it the current index buffer for rendering.

Definition at line 674 of file dxGraphicsStateGuardian9.cxx.

## ◆ apply_texture()

void DXGraphicsStateGuardian9::apply_texture | ( | int | i,
|  | TextureContext * | tc,
|  | const SamplerState & | sampler
| ) |  |

Makes the texture the currently available texture for rendering on the ith stage.

Definition at line 208 of file dxGraphicsStateGuardian9.cxx.

## ◆ apply_vertex_buffer()

bool DXGraphicsStateGuardian9::apply_vertex_buffer | ( | VertexBufferContext * | vbc,
|  | const GeomVertexArrayDataHandle * | reader,
|  | bool | force
| ) |  |

Updates the vertex buffer with the current data, and makes it the current vertex buffer for rendering.

Definition at line 515 of file dxGraphicsStateGuardian9.cxx.

## ◆ atexit_function()

void DXGraphicsStateGuardian9::atexit_function | ( | void |  | ) |
| static

This function is passed to the atexit function.

Definition at line 5407 of file dxGraphicsStateGuardian9.cxx.

References set_cg_device().

## ◆ begin_draw_primitives()

bool DXGraphicsStateGuardian9::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.

Reimplemented from GraphicsStateGuardian.

Definition at line 1178 of file dxGraphicsStateGuardian9.cxx.

References GraphicsStateGuardian::begin_draw_primitives().

## ◆ begin_frame()

bool DXGraphicsStateGuardian9::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 from GraphicsStateGuardian.

Definition at line 998 of file dxGraphicsStateGuardian9.cxx.

References GraphicsStateGuardian::begin_frame().

## ◆ begin_occlusion_query()

void DXGraphicsStateGuardian9::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 from GraphicsStateGuardian.

Definition at line 746 of file dxGraphicsStateGuardian9.cxx.

## ◆ begin_scene()

bool DXGraphicsStateGuardian9::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().

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 from GraphicsStateGuardian.

Definition at line 1048 of file dxGraphicsStateGuardian9.cxx.

References GraphicsStateGuardian::begin_scene().

## ◆ bind_light() [1/3]

void DXGraphicsStateGuardian9::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 GraphicsStateGuardian.

Definition at line 3346 of file dxGraphicsStateGuardian9.cxx.

References TransformState::get_mat, and NodePath::get_transform().

## ◆ bind_light() [2/3]

void DXGraphicsStateGuardian9::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 GraphicsStateGuardian.

Definition at line 3302 of file dxGraphicsStateGuardian9.cxx.

References TransformState::get_mat, and NodePath::get_transform().

## ◆ bind_light() [3/3]

void DXGraphicsStateGuardian9::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 GraphicsStateGuardian.

Definition at line 3400 of file dxGraphicsStateGuardian9.cxx.

References LensNode::get_lens().

## ◆ calc_fb_properties()

FrameBufferProperties DXGraphicsStateGuardian9::calc_fb_properties | ( | DWORD | cformat,
|  | DWORD | dformat,
|  | DWORD | multisampletype,
|  | DWORD | multisamplequality
| ) |  |

Convert DirectX framebuffer format ids into a FrameBufferProperties structure.

Definition at line 5216 of file dxGraphicsStateGuardian9.cxx.

References FrameBufferProperties::set_color_bits, and FrameBufferProperties::set_rgba_bits().

## ◆ check_dx_allocation()

bool DXGraphicsStateGuardian9::check_dx_allocation | ( | HRESULT | result,
|  | int | allocation_size,
|  | int | attempts
| ) |  |

This function is called after the creation of textures, vertex buffers, and index buffers to check if DirectX is out of memory.

If DirectX is out of memory and the LRU is being used, then page out some memory. This function is a fail-safe just in case another process allocates video memory, DirectX is fragmented, or there are some borderline memory allocation cases, ...

Definition at line 5046 of file dxGraphicsStateGuardian9.cxx.

## ◆ clear()

void DXGraphicsStateGuardian9::clear | ( | DrawableRegion * | clearable | ) |
| virtual

Clears all of the indicated buffers to their assigned colors.

Reimplemented from GraphicsStateGuardian.

Definition at line 810 of file dxGraphicsStateGuardian9.cxx.

References DrawableRegion::get_clear_color, DrawableRegion::get_clear_color_active(), DrawableRegion::get_clear_depth, DrawableRegion::get_clear_depth_active(), DrawableRegion::get_clear_stencil, DrawableRegion::get_clear_stencil_active(), LColor_to_D3DCOLOR(), and set_state_and_transform().

## ◆ do_framebuffer_copy_to_ram()

bool DXGraphicsStateGuardian9::do_framebuffer_copy_to_ram | ( | Texture * | tex,
|  | int | view,
|  | int | z,
|  | const DisplayRegion * | dr,
|  | const RenderBuffer & | rb,
|  | bool | inverted
| ) |  |

This is the implementation of framebuffer_copy_to_ram(); it adds one additional parameter, which should be true if the framebuffer is to be inverted during the copy (as in the same way it copies to texture memory).

Definition at line 1999 of file dxGraphicsStateGuardian9.cxx.

Referenced by framebuffer_copy_to_ram().

## ◆ draw_lines()

bool DXGraphicsStateGuardian9::draw_lines | ( | const GeomPrimitivePipelineReader * | reader,
|  | bool | force
| ) |  |
| virtual

Draws a series of disconnected line segments.

Reimplemented from GraphicsStateGuardian.

Definition at line 1705 of file dxGraphicsStateGuardian9.cxx.

## ◆ draw_linestrips()

bool DXGraphicsStateGuardian9::draw_linestrips | ( | const GeomPrimitivePipelineReader * | reader,
|  | bool | force
| ) |  |
| virtual

Draws a series of line strips.

Reimplemented from GraphicsStateGuardian.

Definition at line 1771 of file dxGraphicsStateGuardian9.cxx.

## ◆ draw_points()

bool DXGraphicsStateGuardian9::draw_points | ( | const GeomPrimitivePipelineReader * | reader,
|  | bool | force
| ) |  |
| virtual

Draws a series of disconnected points.

Reimplemented from GraphicsStateGuardian.

Definition at line 1779 of file dxGraphicsStateGuardian9.cxx.

## ◆ draw_triangles()

bool DXGraphicsStateGuardian9::draw_triangles | ( | const GeomPrimitivePipelineReader * | reader,
|  | bool | force
| ) |  |
| virtual

Draws a series of disconnected triangles.

Reimplemented from GraphicsStateGuardian.

Definition at line 1364 of file dxGraphicsStateGuardian9.cxx.

## ◆ draw_trifans()

bool DXGraphicsStateGuardian9::draw_trifans | ( | const GeomPrimitivePipelineReader * | reader,
|  | bool | force
| ) |  |
| virtual

Draws a series of triangle fans.

Reimplemented from GraphicsStateGuardian.

Definition at line 1599 of file dxGraphicsStateGuardian9.cxx.

## ◆ draw_tristrips()

bool DXGraphicsStateGuardian9::draw_tristrips | ( | const GeomPrimitivePipelineReader * | reader,
|  | bool | force
| ) |  |
| virtual

Draws a series of triangle strips.

Reimplemented from GraphicsStateGuardian.

Definition at line 1431 of file dxGraphicsStateGuardian9.cxx.

## ◆ end_draw_primitives()

void DXGraphicsStateGuardian9::end_draw_primitives | ( |  | ) |
| virtual

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

Reimplemented from GraphicsStateGuardian.

Definition at line 1814 of file dxGraphicsStateGuardian9.cxx.

References set_render_state().

## ◆ end_frame()

void DXGraphicsStateGuardian9::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 from GraphicsStateGuardian.

Definition at line 1133 of file dxGraphicsStateGuardian9.cxx.

## ◆ end_scene()

void DXGraphicsStateGuardian9::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 from GraphicsStateGuardian.

Definition at line 1085 of file dxGraphicsStateGuardian9.cxx.

References DXShaderContext9::disable_shader_texture_bindings(), DXShaderContext9::disable_shader_vertex_arrays(), GraphicsStateGuardian::end_scene(), and DXShaderContext9::unbind().

## ◆ extract_texture_data()

bool DXGraphicsStateGuardian9::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.

Reimplemented from GraphicsStateGuardian.

Definition at line 388 of file dxGraphicsStateGuardian9.cxx.

References Texture::get_num_views, GraphicsStateGuardian::get_prepared_objects, and Texture::prepare_now().

## ◆ framebuffer_copy_to_ram()

bool DXGraphicsStateGuardian9::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.

Reimplemented from GraphicsStateGuardian.

Definition at line 1988 of file dxGraphicsStateGuardian9.cxx.

References do_framebuffer_copy_to_ram().

## ◆ framebuffer_copy_to_texture()

bool DXGraphicsStateGuardian9::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.

Reimplemented from GraphicsStateGuardian.

Definition at line 1839 of file dxGraphicsStateGuardian9.cxx.

References GraphicsStateGuardian::get_prepared_objects, DisplayRegion::get_region_pixels_i(), Texture::get_x_size, Texture::get_y_size, Texture::prepare_now(), Texture::set_render_to_texture, and Texture::set_size_padded().

## ◆ get_gamma_table()

bool DXGraphicsStateGuardian9::get_gamma_table | ( | void |  | ) |
| static

Static function for getting the original gamma.

Definition at line 5330 of file dxGraphicsStateGuardian9.cxx.

## ◆ get_index_type()

D3DFORMAT DXGraphicsStateGuardian9::get_index_type | ( | Geom::NumericType | numeric_type | ) |
| static

Maps from the Geom's internal numeric type symbols to DirectX's.

Definition at line 3456 of file dxGraphicsStateGuardian9.cxx.

Referenced by DXIndexBufferContext9::allocate_ibuffer().

## ◆ get_supports_cg_profile()

bool DXGraphicsStateGuardian9::get_supports_cg_profile | ( | const std::string & | name | ) | const
| virtual

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

Reimplemented from GraphicsStateGuardian.

Definition at line 5419 of file dxGraphicsStateGuardian9.cxx.

## ◆ get_supports_render_texture()

bool DXGraphicsStateGuardian9::get_supports_render_texture | ( |  | ) | const
| inline

Returns true if this particular GSG can render from a wdxGraphicsBuffer9 directly into a texture, or false if it must always copy-to-texture at the end of each frame to achieve this effect.

Definition at line 201 of file dxGraphicsStateGuardian9.I.

## ◆ get_white_vbuffer()

LPDIRECT3DVERTEXBUFFER9 DXGraphicsStateGuardian9::get_white_vbuffer | ( |  | ) |

Returns a vertex buffer containing only a full-white color.

Definition at line 5451 of file dxGraphicsStateGuardian9.cxx.

## ◆ LColor_to_D3DCOLOR()

DWORD DXGraphicsStateGuardian9::LColor_to_D3DCOLOR | ( | const LColor & | cLColor | ) |
| inline static

Converts Panda's floating-point LColor structure to DirectX's D3DCOLOR packed structure.

Definition at line 18 of file dxGraphicsStateGuardian9.I.

Referenced by clear().

## ◆ prepare_display_region()

void DXGraphicsStateGuardian9::prepare_display_region | ( | DisplayRegionPipelineReader * | dr | ) |
| virtual

Prepare a display region for rendering (set up scissor region and viewport)

Reimplemented from GraphicsStateGuardian.

Definition at line 893 of file dxGraphicsStateGuardian9.cxx.

## ◆ prepare_index_buffer()

IndexBufferContext * DXGraphicsStateGuardian9::prepare_index_buffer | ( | GeomPrimitive * | data | ) |
| virtual

Creates a new retained-mode representation of the given data, and returns a newly-allocated IndexBufferContext pointer to reference it.

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

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

Reimplemented from GraphicsStateGuardian.

Definition at line 664 of file dxGraphicsStateGuardian9.cxx.

## ◆ prepare_lens()

bool DXGraphicsStateGuardian9::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 from GraphicsStateGuardian.

Definition at line 981 of file dxGraphicsStateGuardian9.cxx.

## ◆ prepare_shader()

ShaderContext * DXGraphicsStateGuardian9::prepare_shader | ( | Shader * | shader | ) |
| virtual

Compile a vertex/fragment shader body.

Reimplemented from GraphicsStateGuardian.

Definition at line 409 of file dxGraphicsStateGuardian9.cxx.

References Shader::get_language().

## ◆ prepare_texture()

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

Creates a new retained-mode representation of the given texture, and returns a newly-allocated TextureContext pointer to reference it.

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().

Reimplemented from GraphicsStateGuardian.

Definition at line 191 of file dxGraphicsStateGuardian9.cxx.

References Texture::get_ram_image_compression, GraphicsStateGuardian::get_supports_compressed_texture_format(), and TextureContext::get_texture().

## ◆ prepare_vertex_buffer()

VertexBufferContext * DXGraphicsStateGuardian9::prepare_vertex_buffer | ( | GeomVertexArrayData * | data | ) |
| virtual

Creates a new retained-mode representation of the given data, and returns a newly-allocated VertexBufferContext pointer to reference it.

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

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

Reimplemented from GraphicsStateGuardian.

Definition at line 462 of file dxGraphicsStateGuardian9.cxx.

## ◆ release_index_buffer()

void DXGraphicsStateGuardian9::release_index_buffer | ( | IndexBufferContext * | ibc | ) |
| virtual

Frees the GL resources previously allocated for the data.

This function should never be called directly; instead, call Data::release() (or simply let the Data destruct).

Reimplemented from GraphicsStateGuardian.

Definition at line 729 of file dxGraphicsStateGuardian9.cxx.

## ◆ release_shader()

void DXGraphicsStateGuardian9::release_shader | ( | ShaderContext * | sc | ) |
| virtual

Releases the resources allocated by prepare_shader.

Reimplemented from GraphicsStateGuardian.

Definition at line 446 of file dxGraphicsStateGuardian9.cxx.

## ◆ release_texture()

void DXGraphicsStateGuardian9::release_texture | ( | TextureContext * | tc | ) |
| virtual

Frees the GL resources previously allocated for the texture.

Reimplemented from GraphicsStateGuardian.

Definition at line 374 of file dxGraphicsStateGuardian9.cxx.

## ◆ release_vertex_buffer()

void DXGraphicsStateGuardian9::release_vertex_buffer | ( | VertexBufferContext * | vbc | ) |
| virtual

Frees the GL resources previously allocated for the data.

This function should never be called directly; instead, call Data::release() (or simply let the Data destruct).

Reimplemented from GraphicsStateGuardian.

Definition at line 606 of file dxGraphicsStateGuardian9.cxx.

## ◆ reset()

void DXGraphicsStateGuardian9::reset | ( |  | ) |
| virtual

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

The GraphicsWindow pointer represents a typical window that might be used for this context; it may be required to set up the frame buffer properly the first time.

Reimplemented from GraphicsStateGuardian.

Definition at line 2208 of file dxGraphicsStateGuardian9.cxx.

References GraphicsStateGuardian::reset().

## ◆ restore_gamma()

void DXGraphicsStateGuardian9::restore_gamma | ( |  | ) |
| virtual

Restore original gamma.

Reimplemented from GraphicsStateGuardian.

Definition at line 5399 of file dxGraphicsStateGuardian9.cxx.

References static_set_gamma().

## ◆ set_cg_device()

void DXGraphicsStateGuardian9::set_cg_device | ( | LPDIRECT3DDEVICE9 | cg_device | ) |
| static

Sets the global Cg device pointer.

TODO: make this thread-safe somehow. Maybe Cg is inherently not thread-safe.

Definition at line 5438 of file dxGraphicsStateGuardian9.cxx.

Referenced by atexit_function().

## ◆ set_gamma()

bool DXGraphicsStateGuardian9::set_gamma | ( | PN_stdfloat | gamma | ) |
| virtual

Non static version of setting gamma.

Returns true on success.

Reimplemented from GraphicsStateGuardian.

Definition at line 5384 of file dxGraphicsStateGuardian9.cxx.

References static_set_gamma().

## ◆ set_render_state()

HRESULT DXGraphicsStateGuardian9::set_render_state | ( | D3DRENDERSTATETYPE | state,
|  | DWORD | value
| ) |  |
| inline

This function creates a common layer between DX and Panda for SetRenderState.

It also keeps avoids setting redundant render states.

Definition at line 142 of file dxGraphicsStateGuardian9.I.

Referenced by end_draw_primitives().

## ◆ set_sampler_state()

HRESULT DXGraphicsStateGuardian9::set_sampler_state | ( | DWORD | sampler,
|  | D3DSAMPLERSTATETYPE | type,
|  | DWORD | value
| ) |  |
| inline

This function creates a common layer between DX and Panda.

It also keeps avoids setting redundant render states.

Definition at line 180 of file dxGraphicsStateGuardian9.I.

## ◆ set_state_and_transform()

void DXGraphicsStateGuardian9::set_state_and_transform | ( | const RenderState * | target,
|  | const TransformState * | transform
| ) |  |
| 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.

Reimplemented from GraphicsStateGuardian.

Definition at line 3089 of file dxGraphicsStateGuardian9.cxx.

References GraphicsStateGuardian::do_issue_color(), GraphicsStateGuardian::do_issue_light(), and DXShaderContext9::issue_parameters().

Referenced by clear().

## ◆ set_texture_stage_state()

HRESULT DXGraphicsStateGuardian9::set_texture_stage_state | ( | DWORD | stage,
|  | D3DTEXTURESTAGESTATETYPE | type,
|  | DWORD | value
| ) |  |
| inline

This function creates a common layer between DX and Panda.

It also keeps avoids setting redundant render states.

Definition at line 161 of file dxGraphicsStateGuardian9.I.

## ◆ setup_array_data()

bool DXGraphicsStateGuardian9::setup_array_data | ( | DXVertexBufferContext9 *& | dvbc,
|  | const GeomVertexArrayDataHandle * | array_reader,
|  | bool | force
| ) |  |

Internal function to bind a buffer object for the indicated data array, if appropriate, or to unbind a buffer object if it should be rendered from client memory.

If the buffer object is bound, this function sets client_pointer to NULL (representing the start of the buffer object in server memory); if the buffer object is not bound, this function sets client_pointer the pointer to the data array in client memory, that is, the data array passed in.

If force is not true, the function may return false indicating the data is not currently available.

Definition at line 639 of file dxGraphicsStateGuardian9.cxx.

References GraphicsStateGuardian::get_prepared_objects.

Referenced by DXShaderContext9::update_shader_vertex_arrays().

## ◆ static_set_gamma()

bool DXGraphicsStateGuardian9::static_set_gamma | ( | bool | restore,
|  | PN_stdfloat | gamma
| ) |  |
| static

Static function for setting gamma which is needed for atexit.

Definition at line 5354 of file dxGraphicsStateGuardian9.cxx.

Referenced by restore_gamma(), and set_gamma().

## ◆ update_texture()

bool DXGraphicsStateGuardian9::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).

Reimplemented from GraphicsStateGuardian.

Definition at line 312 of file dxGraphicsStateGuardian9.cxx.

## ◆ upload_texture()

bool DXGraphicsStateGuardian9::upload_texture | ( | DXTextureContext9 * | dtc,
|  | bool | force
| ) |  |

Creates a texture surface on the graphics card and fills it with its pixel data.

Definition at line 337 of file dxGraphicsStateGuardian9.cxx.

References DXTextureContext9::create_texture(), DXTextureContext9::delete_texture(), Texture::get_ram_image_compression, GraphicsStateGuardian::get_supports_compressed_texture_format(), TextureContext::get_texture(), Texture::has_ram_image(), Texture::has_simple_ram_image, Texture::has_uncompressed_ram_image(), TextureContext::mark_unloaded(), Texture::might_have_ram_image(), TextureContext::update_data_size_bytes(), and TextureContext::was_simple_image_modified().

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

- panda/src/dxgsg9/dxGraphicsStateGuardian9.h
- panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx
- panda/src/dxgsg9/dxGraphicsStateGuardian9.I