wined3d: Introduce a separate structure for OpenGL swapchain information.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2019-08-13 13:01:37 +04:30 committed by Alexandre Julliard
parent e3e9bdeedb
commit eef96e89ac
3 changed files with 25 additions and 7 deletions

View File

@ -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,

View File

@ -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,

View File

@ -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;