From fdca621619cdd9289a7f1c4f25c45733659e5f81 Mon Sep 17 00:00:00 2001 From: David Rose Date: Sat, 14 Jan 2012 16:21:53 +0000 Subject: [PATCH] slightly more robust handling of CallbackGraphicsWindow --- panda/src/display/callbackGraphicsWindow.cxx | 9 +++++++++ panda/src/display/graphicsEngine.cxx | 2 ++ panda/src/display/graphicsOutput.cxx | 8 ++++++++ 3 files changed, 19 insertions(+) diff --git a/panda/src/display/callbackGraphicsWindow.cxx b/panda/src/display/callbackGraphicsWindow.cxx index b0b29808f6..d89f7bc833 100644 --- a/panda/src/display/callbackGraphicsWindow.cxx +++ b/panda/src/display/callbackGraphicsWindow.cxx @@ -230,6 +230,15 @@ bool CallbackGraphicsWindow:: open_window() { // In this case, we assume the callback has handled the window // opening. + + // We also assume the callback has given us an accurate + // FramebufferProperties, but we do go ahead and assume some certain + // minimum properties. + _fb_properties.set_rgb_color(1); + + if (_fb_properties.get_color_bits() == 0) { + _fb_properties.set_color_bits(16); + } return true; } diff --git a/panda/src/display/graphicsEngine.cxx b/panda/src/display/graphicsEngine.cxx index 439bdfee42..f9ca6efdbf 100644 --- a/panda/src/display/graphicsEngine.cxx +++ b/panda/src/display/graphicsEngine.cxx @@ -416,6 +416,8 @@ make_output(GraphicsPipe *pipe, if ((precertify) && (gsg != 0) && (window->get_gsg()==gsg)) { do_add_window(window, threading_model); do_add_gsg(window->get_gsg(), pipe, threading_model); + display_cat.info() + << "Created output of type " << window->get_type() << "\n"; return window; } do_add_window(window, threading_model); diff --git a/panda/src/display/graphicsOutput.cxx b/panda/src/display/graphicsOutput.cxx index f3d06c1585..c0eaa95d6e 100644 --- a/panda/src/display/graphicsOutput.cxx +++ b/panda/src/display/graphicsOutput.cxx @@ -937,6 +937,14 @@ make_texture_buffer(const string &name, int x_size, int y_size, flags, get_gsg(), get_host()); if (buffer != (GraphicsOutput *)NULL) { + if (buffer->get_gsg() == (GraphicsStateGuardian *)NULL || + buffer->get_gsg()->get_prepared_objects() != get_gsg()->get_prepared_objects()) { + // If the newly-created buffer doesn't share texture objects + // with the current GSG, then we will have to force the texture + // copy to go through RAM. + to_ram = true; + } + buffer->add_render_texture(tex, to_ram ? RTM_copy_ram : RTM_bind_or_copy); return buffer; }