mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
add GraphicsOutput::flip_ready
This commit is contained in:
parent
f709ae9232
commit
a39aa8f71c
@ -775,15 +775,13 @@ flip_windows(const GraphicsEngine::Windows &wlist) {
|
|||||||
Windows::const_iterator wi;
|
Windows::const_iterator wi;
|
||||||
for (wi = wlist.begin(); wi != wlist.end(); ++wi) {
|
for (wi = wlist.begin(); wi != wlist.end(); ++wi) {
|
||||||
GraphicsOutput *win = (*wi);
|
GraphicsOutput *win = (*wi);
|
||||||
if (win->is_active() && win->get_gsg()->is_active() &&
|
if (win->flip_ready()) {
|
||||||
!win->get_gsg()->get_properties().is_single_buffered()) {
|
|
||||||
win->begin_flip();
|
win->begin_flip();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (wi = wlist.begin(); wi != wlist.end(); ++wi) {
|
for (wi = wlist.begin(); wi != wlist.end(); ++wi) {
|
||||||
GraphicsOutput *win = (*wi);
|
GraphicsOutput *win = (*wi);
|
||||||
if (win->is_active() && win->get_gsg()->is_active() &&
|
if (win->flip_ready()) {
|
||||||
!win->get_gsg()->get_properties().is_single_buffered()) {
|
|
||||||
win->end_flip();
|
win->end_flip();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,6 +160,17 @@ is_valid() const {
|
|||||||
return _is_valid;
|
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
|
// Function: GraphicsOutput::get_sort
|
||||||
// Access: Published
|
// Access: Published
|
||||||
|
@ -51,6 +51,7 @@ GraphicsOutput(GraphicsPipe *pipe, GraphicsStateGuardian *gsg,
|
|||||||
_has_size = false;
|
_has_size = false;
|
||||||
_is_valid = false;
|
_is_valid = false;
|
||||||
_copy_texture = false;
|
_copy_texture = false;
|
||||||
|
_flip_ready = false;
|
||||||
_sort = 0;
|
_sort = 0;
|
||||||
|
|
||||||
int mode = gsg->get_properties().get_frame_buffer_mode();
|
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);
|
TextureContext *tc = get_texture()->prepare_now(_gsg->get_prepared_objects(), _gsg);
|
||||||
_gsg->copy_texture(tc, &dr, buffer);
|
_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::
|
void GraphicsOutput::
|
||||||
end_flip() {
|
end_flip() {
|
||||||
|
_flip_ready = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
@ -80,6 +80,7 @@ PUBLISHED:
|
|||||||
INLINE int get_y_size() const;
|
INLINE int get_y_size() const;
|
||||||
INLINE bool has_size() const;
|
INLINE bool has_size() const;
|
||||||
INLINE bool is_valid() const;
|
INLINE bool is_valid() const;
|
||||||
|
INLINE bool flip_ready() const;
|
||||||
|
|
||||||
virtual bool is_active() const;
|
virtual bool is_active() const;
|
||||||
|
|
||||||
@ -149,6 +150,7 @@ protected:
|
|||||||
string _name;
|
string _name;
|
||||||
PT(Texture) _texture;
|
PT(Texture) _texture;
|
||||||
bool _copy_texture;
|
bool _copy_texture;
|
||||||
|
bool _flip_ready;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
INLINE void determine_display_regions() const;
|
INLINE void determine_display_regions() const;
|
||||||
|
@ -219,6 +219,7 @@ end_flip() {
|
|||||||
if (_dxgsg != (DXGraphicsStateGuardian7 *)NULL && is_active()) {
|
if (_dxgsg != (DXGraphicsStateGuardian7 *)NULL && is_active()) {
|
||||||
_dxgsg->show_frame();
|
_dxgsg->show_frame();
|
||||||
}
|
}
|
||||||
|
GraphicsWindow::end_flip();
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
@ -258,6 +258,7 @@ end_flip() {
|
|||||||
// wdxdisplay8_cat.debug() << "current swapchain from end_flip is " << _wcontext.pSwapChain << "\n";
|
// wdxdisplay8_cat.debug() << "current swapchain from end_flip is " << _wcontext.pSwapChain << "\n";
|
||||||
_dxgsg->show_frame();
|
_dxgsg->show_frame();
|
||||||
}
|
}
|
||||||
|
GraphicsWindow::end_flip();
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
@ -259,6 +259,7 @@ end_flip() {
|
|||||||
//wdxdisplay9_cat.debug() << "current swapchain from end_flip is " << _wcontext.pSwapChain << "\n";
|
//wdxdisplay9_cat.debug() << "current swapchain from end_flip is " << _wcontext.pSwapChain << "\n";
|
||||||
_dxgsg->show_frame();
|
_dxgsg->show_frame();
|
||||||
}
|
}
|
||||||
|
GraphicsWindow::end_flip();
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
@ -147,7 +147,7 @@ begin_flip() {
|
|||||||
// context is current before flipping the windows, and insisting
|
// context is current before flipping the windows, and insisting
|
||||||
// on doing so can be a significant performance hit.
|
// on doing so can be a significant performance hit.
|
||||||
|
|
||||||
// make_current();
|
//make_current();
|
||||||
|
|
||||||
glXSwapBuffers(_display, _xwindow);
|
glXSwapBuffers(_display, _xwindow);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user