[2/2] wined3d: Simplify context_apply_draw_buffers() a bit.
Matteo Bruni
matteo.mystral at gmail.com
Tue Jun 7 08:37:12 CDT 2011
-------------- next part --------------
From a1b96b472cd79a081c6e64faf9095e03a806fca9 Mon Sep 17 00:00:00 2001
From: Matteo Bruni <mbruni at codeweavers.com>
Date: Mon, 6 Jun 2011 23:46:12 +0200
Subject: 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()");
}
}
--
1.7.3.4
More information about the wine-patches
mailing list