wined3d: Get rid of wined3d_device_init_gdi().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
0ffb153551
commit
b599e8e3a0
|
@ -569,6 +569,9 @@ static HRESULT ddraw_attach_d3d_device(struct ddraw *ddraw,
|
|||
|
||||
TRACE("ddraw %p.\n", ddraw);
|
||||
|
||||
if (ddraw->flags & DDRAW_NO3D)
|
||||
return wined3d_device_init_3d(ddraw->wined3d_device, swapchain_desc);
|
||||
|
||||
if (!window || window == GetDesktopWindow())
|
||||
{
|
||||
window = CreateWindowExA(0, DDRAW_WINDOW_CLASS_NAME, "Hidden D3D Window",
|
||||
|
@ -594,8 +597,7 @@ static HRESULT ddraw_attach_d3d_device(struct ddraw *ddraw,
|
|||
/* Set this NOW, otherwise creating the depth stencil surface will cause a
|
||||
* recursive loop until ram or emulated video memory is full. */
|
||||
ddraw->flags |= DDRAW_D3D_INITIALIZED;
|
||||
hr = wined3d_device_init_3d(ddraw->wined3d_device, swapchain_desc);
|
||||
if (FAILED(hr))
|
||||
if (FAILED(hr = wined3d_device_init_3d(ddraw->wined3d_device, swapchain_desc)))
|
||||
{
|
||||
ddraw->flags &= ~DDRAW_D3D_INITIALIZED;
|
||||
return hr;
|
||||
|
@ -638,12 +640,7 @@ static HRESULT ddraw_create_swapchain(struct ddraw *ddraw, HWND window, BOOL win
|
|||
swapchain_desc.windowed = windowed;
|
||||
swapchain_desc.flags = WINED3D_SWAPCHAIN_ALLOW_MODE_SWITCH;
|
||||
|
||||
if (!(ddraw->flags & DDRAW_NO3D))
|
||||
hr = ddraw_attach_d3d_device(ddraw, &swapchain_desc);
|
||||
else
|
||||
hr = wined3d_device_init_gdi(ddraw->wined3d_device, &swapchain_desc);
|
||||
|
||||
if (FAILED(hr))
|
||||
if (FAILED(hr = ddraw_attach_d3d_device(ddraw, &swapchain_desc)))
|
||||
{
|
||||
ERR("Failed to create swapchain, hr %#x.\n", hr);
|
||||
return hr;
|
||||
|
|
|
@ -1079,8 +1079,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
|
|||
|
||||
if (device->d3d_initialized)
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
if (device->wined3d->flags & WINED3D_NO3D)
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
|
||||
memset(device->fb.render_targets, 0, sizeof(device->fb.render_targets));
|
||||
|
||||
|
@ -1120,26 +1118,40 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
|
|||
}
|
||||
device->swapchains[0] = swapchain;
|
||||
|
||||
if (FAILED(hr = wined3d_device_create_primary_opengl_context(device)))
|
||||
goto err_out;
|
||||
device_init_swapchain_state(device, swapchain);
|
||||
if (device->wined3d->flags & WINED3D_NO3D)
|
||||
{
|
||||
if (!(device->blitter = wined3d_cpu_blitter_create()))
|
||||
{
|
||||
ERR("Failed to create CPU blitter.\n");
|
||||
heap_free(device->swapchains);
|
||||
device->swapchain_count = 0;
|
||||
goto err_out;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (FAILED(hr = wined3d_device_create_primary_opengl_context(device)))
|
||||
goto err_out;
|
||||
device_init_swapchain_state(device, swapchain);
|
||||
|
||||
device->contexts[0]->last_was_rhw = 0;
|
||||
device->contexts[0]->last_was_rhw = 0;
|
||||
|
||||
TRACE("All defaults now set up.\n");
|
||||
TRACE("All defaults now set up.\n");
|
||||
|
||||
/* Clear the screen */
|
||||
if (device->back_buffer_view)
|
||||
clear_flags |= WINED3DCLEAR_TARGET;
|
||||
if (swapchain_desc->enable_auto_depth_stencil)
|
||||
clear_flags |= WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL;
|
||||
if (clear_flags)
|
||||
wined3d_device_clear(device, 0, NULL, clear_flags, &black, 1.0f, 0);
|
||||
/* Clear the screen */
|
||||
if (device->back_buffer_view)
|
||||
clear_flags |= WINED3DCLEAR_TARGET;
|
||||
if (swapchain_desc->enable_auto_depth_stencil)
|
||||
clear_flags |= WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL;
|
||||
if (clear_flags)
|
||||
wined3d_device_clear(device, 0, NULL, clear_flags, &black, 1.0f, 0);
|
||||
|
||||
device->d3d_initialized = TRUE;
|
||||
device->d3d_initialized = TRUE;
|
||||
|
||||
if (wined3d_settings.logo)
|
||||
device_load_logo(device, wined3d_settings.logo);
|
||||
}
|
||||
|
||||
if (wined3d_settings.logo)
|
||||
device_load_logo(device, wined3d_settings.logo);
|
||||
return WINED3D_OK;
|
||||
|
||||
err_out:
|
||||
|
@ -1153,47 +1165,6 @@ err_out:
|
|||
return hr;
|
||||
}
|
||||
|
||||
HRESULT CDECL wined3d_device_init_gdi(struct wined3d_device *device,
|
||||
struct wined3d_swapchain_desc *swapchain_desc)
|
||||
{
|
||||
struct wined3d_swapchain *swapchain = NULL;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("device %p, swapchain_desc %p.\n", device, swapchain_desc);
|
||||
|
||||
/* Setup the implicit swapchain */
|
||||
TRACE("Creating implicit swapchain\n");
|
||||
hr = device->device_parent->ops->create_swapchain(device->device_parent,
|
||||
swapchain_desc, &swapchain);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
WARN("Failed to create implicit swapchain\n");
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
device->swapchain_count = 1;
|
||||
if (!(device->swapchains = heap_calloc(device->swapchain_count, sizeof(*device->swapchains))))
|
||||
{
|
||||
ERR("Out of memory!\n");
|
||||
goto err_out;
|
||||
}
|
||||
device->swapchains[0] = swapchain;
|
||||
|
||||
if (!(device->blitter = wined3d_cpu_blitter_create()))
|
||||
{
|
||||
ERR("Failed to create CPU blitter.\n");
|
||||
heap_free(device->swapchains);
|
||||
device->swapchain_count = 0;
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
return WINED3D_OK;
|
||||
|
||||
err_out:
|
||||
wined3d_swapchain_decref(swapchain);
|
||||
return hr;
|
||||
}
|
||||
|
||||
static void device_free_sampler(struct wine_rb_entry *entry, void *context)
|
||||
{
|
||||
struct wined3d_sampler *sampler = WINE_RB_ENTRY_VALUE(entry, struct wined3d_sampler, entry);
|
||||
|
|
|
@ -121,7 +121,6 @@
|
|||
@ cdecl wined3d_device_get_wined3d(ptr)
|
||||
@ cdecl wined3d_device_incref(ptr)
|
||||
@ cdecl wined3d_device_init_3d(ptr ptr)
|
||||
@ cdecl wined3d_device_init_gdi(ptr ptr)
|
||||
@ cdecl wined3d_device_multiply_transform(ptr long ptr)
|
||||
@ cdecl wined3d_device_process_vertices(ptr long long long ptr ptr long long)
|
||||
@ cdecl wined3d_device_release_focus_window(ptr)
|
||||
|
|
|
@ -2364,7 +2364,6 @@ struct wined3d_sampler * __cdecl wined3d_device_get_vs_sampler(const struct wine
|
|||
struct wined3d * __cdecl wined3d_device_get_wined3d(const struct wined3d_device *device);
|
||||
ULONG __cdecl wined3d_device_incref(struct wined3d_device *device);
|
||||
HRESULT __cdecl wined3d_device_init_3d(struct wined3d_device *device, struct wined3d_swapchain_desc *swapchain_desc);
|
||||
HRESULT __cdecl wined3d_device_init_gdi(struct wined3d_device *device, struct wined3d_swapchain_desc *swapchain_desc);
|
||||
void __cdecl wined3d_device_multiply_transform(struct wined3d_device *device,
|
||||
enum wined3d_transform_state state, const struct wined3d_matrix *matrix);
|
||||
HRESULT __cdecl wined3d_device_process_vertices(struct wined3d_device *device,
|
||||
|
|
Loading…
Reference in New Issue