Matteo Bruni : wined3d: Simplify context_apply_draw_buffers() a bit.

Alexandre Julliard julliard at winehq.org
Tue Jun 7 12:02:38 CDT 2011


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

Author: Matteo Bruni <mbruni at codeweavers.com>
Date:   Mon Jun  6 23:46:12 2011 +0200

wined3d: Simplify context_apply_draw_buffers() a bit.

---

 dlls/wined3d/context.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 5cd0517..b077c5f 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -1973,6 +1973,16 @@ static struct wined3d_context *FindContext(struct wined3d_device *device, struct
     return context;
 }
 
+static inline BOOL is_rt_mask_onscreen(DWORD rt_mask)
+{
+    return rt_mask & (1 << 31);
+}
+
+static inline GLenum draw_buffer_from_rt_mask(DWORD rt_mask)
+{
+    return rt_mask & ~(1 << 31);
+}
+
 /* Context activation and GL locking are done by the caller. */
 static void context_apply_draw_buffers(struct wined3d_context *context, DWORD rt_mask, struct wined3d_surface **rts)
 {
@@ -1981,9 +1991,9 @@ static void context_apply_draw_buffers(struct wined3d_context *context, DWORD rt
         glDrawBuffer(GL_NONE);
         checkGLcall("glDrawBuffer()");
     }
-    else if (!surface_is_offscreen(rts[0]))
+    else if (is_rt_mask_onscreen(rt_mask))
     {
-        glDrawBuffer(surface_get_gl_buffer(rts[0]));
+        glDrawBuffer(draw_buffer_from_rt_mask(rt_mask));
         checkGLcall("glDrawBuffer()");
     }
     else
@@ -2017,7 +2027,7 @@ static void context_apply_draw_buffers(struct wined3d_context *context, DWORD rt
         }
         else
         {
-            glDrawBuffer(rts[0]->resource.device->offscreenBuffer);
+            glDrawBuffer(draw_buffer_from_rt_mask(rt_mask));
             checkGLcall("glDrawBuffer()");
         }
     }




More information about the wine-cvs mailing list