wined3d: Get rid of the surface_type parameter to wined3d_swapchain_create().
This commit is contained in:
parent
56b256cb77
commit
31e8976910
|
@ -160,9 +160,8 @@ static HRESULT swapchain_init(struct d3d8_swapchain *swapchain, struct d3d8_devi
|
||||||
swapchain->IDirect3DSwapChain8_iface.lpVtbl = &d3d8_swapchain_vtbl;
|
swapchain->IDirect3DSwapChain8_iface.lpVtbl = &d3d8_swapchain_vtbl;
|
||||||
|
|
||||||
wined3d_mutex_lock();
|
wined3d_mutex_lock();
|
||||||
hr = wined3d_swapchain_create(device->wined3d_device, desc,
|
hr = wined3d_swapchain_create(device->wined3d_device, desc, swapchain,
|
||||||
WINED3D_SURFACE_TYPE_OPENGL, swapchain, &d3d8_swapchain_wined3d_parent_ops,
|
&d3d8_swapchain_wined3d_parent_ops, &swapchain->wined3d_swapchain);
|
||||||
&swapchain->wined3d_swapchain);
|
|
||||||
wined3d_mutex_unlock();
|
wined3d_mutex_unlock();
|
||||||
|
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
|
|
|
@ -255,9 +255,8 @@ static HRESULT swapchain_init(struct d3d9_swapchain *swapchain, struct d3d9_devi
|
||||||
swapchain->IDirect3DSwapChain9_iface.lpVtbl = &d3d9_swapchain_vtbl;
|
swapchain->IDirect3DSwapChain9_iface.lpVtbl = &d3d9_swapchain_vtbl;
|
||||||
|
|
||||||
wined3d_mutex_lock();
|
wined3d_mutex_lock();
|
||||||
hr = wined3d_swapchain_create(device->wined3d_device, desc,
|
hr = wined3d_swapchain_create(device->wined3d_device, desc, swapchain,
|
||||||
WINED3D_SURFACE_TYPE_OPENGL, swapchain, &d3d9_swapchain_wined3d_parent_ops,
|
&d3d9_swapchain_wined3d_parent_ops, &swapchain->wined3d_swapchain);
|
||||||
&swapchain->wined3d_swapchain);
|
|
||||||
wined3d_mutex_unlock();
|
wined3d_mutex_unlock();
|
||||||
|
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
|
|
|
@ -5223,9 +5223,8 @@ static HRESULT CDECL device_parent_create_swapchain(struct wined3d_device_parent
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = wined3d_swapchain_create(ddraw->wined3d_device, desc,
|
if (FAILED(hr = wined3d_swapchain_create(ddraw->wined3d_device, desc, NULL,
|
||||||
DefaultSurfaceType, NULL, &ddraw_null_wined3d_parent_ops, swapchain);
|
&ddraw_null_wined3d_parent_ops, swapchain)))
|
||||||
if (FAILED(hr))
|
|
||||||
WARN("Failed to create swapchain, hr %#x.\n", hr);
|
WARN("Failed to create swapchain, hr %#x.\n", hr);
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
|
|
|
@ -304,10 +304,8 @@ HRESULT dxgi_swapchain_init(struct dxgi_swapchain *swapchain, struct dxgi_device
|
||||||
swapchain->IDXGISwapChain_iface.lpVtbl = &dxgi_swapchain_vtbl;
|
swapchain->IDXGISwapChain_iface.lpVtbl = &dxgi_swapchain_vtbl;
|
||||||
swapchain->refcount = 1;
|
swapchain->refcount = 1;
|
||||||
|
|
||||||
hr = wined3d_swapchain_create(device->wined3d_device, desc,
|
if (FAILED(hr = wined3d_swapchain_create(device->wined3d_device, desc, swapchain,
|
||||||
WINED3D_SURFACE_TYPE_OPENGL, swapchain, &dxgi_swapchain_wined3d_parent_ops,
|
&dxgi_swapchain_wined3d_parent_ops, &swapchain->wined3d_swapchain)))
|
||||||
&swapchain->wined3d_swapchain);
|
|
||||||
if (FAILED(hr))
|
|
||||||
{
|
{
|
||||||
WARN("Failed to create wined3d swapchain, hr %#x.\n", hr);
|
WARN("Failed to create wined3d swapchain, hr %#x.\n", hr);
|
||||||
return hr;
|
return hr;
|
||||||
|
|
|
@ -815,9 +815,8 @@ void swapchain_update_render_to_fbo(struct wined3d_swapchain *swapchain)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do not call while under the GL lock. */
|
/* Do not call while under the GL lock. */
|
||||||
static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, enum wined3d_surface_type surface_type,
|
static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3d_device *device,
|
||||||
struct wined3d_device *device, struct wined3d_swapchain_desc *desc,
|
struct wined3d_swapchain_desc *desc, void *parent, const struct wined3d_parent_ops *parent_ops)
|
||||||
void *parent, const struct wined3d_parent_ops *parent_ops)
|
|
||||||
{
|
{
|
||||||
const struct wined3d_adapter *adapter = device->adapter;
|
const struct wined3d_adapter *adapter = device->adapter;
|
||||||
const struct wined3d_format *format;
|
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");
|
"Please configure the application to use double buffering (1 back buffer) if possible.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (surface_type)
|
if (device->wined3d->flags & WINED3D_NO3D)
|
||||||
{
|
swapchain->swapchain_ops = &swapchain_gdi_ops;
|
||||||
case WINED3D_SURFACE_TYPE_GDI:
|
else
|
||||||
swapchain->swapchain_ops = &swapchain_gdi_ops;
|
swapchain->swapchain_ops = &swapchain_gl_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;
|
|
||||||
}
|
|
||||||
|
|
||||||
window = desc->device_window ? desc->device_window : device->create_parms.focus_window;
|
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)
|
if (swapchain->front_buffer->container.type == WINED3D_CONTAINER_NONE)
|
||||||
surface_set_container(swapchain->front_buffer, WINED3D_CONTAINER_SWAPCHAIN, swapchain);
|
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);
|
surface_modify_location(swapchain->front_buffer, SFLAG_INDRAWABLE, TRUE);
|
||||||
|
|
||||||
/* MSDN says we're only allowed a single fullscreen swapchain per device,
|
/* 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;
|
displaymode_set = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (surface_type == WINED3D_SURFACE_TYPE_OPENGL)
|
if (!(device->wined3d->flags & WINED3D_NO3D))
|
||||||
{
|
{
|
||||||
static const enum wined3d_format_id formats[] =
|
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. */
|
/* 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");
|
TRACE("Creating depth/stencil buffer.\n");
|
||||||
if (!device->auto_depth_stencil)
|
if (!device->auto_depth_stencil)
|
||||||
|
@ -1098,16 +1087,14 @@ err:
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do not call while under the GL lock. */
|
/* Do not call while under the GL lock. */
|
||||||
HRESULT CDECL wined3d_swapchain_create(struct wined3d_device *device,
|
HRESULT CDECL wined3d_swapchain_create(struct wined3d_device *device, struct wined3d_swapchain_desc *desc,
|
||||||
struct wined3d_swapchain_desc *desc, enum wined3d_surface_type surface_type,
|
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_swapchain **swapchain)
|
||||||
void *parent, const struct wined3d_parent_ops *parent_ops,
|
|
||||||
struct wined3d_swapchain **swapchain)
|
|
||||||
{
|
{
|
||||||
struct wined3d_swapchain *object;
|
struct wined3d_swapchain *object;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("device %p, desc %p, swapchain %p, parent %p, surface_type %#x.\n",
|
TRACE("device %p, desc %p, parent %p, parent_ops %p, swapchain %p.\n",
|
||||||
device, desc, swapchain, parent, surface_type);
|
device, desc, parent, parent_ops, swapchain);
|
||||||
|
|
||||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
||||||
if (!object)
|
if (!object)
|
||||||
|
@ -1116,7 +1103,7 @@ HRESULT CDECL wined3d_swapchain_create(struct wined3d_device *device,
|
||||||
return E_OUTOFMEMORY;
|
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))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
WARN("Failed to initialize swapchain, hr %#x.\n", hr);
|
WARN("Failed to initialize swapchain, hr %#x.\n", hr);
|
||||||
|
|
|
@ -240,7 +240,7 @@
|
||||||
@ cdecl wined3d_surface_update_overlay(ptr ptr ptr ptr long ptr)
|
@ cdecl wined3d_surface_update_overlay(ptr ptr ptr ptr long ptr)
|
||||||
@ cdecl wined3d_surface_update_overlay_z_order(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_decref(ptr)
|
||||||
@ cdecl wined3d_swapchain_get_back_buffer(ptr long long)
|
@ cdecl wined3d_swapchain_get_back_buffer(ptr long long)
|
||||||
@ cdecl wined3d_swapchain_get_device(ptr)
|
@ cdecl wined3d_swapchain_get_device(ptr)
|
||||||
|
|
|
@ -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,
|
HRESULT __cdecl wined3d_surface_update_overlay_z_order(struct wined3d_surface *surface,
|
||||||
DWORD flags, struct wined3d_surface *ref);
|
DWORD flags, struct wined3d_surface *ref);
|
||||||
|
|
||||||
HRESULT __cdecl wined3d_swapchain_create(struct wined3d_device *device,
|
HRESULT __cdecl wined3d_swapchain_create(struct wined3d_device *device, struct wined3d_swapchain_desc *desc,
|
||||||
struct wined3d_swapchain_desc *desc, enum wined3d_surface_type surface_type, void *parent,
|
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_swapchain **swapchain);
|
||||||
const struct wined3d_parent_ops *parent_ops, struct wined3d_swapchain **swapchain);
|
|
||||||
ULONG __cdecl wined3d_swapchain_decref(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,
|
struct wined3d_surface * __cdecl wined3d_swapchain_get_back_buffer(const struct wined3d_swapchain *swapchain,
|
||||||
UINT backbuffer_idx, enum wined3d_backbuffer_type backbuffer_type);
|
UINT backbuffer_idx, enum wined3d_backbuffer_type backbuffer_type);
|
||||||
|
|
Loading…
Reference in New Issue