Henri Verbeet : wined3d: Properly invalidate the context' s draw buffer in color_fill_fbo().

Alexandre Julliard julliard at winehq.org
Fri Dec 11 11:04:44 CST 2009


Module: wine
Branch: master
Commit: 840b5af77e7e387d32b24a6f7d48f0a0e8d32ad3
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=840b5af77e7e387d32b24a6f7d48f0a0e8d32ad3

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Thu Dec 10 21:41:52 2009 +0100

wined3d: Properly invalidate the context's draw buffer in color_fill_fbo().

---

 dlls/wined3d/context.c         |    8 ++++++++
 dlls/wined3d/device.c          |   13 ++++++-------
 dlls/wined3d/wined3d_private.h |    1 +
 3 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 8a2a522..0debd2e 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -2097,6 +2097,14 @@ static void context_apply_draw_buffer(struct wined3d_context *context, BOOL blit
     }
 }
 
+/* GL locking is done by the caller. */
+void context_set_draw_buffer(struct wined3d_context *context, GLenum buffer)
+{
+    glDrawBuffer(buffer);
+    checkGLcall("glDrawBuffer()");
+    context->draw_buffer_dirty = TRUE;
+}
+
 /*****************************************************************************
  * context_acquire
  *
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index a4eacba..c04f32b 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -5696,18 +5696,17 @@ static void color_fill_fbo(IWineD3DDevice *iface, IWineD3DSurface *surface,
     IWineD3DSwapChain *swapchain;
 
     swapchain = get_swapchain(surface);
-    if (!surface_is_offscreen(surface)) {
-        GLenum buffer;
-
+    if (!surface_is_offscreen(surface))
+    {
         TRACE("Surface %p is onscreen\n", surface);
 
         context = context_acquire(This, surface, CTXUSAGE_RESOURCELOAD);
         ENTER_GL();
         context_bind_fbo(context, GL_FRAMEBUFFER, NULL);
-        buffer = surface_get_gl_buffer(surface, swapchain);
-        glDrawBuffer(buffer);
-        checkGLcall("glDrawBuffer()");
-    } else {
+        context_set_draw_buffer(context, surface_get_gl_buffer(surface, swapchain));
+    }
+    else
+    {
         TRACE("Surface %p is offscreen\n", surface);
 
         context = context_acquire(This, NULL, CTXUSAGE_RESOURCELOAD);
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 35887f7..9cecc97 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1187,6 +1187,7 @@ struct wined3d_context *context_get_current(void) DECLSPEC_HIDDEN;
 DWORD context_get_tls_idx(void) DECLSPEC_HIDDEN;
 void context_release(struct wined3d_context *context) DECLSPEC_HIDDEN;
 BOOL context_set_current(struct wined3d_context *ctx) DECLSPEC_HIDDEN;
+void context_set_draw_buffer(struct wined3d_context *context, GLenum buffer) DECLSPEC_HIDDEN;
 void context_set_tls_idx(DWORD idx) DECLSPEC_HIDDEN;
 
 void delete_opengl_contexts(IWineD3DDevice *iface, IWineD3DSwapChain *swapchain) DECLSPEC_HIDDEN;




More information about the wine-cvs mailing list