Fix graphics buffer tracking.

This commit is contained in:
aignacio_sf 2009-01-08 22:30:14 +00:00
parent f4b377e90d
commit b3f25daed7
4 changed files with 17 additions and 5 deletions

View File

@ -3749,11 +3749,11 @@ reset_d3d_device(D3DPRESENT_PARAMETERS *presentation_params,
// release graphics buffer surfaces
{
wdxGraphicsBuffer8 *graphics_buffer;
list <wdxGraphicsBuffer8 *>::iterator graphics_buffer_iterator;
list <wdxGraphicsBuffer8 **>::iterator graphics_buffer_iterator;
for (graphics_buffer_iterator = _graphics_buffer_list.begin( ); graphics_buffer_iterator != _graphics_buffer_list.end( ); graphics_buffer_iterator++)
{
graphics_buffer = (*graphics_buffer_iterator);
graphics_buffer = **graphics_buffer_iterator;
if (graphics_buffer -> _color_backing_store)
{
graphics_buffer -> _color_backing_store -> Release ( );
@ -4341,6 +4341,7 @@ void dx_set_stencil_functions (StencilRenderStates *stencil_render_states) {
////////////////////////////////////////////////////////////////////
void DXGraphicsStateGuardian8::
do_issue_stencil() {
if (!_supports_stencil) {
return;
}

View File

@ -269,7 +269,7 @@ protected:
static unsigned char *_temp_buffer;
static unsigned char *_safe_buffer_start;
list <wdxGraphicsBuffer8 *> _graphics_buffer_list;
list <wdxGraphicsBuffer8 **> _graphics_buffer_list;
public:
virtual TypeHandle get_type() const {

View File

@ -58,12 +58,16 @@ wdxGraphicsBuffer8(GraphicsPipe *pipe,
// same buffer we draw into.
_screenshot_buffer_type = _draw_buffer_type;
_this = 0;
if (_gsg) {
// save to GSG list to handle device lost issues
DXGraphicsStateGuardian8 *dxgsg;
dxgsg = DCAST (DXGraphicsStateGuardian8, _gsg);
dxgsg -> _graphics_buffer_list.push_back(this);
_this = new (wdxGraphicsBuffer8 *);
*_this = this;
dxgsg -> _graphics_buffer_list.push_back(_this);
}
}
@ -81,7 +85,12 @@ wdxGraphicsBuffer8::
DXGraphicsStateGuardian8 *dxgsg;
dxgsg = DCAST (DXGraphicsStateGuardian8, _gsg);
dxgsg -> _graphics_buffer_list.remove(this);
if (_this) {
dxgsg -> _graphics_buffer_list.remove(_this);
}
_this = 0;
_gsg.clear();
_gsg = 0;
}
}

View File

@ -69,6 +69,8 @@ private:
int _backing_sizex;
int _backing_sizey;
wdxGraphicsBuffer8 **_this;
public:
static TypeHandle get_class_type() {
return _type_handle;