more fixes to fullscreen/windowed switch

This commit is contained in:
David Rose 2006-07-20 19:46:24 +00:00
parent 76ff8ab6fd
commit d0cf3615bc
4 changed files with 58 additions and 0 deletions

View File

@ -2896,6 +2896,34 @@ do_issue_blending() {
_d3d_device->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE); _d3d_device->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
} }
////////////////////////////////////////////////////////////////////
// Function: DXGraphicsStateGuardian8::close_gsg
// Access: Protected, Virtual
// Description: 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.
////////////////////////////////////////////////////////////////////
void DXGraphicsStateGuardian8::
close_gsg() {
GraphicsStateGuardian::close_gsg();
// Unlike in OpenGL, in DX8 it is safe to try to explicitly release
// any textures here. And it may even be a good idea.
if (_prepared_objects->get_ref_count() == 1) {
release_all_textures();
release_all_geoms();
release_all_vertex_buffers();
release_all_index_buffers();
// Now we need to actually delete all of the objects we just
// released.
Thread *current_thread = Thread::get_current_thread();
_prepared_objects->begin_frame(this, current_thread);
_prepared_objects->end_frame(current_thread);
}
}
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: DXGraphicsStateGuardian8::free_nondx_resources // Function: DXGraphicsStateGuardian8::free_nondx_resources
// Access: Public // Access: Public

View File

@ -141,6 +141,7 @@ protected:
virtual void enable_clip_plane(int plane_id, bool enable); virtual void enable_clip_plane(int plane_id, bool enable);
virtual void bind_clip_plane(const NodePath &plane, int plane_id); virtual void bind_clip_plane(const NodePath &plane, int plane_id);
virtual void close_gsg();
void free_nondx_resources(); void free_nondx_resources();
void free_d3d_device(); void free_d3d_device();

View File

@ -3996,6 +3996,34 @@ bind_clip_plane(const NodePath &plane, int plane_id) {
} }
} }
////////////////////////////////////////////////////////////////////
// Function: DXGraphicsStateGuardian9::close_gsg
// Access: Protected, Virtual
// Description: 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.
////////////////////////////////////////////////////////////////////
void DXGraphicsStateGuardian9::
close_gsg() {
GraphicsStateGuardian::close_gsg();
// Unlike in OpenGL, in DX9 it is safe to try to explicitly release
// any textures here. And it may even be a good idea.
if (_prepared_objects->get_ref_count() == 1) {
release_all_textures();
release_all_geoms();
release_all_vertex_buffers();
release_all_index_buffers();
// Now we need to actually delete all of the objects we just
// released.
Thread *current_thread = Thread::get_current_thread();
_prepared_objects->begin_frame(this, current_thread);
_prepared_objects->end_frame(current_thread);
}
}
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Function: DXGraphicsStateGuardian9::free_nondx_resources // Function: DXGraphicsStateGuardian9::free_nondx_resources
// Access: Public // Access: Public

View File

@ -187,6 +187,7 @@ protected:
virtual void enable_clip_plane(int plane_id, bool enable); virtual void enable_clip_plane(int plane_id, bool enable);
virtual void bind_clip_plane(const NodePath &plane, int plane_id); virtual void bind_clip_plane(const NodePath &plane, int plane_id);
virtual void close_gsg();
void free_nondx_resources(); void free_nondx_resources();
void free_d3d_device(); void free_d3d_device();