[PATCH 3/5] wined3d: Pass a context to blit_shader.blit_surface().

Henri Verbeet hverbeet at codeweavers.com
Fri Mar 17 07:33:17 CDT 2017


Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
---
 dlls/wined3d/arb_program_shader.c | 10 ++--------
 dlls/wined3d/surface.c            | 28 +++++++++++++---------------
 dlls/wined3d/wined3d_private.h    |  4 ++--
 3 files changed, 17 insertions(+), 25 deletions(-)

diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index 66adf0f..60bfbe3 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -7789,22 +7789,18 @@ static BOOL arbfp_blit_supported(const struct wined3d_gl_info *gl_info,
     }
 }
 
-static void arbfp_blit_surface(struct wined3d_device *device, enum wined3d_blit_op op, DWORD filter,
+static void arbfp_blit_surface(struct wined3d_device *device, enum wined3d_blit_op op, struct wined3d_context *context,
         struct wined3d_surface *src_surface, const RECT *src_rect_in,
         struct wined3d_surface *dst_surface, const RECT *dst_rect_in,
-        const struct wined3d_color_key *color_key)
+        const struct wined3d_color_key *color_key, enum wined3d_texture_filter_type filter)
 {
     unsigned int dst_sub_resource_idx = surface_get_sub_resource_idx(dst_surface);
     struct wined3d_texture *src_texture = src_surface->container;
     struct wined3d_texture *dst_texture = dst_surface->container;
-    struct wined3d_context *context;
     RECT src_rect = *src_rect_in;
     RECT dst_rect = *dst_rect_in;
     struct wined3d_color_key alpha_test_key;
 
-    /* Activate the destination context, set it up for blitting */
-    context = context_acquire(device, dst_texture, dst_sub_resource_idx);
-
     /* Now load the surface */
     if (wined3d_settings.offscreen_rendering_mode != ORM_FBO
             && (surface_get_sub_resource(src_surface)->locations
@@ -7850,8 +7846,6 @@ static void arbfp_blit_surface(struct wined3d_device *device, enum wined3d_blit_
             || (dst_texture->swapchain && (dst_texture->swapchain->front_buffer == dst_texture)))
         context->gl_info->gl_ops.gl.p_glFlush(); /* Flush to ensure ordering across contexts. */
 
-    context_release(context);
-
     wined3d_texture_validate_location(dst_texture, dst_sub_resource_idx, dst_texture->resource.draw_binding);
     wined3d_texture_invalidate_location(dst_texture, dst_sub_resource_idx, ~dst_texture->resource.draw_binding);
 }
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index aa85698..f142d91 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -2780,16 +2780,15 @@ static HRESULT ffp_blit_depth_fill(struct wined3d_device *device,
     return WINED3D_OK;
 }
 
-static void ffp_blit_blit_surface(struct wined3d_device *device, enum wined3d_blit_op op, DWORD filter,
-        struct wined3d_surface *src_surface, const RECT *src_rect,
+static void ffp_blit_blit_surface(struct wined3d_device *device, enum wined3d_blit_op op,
+        struct wined3d_context *context, struct wined3d_surface *src_surface, const RECT *src_rect,
         struct wined3d_surface *dst_surface, const RECT *dst_rect,
-        const struct wined3d_color_key *color_key)
+        const struct wined3d_color_key *color_key, enum wined3d_texture_filter_type filter)
 {
     unsigned int dst_sub_resource_idx = surface_get_sub_resource_idx(dst_surface);
     struct wined3d_texture *dst_texture = dst_surface->container;
     struct wined3d_texture *src_texture = src_surface->container;
-    const struct wined3d_gl_info *gl_info;
-    struct wined3d_context *context;
+    const struct wined3d_gl_info *gl_info = context->gl_info;
 
     /* Blit from offscreen surface to render target */
     struct wined3d_color_key old_blt_key = src_texture->async.src_blt_color_key;
@@ -2799,9 +2798,6 @@ static void ffp_blit_blit_surface(struct wined3d_device *device, enum wined3d_bl
 
     wined3d_texture_set_color_key(src_texture, WINED3D_CKEY_SRC_BLT, color_key);
 
-    context = context_acquire(device, dst_texture, dst_sub_resource_idx);
-    gl_info = context->gl_info;
-
     if (op == WINED3D_BLIT_OP_COLOR_BLIT_ALPHATEST)
         gl_info->gl_ops.gl.p_glEnable(GL_ALPHA_TEST);
 
@@ -2811,8 +2807,6 @@ static void ffp_blit_blit_surface(struct wined3d_device *device, enum wined3d_bl
     if (op == WINED3D_BLIT_OP_COLOR_BLIT_ALPHATEST)
         gl_info->gl_ops.gl.p_glDisable(GL_ALPHA_TEST);
 
-    context_release(context);
-
     /* Restore the color key parameters */
     wined3d_texture_set_color_key(src_texture, WINED3D_CKEY_SRC_BLT,
             (old_color_key_flags & WINED3D_CKEY_SRC_BLT) ? &old_blt_key : NULL);
@@ -3466,10 +3460,10 @@ static HRESULT cpu_blit_depth_fill(struct wined3d_device *device,
             &box, NULL, 0, &src_box, WINED3D_BLT_DEPTH_FILL, &fx, WINED3D_TEXF_POINT);
 }
 
-static void cpu_blit_blit_surface(struct wined3d_device *device, enum wined3d_blit_op op, DWORD filter,
-        struct wined3d_surface *src_surface, const RECT *src_rect,
+static void cpu_blit_blit_surface(struct wined3d_device *device, enum wined3d_blit_op op,
+        struct wined3d_context *context, struct wined3d_surface *src_surface, const RECT *src_rect,
         struct wined3d_surface *dst_surface, const RECT *dst_rect,
-        const struct wined3d_color_key *color_key)
+        const struct wined3d_color_key *color_key, enum wined3d_texture_filter_type filter)
 {
     /* FIXME: Remove error returns from surface_blt_cpu. */
     ERR("Blit method not implemented by cpu_blit.\n");
@@ -3761,8 +3755,12 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
                     dst_rect, dst_texture->resource.usage, dst_texture->resource.pool, dst_texture->resource.format);
             if (blitter)
             {
-                blitter->blit_surface(device, blit_op, filter, src_surface,
-                        src_rect, dst_surface, dst_rect, color_key);
+                struct wined3d_context *context;
+
+                context = context_acquire(device, dst_texture, dst_sub_resource_idx);
+                blitter->blit_surface(device, blit_op, context, src_surface,
+                        src_rect, dst_surface, dst_rect, color_key, filter);
+                context_release(context);
                 return WINED3D_OK;
             }
         }
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 5b5134a..64e669b 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1880,10 +1880,10 @@ struct blit_shader
             const RECT *rect, const struct wined3d_color *color);
     HRESULT (*depth_fill)(struct wined3d_device *device, struct wined3d_rendertarget_view *view,
             const RECT *rect, DWORD clear_flags, float depth, DWORD stencil);
-    void (*blit_surface)(struct wined3d_device *device, enum wined3d_blit_op op, DWORD filter,
+    void (*blit_surface)(struct wined3d_device *device, enum wined3d_blit_op op, struct wined3d_context *context,
             struct wined3d_surface *src_surface, const RECT *src_rect,
             struct wined3d_surface *dst_surface, const RECT *dst_rect,
-            const struct wined3d_color_key *color_key);
+            const struct wined3d_color_key *color_key, enum wined3d_texture_filter_type filter);
 };
 
 extern const struct blit_shader ffp_blit DECLSPEC_HIDDEN;
-- 
2.1.4




More information about the wine-patches mailing list