[PATCH 3/5] wined3d: Don't flush just because a swapchain has multiple contexts.

Henri Verbeet hverbeet at codeweavers.com
Thu Apr 14 15:41:49 CDT 2011


If you really have e.g. multiple draws to the same drawable, this is not
enough, and you should use the StrictDrawOrdering registry setting. In the
other cases it just slows things down unnecessarily.
---
 dlls/wined3d/arb_program_shader.c |    9 +++------
 dlls/wined3d/surface.c            |    9 +++------
 2 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index 669cac2..1197aac 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -7206,7 +7206,6 @@ HRESULT arbfp_blit_surface(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *src_
                            IWineD3DSurfaceImpl *dst_surface, const RECT *dst_rect_in, enum wined3d_blit_op blit_op,
                            DWORD Filter)
 {
-    struct wined3d_swapchain *dst_swapchain;
     struct wined3d_context *context;
     RECT dst_rect = *dst_rect_in;
 
@@ -7232,11 +7231,9 @@ HRESULT arbfp_blit_surface(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *src_
     /* Leave the opengl state valid for blitting */
     arbfp_blit_unset(context->gl_info);
 
-    dst_swapchain = dst_surface->container.type == WINED3D_CONTAINER_SWAPCHAIN
-            ? dst_surface->container.u.swapchain : NULL;
-    if (wined3d_settings.strict_draw_ordering || (dst_swapchain
-            && (dst_surface == dst_swapchain->front_buffer
-            || dst_swapchain->num_contexts > 1)))
+    if (wined3d_settings.strict_draw_ordering
+            || (dst_surface->container.type == WINED3D_CONTAINER_SWAPCHAIN
+            && (dst_surface->container.u.swapchain->front_buffer == dst_surface)))
         wglFlush(); /* Flush to ensure ordering across contexts. */
 
     context_release(context);
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 0f6f247..6daf886 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -3568,16 +3568,12 @@ static void surface_blt_to_drawable(IWineD3DDeviceImpl *device,
         IWineD3DSurfaceImpl *src_surface, const RECT *src_rect_in,
         IWineD3DSurfaceImpl *dst_surface, const RECT *dst_rect_in)
 {
-    struct wined3d_swapchain *swapchain = NULL;
     struct wined3d_context *context;
     RECT src_rect, dst_rect;
 
     src_rect = *src_rect_in;
     dst_rect = *dst_rect_in;
 
-    if (dst_surface->container.type == WINED3D_CONTAINER_SWAPCHAIN)
-        swapchain = dst_surface->container.u.swapchain;
-
     /* Make sure the surface is up-to-date. This should probably use
      * surface_load_location() and worry about the destination surface too,
      * unless we're overwriting it completely. */
@@ -3628,8 +3624,9 @@ static void surface_blt_to_drawable(IWineD3DDeviceImpl *device,
     /* Leave the opengl state valid for blitting */
     device->blitter->unset_shader(context->gl_info);
 
-    if (wined3d_settings.strict_draw_ordering || (swapchain
-            && (dst_surface == swapchain->front_buffer || swapchain->num_contexts > 1)))
+    if (wined3d_settings.strict_draw_ordering
+            || (dst_surface->container.type == WINED3D_CONTAINER_SWAPCHAIN
+            && (dst_surface->container.u.swapchain->front_buffer == dst_surface)))
         wglFlush(); /* Flush to ensure ordering across contexts. */
 
     context_release(context);
-- 
1.7.3.4




More information about the wine-patches mailing list