slightly more robust handling of CallbackGraphicsWindow

This commit is contained in:
David Rose 2012-01-14 16:21:53 +00:00
parent 279b3a8aeb
commit fdca621619
3 changed files with 19 additions and 0 deletions

View File

@ -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;
}

View File

@ -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);

View File

@ -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;
}