From 12459eb25a6de52dabfc1e1f654356c09988f25b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Thu, 10 Dec 2009 22:21:51 +0100 Subject: [PATCH 02/16] WineD3D: Frontbuffers are always onscreen Even if the swapchain's backbuffer is rendered to a FBO. So swapchain->render_to_fbo doesn't necessarily mean the context is rendering offscreen Fixes GL errors in the ddraw dsurface test with the GL ddraw renderer --- dlls/wined3d/context.c | 2 +- dlls/wined3d/device.c | 2 +- dlls/wined3d/swapchain.c | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index 0debd2e..cc5dfaf 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -1893,7 +1893,7 @@ static inline struct wined3d_context *FindContext(IWineD3DDeviceImpl *This, IWin context = findThreadContextForSwapChain(swapchain, tid); old_render_offscreen = context->render_offscreen; - context->render_offscreen = ((IWineD3DSwapChainImpl *)swapchain)->render_to_fbo; + context->render_offscreen = surface_is_offscreen(target); /* The context != This->activeContext will catch a NOP context change. This can occur * if we are switching back to swapchain rendering in case of FBO or Back Buffer offscreen * rendering. No context change is needed in that case diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 6529b23..32322d0 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -6304,7 +6304,7 @@ HRESULT create_primary_opengl_context(IWineD3DDevice *iface, IWineD3DSwapChain * } swapchain->context[0] = context_create(This, target, swapchain->win_handle, FALSE, &swapchain->presentParms); swapchain->num_contexts = 1; - swapchain->context[0]->render_offscreen = swapchain->render_to_fbo; + swapchain->context[0]->render_offscreen = surface_is_offscreen(target); create_dummy_textures(This); diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index 3e4da78..a75d76a 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -790,8 +790,6 @@ HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface hr = WINED3DERR_NOTAVAILABLE; goto err; } - - swapchain->context[0]->render_offscreen = swapchain->render_to_fbo; } else { @@ -833,6 +831,10 @@ HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface LEAVE_GL(); } } + if(swapchain->context[0]) + { + swapchain->context[0]->render_offscreen = swapchain->render_to_fbo; + } } else { -- 1.6.4.4