wined3d: Get rid of the surface_type parameter to wined3d_swapchain_create().

This commit is contained in:
Henri Verbeet 2013-01-16 08:51:49 +01:00 committed by Alexandre Julliard
parent 56b256cb77
commit 31e8976910
7 changed files with 25 additions and 44 deletions

View file

@ -160,9 +160,8 @@ static HRESULT swapchain_init(struct d3d8_swapchain *swapchain, struct d3d8_devi
swapchain->IDirect3DSwapChain8_iface.lpVtbl = &d3d8_swapchain_vtbl;
wined3d_mutex_lock();
hr = wined3d_swapchain_create(device->wined3d_device, desc,
WINED3D_SURFACE_TYPE_OPENGL, swapchain, &d3d8_swapchain_wined3d_parent_ops,
&swapchain->wined3d_swapchain);
hr = wined3d_swapchain_create(device->wined3d_device, desc, swapchain,
&d3d8_swapchain_wined3d_parent_ops, &swapchain->wined3d_swapchain);
wined3d_mutex_unlock();
if (FAILED(hr))

View file

@ -255,9 +255,8 @@ static HRESULT swapchain_init(struct d3d9_swapchain *swapchain, struct d3d9_devi
swapchain->IDirect3DSwapChain9_iface.lpVtbl = &d3d9_swapchain_vtbl;
wined3d_mutex_lock();
hr = wined3d_swapchain_create(device->wined3d_device, desc,
WINED3D_SURFACE_TYPE_OPENGL, swapchain, &d3d9_swapchain_wined3d_parent_ops,
&swapchain->wined3d_swapchain);
hr = wined3d_swapchain_create(device->wined3d_device, desc, swapchain,
&d3d9_swapchain_wined3d_parent_ops, &swapchain->wined3d_swapchain);
wined3d_mutex_unlock();
if (FAILED(hr))

View file

@ -5223,9 +5223,8 @@ static HRESULT CDECL device_parent_create_swapchain(struct wined3d_device_parent
return E_FAIL;
}
hr = wined3d_swapchain_create(ddraw->wined3d_device, desc,
DefaultSurfaceType, NULL, &ddraw_null_wined3d_parent_ops, swapchain);
if (FAILED(hr))
if (FAILED(hr = wined3d_swapchain_create(ddraw->wined3d_device, desc, NULL,
&ddraw_null_wined3d_parent_ops, swapchain)))
WARN("Failed to create swapchain, hr %#x.\n", hr);
return hr;

View file

@ -304,10 +304,8 @@ HRESULT dxgi_swapchain_init(struct dxgi_swapchain *swapchain, struct dxgi_device
swapchain->IDXGISwapChain_iface.lpVtbl = &dxgi_swapchain_vtbl;
swapchain->refcount = 1;
hr = wined3d_swapchain_create(device->wined3d_device, desc,
WINED3D_SURFACE_TYPE_OPENGL, swapchain, &dxgi_swapchain_wined3d_parent_ops,
&swapchain->wined3d_swapchain);
if (FAILED(hr))
if (FAILED(hr = wined3d_swapchain_create(device->wined3d_device, desc, swapchain,
&dxgi_swapchain_wined3d_parent_ops, &swapchain->wined3d_swapchain)))
{
WARN("Failed to create wined3d swapchain, hr %#x.\n", hr);
return hr;

View file

@ -815,9 +815,8 @@ void swapchain_update_render_to_fbo(struct wined3d_swapchain *swapchain)
}
/* Do not call while under the GL lock. */
static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, enum wined3d_surface_type surface_type,
struct wined3d_device *device, struct wined3d_swapchain_desc *desc,
void *parent, const struct wined3d_parent_ops *parent_ops)
static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3d_device *device,
struct wined3d_swapchain_desc *desc, void *parent, const struct wined3d_parent_ops *parent_ops)
{
const struct wined3d_adapter *adapter = device->adapter;
const struct wined3d_format *format;
@ -841,20 +840,10 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, enum wined3d_
"Please configure the application to use double buffering (1 back buffer) if possible.\n");
}
switch (surface_type)
{
case WINED3D_SURFACE_TYPE_GDI:
swapchain->swapchain_ops = &swapchain_gdi_ops;
break;
case WINED3D_SURFACE_TYPE_OPENGL:
swapchain->swapchain_ops = &swapchain_gl_ops;
break;
default:
ERR("Invalid surface type %#x.\n", surface_type);
return WINED3DERR_INVALIDCALL;
}
if (device->wined3d->flags & WINED3D_NO3D)
swapchain->swapchain_ops = &swapchain_gdi_ops;
else
swapchain->swapchain_ops = &swapchain_gl_ops;
window = desc->device_window ? desc->device_window : device->create_parms.focus_window;
@ -911,7 +900,7 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, enum wined3d_
if (swapchain->front_buffer->container.type == WINED3D_CONTAINER_NONE)
surface_set_container(swapchain->front_buffer, WINED3D_CONTAINER_SWAPCHAIN, swapchain);
if (surface_type == WINED3D_SURFACE_TYPE_OPENGL)
if (!(device->wined3d->flags & WINED3D_NO3D))
surface_modify_location(swapchain->front_buffer, SFLAG_INDRAWABLE, TRUE);
/* MSDN says we're only allowed a single fullscreen swapchain per device,
@ -937,7 +926,7 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, enum wined3d_
displaymode_set = TRUE;
}
if (surface_type == WINED3D_SURFACE_TYPE_OPENGL)
if (!(device->wined3d->flags & WINED3D_NO3D))
{
static const enum wined3d_format_id formats[] =
{
@ -1024,7 +1013,7 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, enum wined3d_
}
/* Swapchains share the depth/stencil buffer, so only create a single depthstencil surface. */
if (desc->enable_auto_depth_stencil && surface_type == WINED3D_SURFACE_TYPE_OPENGL)
if (desc->enable_auto_depth_stencil && !(device->wined3d->flags & WINED3D_NO3D))
{
TRACE("Creating depth/stencil buffer.\n");
if (!device->auto_depth_stencil)
@ -1098,16 +1087,14 @@ err:
}
/* Do not call while under the GL lock. */
HRESULT CDECL wined3d_swapchain_create(struct wined3d_device *device,
struct wined3d_swapchain_desc *desc, enum wined3d_surface_type surface_type,
void *parent, const struct wined3d_parent_ops *parent_ops,
struct wined3d_swapchain **swapchain)
HRESULT CDECL wined3d_swapchain_create(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 *object;
HRESULT hr;
TRACE("device %p, desc %p, swapchain %p, parent %p, surface_type %#x.\n",
device, desc, swapchain, parent, surface_type);
TRACE("device %p, desc %p, parent %p, parent_ops %p, swapchain %p.\n",
device, desc, parent, parent_ops, swapchain);
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object)
@ -1116,7 +1103,7 @@ HRESULT CDECL wined3d_swapchain_create(struct wined3d_device *device,
return E_OUTOFMEMORY;
}
hr = swapchain_init(object, surface_type, device, desc, parent, parent_ops);
hr = swapchain_init(object, device, desc, parent, parent_ops);
if (FAILED(hr))
{
WARN("Failed to initialize swapchain, hr %#x.\n", hr);

View file

@ -240,7 +240,7 @@
@ cdecl wined3d_surface_update_overlay(ptr ptr ptr ptr long ptr)
@ cdecl wined3d_surface_update_overlay_z_order(ptr long ptr)
@ cdecl wined3d_swapchain_create(ptr ptr long ptr ptr ptr)
@ cdecl wined3d_swapchain_create(ptr ptr ptr ptr ptr)
@ cdecl wined3d_swapchain_decref(ptr)
@ cdecl wined3d_swapchain_get_back_buffer(ptr long long)
@ cdecl wined3d_swapchain_get_device(ptr)

View file

@ -2378,9 +2378,8 @@ HRESULT __cdecl wined3d_surface_update_overlay(struct wined3d_surface *surface,
HRESULT __cdecl wined3d_surface_update_overlay_z_order(struct wined3d_surface *surface,
DWORD flags, struct wined3d_surface *ref);
HRESULT __cdecl wined3d_swapchain_create(struct wined3d_device *device,
struct wined3d_swapchain_desc *desc, enum wined3d_surface_type surface_type, void *parent,
const struct wined3d_parent_ops *parent_ops, struct wined3d_swapchain **swapchain);
HRESULT __cdecl wined3d_swapchain_create(struct wined3d_device *device, struct wined3d_swapchain_desc *desc,
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_swapchain **swapchain);
ULONG __cdecl wined3d_swapchain_decref(struct wined3d_swapchain *swapchain);
struct wined3d_surface * __cdecl wined3d_swapchain_get_back_buffer(const struct wined3d_swapchain *swapchain,
UINT backbuffer_idx, enum wined3d_backbuffer_type backbuffer_type);