egl_dri2: set ctx->WindowRenderBuffer
authorChia-I Wu <olv@lunarg.com>
Fri, 26 Aug 2011 17:42:16 +0000 (01:42 +0800)
committerChia-I Wu <olv@lunarg.com>
Wed, 31 Aug 2011 03:51:42 +0000 (11:51 +0800)
Set ctx->WindowRenderBuffer to EGL_BACK_BUFFER.  As EGL_WINDOW_BIT of a
config is set only when there is dri_double_buffer, that makes sure
window surfaces are always double-buffered and contexts will render to
the back buffer.

Reviewed-by: Chad Versace <chad@chad-versace.us>
src/egl/drivers/dri2/egl_dri2.c

index 4aa1df056cf92df59eeedbe8ea713fca6982ff27..0099a0d6d7fab821d542e6f00759a53be1ecdb3b 100644 (file)
@@ -697,6 +697,12 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
          dri_config = dri2_config->dri_double_config;
       else
          dri_config = dri2_config->dri_single_config;
+
+      /* EGL_WINDOW_BIT is set only when there is a dri_double_config.  This
+       * makes sure the back buffer will always be used.
+       */
+      if (conf->SurfaceType & EGL_WINDOW_BIT)
+         dri2_ctx->base.WindowRenderBuffer = EGL_BACK_BUFFER;
    }
    else
       dri_config = NULL;