Henri Verbeet : wined3d: Get rid of the "target" parameter to wined3d_adapter_gl_create_context().

Alexandre Julliard julliard at winehq.org
Mon May 6 15:38:50 CDT 2019


Module: wine
Branch: master
Commit: 11b7e47598b4bf6caa99c0dd3666b07f1b82ddd7
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=11b7e47598b4bf6caa99c0dd3666b07f1b82ddd7

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Mon May  6 21:34:29 2019 +0430

wined3d: Get rid of the "target" parameter to wined3d_adapter_gl_create_context().

Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wined3d/adapter_vk.c      |  3 +--
 dlls/wined3d/context.c         | 16 ++++++++--------
 dlls/wined3d/directx.c         |  2 +-
 dlls/wined3d/wined3d_private.h |  8 ++++----
 4 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/dlls/wined3d/adapter_vk.c b/dlls/wined3d/adapter_vk.c
index a5fd891..da53edd 100644
--- a/dlls/wined3d/adapter_vk.c
+++ b/dlls/wined3d/adapter_vk.c
@@ -288,8 +288,7 @@ static void adapter_vk_destroy_device(struct wined3d_device *device)
     heap_free(device_vk);
 }
 
-static BOOL adapter_vk_create_context(struct wined3d_context *context,
-        struct wined3d_texture *target, const struct wined3d_format *ds_format)
+static BOOL adapter_vk_create_context(struct wined3d_context *context, const struct wined3d_format *ds_format)
 {
     return TRUE;
 }
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index a4f4be5..30686f5 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -1967,12 +1967,11 @@ static BOOL wined3d_context_init(struct wined3d_context *context, struct wined3d
 
 struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, const struct wined3d_format *ds_format)
 {
-    struct wined3d_texture *target = swapchain->front_buffer;
     struct wined3d_device *device = swapchain->device;
     struct wined3d_context_gl *context_gl;
     struct wined3d_context *context;
 
-    TRACE("swapchain %p, target %p, window %p.\n", swapchain, target, swapchain->win_handle);
+    TRACE("swapchain %p.\n", swapchain);
 
     wined3d_from_cs(device->cs);
 
@@ -1985,7 +1984,7 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, cons
         heap_free(context_gl);
         return NULL;
     }
-    if (!(device->adapter->adapter_ops->adapter_create_context(context, target, ds_format)))
+    if (!(device->adapter->adapter_ops->adapter_create_context(context, ds_format)))
     {
         wined3d_release_dc(context->win_handle, context->hdc);
         heap_free(context_gl);
@@ -2004,13 +2003,13 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, cons
     return context;
 }
 
-BOOL wined3d_adapter_gl_create_context(struct wined3d_context *context,
-        struct wined3d_texture *target, const struct wined3d_format *ds_format)
+BOOL wined3d_adapter_gl_create_context(struct wined3d_context *context, const struct wined3d_format *ds_format)
 {
     struct wined3d_device *device = context->device;
     const struct wined3d_format *color_format;
     const struct wined3d_d3d_info *d3d_info;
     const struct wined3d_gl_info *gl_info;
+    struct wined3d_resource *target;
     unsigned int target_bind_flags;
     BOOL aux_buffers = FALSE;
     HGLRC ctx, share_ctx;
@@ -2057,8 +2056,9 @@ BOOL wined3d_adapter_gl_create_context(struct wined3d_context *context,
             sizeof(*context->texture_type))))
         return FALSE;
 
-    color_format = target->resource.format;
-    target_bind_flags = target->resource.bind_flags;
+    target = &context->current_rt.texture->resource;
+    color_format = target->format;
+    target_bind_flags = target->bind_flags;
 
     /* In case of ORM_BACKBUFFER, make sure to request an alpha component for
      * X4R4G4B4/X8R8G8B8 as we might need it for the backbuffer. */
@@ -2141,7 +2141,7 @@ BOOL wined3d_adapter_gl_create_context(struct wined3d_context *context,
         }
     }
 
-    context->render_offscreen = wined3d_resource_is_offscreen(&target->resource);
+    context->render_offscreen = wined3d_resource_is_offscreen(target);
     context->draw_buffers_mask = context_generate_rt_mask(GL_BACK);
     context->valid = 1;
 
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index b8c151d..c909e51 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -2256,7 +2256,7 @@ static void adapter_no3d_destroy_device(struct wined3d_device *device)
 }
 
 static BOOL wined3d_adapter_no3d_create_context(struct wined3d_context *context,
-        struct wined3d_texture *target, const struct wined3d_format *ds_format)
+        const struct wined3d_format *ds_format)
 {
     return TRUE;
 }
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 02177a9..fbcda94 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2711,8 +2711,7 @@ struct wined3d_adapter_ops
             BYTE surface_alignment, const enum wined3d_feature_level *levels, unsigned int level_count,
             struct wined3d_device_parent *device_parent, struct wined3d_device **device);
     void (*adapter_destroy_device)(struct wined3d_device *device);
-    BOOL (*adapter_create_context)(struct wined3d_context *context,
-            struct wined3d_texture *target, const struct wined3d_format *ds_format);
+    BOOL (*adapter_create_context)(struct wined3d_context *context, const struct wined3d_format *ds_format);
     void (*adapter_get_wined3d_caps)(const struct wined3d_adapter *adapter, struct wined3d_caps *caps);
     BOOL (*adapter_check_format)(const struct wined3d_adapter *adapter,
             const struct wined3d_format *adapter_format, const struct wined3d_format *rt_format,
@@ -2767,9 +2766,10 @@ static inline const struct wined3d_adapter_gl *wined3d_adapter_gl_const(const st
     return CONTAINING_RECORD(adapter, struct wined3d_adapter_gl, a);
 }
 
-struct wined3d_adapter *wined3d_adapter_gl_create(unsigned int ordinal, unsigned int wined3d_creation_flags) DECLSPEC_HIDDEN;
+struct wined3d_adapter *wined3d_adapter_gl_create(unsigned int ordinal,
+        unsigned int wined3d_creation_flags) DECLSPEC_HIDDEN;
 BOOL wined3d_adapter_gl_create_context(struct wined3d_context *context,
-        struct wined3d_texture *target, const struct wined3d_format *ds_format) DECLSPEC_HIDDEN;
+        const struct wined3d_format *ds_format) DECLSPEC_HIDDEN;
 
 struct wined3d_adapter_vk
 {




More information about the wine-cvs mailing list