[PATCH 5/6] wined3d: Improve FBO support in ClearSurface.
Roderick Colenbrander
thunderbird2k at gmail.com
Wed Apr 14 07:19:21 CDT 2010
---
dlls/wined3d/device.c | 30 +++++++++++++++++++++++++++++-
1 files changed, 29 insertions(+), 1 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 3b87878..5d001a3 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4384,7 +4384,35 @@ HRESULT IWineD3DDeviceImpl_ClearSurface(IWineD3DDeviceImpl *This, IWineD3DSurfac
IWineD3DSurface_LoadLocation((IWineD3DSurface *)target, SFLAG_INDRAWABLE, NULL);
}
- context = context_acquire(This, (IWineD3DSurface *)target, CTXUSAGE_CLEAR);
+ if (wined3d_settings.offscreen_rendering_mode == ORM_FBO)
+ {
+ if (!surface_is_offscreen((IWineD3DSurface *)target))
+ {
+ TRACE("Surface %p is onscreen\n", target);
+
+ context = context_acquire(This, (IWineD3DSurface *)target, CTXUSAGE_RESOURCELOAD);
+ ENTER_GL();
+ context_bind_fbo(context, GL_FRAMEBUFFER, NULL);
+ context_set_draw_buffer(context, surface_get_gl_buffer((IWineD3DSurface *)target));
+ LEAVE_GL();
+ }
+ else
+ {
+ TRACE("Surface %p is offscreen\n", target);
+
+ context = context_acquire(This, NULL, CTXUSAGE_RESOURCELOAD);
+ ENTER_GL();
+ context_bind_fbo(context, GL_FRAMEBUFFER, &context->dst_fbo);
+ context_attach_surface_fbo(context, GL_FRAMEBUFFER, 0, (IWineD3DSurface *)target);
+ context_attach_depth_stencil_fbo(context, GL_FRAMEBUFFER, NULL, FALSE);
+ LEAVE_GL();
+ }
+ }
+ else
+ {
+ context = context_acquire(This, (IWineD3DSurface *)target, CTXUSAGE_CLEAR);
+ }
+
if (!context->valid)
{
context_release(context);
--
1.6.3.3
More information about the wine-patches
mailing list