Panda3D
|
A GraphicsStateGuardian for rendering into DirectX9 contexts. More...
#include "dxGraphicsStateGuardian9.h"
Classes | |
struct | TextureRenderStates |
struct | TextureStageStates |
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. | |
void | apply_texture (int i, TextureContext *tc) |
Makes the texture the currently available texture for rendering on the ith stage. | |
bool | apply_vertex_buffer (VertexBufferContext *vbc, const GeomVertexArrayDataHandle *reader, bool force) |
virtual bool | begin_draw_primitives (const GeomPipelineReader *geom_reader, const GeomMunger *munger, const GeomVertexDataPipelineReader *data_reader, bool force) |
Called before a sequence of draw_primitive() functions are called, this should prepare the vertex data for rendering. | |
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. | |
virtual void | begin_occlusion_query () |
Begins a new occlusion query. | |
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. | |
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. | |
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. | |
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. | |
FrameBufferProperties | calc_fb_properties (DWORD cformat, DWORD dformat, DWORD multisampletype, DWORD multisamplequality) |
Convert DirectX framebuffer format ids into a FrameBufferProperties structure. | |
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. | |
virtual void | clear (DrawableRegion *clearable) |
Clears all of the indicated buffers to their assigned colors. | |
virtual | CPT (TransformState) calc_projection_mat(const Lens *lens) |
bool | do_framebuffer_copy_to_ram (Texture *tex, 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). | |
virtual bool | draw_lines (const GeomPrimitivePipelineReader *reader, bool force) |
Draws a series of disconnected line segments. | |
virtual bool | draw_linestrips (const GeomPrimitivePipelineReader *reader, bool force) |
Draws a series of line strips. | |
virtual bool | draw_points (const GeomPrimitivePipelineReader *reader, bool force) |
Draws a series of disconnected points. | |
virtual bool | draw_triangles (const GeomPrimitivePipelineReader *reader, bool force) |
Draws a series of disconnected triangles. | |
virtual bool | draw_trifans (const GeomPrimitivePipelineReader *reader, bool force) |
Draws a series of triangle fans. | |
virtual bool | draw_tristrips (const GeomPrimitivePipelineReader *reader, bool force) |
Draws a series of triangle strips. | |
virtual void | end_draw_primitives () |
Called after a sequence of draw_primitive() functions are called, this should do whatever cleanup is appropriate. | |
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. | |
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. | |
virtual bool | extract_texture_data (Texture *tex) |
This method should only be called by the GraphicsEngine. | |
virtual TypeHandle | force_init_type () |
virtual bool | framebuffer_copy_to_ram (Texture *tex, 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. | |
virtual bool | framebuffer_copy_to_texture (Texture *tex, int z, const DisplayRegion *dr, const RenderBuffer &rb) |
Copy the pixels within the indicated display region from the framebuffer into texture memory. | |
virtual bool | get_supports_cg_profile (const string &name) const |
Returns true if this particular GSG supports the specified Cg Shader Profile. | |
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. | |
virtual TypeHandle | get_type () const |
virtual void | prepare_display_region (DisplayRegionPipelineReader *dr) |
Prepare a display region for rendering (set up scissor region and viewport) | |
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. | |
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. | |
ShaderContext * | prepare_shader (Shader *se) |
Compile a vertex/fragment shader body. | |
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. | |
virtual VertexBufferContext * | prepare_vertex_buffer (GeomVertexArrayData *data) |
Prepares the indicated buffer for retained-mode rendering. | |
virtual | PT (OcclusionQueryContext) end_occlusion_query() |
virtual | PT (GeomMunger) make_geom_munger(const RenderState *state |
virtual void | release_index_buffer (IndexBufferContext *ibc) |
Frees the GL resources previously allocated for the data. | |
void | release_shader (ShaderContext *sc) |
Releases the resources allocated by prepare_shader. | |
virtual void | release_texture (TextureContext *tc) |
Frees the GL resources previously allocated for the texture. | |
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. | |
virtual void | reset () |
Resets all internal state as if the gsg were newly created. | |
void | reset_render_states (void) |
void | restore_gamma () |
Restore original gamma. | |
bool | set_gamma (PN_stdfloat gamma) |
Non static version of setting gamma. | |
HRESULT | set_render_state (D3DRENDERSTATETYPE state, DWORD value) |
This function creates a common layer between DX and Panda for SetRenderState. | |
HRESULT | set_sampler_state (DWORD sampler, D3DSAMPLERSTATETYPE type, DWORD value) |
This function creates a common layer between DX and Panda. | |
virtual void | set_state_and_transform (const RenderState *state, const TransformState *transform) |
Simultaneously resets the render state and the transform state. | |
HRESULT | set_texture_stage_state (DWORD stage, D3DTEXTURESTAGESTATETYPE type, DWORD value) |
This function creates a common layer between DX and Panda. | |
bool | setup_array_data (CLP(VertexBufferContext)*&vbc, const GeomVertexArrayDataHandle *data, bool force) |
virtual bool | update_texture (TextureContext *tc, bool force) |
Ensures that the current Texture data is refreshed onto the GSG. | |
bool | upload_texture (DXTextureContext9 *dtc, bool force) |
Creates a texture surface on the graphics card and fills it with its pixel data. | |
Static Public Member Functions | |
static void | atexit_function (void) |
This function is passed to the atexit function. | |
static TypeHandle | get_class_type () |
static bool | get_gamma_table (void) |
Static function for getting the original gamma. | |
static D3DFORMAT | get_index_type (Geom::NumericType numeric_type) |
Maps from the Geom's internal numeric type symbols to DirectX's. | |
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. | |
static void | set_cg_device (LPDIRECT3DDEVICE9 cg_device) |
Sets the global Cg device pointer. | |
static bool | static_set_gamma (bool restore, PN_stdfloat gamma) |
Static function for setting gamma which is needed for atexit. | |
Public Attributes | |
DXScreenData * | _screen |
virtual Thread * | current_thread |
Protected Types | |
typedef pmap< NodePath, D3DLIGHT9 > | DirectionalLights |
enum | DxgsgFogType { None, PerVertexFog = D3DRS_FOGVERTEXMODE, PerPixelFog = D3DRS_FOGTABLEMODE } |
Protected Member Functions | |
virtual void | bind_clip_plane (const NodePath &plane, int plane_id) |
Called the first time a particular clip_plane has been bound to a given id within a frame, this should set up the associated hardware clip_plane with the clip_plane's properties. | |
bool | check_cooperative_level () |
virtual void | close_gsg () |
This is called by the associated GraphicsWindow when close_window() is called. | |
CLP (ShaderContext)*_current_shader_context | |
CLP (ShaderContext)*_vertex_array_shader_context | |
CLP (ShaderContext)*_texture_binding_shader_context | |
void | copy_pres_reset (DXScreenData *new_context) |
copies the PresReset from passed DXScreenData | |
bool | create_swap_chain (DXScreenData *new_context) |
void | disable_standard_texture_bindings () |
void | disable_standard_vertex_arrays () |
void | do_auto_rescale_normal () |
Issues the appropriate DX commands to either rescale or normalize the normals according to the current transform. | |
void | do_issue_alpha_test () |
void | do_issue_blending () |
Called after any of the things that might change blending state have changed, this function is responsible for setting the appropriate color blending mode based on the current properties. | |
void | do_issue_color_write () |
void | do_issue_cull_face () |
void | do_issue_depth_offset () |
void | do_issue_depth_test () |
void | do_issue_depth_write () |
void | do_issue_fog () |
void | do_issue_material () |
void | do_issue_render_mode () |
void | do_issue_rescale_normal () |
void | do_issue_scissor () |
void | do_issue_shade_model () |
void | do_issue_shader () |
void | do_issue_stencil () |
Set stencil render states. | |
void | do_issue_tex_gen () |
void | do_issue_texture () |
void | do_issue_transform () |
Sends the indicated transform matrix to the graphics API to be applied to future vertices. | |
void | draw_indexed_primitive_up (D3DPRIMITIVETYPE primitive_type, unsigned int min_index, unsigned int max_index, unsigned int num_primitives, const unsigned char *index_data, D3DFORMAT index_type, const unsigned char *buffer, size_t stride) |
Issues the DrawIndexedPrimitiveUP call to draw the indicated primitive_type from the given buffer. | |
void | draw_primitive_up (D3DPRIMITIVETYPE primitive_type, unsigned int primitive_count, unsigned int first_vertex, unsigned int num_vertices, const unsigned char *buffer, size_t stride) |
Issues the DrawPrimitiveUP call to draw the indicated primitive_type from the given buffer. | |
void | dx_cleanup () |
Clean up the DirectX environment, accounting for exit() | |
virtual void | enable_clip_plane (int plane_id, bool enable) |
Intended to be overridden by a derived class to enable the indicated clip_plane id. | |
virtual void | enable_light (int light_id, bool enable) |
Intended to be overridden by a derived class to enable the indicated light id. | |
virtual void | enable_lighting (bool enable) |
Intended to be overridden by a derived class to enable or disable the use of lighting overall. | |
void | free_d3d_device () |
setup for re-calling dx_init(), this is not the final exit cleanup routine (see dx_cleanup) | |
void | free_nondx_resources () |
Frees some memory that was explicitly allocated within the dxgsg. | |
const D3DCOLORVALUE & | get_light_color (Light *light) const |
Returns the array of four floats that should be issued as the light's color, as scaled by the current value of _light_color_scale, in the case of color_scale_via_lighting. | |
DWORD | get_texture_argument (TextureStage::CombineSource source, TextureStage::CombineOperand operand) const |
Returns the D3DTA value corresponding to the indicated TextureStage::CombineSource and TextureStage::CombineOperand enumerated types. | |
PT (Shader) _current_shader | |
PT (Shader) _vertex_array_shader | |
PT (Shader) _texture_binding_shader | |
virtual void | reissue_transforms () |
Called by clear_state_and_transform() to ensure that the current modelview and projection matrices are properly loaded in the graphics state, after a callback might have mucked them up. | |
bool | release_swap_chain (DXScreenData *new_context) |
Release the swap chain on this DXScreenData. | |
void | report_texmgr_stats () |
Reports the DX texture manager's activity to PStats. | |
HRESULT | reset_d3d_device (D3DPRESENT_PARAMETERS *p_presentation_params, DXScreenData **screen=NULL) |
This function checks current device's framebuffer dimension against passed p_presentation_params backbuffer dimension to determine a device reset if there is only one window or it is the main window or fullscreen mode then, it resets the device. | |
virtual void | set_ambient_light (const LColor &color) |
Intended to be overridden by a derived class to indicate the color of the ambient light that should be in effect. | |
void | set_context (DXScreenData *new_context) |
void | set_draw_buffer (const RenderBuffer &rb) |
Sets up the glDrawBuffer to render into the buffer indicated by the RenderBuffer object. | |
void | set_read_buffer (const RenderBuffer &rb) |
Vestigial analog of glReadBuffer. | |
void | set_render_target () |
Set render target to the backbuffer of current swap chain. | |
void | set_texture_blend_mode (int i, const TextureStage *stage) |
void | show_frame () |
redraw primary buffer | |
void | update_standard_texture_bindings () |
bool | update_standard_vertex_arrays (bool force) |
Static Protected Member Functions | |
static D3DBLEND | get_blend_func (ColorBlendAttrib::Operand operand) |
Maps from ColorBlendAttrib::Operand to D3DBLEND value. | |
static D3DTEXTUREFILTERTYPE | get_d3d_min_type (Texture::FilterType filter_type) |
static D3DTEXTUREFILTERTYPE | get_d3d_mip_type (Texture::FilterType filter_type) |
static D3DFOGMODE | get_fog_mode_type (Fog::Mode m) |
Maps from the fog types to gl version. | |
static unsigned char * | get_safe_buffer_start () |
Returns the address of a 64K buffer that is allocated at the beginning of a 64K block. | |
static D3DTRANSFORMSTATETYPE | get_tex_mat_sym (int stage_index) |
Returns the nth D3DTS_TEXTURE(n) constant. | |
static DWORD | get_texture_argument_modifier (TextureStage::CombineOperand operand) |
Returns the extra bits that modify the D3DTA argument, according to the indicated TextureStage::CombineOperand enumerated type. | |
static D3DTEXTUREOP | get_texture_operation (TextureStage::CombineMode mode, int scale) |
Returns the D3DTEXTUREOP value corresponding to the indicated TextureStage::CombineMode enumerated type. | |
static D3DTEXTUREADDRESS | get_texture_wrap_mode (Texture::WrapMode wm) |
Maps from the Texture's internal wrap mode symbols to GL's. | |
Protected Attributes | |
const DXIndexBufferContext9 * | _active_ibuffer |
bool | _auto_rescale_normal |
UINT | _available_texture_memory |
DWORD | _clip_plane_bits |
DWORD | _constant_color_operand |
CullFaceAttrib::Mode | _cull_face_mode |
RenderBuffer::Type | _cur_read_pixel_buffer |
RenderModeAttrib::Mode | _current_fill_mode |
D3DVIEWPORT9 | _current_viewport |
LPDIRECT3DDEVICE9 | _d3d_device |
DirectionalLights | _dlights |
DxgsgFogType | _do_fog_type |
bool | _dx_is_ready |
list< wdxGraphicsBuffer9 ** > | _graphics_buffer_list |
int | _gsg_managed_index_buffers |
int | _gsg_managed_textures |
int | _gsg_managed_vertex_buffers |
DWORD | _last_fvf |
HRESULT | _last_testcooplevel_result |
PN_stdfloat | _material_ambient |
PN_stdfloat | _material_diffuse |
PN_stdfloat | _material_emission |
PN_stdfloat | _material_shininess |
PN_stdfloat | _material_specular |
int | _num_active_texture_stages |
int | _num_bound_streams |
bool | _overlay_windows_supported |
char * | _pixel_shader_profile |
int | _pixel_shader_version_major |
int | _pixel_shader_version_minor |
D3DPRESENT_PARAMETERS | _presentation_reset |
DWORD | _render_state_array [256] |
bool | _supports_depth_bias |
int | _supports_gamma_calibration |
bool | _supports_render_texture |
bool | _supports_stream_offset |
bool | _supports_texture_constant_color |
IDirect3DSwapChain9 * | _swap_chain |
bool | _tex_stats_retrieval_impossible |
TextureRenderStates | _texture_render_states_array [16] |
TextureStageStates | _texture_stage_states_array [D3D_MAXTEXTURESTAGES] |
bool | _vertex_blending_enabled |
int | _vertex_shader_maximum_constants |
char * | _vertex_shader_profile |
int | _vertex_shader_version_major |
int | _vertex_shader_version_minor |
Static Protected Attributes | |
static LPDIRECT3DDEVICE9 | _cg_device = NULL |
static D3DMATRIX | _d3d_ident_mat |
static unsigned char * | _safe_buffer_start = NULL |
static unsigned char * | _temp_buffer = NULL |
Friends | |
class | DXIndexBufferContext9 |
class | DXShaderContext9 |
class | DXTextureContext9 |
class | DXVertexBufferContext9 |
class | wdxGraphicsBuffer9 |
class | wdxGraphicsPipe9 |
class | wdxGraphicsWindow9 |
class | wdxGraphicsWindowGroup9 |
A GraphicsStateGuardian for rendering into DirectX9 contexts.
Definition at line 60 of file dxGraphicsStateGuardian9.h.
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 657 of file dxGraphicsStateGuardian9.cxx.
References IndexBufferContext::changed_size(), DXIndexBufferContext9::create_ibuffer(), AdaptiveLruPage::enqueue_lru(), IndexBufferContext::mark_loaded(), BufferContext::set_active(), DXIndexBufferContext9::upload_data(), and IndexBufferContext::was_modified().
Referenced by draw_lines(), draw_triangles(), draw_trifans(), and draw_tristrips().
void DXGraphicsStateGuardian9::apply_texture | ( | int | i, |
TextureContext * | tc | ||
) |
Makes the texture the currently available texture for rendering on the ith stage.
Definition at line 209 of file dxGraphicsStateGuardian9.cxx.
References Texture::get_border_color(), DXTextureContext9::get_d3d_texture(), Texture::get_effective_anisotropic_degree(), Texture::get_effective_magfilter(), Texture::get_effective_minfilter(), TextureContext::get_texture(), get_texture_wrap_mode(), Texture::get_wrap_u(), Texture::get_wrap_v(), Texture::get_wrap_w(), DXTextureContext9::has_mipmaps(), LColor_to_D3DCOLOR(), Texture::might_have_ram_image(), BufferContext::set_active(), set_sampler_state(), set_texture_stage_state(), and update_texture().
void DXGraphicsStateGuardian9::atexit_function | ( | void | ) | [static] |
This function is passed to the atexit function.
Definition at line 5656 of file dxGraphicsStateGuardian9.cxx.
References set_cg_device(), and static_set_gamma().
bool DXGraphicsStateGuardian9::begin_draw_primitives | ( | const GeomPipelineReader * | geom_reader, |
const GeomMunger * | munger, | ||
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 1201 of file dxGraphicsStateGuardian9.cxx.
References GraphicsStateGuardian::begin_draw_primitives(), GeomVertexFormat::get_animation(), GeomVertexAnimationSpec::get_animation_type(), LMatrix4f::get_data(), GeomVertexAnimationSpec::get_indexed_transforms(), GeomVertexAnimationSpec::get_num_transforms(), TransformTable::get_num_transforms(), TransformTable::get_transform(), VertexTransform::mult_matrix(), and set_render_state().
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 1013 of file dxGraphicsStateGuardian9.cxx.
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 738 of file dxGraphicsStateGuardian9.cxx.
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 1062 of file dxGraphicsStateGuardian9.cxx.
References GraphicsStateGuardian::begin_scene().
void DXGraphicsStateGuardian9::bind_clip_plane | ( | const NodePath & | plane, |
int | plane_id | ||
) | [protected, virtual] |
Called the first time a particular clip_plane has been bound to a given id within a frame, this should set up the associated hardware clip_plane with the clip_plane's properties.
Reimplemented from GraphicsStateGuardian.
Definition at line 4092 of file dxGraphicsStateGuardian9.cxx.
References LMatrix4f::convert_mat(), TransformState::get_mat(), PlaneNode::get_plane(), NodePath::get_transform(), and NodePath::node().
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 3385 of file dxGraphicsStateGuardian9.cxx.
References LMatrix4f::convert_mat(), PointLight::get_attenuation(), LVecBase3f::get_data(), LVecBase4f::get_data(), get_light_color(), PointLight::get_point(), PointLight::get_specular_color(), and NodePath::get_transform().
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 3432 of file dxGraphicsStateGuardian9.cxx.
References LMatrix4f::convert_mat(), LVecBase3f::get_data(), LVecBase4f::get_data(), DirectionalLight::get_direction(), get_light_color(), DirectionalLight::get_specular_color(), and NodePath::get_transform().
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 3489 of file dxGraphicsStateGuardian9.cxx.
References LMatrix4f::convert_mat(), Spotlight::get_attenuation(), LVecBase3f::get_data(), LVecBase4f::get_data(), Spotlight::get_exponent(), Lens::get_hfov(), LensNode::get_lens(), get_light_color(), Lens::get_nodal_point(), Spotlight::get_specular_color(), NodePath::get_transform(), and Lens::get_view_vector().
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 5458 of file dxGraphicsStateGuardian9.cxx.
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 5204 of file dxGraphicsStateGuardian9.cxx.
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.
void DXGraphicsStateGuardian9::close_gsg | ( | ) | [protected, virtual] |
This is called by the associated GraphicsWindow when close_window() is called.
It should null out the _win pointer and possibly free any open resources associated with the GSG.
Reimplemented from GraphicsStateGuardian.
Definition at line 4120 of file dxGraphicsStateGuardian9.cxx.
References Thread::get_current_thread(), and GraphicsStateGuardian::release_all().
void DXGraphicsStateGuardian9::copy_pres_reset | ( | DXScreenData * | new_context | ) | [protected] |
copies the PresReset from passed DXScreenData
Definition at line 4909 of file dxGraphicsStateGuardian9.cxx.
Referenced by wdxGraphicsWindow9::open_window().
void DXGraphicsStateGuardian9::do_auto_rescale_normal | ( | ) | [protected] |
Issues the appropriate DX commands to either rescale or normalize the normals according to the current transform.
Definition at line 4227 of file dxGraphicsStateGuardian9.cxx.
References set_render_state().
Referenced by do_issue_transform().
bool DXGraphicsStateGuardian9::do_framebuffer_copy_to_ram | ( | Texture * | tex, |
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 2056 of file dxGraphicsStateGuardian9.cxx.
References DXTextureContext9::d3d_surface_to_texture(), Texture::get_component_type(), Texture::get_format(), DisplayRegion::get_region_pixels_i(), Texture::get_texture_type(), Texture::get_x_size(), Texture::get_y_size(), Texture::get_z_size(), Texture::has_ram_image(), set_read_buffer(), and Texture::setup_texture().
Referenced by framebuffer_copy_to_ram(), and framebuffer_copy_to_texture().
void DXGraphicsStateGuardian9::do_issue_blending | ( | ) | [protected] |
Called after any of the things that might change blending state have changed, this function is responsible for setting the appropriate color blending mode based on the current properties.
Definition at line 3908 of file dxGraphicsStateGuardian9.cxx.
References get_blend_func(), ColorWriteAttrib::get_channels(), TransparencyAttrib::get_mode(), ColorBlendAttrib::get_mode(), and set_render_state().
Referenced by set_state_and_transform().
void DXGraphicsStateGuardian9::do_issue_stencil | ( | ) | [protected] |
Set stencil render states.
Definition at line 5360 of file dxGraphicsStateGuardian9.cxx.
Referenced by set_state_and_transform().
void DXGraphicsStateGuardian9::do_issue_transform | ( | ) | [protected] |
Sends the indicated transform matrix to the graphics API to be applied to future vertices.
This transform is the internal_transform, already converted into the GSG's internal coordinate system.
Definition at line 2813 of file dxGraphicsStateGuardian9.cxx.
References do_auto_rescale_normal(), LMatrix4f::get_data(), and TransformState::get_mat().
Referenced by reissue_transforms(), and set_state_and_transform().
void DXGraphicsStateGuardian9::draw_indexed_primitive_up | ( | D3DPRIMITIVETYPE | primitive_type, |
unsigned int | min_index, | ||
unsigned int | max_index, | ||
unsigned int | num_primitives, | ||
const unsigned char * | index_data, | ||
D3DFORMAT | index_type, | ||
const unsigned char * | buffer, | ||
size_t | stride | ||
) | [protected] |
Issues the DrawIndexedPrimitiveUP call to draw the indicated primitive_type from the given buffer.
As in draw_primitive_up(), above, the parameter list is not exactly one-for-one with the DrawIndexedPrimitiveUP() call, but it's similar (in particular, we pass max_index instead of NumVertices, which always seemed ambiguous to me).
Definition at line 5155 of file dxGraphicsStateGuardian9.cxx.
References get_safe_buffer_start().
Referenced by draw_lines(), draw_triangles(), draw_trifans(), and draw_tristrips().
bool DXGraphicsStateGuardian9::draw_lines | ( | const GeomPrimitivePipelineReader * | reader, |
bool | force | ||
) | [virtual] |
Draws a series of disconnected line segments.
Reimplemented from GraphicsStateGuardian.
Definition at line 1745 of file dxGraphicsStateGuardian9.cxx.
References apply_index_buffer(), draw_indexed_primitive_up(), draw_primitive_up(), GeomVertexFormat::get_array(), get_index_type(), GraphicsStateGuardian::get_prepared_objects(), GeomVertexArrayDataHandle::get_read_pointer(), and GeomVertexArrayFormat::get_stride().
bool DXGraphicsStateGuardian9::draw_linestrips | ( | const GeomPrimitivePipelineReader * | reader, |
bool | force | ||
) | [virtual] |
Draws a series of line strips.
Reimplemented from GraphicsStateGuardian.
Definition at line 1813 of file dxGraphicsStateGuardian9.cxx.
bool DXGraphicsStateGuardian9::draw_points | ( | const GeomPrimitivePipelineReader * | reader, |
bool | force | ||
) | [virtual] |
Draws a series of disconnected points.
Reimplemented from GraphicsStateGuardian.
Definition at line 1823 of file dxGraphicsStateGuardian9.cxx.
References draw_primitive_up(), GeomVertexFormat::get_array(), GeomVertexArrayDataHandle::get_read_pointer(), and GeomVertexArrayFormat::get_stride().
void DXGraphicsStateGuardian9::draw_primitive_up | ( | D3DPRIMITIVETYPE | primitive_type, |
unsigned int | primitive_count, | ||
unsigned int | first_vertex, | ||
unsigned int | num_vertices, | ||
const unsigned char * | buffer, | ||
size_t | stride | ||
) | [protected] |
Issues the DrawPrimitiveUP call to draw the indicated primitive_type from the given buffer.
We add the num_vertices parameter, so we can determine the size of the buffer.
Definition at line 5105 of file dxGraphicsStateGuardian9.cxx.
References get_safe_buffer_start().
Referenced by draw_lines(), draw_points(), draw_triangles(), draw_trifans(), and draw_tristrips().
bool DXGraphicsStateGuardian9::draw_triangles | ( | const GeomPrimitivePipelineReader * | reader, |
bool | force | ||
) | [virtual] |
Draws a series of disconnected triangles.
Reimplemented from GraphicsStateGuardian.
Definition at line 1399 of file dxGraphicsStateGuardian9.cxx.
References apply_index_buffer(), draw_indexed_primitive_up(), draw_primitive_up(), GeomVertexFormat::get_array(), get_index_type(), GraphicsStateGuardian::get_prepared_objects(), GeomVertexArrayDataHandle::get_read_pointer(), and GeomVertexArrayFormat::get_stride().
bool DXGraphicsStateGuardian9::draw_trifans | ( | const GeomPrimitivePipelineReader * | reader, |
bool | force | ||
) | [virtual] |
Draws a series of triangle fans.
Reimplemented from GraphicsStateGuardian.
Definition at line 1637 of file dxGraphicsStateGuardian9.cxx.
References apply_index_buffer(), draw_indexed_primitive_up(), draw_primitive_up(), GeomVertexFormat::get_array(), get_index_type(), GraphicsStateGuardian::get_prepared_objects(), GeomVertexArrayDataHandle::get_read_pointer(), and GeomVertexArrayFormat::get_stride().
bool DXGraphicsStateGuardian9::draw_tristrips | ( | const GeomPrimitivePipelineReader * | reader, |
bool | force | ||
) | [virtual] |
Draws a series of triangle strips.
Reimplemented from GraphicsStateGuardian.
Definition at line 1468 of file dxGraphicsStateGuardian9.cxx.
References apply_index_buffer(), draw_indexed_primitive_up(), draw_primitive_up(), GeomVertexFormat::get_array(), get_index_type(), GraphicsStateGuardian::get_prepared_objects(), GeomVertexArrayDataHandle::get_read_pointer(), and GeomVertexArrayFormat::get_stride().
void DXGraphicsStateGuardian9::dx_cleanup | ( | ) | [protected] |
Clean up the DirectX environment, accounting for exit()
Definition at line 4628 of file dxGraphicsStateGuardian9.cxx.
References free_nondx_resources().
Referenced by wdxGraphicsWindow9::open_window().
void DXGraphicsStateGuardian9::enable_clip_plane | ( | int | plane_id, |
bool | enable | ||
) | [protected, virtual] |
Intended to be overridden by a derived class to enable the indicated clip_plane id.
A specific PlaneNode will already have been bound to this id via bind_clip_plane().
Reimplemented from GraphicsStateGuardian.
Definition at line 4074 of file dxGraphicsStateGuardian9.cxx.
References set_render_state().
void DXGraphicsStateGuardian9::enable_light | ( | int | light_id, |
bool | enable | ||
) | [protected, virtual] |
Intended to be overridden by a derived class to enable the indicated light id.
A specific Light will already have been bound to this id via bind_light().
Reimplemented from GraphicsStateGuardian.
Definition at line 4055 of file dxGraphicsStateGuardian9.cxx.
void DXGraphicsStateGuardian9::enable_lighting | ( | bool | enable | ) | [protected, virtual] |
Intended to be overridden by a derived class to enable or disable the use of lighting overall.
This is called by issue_light() according to whether any lights are in use or not.
Reimplemented from GraphicsStateGuardian.
Definition at line 4024 of file dxGraphicsStateGuardian9.cxx.
References set_render_state().
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 1861 of file dxGraphicsStateGuardian9.cxx.
References LMatrix4f::get_data(), and set_render_state().
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 1153 of file dxGraphicsStateGuardian9.cxx.
References report_texmgr_stats().
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 1102 of file dxGraphicsStateGuardian9.cxx.
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 403 of file dxGraphicsStateGuardian9.cxx.
References DXTextureContext9::extract_texture_data(), Texture::get_num_views(), GraphicsStateGuardian::get_prepared_objects(), and Texture::prepare_now().
bool DXGraphicsStateGuardian9::framebuffer_copy_to_ram | ( | Texture * | tex, |
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 2041 of file dxGraphicsStateGuardian9.cxx.
References do_framebuffer_copy_to_ram().
bool DXGraphicsStateGuardian9::framebuffer_copy_to_texture | ( | Texture * | tex, |
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 1890 of file dxGraphicsStateGuardian9.cxx.
References DXTextureContext9::create_texture(), do_framebuffer_copy_to_ram(), AdaptiveLruPage::enqueue_lru(), DXTextureContext9::get_d3d_2d_texture(), GraphicsStateGuardian::get_prepared_objects(), DisplayRegion::get_region_pixels_i(), DisplayRegion::get_tex_view_offset(), TextureContext::get_texture(), Texture::get_texture_type(), Texture::get_x_size(), Texture::get_y_size(), TextureContext::mark_loaded(), Texture::prepare_now(), set_read_buffer(), Texture::set_render_to_texture(), and Texture::set_size_padded().
void DXGraphicsStateGuardian9::free_d3d_device | ( | ) | [protected] |
setup for re-calling dx_init(), this is not the final exit cleanup routine (see dx_cleanup)
Definition at line 4159 of file dxGraphicsStateGuardian9.cxx.
References BitMask< WType, nbits >::clear(), free_nondx_resources(), and GraphicsStateGuardian::release_all().
void DXGraphicsStateGuardian9::free_nondx_resources | ( | ) | [protected] |
Frees some memory that was explicitly allocated within the dxgsg.
Definition at line 4149 of file dxGraphicsStateGuardian9.cxx.
Referenced by dx_cleanup(), and free_d3d_device().
D3DBLEND DXGraphicsStateGuardian9::get_blend_func | ( | ColorBlendAttrib::Operand | operand | ) | [static, protected] |
Maps from ColorBlendAttrib::Operand to D3DBLEND value.
Definition at line 4263 of file dxGraphicsStateGuardian9.cxx.
Referenced by do_issue_blending().
D3DFOGMODE DXGraphicsStateGuardian9::get_fog_mode_type | ( | Fog::Mode | m | ) | [inline, static, protected] |
Maps from the fog types to gl version.
Definition at line 105 of file dxGraphicsStateGuardian9.I.
bool DXGraphicsStateGuardian9::get_gamma_table | ( | void | ) | [static] |
Static function for getting the original gamma.
Definition at line 5570 of file dxGraphicsStateGuardian9.cxx.
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 3549 of file dxGraphicsStateGuardian9.cxx.
Referenced by DXIndexBufferContext9::allocate_ibuffer(), draw_lines(), draw_triangles(), draw_trifans(), and draw_tristrips().
const D3DCOLORVALUE & DXGraphicsStateGuardian9::get_light_color | ( | Light * | light | ) | const [protected] |
Returns the array of four floats that should be issued as the light's color, as scaled by the current value of _light_color_scale, in the case of color_scale_via_lighting.
Definition at line 4246 of file dxGraphicsStateGuardian9.cxx.
References Light::get_color(), and LVecBase4f::get_data().
Referenced by bind_light().
unsigned char * DXGraphicsStateGuardian9::get_safe_buffer_start | ( | ) | [inline, static, protected] |
Returns the address of a 64K buffer that is allocated at the beginning of a 64K block.
Definition at line 135 of file dxGraphicsStateGuardian9.I.
Referenced by draw_indexed_primitive_up(), and draw_primitive_up().
bool DXGraphicsStateGuardian9::get_supports_cg_profile | ( | const string & | name | ) | const [virtual] |
Returns true if this particular GSG supports the specified Cg Shader Profile.
Reimplemented from GraphicsStateGuardian.
Definition at line 5668 of file dxGraphicsStateGuardian9.cxx.
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 226 of file dxGraphicsStateGuardian9.I.
D3DTRANSFORMSTATETYPE DXGraphicsStateGuardian9::get_tex_mat_sym | ( | int | stage_index | ) | [inline, static, protected] |
Returns the nth D3DTS_TEXTURE(n) constant.
Definition at line 124 of file dxGraphicsStateGuardian9.I.
DWORD DXGraphicsStateGuardian9::get_texture_argument | ( | TextureStage::CombineSource | source, |
TextureStage::CombineOperand | operand | ||
) | const [protected] |
Returns the D3DTA value corresponding to the indicated TextureStage::CombineSource and TextureStage::CombineOperand enumerated types.
Definition at line 5041 of file dxGraphicsStateGuardian9.cxx.
References get_texture_argument_modifier().
DWORD DXGraphicsStateGuardian9::get_texture_argument_modifier | ( | TextureStage::CombineOperand | operand | ) | [static, protected] |
Returns the extra bits that modify the D3DTA argument, according to the indicated TextureStage::CombineOperand enumerated type.
Definition at line 5074 of file dxGraphicsStateGuardian9.cxx.
Referenced by get_texture_argument().
D3DTEXTUREOP DXGraphicsStateGuardian9::get_texture_operation | ( | TextureStage::CombineMode | mode, |
int | scale | ||
) | [static, protected] |
Returns the D3DTEXTUREOP value corresponding to the indicated TextureStage::CombineMode enumerated type.
Definition at line 4992 of file dxGraphicsStateGuardian9.cxx.
D3DTEXTUREADDRESS DXGraphicsStateGuardian9::get_texture_wrap_mode | ( | Texture::WrapMode | wm | ) | [inline, static, protected] |
Maps from the Texture's internal wrap mode symbols to GL's.
Definition at line 82 of file dxGraphicsStateGuardian9.I.
Referenced by apply_texture().
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 23 of file dxGraphicsStateGuardian9.I.
Referenced by apply_texture(), and set_ambient_light().
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 896 of file dxGraphicsStateGuardian9.cxx.
References DisplayRegionPipelineReader::get_region_pixels_i(), and set_render_state().
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 645 of file dxGraphicsStateGuardian9.cxx.
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 991 of file dxGraphicsStateGuardian9.cxx.
References LMatrix4f::get_data().
Referenced by reissue_transforms().
ShaderContext * DXGraphicsStateGuardian9::prepare_shader | ( | Shader * | shader | ) | [virtual] |
Compile a vertex/fragment shader body.
Reimplemented from GraphicsStateGuardian.
Definition at line 426 of file dxGraphicsStateGuardian9.cxx.
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().
Implements GraphicsStateGuardianBase.
Definition at line 190 of file dxGraphicsStateGuardian9.cxx.
References Texture::get_ram_image_compression(), GraphicsStateGuardian::get_supports_compressed_texture_format(), and TextureContext::get_texture().
virtual VertexBufferContext* DXGraphicsStateGuardian9::prepare_vertex_buffer | ( | GeomVertexArrayData * | data | ) | [virtual] |
Prepares the indicated buffer for retained-mode rendering.
Reimplemented from GraphicsStateGuardian.
void DXGraphicsStateGuardian9::reissue_transforms | ( | ) | [protected, virtual] |
Called by clear_state_and_transform() to ensure that the current modelview and projection matrices are properly loaded in the graphics state, after a callback might have mucked them up.
Reimplemented from GraphicsStateGuardian.
Definition at line 4010 of file dxGraphicsStateGuardian9.cxx.
References do_issue_transform(), and prepare_lens().
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 716 of file dxGraphicsStateGuardian9.cxx.
void DXGraphicsStateGuardian9::release_shader | ( | ShaderContext * | sc | ) | [virtual] |
Releases the resources allocated by prepare_shader.
Reimplemented from GraphicsStateGuardian.
Definition at line 440 of file dxGraphicsStateGuardian9.cxx.
bool DXGraphicsStateGuardian9::release_swap_chain | ( | DXScreenData * | new_context | ) | [protected] |
Release the swap chain on this DXScreenData.
Definition at line 4891 of file dxGraphicsStateGuardian9.cxx.
Referenced by wdxGraphicsWindow9::close_window(), and wdxGraphicsWindow9::reset_window().
void DXGraphicsStateGuardian9::release_texture | ( | TextureContext * | tc | ) | [virtual] |
Frees the GL resources previously allocated for the texture.
Reimplemented from GraphicsStateGuardian.
Definition at line 385 of file dxGraphicsStateGuardian9.cxx.
virtual void DXGraphicsStateGuardian9::release_vertex_buffer | ( | VertexBufferContext * | vbc | ) | [virtual] |
Frees the resources previously allocated via a call to prepare_data(), including deleting the VertexBufferContext itself, if necessary.
Reimplemented from GraphicsStateGuardian.
void DXGraphicsStateGuardian9::report_texmgr_stats | ( | ) | [protected] |
Reports the DX texture manager's activity to PStats.
Definition at line 4326 of file dxGraphicsStateGuardian9.cxx.
Referenced by end_frame().
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 2267 of file dxGraphicsStateGuardian9.cxx.
References GraphicsStateGuardianBase::add_gsg(), BitMask< WType, nbits >::clear_bit(), set_cg_device(), set_render_state(), and set_texture_stage_state().
HRESULT DXGraphicsStateGuardian9::reset_d3d_device | ( | D3DPRESENT_PARAMETERS * | presentation_params, |
DXScreenData ** | screen = NULL |
||
) | [protected] |
This function checks current device's framebuffer dimension against passed p_presentation_params backbuffer dimension to determine a device reset if there is only one window or it is the main window or fullscreen mode then, it resets the device.
Finally it returns the new DXScreenData through parameter screen
Definition at line 4656 of file dxGraphicsStateGuardian9.cxx.
References Thread::get_current_thread(), GraphicsStateGuardian::get_engine(), GraphicsStateGuardian::mark_new(), GraphicsStateGuardian::release_all(), GraphicsStateGuardian::release_all_index_buffers(), GraphicsStateGuardian::release_all_vertex_buffers(), and GraphicsEngine::reset_all_windows().
void DXGraphicsStateGuardian9::restore_gamma | ( | ) | [virtual] |
Restore original gamma.
Reimplemented from GraphicsStateGuardian.
Definition at line 5646 of file dxGraphicsStateGuardian9.cxx.
References static_set_gamma().
void DXGraphicsStateGuardian9::set_ambient_light | ( | const LColor & | color | ) | [protected, virtual] |
Intended to be overridden by a derived class to indicate the color of the ambient light that should be in effect.
This is called by issue_light() after all other lights have been enabled or disabled.
Reimplemented from GraphicsStateGuardian.
Definition at line 4037 of file dxGraphicsStateGuardian9.cxx.
References LColor_to_D3DCOLOR(), and set_render_state().
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 5690 of file dxGraphicsStateGuardian9.cxx.
Referenced by atexit_function(), wdxGraphicsWindow9::close_window(), and reset().
void DXGraphicsStateGuardian9::set_draw_buffer | ( | const RenderBuffer & | rb | ) | [protected] |
Sets up the glDrawBuffer to render into the buffer indicated by the RenderBuffer object.
This only sets up the color bits; it does not affect the depth, stencil, accum layers.
Definition at line 4195 of file dxGraphicsStateGuardian9.cxx.
bool DXGraphicsStateGuardian9::set_gamma | ( | PN_stdfloat | gamma | ) | [virtual] |
Non static version of setting gamma.
Returns true on success.
Reimplemented from GraphicsStateGuardian.
Definition at line 5629 of file dxGraphicsStateGuardian9.cxx.
References static_set_gamma().
void DXGraphicsStateGuardian9::set_read_buffer | ( | const RenderBuffer & | rb | ) | [protected] |
Vestigial analog of glReadBuffer.
Definition at line 4206 of file dxGraphicsStateGuardian9.cxx.
Referenced by do_framebuffer_copy_to_ram(), and framebuffer_copy_to_texture().
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 158 of file dxGraphicsStateGuardian9.I.
Referenced by begin_draw_primitives(), do_auto_rescale_normal(), do_issue_blending(), enable_clip_plane(), enable_lighting(), end_draw_primitives(), prepare_display_region(), reset(), and set_ambient_light().
void DXGraphicsStateGuardian9::set_render_target | ( | ) | [protected] |
Set render target to the backbuffer of current swap chain.
Definition at line 4421 of file dxGraphicsStateGuardian9.cxx.
Referenced by wdxGraphicsWindow9::begin_frame().
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 202 of file dxGraphicsStateGuardian9.I.
Referenced by apply_texture().
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 3159 of file dxGraphicsStateGuardian9.cxx.
References BitMask< WType, nbits >::clear_bit(), GraphicsStateGuardian::determine_target_texture(), do_issue_blending(), GraphicsStateGuardian::do_issue_clip_plane(), GraphicsStateGuardian::do_issue_color(), GraphicsStateGuardian::do_issue_light(), do_issue_stencil(), do_issue_transform(), BitMask< WType, nbits >::get_bit(), and BitMask< WType, nbits >::set_bit().
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 180 of file dxGraphicsStateGuardian9.I.
Referenced by apply_texture(), and reset().
void DXGraphicsStateGuardian9::show_frame | ( | ) | [protected] |
redraw primary buffer
Definition at line 4837 of file dxGraphicsStateGuardian9.cxx.
Referenced by wdxGraphicsWindow9::end_flip().
bool DXGraphicsStateGuardian9::static_set_gamma | ( | bool | restore, |
PN_stdfloat | gamma | ||
) | [static] |
Static function for setting gamma which is needed for atexit.
Definition at line 5597 of file dxGraphicsStateGuardian9.cxx.
Referenced by atexit_function(), restore_gamma(), and set_gamma().
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 318 of file dxGraphicsStateGuardian9.cxx.
References AdaptiveLruPage::enqueue_lru(), TextureContext::get_texture(), upload_texture(), and TextureContext::was_modified().
Referenced by apply_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 345 of file dxGraphicsStateGuardian9.cxx.
References GraphicsStateGuardian::async_reload_texture(), 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().
Referenced by update_texture().