Browse Source

force-parasite-buffer

David Rose 16 years ago
parent
commit
6829badc7e

+ 11 - 0
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 "

+ 1 - 0
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;

+ 11 - 0
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++) {