wined3d: Move the backup window from struct wined3d_swapchain to struct wined3d_swapchain_gl.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
eef96e89ac
commit
17ce100766
|
@ -1231,7 +1231,7 @@ success:
|
|||
|
||||
static BOOL wined3d_context_gl_set_gl_context(struct wined3d_context_gl *context_gl)
|
||||
{
|
||||
struct wined3d_swapchain *swapchain = context_gl->c.swapchain;
|
||||
struct wined3d_swapchain_gl *swapchain_gl = wined3d_swapchain_gl(context_gl->c.swapchain);
|
||||
BOOL backup = FALSE;
|
||||
|
||||
if (!wined3d_context_gl_set_pixel_format(context_gl))
|
||||
|
@ -1252,14 +1252,14 @@ static BOOL wined3d_context_gl_set_gl_context(struct wined3d_context_gl *context
|
|||
* a swapchain, so we can't use the swapchain to get a backup dc. To
|
||||
* make this work windowless contexts would need to be handled by the
|
||||
* device. */
|
||||
if (context_gl->c.destroyed || !swapchain)
|
||||
if (context_gl->c.destroyed || !swapchain_gl)
|
||||
{
|
||||
FIXME("Unable to get backup dc for destroyed context %p.\n", context_gl);
|
||||
wined3d_context_gl_set_current(NULL);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!(context_gl->dc = swapchain_get_backup_dc(swapchain)))
|
||||
if (!(context_gl->dc = wined3d_swapchain_gl_get_backup_dc(swapchain_gl)))
|
||||
{
|
||||
wined3d_context_gl_set_current(NULL);
|
||||
return FALSE;
|
||||
|
@ -1968,7 +1968,7 @@ HRESULT wined3d_context_gl_init(struct wined3d_context_gl *context_gl, struct wi
|
|||
|
||||
if (!context_gl->dc)
|
||||
{
|
||||
if (!(context_gl->dc = swapchain_get_backup_dc(context->swapchain)))
|
||||
if (!(context_gl->dc = wined3d_swapchain_gl_get_backup_dc(wined3d_swapchain_gl(context->swapchain))))
|
||||
{
|
||||
ERR("Failed to retrieve a device context.\n");
|
||||
return E_FAIL;
|
||||
|
|
|
@ -95,19 +95,19 @@ void wined3d_swapchain_cleanup(struct wined3d_swapchain *swapchain)
|
|||
wined3d_swapchain_state_restore_from_fullscreen(&swapchain->state, swapchain->state.device_window, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
if (swapchain->backup_dc)
|
||||
{
|
||||
TRACE("Destroying backup wined3d window %p, dc %p.\n", swapchain->backup_wnd, swapchain->backup_dc);
|
||||
|
||||
wined3d_release_dc(swapchain->backup_wnd, swapchain->backup_dc);
|
||||
DestroyWindow(swapchain->backup_wnd);
|
||||
}
|
||||
}
|
||||
|
||||
void wined3d_swapchain_gl_cleanup(struct wined3d_swapchain_gl *swapchain_gl)
|
||||
{
|
||||
wined3d_swapchain_cleanup(&swapchain_gl->s);
|
||||
|
||||
if (swapchain_gl->backup_dc)
|
||||
{
|
||||
TRACE("Destroying backup wined3d window %p, dc %p.\n", swapchain_gl->backup_wnd, swapchain_gl->backup_dc);
|
||||
|
||||
wined3d_release_dc(swapchain_gl->backup_wnd, swapchain_gl->backup_dc);
|
||||
DestroyWindow(swapchain_gl->backup_wnd);
|
||||
}
|
||||
}
|
||||
|
||||
ULONG CDECL wined3d_swapchain_incref(struct wined3d_swapchain *swapchain)
|
||||
|
@ -1162,29 +1162,29 @@ struct wined3d_context *swapchain_get_context(struct wined3d_swapchain *swapchai
|
|||
return swapchain_create_context(swapchain);
|
||||
}
|
||||
|
||||
HDC swapchain_get_backup_dc(struct wined3d_swapchain *swapchain)
|
||||
HDC wined3d_swapchain_gl_get_backup_dc(struct wined3d_swapchain_gl *swapchain_gl)
|
||||
{
|
||||
if (!swapchain->backup_dc)
|
||||
if (!swapchain_gl->backup_dc)
|
||||
{
|
||||
TRACE("Creating the backup window for swapchain %p.\n", swapchain);
|
||||
TRACE("Creating the backup window for swapchain %p.\n", swapchain_gl);
|
||||
|
||||
if (!(swapchain->backup_wnd = CreateWindowA(WINED3D_OPENGL_WINDOW_CLASS_NAME, "WineD3D fake window",
|
||||
if (!(swapchain_gl->backup_wnd = CreateWindowA(WINED3D_OPENGL_WINDOW_CLASS_NAME, "WineD3D fake window",
|
||||
WS_OVERLAPPEDWINDOW, 10, 10, 10, 10, NULL, NULL, NULL, NULL)))
|
||||
{
|
||||
ERR("Failed to create a window.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!(swapchain->backup_dc = GetDC(swapchain->backup_wnd)))
|
||||
if (!(swapchain_gl->backup_dc = GetDC(swapchain_gl->backup_wnd)))
|
||||
{
|
||||
ERR("Failed to get a DC.\n");
|
||||
DestroyWindow(swapchain->backup_wnd);
|
||||
swapchain->backup_wnd = NULL;
|
||||
DestroyWindow(swapchain_gl->backup_wnd);
|
||||
swapchain_gl->backup_wnd = NULL;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return swapchain->backup_dc;
|
||||
return swapchain_gl->backup_dc;
|
||||
}
|
||||
|
||||
void swapchain_update_draw_bindings(struct wined3d_swapchain *swapchain)
|
||||
|
|
|
@ -4404,16 +4404,12 @@ struct wined3d_swapchain
|
|||
|
||||
struct wined3d_swapchain_state state;
|
||||
HWND win_handle;
|
||||
|
||||
HDC backup_dc;
|
||||
HWND backup_wnd;
|
||||
};
|
||||
|
||||
void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activate) DECLSPEC_HIDDEN;
|
||||
void wined3d_swapchain_cleanup(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
|
||||
struct wined3d_context *swapchain_get_context(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
|
||||
void swapchain_destroy_contexts(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
|
||||
HDC swapchain_get_backup_dc(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
|
||||
void swapchain_update_draw_bindings(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
|
||||
void swapchain_set_max_frame_latency(struct wined3d_swapchain *swapchain,
|
||||
const struct wined3d_device *device) DECLSPEC_HIDDEN;
|
||||
|
@ -4425,6 +4421,9 @@ HRESULT wined3d_swapchain_no3d_init(struct wined3d_swapchain *swapchain_no3d,
|
|||
struct wined3d_swapchain_gl
|
||||
{
|
||||
struct wined3d_swapchain s;
|
||||
|
||||
HDC backup_dc;
|
||||
HWND backup_wnd;
|
||||
};
|
||||
|
||||
static inline struct wined3d_swapchain_gl *wined3d_swapchain_gl(struct wined3d_swapchain *swapchain)
|
||||
|
@ -4433,6 +4432,7 @@ static inline struct wined3d_swapchain_gl *wined3d_swapchain_gl(struct wined3d_s
|
|||
}
|
||||
|
||||
void wined3d_swapchain_gl_cleanup(struct wined3d_swapchain_gl *swapchain_gl) DECLSPEC_HIDDEN;
|
||||
HDC wined3d_swapchain_gl_get_backup_dc(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;
|
||||
|
|
Loading…
Reference in New Issue