wined3d: Simplify context_apply_draw_buffers() a bit.

This commit is contained in:
Matteo Bruni 2011-06-06 23:46:12 +02:00 committed by Alexandre Julliard
parent 002674e49d
commit c23a5443c1
1 changed files with 13 additions and 3 deletions

View File

@ -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()");
}
}