--- dlls/wined3d/context.c | 33 ++++++++++++++++++++++++--------- dlls/wined3d/device.c | 2 +- dlls/wined3d/wined3d_private.h | 1 + 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index 56111ef..4440848 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -1065,16 +1065,22 @@ static void apply_draw_buffer(IWineD3DDeviceImpl *This, IWineD3DSurface *target, } else { - if (!blit && wined3d_settings.offscreen_rendering_mode == ORM_FBO) + if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) { - if (GL_SUPPORT(ARB_DRAW_BUFFERS)) + if (!blit) { - GL_EXTCALL(glDrawBuffersARB(GL_LIMITS(buffers), This->draw_buffers)); - checkGLcall("glDrawBuffers()"); - } - else - { - glDrawBuffer(This->draw_buffers[0]); + if (GL_SUPPORT(ARB_DRAW_BUFFERS)) + { + GL_EXTCALL(glDrawBuffersARB(GL_LIMITS(buffers), This->draw_buffers)); + checkGLcall("glDrawBuffers()"); + } + else + { + glDrawBuffer(This->draw_buffers[0]); + checkGLcall("glDrawBuffer()"); + } + } else { + glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT); checkGLcall("glDrawBuffer()"); } } @@ -1165,7 +1171,16 @@ void ActivateContext(IWineD3DDeviceImpl *This, IWineD3DSurface *target, ContextU case CTXUSAGE_BLIT: if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) { - GL_EXTCALL(glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0)); + if (This->render_offscreen) { + FIXME("Activating for CTXUSAGE_BLIT for an offscreen target with ORM_FBO. This should be avoided.\n"); + bind_fbo((IWineD3DDevice *)This, GL_FRAMEBUFFER_EXT, &This->dst_fbo); + attach_surface_fbo(This, GL_FRAMEBUFFER_EXT, 0, target); + GL_EXTCALL(glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, 0)); + checkGLcall("glFramebufferRenderbufferEXT"); + } else { + GL_EXTCALL(glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0)); + checkGLcall("glFramebufferRenderbufferEXT"); + } context->draw_buffer_dirty = TRUE; } if (context->draw_buffer_dirty) { diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 7867517..9e97d3b 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -6127,7 +6127,7 @@ void attach_depth_stencil_fbo(IWineD3DDeviceImpl *This, GLenum fbo_target, IWine } } -static void attach_surface_fbo(IWineD3DDeviceImpl *This, GLenum fbo_target, DWORD idx, IWineD3DSurface *surface) { +void attach_surface_fbo(IWineD3DDeviceImpl *This, GLenum fbo_target, DWORD idx, IWineD3DSurface *surface) { const IWineD3DSurfaceImpl *surface_impl = (IWineD3DSurfaceImpl *)surface; IWineD3DBaseTextureImpl *texture_impl; GLenum texttarget, target; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 33b48df..c1432ec 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2469,6 +2469,7 @@ void stretch_rect_fbo(IWineD3DDevice *iface, IWineD3DSurface *src_surface, WINED IWineD3DSurface *dst_surface, WINED3DRECT *dst_rect, const WINED3DTEXTUREFILTERTYPE filter, BOOL flip); void bind_fbo(IWineD3DDevice *iface, GLenum target, GLuint *fbo); void attach_depth_stencil_fbo(IWineD3DDeviceImpl *This, GLenum fbo_target, IWineD3DSurface *depth_stencil, BOOL use_render_buffer); +void attach_surface_fbo(IWineD3DDeviceImpl *This, GLenum fbo_target, DWORD idx, IWineD3DSurface *surface); void depth_blt(IWineD3DDevice *iface, GLuint texture); #endif