add GraphicsOutput::flip_ready

This commit is contained in:
David Rose 2004-03-02 20:11:51 +00:00
parent f709ae9232
commit a39aa8f71c
8 changed files with 26 additions and 5 deletions

View File

@ -775,15 +775,13 @@ flip_windows(const GraphicsEngine::Windows &wlist) {
Windows::const_iterator wi;
for (wi = wlist.begin(); wi != wlist.end(); ++wi) {
GraphicsOutput *win = (*wi);
if (win->is_active() && win->get_gsg()->is_active() &&
!win->get_gsg()->get_properties().is_single_buffered()) {
if (win->flip_ready()) {
win->begin_flip();
}
}
for (wi = wlist.begin(); wi != wlist.end(); ++wi) {
GraphicsOutput *win = (*wi);
if (win->is_active() && win->get_gsg()->is_active() &&
!win->get_gsg()->get_properties().is_single_buffered()) {
if (win->flip_ready()) {
win->end_flip();
}
}

View File

@ -160,6 +160,17 @@ is_valid() const {
return _is_valid;
}
////////////////////////////////////////////////////////////////////
// Function: GraphicsOutput::flip_ready
// Access: Published
// Description: Returns true if a frame has been rendered and needs
// to be flipped, false otherwise.
////////////////////////////////////////////////////////////////////
INLINE bool GraphicsOutput::
flip_ready() const {
return _flip_ready;
}
////////////////////////////////////////////////////////////////////
// Function: GraphicsOutput::get_sort
// Access: Published

View File

@ -51,6 +51,7 @@ GraphicsOutput(GraphicsPipe *pipe, GraphicsStateGuardian *gsg,
_has_size = false;
_is_valid = false;
_copy_texture = false;
_flip_ready = false;
_sort = 0;
int mode = gsg->get_properties().get_frame_buffer_mode();
@ -542,6 +543,11 @@ end_frame() {
TextureContext *tc = get_texture()->prepare_now(_gsg->get_prepared_objects(), _gsg);
_gsg->copy_texture(tc, &dr, buffer);
}
// If we're not single-buffered, we're now ready to flip.
if (!_gsg->get_properties().is_single_buffered()) {
_flip_ready = true;
}
}
////////////////////////////////////////////////////////////////////
@ -599,6 +605,7 @@ begin_flip() {
////////////////////////////////////////////////////////////////////
void GraphicsOutput::
end_flip() {
_flip_ready = false;
}
////////////////////////////////////////////////////////////////////

View File

@ -80,6 +80,7 @@ PUBLISHED:
INLINE int get_y_size() const;
INLINE bool has_size() const;
INLINE bool is_valid() const;
INLINE bool flip_ready() const;
virtual bool is_active() const;
@ -149,6 +150,7 @@ protected:
string _name;
PT(Texture) _texture;
bool _copy_texture;
bool _flip_ready;
private:
INLINE void determine_display_regions() const;

View File

@ -219,6 +219,7 @@ end_flip() {
if (_dxgsg != (DXGraphicsStateGuardian7 *)NULL && is_active()) {
_dxgsg->show_frame();
}
GraphicsWindow::end_flip();
}
////////////////////////////////////////////////////////////////////

View File

@ -258,6 +258,7 @@ end_flip() {
// wdxdisplay8_cat.debug() << "current swapchain from end_flip is " << _wcontext.pSwapChain << "\n";
_dxgsg->show_frame();
}
GraphicsWindow::end_flip();
}
////////////////////////////////////////////////////////////////////

View File

@ -259,6 +259,7 @@ end_flip() {
//wdxdisplay9_cat.debug() << "current swapchain from end_flip is " << _wcontext.pSwapChain << "\n";
_dxgsg->show_frame();
}
GraphicsWindow::end_flip();
}
////////////////////////////////////////////////////////////////////

View File

@ -147,7 +147,7 @@ begin_flip() {
// context is current before flipping the windows, and insisting
// on doing so can be a significant performance hit.
// make_current();
//make_current();
glXSwapBuffers(_display, _xwindow);
}