wined3d: Avoid redundant glDrawBuffer() calls.

This commit is contained in:
Matteo Bruni 2013-04-10 01:35:42 +02:00 committed by Alexandre Julliard
parent 0d563a69dd
commit 075fa6547c
1 changed files with 7 additions and 4 deletions

View File

@ -1897,13 +1897,16 @@ static void context_apply_draw_buffers(struct wined3d_context *context, DWORD rt
void context_set_draw_buffer(struct wined3d_context *context, GLenum buffer) void context_set_draw_buffer(struct wined3d_context *context, GLenum buffer)
{ {
const struct wined3d_gl_info *gl_info = context->gl_info; const struct wined3d_gl_info *gl_info = context->gl_info;
DWORD *current_mask = context->current_fbo ? &context->current_fbo->rt_mask : &context->draw_buffers_mask;
DWORD new_mask = context_generate_rt_mask(buffer);
if (new_mask == *current_mask)
return;
gl_info->gl_ops.gl.p_glDrawBuffer(buffer); gl_info->gl_ops.gl.p_glDrawBuffer(buffer);
checkGLcall("glDrawBuffer()"); checkGLcall("glDrawBuffer()");
if (context->current_fbo)
context->current_fbo->rt_mask = context_generate_rt_mask(buffer); *current_mask = new_mask;
else
context->draw_buffers_mask = context_generate_rt_mask(buffer);
} }
/* Context activation is done by the caller. */ /* Context activation is done by the caller. */