mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-17 12:12:10 -04:00
Fix graphics buffer tracking.
This commit is contained in:
parent
f81493e6e0
commit
f4b377e90d
@ -4699,11 +4699,11 @@ reset_d3d_device(D3DPRESENT_PARAMETERS *presentation_params,
|
||||
// release graphics buffer surfaces
|
||||
{
|
||||
wdxGraphicsBuffer9 *graphics_buffer;
|
||||
list <wdxGraphicsBuffer9 *>::iterator graphics_buffer_iterator;
|
||||
list <wdxGraphicsBuffer9 **>::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 ( );
|
||||
|
@ -362,7 +362,7 @@ protected:
|
||||
|
||||
bool _supports_stream_offset;
|
||||
|
||||
list <wdxGraphicsBuffer9 *> _graphics_buffer_list;
|
||||
list <wdxGraphicsBuffer9 **> _graphics_buffer_list;
|
||||
|
||||
int _supports_gamma_calibration;
|
||||
|
||||
|
@ -52,13 +52,20 @@ wdxGraphicsBuffer9(GraphicsPipe *pipe,
|
||||
|
||||
_shared_depth_buffer = 0;
|
||||
_debug = 0;
|
||||
_this = 0;
|
||||
|
||||
if (_debug) {
|
||||
cout << "+++++ wdxGraphicsBuffer9 constructor " << this << " " << this -> get_name ( ) << "\n";
|
||||
}
|
||||
|
||||
if (_gsg) {
|
||||
// save to GSG list to handle device lost issues
|
||||
DXGraphicsStateGuardian9 *dxgsg;
|
||||
|
||||
dxgsg = DCAST (DXGraphicsStateGuardian9, _gsg);
|
||||
dxgsg -> _graphics_buffer_list.push_back(this);
|
||||
_this = new (wdxGraphicsBuffer9 *);
|
||||
*_this = this;
|
||||
dxgsg -> _graphics_buffer_list.push_back(_this);
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,12 +77,21 @@ wdxGraphicsBuffer9(GraphicsPipe *pipe,
|
||||
wdxGraphicsBuffer9::
|
||||
~wdxGraphicsBuffer9() {
|
||||
|
||||
if (_debug) {
|
||||
cout << "----- wdxGraphicsBuffer9 destructor " << this << " " << this -> get_name ( ) << "\n";
|
||||
}
|
||||
|
||||
if (_gsg) {
|
||||
// remove from GSG list
|
||||
DXGraphicsStateGuardian9 *dxgsg;
|
||||
|
||||
dxgsg = DCAST (DXGraphicsStateGuardian9, _gsg);
|
||||
dxgsg -> _graphics_buffer_list.remove(this);
|
||||
if (_this) {
|
||||
dxgsg -> _graphics_buffer_list.remove(_this);
|
||||
}
|
||||
_this = 0;
|
||||
_gsg.clear();
|
||||
_gsg = 0;
|
||||
}
|
||||
|
||||
// unshare shared depth buffer if any
|
||||
@ -96,10 +112,6 @@ wdxGraphicsBuffer9::
|
||||
graphics_buffer_iterator = _shared_depth_buffer_list.begin( );
|
||||
}
|
||||
}
|
||||
|
||||
if (_debug) {
|
||||
printf ("wdxGraphicsBuffer9 destructor \n");
|
||||
}
|
||||
|
||||
this -> close_buffer ( );
|
||||
}
|
||||
@ -480,7 +492,7 @@ rebuild_bitplanes() {
|
||||
RenderTexturePlane plane = get_texture_plane(i);
|
||||
|
||||
if (_debug) {
|
||||
printf ("i = %d, RenderTexturePlane = %d \n", i, plane);
|
||||
// printf ("i = %d, RenderTexturePlane = %d \n", i, plane);
|
||||
}
|
||||
|
||||
switch (plane) {
|
||||
@ -706,10 +718,6 @@ process_events() {
|
||||
void wdxGraphicsBuffer9::
|
||||
close_buffer() {
|
||||
|
||||
if (_gsg != (GraphicsStateGuardian *)NULL) {
|
||||
_gsg.clear();
|
||||
}
|
||||
|
||||
if (_color_backing_store) {
|
||||
_color_backing_store->Release();
|
||||
_color_backing_store = NULL;
|
||||
|
@ -77,6 +77,8 @@ private:
|
||||
wdxGraphicsBuffer9 *_shared_depth_buffer;
|
||||
list <wdxGraphicsBuffer9 *> _shared_depth_buffer_list;
|
||||
|
||||
wdxGraphicsBuffer9 **_this;
|
||||
|
||||
public:
|
||||
static TypeHandle get_class_type() {
|
||||
return _type_handle;
|
||||
|
Loading…
x
Reference in New Issue
Block a user