From: Henri Verbeet Subject: [PATCH 2/5] wined3d: Don't load the draw_binding location in surface_unmap() unless the surface is on a swapchain. Message-Id: <1327016189-8179-2-git-send-email-hverbeet@codeweavers.com> Date: Fri, 20 Jan 2012 00:36:26 +0100 It really makes no sense to do this just because a surface happens to be the current render target. In particular, this patch prevents needlessly bouncing the surface between the CPU and the GPU when the application does e.g. multiple colorkeyed blits to the current render target to draw a HUD. --- dlls/wined3d/surface.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 7aa68d1..21bd088 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -953,8 +953,14 @@ static void surface_unmap(struct wined3d_surface *surface) goto done; } + /* FIXME: The ORM_BACKBUFFER case probably isn't needed, but who knows + * what obscure bugs in backbuffer ORM removing it will uncover. Also, + * this should only be needed for the frontbuffer, but that requires + * present calls to call surface_load_location() on the backbuffer. + * Fix both of those after 1.4. */ if (surface->container.type == WINED3D_CONTAINER_SWAPCHAIN - || (device->fb.render_targets && surface == device->fb.render_targets[0])) + || (wined3d_settings.offscreen_rendering_mode == ORM_BACKBUFFER + && device->fb.render_targets && surface == device->fb.render_targets[0])) { if (!surface->dirtyRect.left && !surface->dirtyRect.top && surface->dirtyRect.right == surface->resource.width -- 1.7.3.4