Module: wine Branch: master Commit: bda63dd4a9fe4fd483c6eb341a8504749660c130 URL: http://source.winehq.org/git/wine.git/?a=commit;h=bda63dd4a9fe4fd483c6eb341a...
Author: Matteo Bruni mbruni@codeweavers.com Date: Fri Apr 26 14:58:27 2013 +0200
wined3d: Set GL_NONE for glReadBuffer / glDrawBuffer on FBO initialization.
---
dlls/wined3d/context.c | 23 +++++++++++++++++++++-- 1 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index 54e9e80..982df71 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -424,10 +424,17 @@ static void context_apply_fbo_entry(struct wined3d_context *context, GLenum targ { const struct wined3d_gl_info *gl_info = context->gl_info; unsigned int i; + GLuint read_binding, draw_binding;
- context_bind_fbo(context, target, &entry->id); + if (entry->attached) + { + context_bind_fbo(context, target, &entry->id); + return; + }
- if (entry->attached) return; + read_binding = context->fbo_read_binding; + draw_binding = context->fbo_draw_binding; + context_bind_fbo(context, GL_FRAMEBUFFER, &entry->id);
/* Apply render targets */ for (i = 0; i < gl_info->limits.buffers; ++i) @@ -440,6 +447,18 @@ static void context_apply_fbo_entry(struct wined3d_context *context, GLenum targ surface_set_compatible_renderbuffer(entry->depth_stencil, entry->render_targets[0]); context_attach_depth_stencil_fbo(context, target, entry->depth_stencil, entry->location);
+ /* Set valid read and draw buffer bindings to satisfy pedantic pre-ES2_compatibility + * GL contexts requirements. */ + glReadBuffer(GL_NONE); + context_set_draw_buffer(context, GL_NONE); + if (target != GL_FRAMEBUFFER) + { + if (target == GL_READ_FRAMEBUFFER) + context_bind_fbo(context, GL_DRAW_FRAMEBUFFER, draw_binding ? &draw_binding : NULL); + else + context_bind_fbo(context, GL_READ_FRAMEBUFFER, read_binding ? &read_binding : NULL); + } + entry->attached = TRUE; }