X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fstate_tracker%2Fst_cb_flush.c;h=5a2343d3aec30991a542c783dff0aebce9200144;hb=cd6a31cd4a9ea6deef4778c2eaef2d47240c3a6e;hp=8ceeeabcd37ec18418e0af1c824b6b6967779791;hpb=9615daa9324341f6a56932dc46b807f402d18283;p=mesa.git diff --git a/src/mesa/state_tracker/st_cb_flush.c b/src/mesa/state_tracker/st_cb_flush.c index 8ceeeabcd37..5a2343d3aec 100644 --- a/src/mesa/state_tracker/st_cb_flush.c +++ b/src/mesa/state_tracker/st_cb_flush.c @@ -39,7 +39,7 @@ #include "st_cb_flush.h" #include "st_cb_clear.h" #include "st_cb_fbo.h" -#include "st_public.h" +#include "st_manager.h" #include "pipe/p_context.h" #include "pipe/p_defines.h" #include "pipe/p_screen.h" @@ -51,15 +51,10 @@ static INLINE GLboolean is_front_buffer_dirty(struct st_context *st) { - if (st->frontbuffer_status == FRONT_STATUS_DIRTY) { - return GL_TRUE; - } - else { - GLframebuffer *fb = st->ctx->DrawBuffer; - struct st_renderbuffer *strb - = st_renderbuffer(fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer); - return strb && strb->defined; - } + struct gl_framebuffer *fb = st->ctx->DrawBuffer; + struct st_renderbuffer *strb + = st_renderbuffer(fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer); + return strb && strb->defined; } @@ -69,21 +64,14 @@ is_front_buffer_dirty(struct st_context *st) static void display_front_buffer(struct st_context *st) { - GLframebuffer *fb = st->ctx->DrawBuffer; + struct gl_framebuffer *fb = st->ctx->DrawBuffer; struct st_renderbuffer *strb = st_renderbuffer(fb->Attachment[BUFFER_FRONT_LEFT].Renderbuffer); if (strb) { - struct pipe_surface *front_surf = strb->surface; - /* Hook for copying "fake" frontbuffer if necessary: */ - st->pipe->screen->flush_frontbuffer( st->pipe->screen, front_surf, - st->pipe->priv ); - - /* - st->frontbuffer_status = FRONT_STATUS_UNDEFINED; - */ + st_manager_flush_frontbuffer(st); } } @@ -125,9 +113,9 @@ void st_finish( struct st_context *st ) /** * Called via ctx->Driver.Flush() */ -static void st_glFlush(GLcontext *ctx) +static void st_glFlush(struct gl_context *ctx) { - struct st_context *st = ctx->st; + struct st_context *st = st_context(ctx); /* Don't call st_finish() here. It is not the state tracker's * responsibilty to inject sleeps in the hope of avoiding buffer @@ -145,9 +133,9 @@ static void st_glFlush(GLcontext *ctx) /** * Called via ctx->Driver.Finish() */ -static void st_glFinish(GLcontext *ctx) +static void st_glFinish(struct gl_context *ctx) { - struct st_context *st = ctx->st; + struct st_context *st = st_context(ctx); st_finish(st); @@ -161,4 +149,16 @@ void st_init_flush_functions(struct dd_function_table *functions) { functions->Flush = st_glFlush; functions->Finish = st_glFinish; + + /* Windows opengl32.dll calls glFinish prior to every swapbuffers. + * This is unnecessary and degrades performance. Luckily we have some + * scope to work around this, as the externally-visible behaviour of + * Finish() is identical to Flush() in all cases - no differences in + * rendering or ReadPixels are visible if we opt not to wait here. + * + * Only set this up on windows to avoid suprise elsewhere. + */ +#ifdef PIPE_OS_WINDOWS + functions->Finish = st_glFlush; +#endif }