Signed-off-by: Henri Verbeet hverbeet@codeweavers.com --- dlls/wined3d/adapter_gl.c | 10 ++++++---- dlls/wined3d/swapchain.c | 9 +++++++-- dlls/wined3d/wined3d_private.h | 13 ++++++++++++- 3 files changed, 25 insertions(+), 7 deletions(-)
diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c index cf54468a76b..cf5cb0e79c7 100644 --- a/dlls/wined3d/adapter_gl.c +++ b/dlls/wined3d/adapter_gl.c @@ -4656,7 +4656,7 @@ static void adapter_gl_uninit_3d(struct wined3d_device *device) static HRESULT adapter_gl_create_swapchain(struct wined3d_device *device, struct wined3d_swapchain_desc *desc, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_swapchain **swapchain) { - struct wined3d_swapchain *swapchain_gl; + struct wined3d_swapchain_gl *swapchain_gl; HRESULT hr;
TRACE("device %p, desc %p, parent %p, parent_ops %p, swapchain %p.\n", @@ -4673,15 +4673,17 @@ static HRESULT adapter_gl_create_swapchain(struct wined3d_device *device, struct }
TRACE("Created swapchain %p.\n", swapchain_gl); - *swapchain = swapchain_gl; + *swapchain = &swapchain_gl->s;
return hr; }
static void adapter_gl_destroy_swapchain(struct wined3d_swapchain *swapchain) { - wined3d_swapchain_cleanup(swapchain); - heap_free(swapchain); + struct wined3d_swapchain_gl *swapchain_gl = wined3d_swapchain_gl(swapchain); + + wined3d_swapchain_gl_cleanup(swapchain_gl); + heap_free(swapchain_gl); }
static HRESULT adapter_gl_create_buffer(struct wined3d_device *device, diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index 4d277c7a5e2..c0eeca52c7d 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -105,6 +105,11 @@ void wined3d_swapchain_cleanup(struct wined3d_swapchain *swapchain) } }
+void wined3d_swapchain_gl_cleanup(struct wined3d_swapchain_gl *swapchain_gl) +{ + wined3d_swapchain_cleanup(&swapchain_gl->s); +} + ULONG CDECL wined3d_swapchain_incref(struct wined3d_swapchain *swapchain) { ULONG refcount = InterlockedIncrement(&swapchain->ref); @@ -1031,13 +1036,13 @@ HRESULT wined3d_swapchain_no3d_init(struct wined3d_swapchain *swapchain_no3d, st return wined3d_swapchain_init(swapchain_no3d, device, desc, parent, parent_ops, &swapchain_no3d_ops); }
-HRESULT wined3d_swapchain_gl_init(struct wined3d_swapchain *swapchain_gl, struct wined3d_device *device, +HRESULT wined3d_swapchain_gl_init(struct wined3d_swapchain_gl *swapchain_gl, struct wined3d_device *device, struct wined3d_swapchain_desc *desc, void *parent, const struct wined3d_parent_ops *parent_ops) { TRACE("swapchain_gl %p, device %p, desc %p, parent %p, parent_ops %p.\n", swapchain_gl, device, desc, parent, parent_ops);
- return wined3d_swapchain_init(swapchain_gl, device, desc, parent, parent_ops, &swapchain_gl_ops); + return wined3d_swapchain_init(&swapchain_gl->s, device, desc, parent, parent_ops, &swapchain_gl_ops); }
HRESULT wined3d_swapchain_vk_init(struct wined3d_swapchain *swapchain_vk, struct wined3d_device *device, diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index e81d72b7db3..1e4e1390fe5 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -4422,7 +4422,18 @@ HRESULT wined3d_swapchain_no3d_init(struct wined3d_swapchain *swapchain_no3d, struct wined3d_device *device, struct wined3d_swapchain_desc *desc, void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
-HRESULT wined3d_swapchain_gl_init(struct wined3d_swapchain *swapchain_gl, +struct wined3d_swapchain_gl +{ + struct wined3d_swapchain s; +}; + +static inline struct wined3d_swapchain_gl *wined3d_swapchain_gl(struct wined3d_swapchain *swapchain) +{ + return CONTAINING_RECORD(swapchain, struct wined3d_swapchain_gl, s); +} + +void wined3d_swapchain_gl_cleanup(struct wined3d_swapchain_gl *swapchain_gl) DECLSPEC_HIDDEN; +HRESULT wined3d_swapchain_gl_init(struct wined3d_swapchain_gl *swapchain_gl, struct wined3d_device *device, struct wined3d_swapchain_desc *desc, void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;