From 6829badc7e59bc5b011b3981320ed1f145281f81 Mon Sep 17 00:00:00 2001 From: David Rose Date: Wed, 27 May 2009 02:36:43 +0000 Subject: [PATCH] force-parasite-buffer --- panda/src/display/config_display.cxx | 11 +++++++++++ panda/src/display/config_display.h | 1 + panda/src/display/graphicsEngine.cxx | 11 +++++++++++ 3 files changed, 23 insertions(+) diff --git a/panda/src/display/config_display.cxx b/panda/src/display/config_display.cxx index 3ebb12addb..2c2083c75e 100644 --- a/panda/src/display/config_display.cxx +++ b/panda/src/display/config_display.cxx @@ -125,6 +125,17 @@ ConfigVariableBool prefer_parasite_buffer "cause problems if the user subsequently resizes the window " "smaller than the buffer.")); +ConfigVariableBool force_parasite_buffer +("force-parasite-buffer", false, + PRC_DESC("Set this true to make GraphicsOutput::make_texture_buffer() really " + "strongly prefer ParasiteBuffers over conventional offscreen buffers. " + "With this set, it will create a ParasiteBuffer every time an offscreen " + "buffer is requested, even if this means reducing the buffer size to fit " + "within the window. The only exceptions are for buffers that, by their " + "nature, really cannot use ParasiteBuffers (like depth textures). You might " + "set this true if you don't trust your graphics driver's support for " + "offscreen buffers.")); + ConfigVariableBool prefer_single_buffer ("prefer-single-buffer", true, PRC_DESC("Set this true to make GraphicsOutput::make_render_texture() first " diff --git a/panda/src/display/config_display.h b/panda/src/display/config_display.h index 487dec0e71..c7fabef3f4 100644 --- a/panda/src/display/config_display.h +++ b/panda/src/display/config_display.h @@ -47,6 +47,7 @@ extern EXPCL_PANDA_DISPLAY ConfigVariableString screenshot_extension; extern EXPCL_PANDA_DISPLAY ConfigVariableBool prefer_texture_buffer; extern EXPCL_PANDA_DISPLAY ConfigVariableBool prefer_parasite_buffer; +extern EXPCL_PANDA_DISPLAY ConfigVariableBool force_parasite_buffer; extern EXPCL_PANDA_DISPLAY ConfigVariableBool prefer_single_buffer; extern EXPCL_PANDA_DISPLAY ConfigVariableInt max_texture_stages; diff --git a/panda/src/display/graphicsEngine.cxx b/panda/src/display/graphicsEngine.cxx index 54a6232327..44e61e4fc3 100644 --- a/panda/src/display/graphicsEngine.cxx +++ b/panda/src/display/graphicsEngine.cxx @@ -365,6 +365,17 @@ make_output(GraphicsPipe *pipe, return buffer; } + // If force-parasite-buffer is set, we create a parasite buffer even + // if it's less than ideal. You might set this if you really don't + // trust your graphics driver's support for offscreen buffers. + if (force_parasite_buffer && can_use_parasite) { + ParasiteBuffer *buffer = new ParasiteBuffer(host, name, x_size, y_size, flags); + buffer->_sort = sort; + do_add_window(buffer, threading_model); + do_add_gsg(host->get_gsg(), pipe, threading_model); + return buffer; + } + // Ask the pipe to create a window. for (int retry=0; retry<10; retry++) {