From 9dc875c80da425ed2cbeb906942891021afa605e Mon Sep 17 00:00:00 2001 From: David Rose Date: Tue, 16 Aug 2005 20:56:26 +0000 Subject: [PATCH] be less aggressive when window is resized or moved --- panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx | 5 +++- panda/src/dxgsg8/wdxGraphicsWindow8.cxx | 30 +++++++++++-------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx b/panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx index 32a9fb16a4..2ce940d03e 100644 --- a/panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx +++ b/panda/src/dxgsg8/dxGraphicsStateGuardian8.cxx @@ -3060,7 +3060,10 @@ reset_d3d_device(D3DPRESENT_PARAMETERS *presentation_params, // Calling this forces all of the textures and vbuffers to be // regenerated. It appears to be necessary on some cards but not // on others. - release_all(); + // release_all(); + // On second thought, let's try releasing the vertex buffers only. + release_all_vertex_buffers(); + release_all_index_buffers(); // for windowed mode make sure our format matches the desktop fmt, // in case the desktop mode has been changed diff --git a/panda/src/dxgsg8/wdxGraphicsWindow8.cxx b/panda/src/dxgsg8/wdxGraphicsWindow8.cxx index 34aa7fd029..b09f9ad237 100644 --- a/panda/src/dxgsg8/wdxGraphicsWindow8.cxx +++ b/panda/src/dxgsg8/wdxGraphicsWindow8.cxx @@ -364,20 +364,24 @@ handle_reshape() { WindowProperties props = get_properties(); int x_size = props.get_x_size(); int y_size = props.get_y_size(); - bool resize_succeeded = reset_device_resize_window(x_size, y_size); - if (wdxdisplay8_cat.is_debug()) { - if (!resize_succeeded) { - wdxdisplay8_cat.debug() - << "windowed_resize to size: (" << x_size << ", " << y_size - << ") failed due to out-of-memory\n"; - } else { - int x_origin = props.get_x_origin(); - int y_origin = props.get_y_origin(); - wdxdisplay8_cat.debug() - << "windowed_resize to origin: (" << x_origin << ", " - << y_origin << "), size: (" << x_size - << ", " << y_size << ")\n"; + if (_wcontext._presentation_params.BackBufferWidth != x_size || + _wcontext._presentation_params.BackBufferHeight != y_size) { + bool resize_succeeded = reset_device_resize_window(x_size, y_size); + + if (wdxdisplay8_cat.is_debug()) { + if (!resize_succeeded) { + wdxdisplay8_cat.debug() + << "windowed_resize to size: (" << x_size << ", " << y_size + << ") failed due to out-of-memory\n"; + } else { + int x_origin = props.get_x_origin(); + int y_origin = props.get_y_origin(); + wdxdisplay8_cat.debug() + << "windowed_resize to origin: (" << x_origin << ", " + << y_origin << "), size: (" << x_size + << ", " << y_size << ")\n"; + } } } }