wined3d: Remove COM from the swapchain implementation.

This commit is contained in:
Henri Verbeet 2011-04-13 19:14:31 +02:00 committed by Alexandre Julliard
parent 178061d3c1
commit 3ec19590d5
23 changed files with 198 additions and 284 deletions

View File

@ -1465,7 +1465,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent
}
static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDeviceParent *iface,
WINED3DPRESENT_PARAMETERS *present_parameters, IWineD3DSwapChain **swapchain)
WINED3DPRESENT_PARAMETERS *present_parameters, struct wined3d_swapchain **swapchain)
{
IWineDXGIDevice *wine_device;
HRESULT hr;

View File

@ -229,12 +229,8 @@ struct IDirect3DSwapChain8Impl
/* IUnknown fields */
IDirect3DSwapChain8 IDirect3DSwapChain8_iface;
LONG ref;
/* IDirect3DSwapChain8 fields */
IWineD3DSwapChain *wineD3DSwapChain;
/* Parent reference */
IDirect3DDevice8 *parentDevice;
struct wined3d_swapchain *wined3d_swapchain;
IDirect3DDevice8 *parentDevice;
};
HRESULT swapchain_init(IDirect3DSwapChain8Impl *swapchain, IDirect3DDevice8Impl *device,

View File

@ -2900,7 +2900,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent
}
static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDeviceParent *iface,
WINED3DPRESENT_PARAMETERS *present_parameters, IWineD3DSwapChain **swapchain)
WINED3DPRESENT_PARAMETERS *present_parameters, struct wined3d_swapchain **swapchain)
{
IDirect3DDevice8Impl *This = impl_from_IWineD3DDeviceParent(iface);
D3DPRESENT_PARAMETERS local_parameters;
@ -2933,8 +2933,8 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDevicePar
return hr;
}
*swapchain = ((IDirect3DSwapChain8Impl *)d3d_swapchain)->wineD3DSwapChain;
IWineD3DSwapChain_AddRef(*swapchain);
*swapchain = ((IDirect3DSwapChain8Impl *)d3d_swapchain)->wined3d_swapchain;
wined3d_swapchain_incref(*swapchain);
IDirect3DSwapChain8_Release(d3d_swapchain);
/* Copy back the presentation parameters */

View File

@ -59,7 +59,7 @@ static ULONG WINAPI IDirect3DSwapChain8Impl_AddRef(IDirect3DSwapChain8 *iface)
if (This->parentDevice)
IDirect3DDevice8_AddRef(This->parentDevice);
wined3d_mutex_lock();
IWineD3DSwapChain_AddRef(This->wineD3DSwapChain);
wined3d_swapchain_incref(This->wined3d_swapchain);
wined3d_mutex_unlock();
}
@ -78,7 +78,7 @@ static ULONG WINAPI IDirect3DSwapChain8Impl_Release(IDirect3DSwapChain8 *iface)
IDirect3DDevice8 *parentDevice = This->parentDevice;
wined3d_mutex_lock();
IWineD3DSwapChain_Release(This->wineD3DSwapChain);
wined3d_swapchain_decref(This->wined3d_swapchain);
wined3d_mutex_unlock();
if (parentDevice)
@ -98,7 +98,8 @@ static HRESULT WINAPI IDirect3DSwapChain8Impl_Present(IDirect3DSwapChain8 *iface
iface, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion);
wined3d_mutex_lock();
hr = IWineD3DSwapChain_Present(This->wineD3DSwapChain, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion, 0);
hr = wined3d_swapchain_present(This->wined3d_swapchain, pSourceRect,
pDestRect, hDestWindowOverride, pDirtyRegion, 0);
wined3d_mutex_unlock();
return hr;
@ -115,8 +116,8 @@ static HRESULT WINAPI IDirect3DSwapChain8Impl_GetBackBuffer(IDirect3DSwapChain8
iface, iBackBuffer, Type, ppBackBuffer);
wined3d_mutex_lock();
hr = IWineD3DSwapChain_GetBackBuffer(This->wineD3DSwapChain, iBackBuffer,
(WINED3DBACKBUFFER_TYPE)Type, &mySurface);
hr = wined3d_swapchain_get_back_buffer(This->wined3d_swapchain,
iBackBuffer, (WINED3DBACKBUFFER_TYPE)Type, &mySurface);
if (SUCCEEDED(hr) && mySurface)
{
*ppBackBuffer = IWineD3DSurface_GetParent(mySurface);
@ -175,7 +176,7 @@ HRESULT swapchain_init(IDirect3DSwapChain8Impl *swapchain, IDirect3DDevice8Impl
wined3d_mutex_lock();
hr = IWineD3DDevice_CreateSwapChain(device->WineD3DDevice, &wined3d_parameters,
SURFACE_OPENGL, swapchain, &d3d8_swapchain_wined3d_parent_ops,
&swapchain->wineD3DSwapChain);
&swapchain->wined3d_swapchain);
wined3d_mutex_unlock();
present_parameters->BackBufferWidth = wined3d_parameters.BackBufferWidth;

View File

@ -216,12 +216,8 @@ typedef struct IDirect3DSwapChain9Impl
/* IUnknown fields */
const IDirect3DSwapChain9Vtbl *lpVtbl;
LONG ref;
/* IDirect3DSwapChain9 fields */
IWineD3DSwapChain *wineD3DSwapChain;
/* Parent reference */
LPDIRECT3DDEVICE9EX parentDevice;
struct wined3d_swapchain *wined3d_swapchain;
IDirect3DDevice9Ex *parentDevice;
} IDirect3DSwapChain9Impl;
HRESULT swapchain_init(IDirect3DSwapChain9Impl *swapchain, IDirect3DDevice9Impl *device,

View File

@ -481,7 +481,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_CreateAdditionalSwa
static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_GetSwapChain(IDirect3DDevice9Ex *iface,
UINT swapchain_idx, IDirect3DSwapChain9 **swapchain)
{
IWineD3DSwapChain *wined3d_swapchain = NULL;
struct wined3d_swapchain *wined3d_swapchain = NULL;
HRESULT hr;
TRACE("iface %p, swapchain_idx %u, swapchain %p.\n", iface, swapchain_idx, swapchain);
@ -491,9 +491,9 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_GetSwapChain(IDirec
swapchain_idx, &wined3d_swapchain);
if (SUCCEEDED(hr) && wined3d_swapchain)
{
*swapchain = IWineD3DSwapChain_GetParent(wined3d_swapchain);
*swapchain = wined3d_swapchain_get_parent(wined3d_swapchain);
IDirect3DSwapChain9_AddRef(*swapchain);
IWineD3DSwapChain_Release(wined3d_swapchain);
wined3d_swapchain_decref(wined3d_swapchain);
}
else
{
@ -3159,7 +3159,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent
}
static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDeviceParent *iface,
WINED3DPRESENT_PARAMETERS *present_parameters, IWineD3DSwapChain **swapchain)
WINED3DPRESENT_PARAMETERS *present_parameters, struct wined3d_swapchain **swapchain)
{
struct IDirect3DDevice9Impl *This = device_from_device_parent(iface);
D3DPRESENT_PARAMETERS local_parameters;
@ -3193,8 +3193,8 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDevicePar
return hr;
}
*swapchain = ((IDirect3DSwapChain9Impl *)d3d_swapchain)->wineD3DSwapChain;
IWineD3DSwapChain_AddRef(*swapchain);
*swapchain = ((IDirect3DSwapChain9Impl *)d3d_swapchain)->wined3d_swapchain;
wined3d_swapchain_incref(*swapchain);
IDirect3DSwapChain9_Release((IDirect3DSwapChain9 *)d3d_swapchain);
/* Copy back the presentation parameters */

View File

@ -56,7 +56,7 @@ static ULONG WINAPI IDirect3DSwapChain9Impl_AddRef(LPDIRECT3DSWAPCHAIN9 iface) {
IDirect3DDevice9Ex_AddRef(This->parentDevice);
wined3d_mutex_lock();
IWineD3DSwapChain_AddRef(This->wineD3DSwapChain);
wined3d_swapchain_incref(This->wined3d_swapchain);
wined3d_mutex_unlock();
}
@ -73,7 +73,7 @@ static ULONG WINAPI IDirect3DSwapChain9Impl_Release(LPDIRECT3DSWAPCHAIN9 iface)
IDirect3DDevice9Ex *parentDevice = This->parentDevice;
wined3d_mutex_lock();
IWineD3DSwapChain_Release(This->wineD3DSwapChain);
wined3d_swapchain_decref(This->wined3d_swapchain);
wined3d_mutex_unlock();
/* Release the device last, as it may cause the device to be destroyed. */
@ -91,7 +91,8 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DSwapChain9Impl_Present(LPDIRECT
iface, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion, dwFlags);
wined3d_mutex_lock();
hr = IWineD3DSwapChain_Present(This->wineD3DSwapChain, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion, dwFlags);
hr = wined3d_swapchain_present(This->wined3d_swapchain, pSourceRect,
pDestRect, hDestWindowOverride, pDirtyRegion, dwFlags);
wined3d_mutex_unlock();
return hr;
@ -104,7 +105,8 @@ static HRESULT WINAPI IDirect3DSwapChain9Impl_GetFrontBufferData(LPDIRECT3DSWAPC
TRACE("iface %p, surface %p.\n", iface, pDestSurface);
wined3d_mutex_lock();
hr = IWineD3DSwapChain_GetFrontBufferData(This->wineD3DSwapChain, ((IDirect3DSurface9Impl *)pDestSurface)->wineD3DSurface);
hr = wined3d_swapchain_get_front_buffer_data(This->wined3d_swapchain,
((IDirect3DSurface9Impl *)pDestSurface)->wineD3DSurface);
wined3d_mutex_unlock();
return hr;
@ -121,8 +123,8 @@ static HRESULT WINAPI IDirect3DSwapChain9Impl_GetBackBuffer(IDirect3DSwapChain9
iface, iBackBuffer, Type, ppBackBuffer);
wined3d_mutex_lock();
hr = IWineD3DSwapChain_GetBackBuffer(This->wineD3DSwapChain, iBackBuffer,
(WINED3DBACKBUFFER_TYPE)Type, &mySurface);
hr = wined3d_swapchain_get_back_buffer(This->wined3d_swapchain,
iBackBuffer, (WINED3DBACKBUFFER_TYPE)Type, &mySurface);
if (SUCCEEDED(hr) && mySurface)
{
*ppBackBuffer = IWineD3DSurface_GetParent(mySurface);
@ -142,7 +144,7 @@ static HRESULT WINAPI IDirect3DSwapChain9Impl_GetRasterStatus(LPDIRECT3DSWAPCHAI
TRACE("iface %p, raster_status %p.\n", iface, pRasterStatus);
wined3d_mutex_lock();
hr = IWineD3DSwapChain_GetRasterStatus(This->wineD3DSwapChain, (WINED3DRASTER_STATUS *) pRasterStatus);
hr = wined3d_swapchain_get_raster_status(This->wined3d_swapchain, (WINED3DRASTER_STATUS *)pRasterStatus);
wined3d_mutex_unlock();
return hr;
@ -155,7 +157,7 @@ static HRESULT WINAPI IDirect3DSwapChain9Impl_GetDisplayMode(LPDIRECT3DSWAPCHAIN
TRACE("iface %p, mode %p.\n", iface, pMode);
wined3d_mutex_lock();
hr = IWineD3DSwapChain_GetDisplayMode(This->wineD3DSwapChain, (WINED3DDISPLAYMODE *) pMode);
hr = wined3d_swapchain_get_display_mode(This->wined3d_swapchain, (WINED3DDISPLAYMODE *)pMode);
wined3d_mutex_unlock();
if (SUCCEEDED(hr)) pMode->Format = d3dformat_from_wined3dformat(pMode->Format);
@ -185,7 +187,7 @@ static HRESULT WINAPI IDirect3DSwapChain9Impl_GetPresentParameters(LPDIRECT3DSWA
TRACE("iface %p, parameters %p.\n", iface, pPresentationParameters);
wined3d_mutex_lock();
hr = IWineD3DSwapChain_GetPresentParameters(This->wineD3DSwapChain, &winePresentParameters);
hr = wined3d_swapchain_get_present_parameters(This->wined3d_swapchain, &winePresentParameters);
wined3d_mutex_unlock();
pPresentationParameters->BackBufferWidth = winePresentParameters.BackBufferWidth;
@ -259,7 +261,7 @@ HRESULT swapchain_init(IDirect3DSwapChain9Impl *swapchain, IDirect3DDevice9Impl
wined3d_mutex_lock();
hr = IWineD3DDevice_CreateSwapChain(device->WineD3DDevice, &wined3d_parameters,
SURFACE_OPENGL, swapchain, &d3d9_swapchain_wined3d_parent_ops,
&swapchain->wineD3DSwapChain);
&swapchain->wined3d_swapchain);
wined3d_mutex_unlock();
present_parameters->BackBufferWidth = wined3d_parameters.BackBufferWidth;

View File

@ -2520,7 +2520,7 @@ HRESULT WINAPI ddraw_recreate_surfaces_cb(IDirectDrawSurface7 *surf, DDSURFACEDE
IDirectDrawImpl *This = surfImpl->ddraw;
struct wined3d_clipper *clipper = NULL;
IWineD3DSurface *wineD3DSurface;
IWineD3DSwapChain *swapchain;
struct wined3d_swapchain *swapchain;
void *parent;
HRESULT hr;
@ -2533,8 +2533,8 @@ HRESULT WINAPI ddraw_recreate_surfaces_cb(IDirectDrawSurface7 *surf, DDSURFACEDE
if(surfImpl->ImplType == This->ImplType) return DDENUMRET_OK; /* Continue */
/* Get the objects */
swapchain = surfImpl->wineD3DSwapChain;
surfImpl->wineD3DSwapChain = NULL;
swapchain = surfImpl->wined3d_swapchain;
surfImpl->wined3d_swapchain = NULL;
wineD3DSurface = surfImpl->WineD3DSurface;
/* get the clipper */
@ -2934,7 +2934,7 @@ static HRESULT ddraw_create_gdi_swapchain(IDirectDrawImpl *ddraw, IDirectDrawSur
if (FAILED(hr))
{
WARN("Failed to initialize GDI ddraw implementation, hr %#x.\n", hr);
primary->wineD3DSwapChain = NULL;
primary->wined3d_swapchain = NULL;
}
return hr;
@ -5888,7 +5888,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent
}
static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDeviceParent *iface,
WINED3DPRESENT_PARAMETERS *present_parameters, IWineD3DSwapChain **swapchain)
WINED3DPRESENT_PARAMETERS *present_parameters, struct wined3d_swapchain **swapchain)
{
struct IDirectDrawImpl *This = ddraw_from_device_parent(iface);
IDirectDrawSurfaceImpl *iterator;
@ -5905,11 +5905,11 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDevicePar
return hr;
}
This->d3d_target->wineD3DSwapChain = *swapchain;
This->d3d_target->wined3d_swapchain = *swapchain;
iterator = This->d3d_target->complex_array[0];
while (iterator)
{
iterator->wineD3DSwapChain = *swapchain;
iterator->wined3d_swapchain = *swapchain;
iterator = iterator->complex_array[0];
}

View File

@ -181,7 +181,7 @@ struct IDirectDrawSurfaceImpl
IDirectDrawImpl *ddraw;
IWineD3DSurface *WineD3DSurface;
struct wined3d_texture *wined3d_texture;
IWineD3DSwapChain *wineD3DSwapChain;
struct wined3d_swapchain *wined3d_swapchain;
/* This implementation handles attaching surfaces to other surfaces */
IDirectDrawSurfaceImpl *next_attached;

View File

@ -356,7 +356,7 @@ static ULONG WINAPI ddraw_surface7_Release(IDirectDrawSurface7 *iface)
wined3d_texture_decref(This->wined3d_texture);
/* If it's the RenderTarget, destroy the d3ddevice */
else if(This->wineD3DSwapChain)
else if (This->wined3d_swapchain)
{
if((ddraw->d3d_initialized) && (This == ddraw->d3d_target)) {
TRACE("(%p) Destroying the render target, uninitializing D3D\n", This);
@ -389,14 +389,14 @@ static ULONG WINAPI ddraw_surface7_Release(IDirectDrawSurface7 *iface)
/* Unset the pointers */
}
This->wineD3DSwapChain = NULL; /* Uninit3D releases the swapchain */
This->wined3d_swapchain = NULL; /* Uninit3D releases the swapchain */
ddraw->d3d_initialized = FALSE;
ddraw->d3d_target = NULL;
}
else
{
IWineD3DDevice_UninitGDI(ddraw->wineD3DDevice);
This->wineD3DSwapChain = NULL;
This->wined3d_swapchain = NULL;
}
/* Reset to the default surface implementation type. This is needed if apps use
@ -2569,19 +2569,17 @@ static HRESULT WINAPI ddraw_surface7_SetClipper(IDirectDrawSurface7 *iface, IDir
hr = IWineD3DSurface_SetClipper(This->WineD3DSurface, This->clipper ? This->clipper->wineD3DClipper : NULL);
if(This->wineD3DSwapChain) {
if (This->wined3d_swapchain)
{
clipWindow = NULL;
if(Clipper) {
IDirectDrawClipper_GetHWnd(Clipper, &clipWindow);
}
if(clipWindow) {
IWineD3DSwapChain_SetDestWindowOverride(This->wineD3DSwapChain,
clipWindow);
} else {
IWineD3DSwapChain_SetDestWindowOverride(This->wineD3DSwapChain,
This->ddraw->d3d_window);
}
if (clipWindow)
wined3d_swapchain_set_window(This->wined3d_swapchain, clipWindow);
else
wined3d_swapchain_set_window(This->wined3d_swapchain, This->ddraw->d3d_window);
}
LeaveCriticalSection(&ddraw_cs);

View File

@ -282,7 +282,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_device_create_surface(IWineDXGIDevice *ifa
}
static HRESULT STDMETHODCALLTYPE dxgi_device_create_swapchain(IWineDXGIDevice *iface,
WINED3DPRESENT_PARAMETERS *present_parameters, IWineD3DSwapChain **wined3d_swapchain)
WINED3DPRESENT_PARAMETERS *present_parameters, struct wined3d_swapchain **wined3d_swapchain)
{
struct dxgi_swapchain *object;
HRESULT hr;

View File

@ -126,7 +126,7 @@ struct dxgi_swapchain
{
const struct IDXGISwapChainVtbl *vtbl;
LONG refcount;
IWineD3DSwapChain *wined3d_swapchain;
struct wined3d_swapchain *wined3d_swapchain;
};
HRESULT dxgi_swapchain_init(struct dxgi_swapchain *swapchain, struct dxgi_device *device,

View File

@ -162,7 +162,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSwapChain(IWineDXGIFactory *
IUnknown *device, DXGI_SWAP_CHAIN_DESC *desc, IDXGISwapChain **swapchain)
{
WINED3DPRESENT_PARAMETERS present_parameters;
IWineD3DSwapChain *wined3d_swapchain;
struct wined3d_swapchain *wined3d_swapchain;
IWineD3DDevice *wined3d_device;
IWineDXGIDevice *dxgi_device;
UINT count;
@ -235,8 +235,8 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSwapChain(IWineDXGIFactory *
return hr;
}
*swapchain = IWineD3DSwapChain_GetParent(wined3d_swapchain);
IUnknown_Release(wined3d_swapchain);
*swapchain = wined3d_swapchain_get_parent(wined3d_swapchain);
wined3d_swapchain_decref(wined3d_swapchain);
/* FIXME? The swapchain is created with refcount 1 by the wined3d device,
* but the wined3d device can't hold a real reference. */

View File

@ -54,7 +54,7 @@ static ULONG STDMETHODCALLTYPE dxgi_swapchain_AddRef(IDXGISwapChain *iface)
TRACE("%p increasing refcount to %u\n", This, refcount);
if (refcount == 1)
IWineD3DSwapChain_AddRef(This->wined3d_swapchain);
wined3d_swapchain_incref(This->wined3d_swapchain);
return refcount;
}
@ -73,19 +73,11 @@ static ULONG STDMETHODCALLTYPE dxgi_swapchain_Release(IDXGISwapChain *iface)
FIXME("Only a single swapchain is supported\n");
hr = IWineD3DSwapChain_GetDevice(This->wined3d_swapchain, &wined3d_device);
wined3d_device = wined3d_swapchain_get_device(This->wined3d_swapchain);
hr = IWineD3DDevice_Uninit3D(wined3d_device);
if (FAILED(hr))
{
ERR("Failed to get the wined3d device, hr %#x\n", hr);
}
else
{
hr = IWineD3DDevice_Uninit3D(wined3d_device);
IWineD3DDevice_Release(wined3d_device);
if (FAILED(hr))
{
ERR("Uninit3D failed, hr %#x\n", hr);
}
ERR("Uninit3D failed, hr %#x\n", hr);
}
}
@ -145,7 +137,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_swapchain_Present(IDXGISwapChain *iface, U
if (sync_interval) FIXME("Unimplemented sync interval %u\n", sync_interval);
if (flags) FIXME("Unimplemented flags %#x\n", flags);
return IWineD3DSwapChain_Present(This->wined3d_swapchain, NULL, NULL, NULL, NULL, 0);
return wined3d_swapchain_present(This->wined3d_swapchain, NULL, NULL, NULL, NULL, 0);
}
static HRESULT STDMETHODCALLTYPE dxgi_swapchain_GetBuffer(IDXGISwapChain *iface,
@ -161,7 +153,8 @@ static HRESULT STDMETHODCALLTYPE dxgi_swapchain_GetBuffer(IDXGISwapChain *iface,
EnterCriticalSection(&dxgi_cs);
hr = IWineD3DSwapChain_GetBackBuffer(This->wined3d_swapchain, buffer_idx, WINED3DBACKBUFFER_TYPE_MONO, &backbuffer);
hr = wined3d_swapchain_get_back_buffer(This->wined3d_swapchain,
buffer_idx, WINED3DBACKBUFFER_TYPE_MONO, &backbuffer);
if (FAILED(hr))
{
LeaveCriticalSection(&dxgi_cs);

View File

@ -1326,7 +1326,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetSwapChain(IWineD3DDevice *iface,
if (iSwapChain < This->swapchain_count)
{
*pSwapChain = (IWineD3DSwapChain *)This->swapchains[iSwapChain];
IWineD3DSwapChain_AddRef(*pSwapChain);
wined3d_swapchain_incref(*pSwapChain);
TRACE("(%p) returning %p\n", This, *pSwapChain);
return WINED3D_OK;
} else {
@ -2065,9 +2065,7 @@ err_out:
}
This->palette_count = 0;
if (swapchain)
{
IWineD3DSwapChain_Release( (IWineD3DSwapChain *) swapchain);
}
wined3d_swapchain_decref(swapchain);
if (This->stateBlock)
{
wined3d_stateblock_decref(This->stateBlock);
@ -2113,7 +2111,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_InitGDI(IWineD3DDevice *iface,
return WINED3D_OK;
err_out:
IWineD3DSwapChain_Release((IWineD3DSwapChain *) swapchain);
wined3d_swapchain_decref(swapchain);
return hr;
}
@ -2265,10 +2263,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Uninit3D(IWineD3DDevice *iface)
for (i = 0; i < This->swapchain_count; ++i)
{
TRACE("Releasing the implicit swapchain %u.\n", i);
if (IWineD3DSwapChain_Release((IWineD3DSwapChain *)This->swapchains[i]))
{
FIXME("(%p) Something's still holding the implicit swapchain\n", This);
}
if (wined3d_swapchain_decref(This->swapchains[i]))
FIXME("Something's still holding the implicit swapchain.\n");
}
HeapFree(GetProcessHeap(), 0, This->swapchains);
@ -2297,10 +2293,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UninitGDI(IWineD3DDevice *iface)
for (i = 0; i < This->swapchain_count; ++i)
{
TRACE("Releasing the implicit swapchain %u.\n", i);
if (IWineD3DSwapChain_Release((IWineD3DSwapChain *)This->swapchains[i]))
{
FIXME("(%p) Something's still holding the implicit swapchain\n", This);
}
if (wined3d_swapchain_decref(This->swapchains[i]))
FIXME("Something's still holding the implicit swapchain.\n");
}
HeapFree(GetProcessHeap(), 0, This->swapchains);
@ -4635,8 +4629,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetBackBuffer(IWineD3DDevice *iface, UI
return hr;
}
hr = IWineD3DSwapChain_GetBackBuffer(swapchain, backbuffer_idx, backbuffer_type, backbuffer);
IWineD3DSwapChain_Release(swapchain);
hr = wined3d_swapchain_get_back_buffer(swapchain, backbuffer_idx, backbuffer_type, backbuffer);
wined3d_swapchain_decref(swapchain);
if (FAILED(hr))
{
WARN("Failed to get backbuffer %u, hr %#x.\n", backbuffer_idx, hr);
@ -4662,13 +4656,18 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetDisplayMode(IWineD3DDevice *iface, U
if(iSwapChain > 0) {
hr = IWineD3DDeviceImpl_GetSwapChain(iface, iSwapChain, &swapChain);
if (hr == WINED3D_OK) {
hr = IWineD3DSwapChain_GetDisplayMode(swapChain, pMode);
IWineD3DSwapChain_Release(swapChain);
} else {
if (SUCCEEDED(hr))
{
hr = wined3d_swapchain_get_display_mode(swapChain, pMode);
wined3d_swapchain_decref(swapChain);
}
else
{
FIXME("(%p) Error getting display mode\n", This);
}
} else {
}
else
{
/* Don't read the real display mode,
but return the stored mode instead. X11 can't change the color
depth, and some apps are pretty angry if they SetDisplayMode from
@ -4790,8 +4789,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Present(IWineD3DDevice *iface, const RE
for (i = 0; i < device->swapchain_count; ++i)
{
IWineD3DSwapChain_Present((IWineD3DSwapChain *)device->swapchains[i],
src_rect, dst_rect, dst_window_override, dirty_region, 0);
wined3d_swapchain_present(device->swapchains[i], src_rect,
dst_rect, dst_window_override, dirty_region, 0);
}
return WINED3D_OK;
@ -5238,8 +5237,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetFrontBufferData(IWineD3DDevice *ifac
hr = IWineD3DDeviceImpl_GetSwapChain(iface, swapchain_idx, &swapchain);
if (FAILED(hr)) return hr;
hr = IWineD3DSwapChain_GetFrontBufferData(swapchain, dst_surface);
IWineD3DSwapChain_Release(swapchain);
hr = wined3d_swapchain_get_front_buffer_data(swapchain, dst_surface);
wined3d_swapchain_decref(swapchain);
return hr;
}
@ -5471,8 +5470,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetRasterStatus(IWineD3DDevice *iface,
return hr;
}
hr = IWineD3DSwapChain_GetRasterStatus(swapchain, raster_status);
IWineD3DSwapChain_Release(swapchain);
hr = wined3d_swapchain_get_raster_status(swapchain, raster_status);
wined3d_swapchain_decref(swapchain);
if (FAILED(hr))
{
WARN("Failed to get raster status, hr %#x.\n", hr);
@ -6400,7 +6399,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Reset(IWineD3DDevice *iface,
WARN("Rejecting Reset() call because the requested display mode is not supported\n");
WARN("Requested mode: %d, %d\n", pPresentationParameters->BackBufferWidth,
pPresentationParameters->BackBufferHeight);
IWineD3DSwapChain_Release((IWineD3DSwapChain *)swapchain);
wined3d_swapchain_decref(swapchain);
return WINED3DERR_INVALIDCALL;
}
@ -6460,10 +6459,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Reset(IWineD3DDevice *iface,
pPresentationParameters->MultiSampleQuality,
FALSE,
(IWineD3DSurface **)&This->auto_depth_stencil);
if (FAILED(hrc)) {
ERR("Failed to create the depth stencil buffer\n");
IWineD3DSwapChain_Release((IWineD3DSwapChain *) swapchain);
if (FAILED(hrc))
{
ERR("Failed to create the depth stencil buffer.\n");
wined3d_swapchain_decref(swapchain);
return WINED3DERR_INVALIDCALL;
}
}
@ -6514,7 +6513,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Reset(IWineD3DDevice *iface,
hr = updateSurfaceDesc(swapchain->front_buffer, pPresentationParameters);
if(FAILED(hr))
{
IWineD3DSwapChain_Release((IWineD3DSwapChain *) swapchain);
wined3d_swapchain_decref(swapchain);
return hr;
}
@ -6523,7 +6522,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Reset(IWineD3DDevice *iface,
hr = updateSurfaceDesc(swapchain->back_buffers[i], pPresentationParameters);
if(FAILED(hr))
{
IWineD3DSwapChain_Release((IWineD3DSwapChain *) swapchain);
wined3d_swapchain_decref(swapchain);
return hr;
}
}
@ -6532,7 +6531,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Reset(IWineD3DDevice *iface,
hr = updateSurfaceDesc(This->auto_depth_stencil, pPresentationParameters);
if(FAILED(hr))
{
IWineD3DSwapChain_Release((IWineD3DSwapChain *) swapchain);
wined3d_swapchain_decref(swapchain);
return hr;
}
}
@ -6555,7 +6554,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Reset(IWineD3DDevice *iface,
if (FAILED(hr = IWineD3DDevice_AcquireFocusWindow(iface, focus_window)))
{
ERR("Failed to acquire focus window, hr %#x.\n", hr);
IWineD3DSwapChain_Release((IWineD3DSwapChain *)swapchain);
wined3d_swapchain_decref(swapchain);
return hr;
}
@ -6634,7 +6633,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Reset(IWineD3DDevice *iface,
}
hr = create_primary_opengl_context(This, swapchain);
IWineD3DSwapChain_Release((IWineD3DSwapChain *) swapchain);
wined3d_swapchain_decref(swapchain);
/* All done. There is no need to reload resources or shaders, this will happen automatically on the
* first use
@ -6667,10 +6666,10 @@ static void WINAPI IWineD3DDeviceImpl_SetGammaRamp(IWineD3DDevice *iface,
TRACE("Relaying to swapchain\n");
if (IWineD3DDeviceImpl_GetSwapChain(iface, iSwapChain, &swapchain) == WINED3D_OK)
if (SUCCEEDED(IWineD3DDeviceImpl_GetSwapChain(iface, iSwapChain, &swapchain)))
{
IWineD3DSwapChain_SetGammaRamp(swapchain, flags, pRamp);
IWineD3DSwapChain_Release(swapchain);
wined3d_swapchain_set_gamma_ramp(swapchain, flags, pRamp);
wined3d_swapchain_decref(swapchain);
}
}
@ -6679,9 +6678,10 @@ static void WINAPI IWineD3DDeviceImpl_GetGammaRamp(IWineD3DDevice *iface, UINT i
TRACE("Relaying to swapchain\n");
if (IWineD3DDeviceImpl_GetSwapChain(iface, iSwapChain, &swapchain) == WINED3D_OK) {
IWineD3DSwapChain_GetGammaRamp(swapchain, pRamp);
IWineD3DSwapChain_Release(swapchain);
if (SUCCEEDED(IWineD3DDeviceImpl_GetSwapChain(iface, iSwapChain, &swapchain)))
{
wined3d_swapchain_get_gamma_ramp(swapchain, pRamp);
wined3d_swapchain_decref(swapchain);
}
}

View File

@ -1287,7 +1287,7 @@ void stateblock_init_default_state(struct wined3d_stateblock *stateblock)
hr = IWineD3DDevice_GetSwapChain((IWineD3DDevice *)device, 0, &swapchain);
if (SUCCEEDED(hr) && swapchain)
{
hr = IWineD3DSwapChain_GetBackBuffer(swapchain, 0, WINED3DBACKBUFFER_TYPE_MONO, &backbuffer);
hr = wined3d_swapchain_get_back_buffer(swapchain, 0, WINED3DBACKBUFFER_TYPE_MONO, &backbuffer);
if (SUCCEEDED(hr) && backbuffer)
{
struct wined3d_resource_desc desc;
@ -1310,7 +1310,7 @@ void stateblock_init_default_state(struct wined3d_stateblock *stateblock)
state->viewport.MinZ = 0.0f;
state->viewport.MaxZ = 1.0f;
IWineD3DSwapChain_Release(swapchain);
wined3d_swapchain_decref(swapchain);
}
TRACE("Done.\n");

View File

@ -2897,9 +2897,8 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_Flip(IWineD3DSurface *iface, IWineD3DS
else
swapchain->presentParms.PresentationInterval = WINED3DPRESENT_INTERVAL_FOUR;
/* Flipping a OpenGL surface -> Use WineD3DDevice::Present */
return IWineD3DSwapChain_Present((IWineD3DSwapChain *)swapchain,
NULL, NULL, swapchain->win_handle, NULL, 0);
/* Flipping a OpenGL surface -> present. */
return wined3d_swapchain_present(swapchain, NULL, NULL, swapchain->win_handle, NULL, 0);
}
/* Does a direct frame buffer -> texture copy. Stretching is done
@ -3795,9 +3794,8 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *dst_surface,
dstSwapchain->presentParms.SwapEffect = WINED3DSWAPEFFECT_COPY;
dstSwapchain->presentParms.PresentationInterval = WINED3DPRESENT_INTERVAL_IMMEDIATE;
TRACE("Full screen back buffer -> front buffer blt, performing a flip instead\n");
IWineD3DSwapChain_Present((IWineD3DSwapChain *)dstSwapchain,
NULL, NULL, dstSwapchain->win_handle, NULL, 0);
TRACE("Full screen back buffer -> front buffer blt, performing a flip instead.\n");
wined3d_swapchain_present(dstSwapchain, NULL, NULL, dstSwapchain->win_handle, NULL, 0);
dstSwapchain->presentParms.SwapEffect = orig_swap;

View File

@ -223,8 +223,7 @@ static HRESULT WINAPI IWineGDISurfaceImpl_Flip(IWineD3DSurface *iface, IWineD3DS
}
swapchain = surface->container.u.swapchain;
hr = IWineD3DSwapChain_Present((IWineD3DSwapChain *)swapchain,
NULL, NULL, swapchain->win_handle, NULL, 0);
hr = wined3d_swapchain_present(swapchain, NULL, NULL, swapchain->win_handle, NULL, 0);
return hr;
}

View File

@ -3,6 +3,7 @@
* Copyright 2002-2003 Raphael Junqueira
* Copyright 2005 Oliver Stieber
* Copyright 2007-2008 Stefan Dösinger for CodeWeavers
* Copyright 2011 Henri Verbeet for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -33,7 +34,7 @@ static void swapchain_cleanup(IWineD3DSwapChainImpl *swapchain)
TRACE("Destroying swapchain %p.\n", swapchain);
IWineD3DSwapChain_SetGammaRamp((IWineD3DSwapChain *)swapchain, 0, &swapchain->orig_gamma);
wined3d_swapchain_set_gamma_ramp(swapchain, 0, &swapchain->orig_gamma);
/* Release the swapchain's draw buffers. Make sure swapchain->back_buffers[0]
* is the last buffer to be destroyed, FindContext() depends on that. */
@ -81,28 +82,8 @@ static void swapchain_cleanup(IWineD3DSwapChainImpl *swapchain)
}
}
static HRESULT WINAPI IWineD3DBaseSwapChainImpl_QueryInterface(IWineD3DSwapChain *iface, REFIID riid, void **object)
ULONG CDECL wined3d_swapchain_incref(struct wined3d_swapchain *swapchain)
{
TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
if (IsEqualGUID(riid, &IID_IWineD3DSwapChain)
|| IsEqualGUID(riid, &IID_IWineD3DBase)
|| IsEqualGUID(riid, &IID_IUnknown))
{
IUnknown_AddRef(iface);
*object = iface;
return S_OK;
}
WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
*object = NULL;
return E_NOINTERFACE;
}
static ULONG WINAPI IWineD3DBaseSwapChainImpl_AddRef(IWineD3DSwapChain *iface)
{
IWineD3DSwapChainImpl *swapchain = (IWineD3DSwapChainImpl *)iface;
ULONG refcount = InterlockedIncrement(&swapchain->ref);
TRACE("%p increasing refcount to %u.\n", swapchain, refcount);
@ -111,9 +92,8 @@ static ULONG WINAPI IWineD3DBaseSwapChainImpl_AddRef(IWineD3DSwapChain *iface)
}
/* Do not call while under the GL lock. */
static ULONG WINAPI IWineD3DBaseSwapChainImpl_Release(IWineD3DSwapChain *iface)
ULONG CDECL wined3d_swapchain_decref(struct wined3d_swapchain *swapchain)
{
IWineD3DSwapChainImpl *swapchain = (IWineD3DSwapChainImpl *)iface;
ULONG refcount = InterlockedDecrement(&swapchain->ref);
TRACE("%p decreasing refcount to %u.\n", swapchain, refcount);
@ -128,17 +108,15 @@ static ULONG WINAPI IWineD3DBaseSwapChainImpl_Release(IWineD3DSwapChain *iface)
return refcount;
}
static void * WINAPI IWineD3DBaseSwapChainImpl_GetParent(IWineD3DSwapChain *iface)
void * CDECL wined3d_swapchain_get_parent(const struct wined3d_swapchain *swapchain)
{
TRACE("iface %p.\n", iface);
TRACE("swapchain %p.\n", swapchain);
return ((IWineD3DSwapChainImpl *)iface)->parent;
return swapchain->parent;
}
static HRESULT WINAPI IWineD3DBaseSwapChainImpl_SetDestWindowOverride(IWineD3DSwapChain *iface, HWND window)
HRESULT CDECL wined3d_swapchain_set_window(struct wined3d_swapchain *swapchain, HWND window)
{
IWineD3DSwapChainImpl *swapchain = (IWineD3DSwapChainImpl *)iface;
if (!window)
window = swapchain->device_window;
if (window == swapchain->win_handle)
@ -151,29 +129,26 @@ static HRESULT WINAPI IWineD3DBaseSwapChainImpl_SetDestWindowOverride(IWineD3DSw
return WINED3D_OK;
}
static HRESULT WINAPI IWineD3DBaseSwapChainImpl_Present(IWineD3DSwapChain *iface,
HRESULT CDECL wined3d_swapchain_present(struct wined3d_swapchain *swapchain,
const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override,
const RGNDATA *dirty_region, DWORD flags)
{
IWineD3DSwapChainImpl *swapchain = (IWineD3DSwapChainImpl *)iface;
TRACE("iface %p, src_rect %s, dst_rect %s, dst_window_override %p, dirty_region %p, flags %#x.\n",
iface, wine_dbgstr_rect(src_rect), wine_dbgstr_rect(dst_rect),
TRACE("swapchain %p, src_rect %s, dst_rect %s, dst_window_override %p, dirty_region %p, flags %#x.\n",
swapchain, wine_dbgstr_rect(src_rect), wine_dbgstr_rect(dst_rect),
dst_window_override, dirty_region, flags);
IWineD3DBaseSwapChainImpl_SetDestWindowOverride(iface, dst_window_override);
wined3d_swapchain_set_window(swapchain, dst_window_override);
return swapchain->swapchain_ops->swapchain_present(swapchain,
src_rect, dst_rect, dirty_region, flags);
}
static HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetFrontBufferData(IWineD3DSwapChain *iface,
HRESULT CDECL wined3d_swapchain_get_front_buffer_data(const struct wined3d_swapchain *swapchain,
IWineD3DSurface *dst_surface)
{
IWineD3DSwapChainImpl *swapchain = (IWineD3DSwapChainImpl *)iface;
POINT offset = {0, 0};
TRACE("iface %p, dst_surface %p.\n", iface, dst_surface);
TRACE("swapchain %p, dst_surface %p.\n", swapchain, dst_surface);
if (swapchain->presentParms.Windowed)
MapWindowPoints(swapchain->win_handle, NULL, &offset, 1);
@ -184,13 +159,11 @@ static HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetFrontBufferData(IWineD3DSwapC
return WINED3D_OK;
}
static HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetBackBuffer(IWineD3DSwapChain *iface,
HRESULT CDECL wined3d_swapchain_get_back_buffer(const struct wined3d_swapchain *swapchain,
UINT back_buffer_idx, WINED3DBACKBUFFER_TYPE type, IWineD3DSurface **back_buffer)
{
IWineD3DSwapChainImpl *swapchain = (IWineD3DSwapChainImpl *)iface;
TRACE("iface %p, back_buffer_idx %u, type %#x, back_buffer %p.\n",
iface, back_buffer_idx, type, back_buffer);
TRACE("swapchain %p, back_buffer_idx %u, type %#x, back_buffer %p.\n",
swapchain, back_buffer_idx, type, back_buffer);
/* Return invalid if there is no backbuffer array, otherwise it will
* crash when ddraw is used (there swapchain->back_buffers is always
@ -214,14 +187,14 @@ static HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetBackBuffer(IWineD3DSwapChain
return WINED3D_OK;
}
static HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetRasterStatus(IWineD3DSwapChain *iface,
HRESULT CDECL wined3d_swapchain_get_raster_status(const struct wined3d_swapchain *swapchain,
WINED3DRASTER_STATUS *raster_status)
{
static BOOL warned;
/* No OpenGL equivalent */
if (!warned)
{
FIXME("iface %p, raster_status %p stub!\n", iface, raster_status);
FIXME("swapchain %p, raster_status %p stub!\n", swapchain, raster_status);
warned = TRUE;
}
@ -233,12 +206,11 @@ static HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetRasterStatus(IWineD3DSwapChai
return WINED3DERR_INVALIDCALL;
}
static HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetDisplayMode(IWineD3DSwapChain *iface, WINED3DDISPLAYMODE *mode)
HRESULT CDECL wined3d_swapchain_get_display_mode(const struct wined3d_swapchain *swapchain, WINED3DDISPLAYMODE *mode)
{
IWineD3DSwapChainImpl *swapchain = (IWineD3DSwapChainImpl *)iface;
HRESULT hr;
TRACE("iface %p, mode %p.\n", iface, mode);
TRACE("swapchain %p, mode %p.\n", swapchain, mode);
hr = wined3d_get_adapter_display_mode(swapchain->device->wined3d, swapchain->device->adapter->ordinal, mode);
@ -248,37 +220,29 @@ static HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetDisplayMode(IWineD3DSwapChain
return hr;
}
static HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetDevice(IWineD3DSwapChain *iface, IWineD3DDevice **device)
IWineD3DDevice * CDECL wined3d_swapchain_get_device(const struct wined3d_swapchain *swapchain)
{
IWineD3DSwapChainImpl *swapchain = (IWineD3DSwapChainImpl *)iface;
TRACE("swapchain %p.\n", swapchain);
TRACE("iface %p, device %p.\n", iface, device);
*device = (IWineD3DDevice *)swapchain->device;
IWineD3DDevice_AddRef(*device);
return WINED3D_OK;
return (IWineD3DDevice *)swapchain->device;
}
static HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetPresentParameters(IWineD3DSwapChain *iface,
HRESULT CDECL wined3d_swapchain_get_present_parameters(const struct wined3d_swapchain *swapchain,
WINED3DPRESENT_PARAMETERS *present_parameters)
{
IWineD3DSwapChainImpl *swapchain = (IWineD3DSwapChainImpl *)iface;
TRACE("iface %p, present_parameters %p.\n", iface, present_parameters);
TRACE("swapchain %p, present_parameters %p.\n", swapchain, present_parameters);
*present_parameters = swapchain->presentParms;
return WINED3D_OK;
}
static HRESULT WINAPI IWineD3DBaseSwapChainImpl_SetGammaRamp(IWineD3DSwapChain *iface,
HRESULT CDECL wined3d_swapchain_set_gamma_ramp(const struct wined3d_swapchain *swapchain,
DWORD flags, const WINED3DGAMMARAMP *ramp)
{
IWineD3DSwapChainImpl *swapchain = (IWineD3DSwapChainImpl *)iface;
HDC dc;
TRACE("iface %p, flags %#x, ramp %p.\n", iface, flags, ramp);
TRACE("swapchain %p, flags %#x, ramp %p.\n", swapchain, flags, ramp);
if (flags)
FIXME("Ignoring flags %#x.\n", flags);
@ -290,13 +254,12 @@ static HRESULT WINAPI IWineD3DBaseSwapChainImpl_SetGammaRamp(IWineD3DSwapChain *
return WINED3D_OK;
}
static HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetGammaRamp(IWineD3DSwapChain *iface,
HRESULT CDECL wined3d_swapchain_get_gamma_ramp(const struct wined3d_swapchain *swapchain,
WINED3DGAMMARAMP *ramp)
{
IWineD3DSwapChainImpl *swapchain = (IWineD3DSwapChainImpl *)iface;
HDC dc;
TRACE("iface %p, ramp %p.\n", iface, ramp);
TRACE("swapchain %p, ramp %p.\n", swapchain, ramp);
dc = GetDC(swapchain->device_window);
GetDeviceGammaRamp(dc, ramp);
@ -305,24 +268,6 @@ static HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetGammaRamp(IWineD3DSwapChain *
return WINED3D_OK;
}
static const IWineD3DSwapChainVtbl IWineD3DSwapChain_Vtbl =
{
IWineD3DBaseSwapChainImpl_QueryInterface,
IWineD3DBaseSwapChainImpl_AddRef,
IWineD3DBaseSwapChainImpl_Release,
IWineD3DBaseSwapChainImpl_GetParent,
IWineD3DBaseSwapChainImpl_GetDevice,
IWineD3DBaseSwapChainImpl_Present,
IWineD3DBaseSwapChainImpl_SetDestWindowOverride,
IWineD3DBaseSwapChainImpl_GetFrontBufferData,
IWineD3DBaseSwapChainImpl_GetBackBuffer,
IWineD3DBaseSwapChainImpl_GetRasterStatus,
IWineD3DBaseSwapChainImpl_GetDisplayMode,
IWineD3DBaseSwapChainImpl_GetPresentParameters,
IWineD3DBaseSwapChainImpl_SetGammaRamp,
IWineD3DBaseSwapChainImpl_GetGammaRamp
};
/* A GL context is provided by the caller */
static void swapchain_blit(IWineD3DSwapChainImpl *This, struct wined3d_context *context,
const RECT *src_rect, const RECT *dst_rect)
@ -875,8 +820,6 @@ HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface
"Please configure the application to use double buffering (1 back buffer) if possible.\n");
}
swapchain->lpVtbl = &IWineD3DSwapChain_Vtbl;
switch (surface_type)
{
case SURFACE_GDI:
@ -1093,7 +1036,7 @@ HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface
}
}
IWineD3DSwapChain_GetGammaRamp((IWineD3DSwapChain *)swapchain, &swapchain->orig_gamma);
wined3d_swapchain_get_gamma_ramp(swapchain, &swapchain->orig_gamma);
return WINED3D_OK;
@ -1140,7 +1083,7 @@ err:
}
/* Do not call while under the GL lock. */
static struct wined3d_context *swapchain_create_context(struct IWineD3DSwapChainImpl *swapchain)
static struct wined3d_context *swapchain_create_context(struct wined3d_swapchain *swapchain)
{
struct wined3d_context **newArray;
struct wined3d_context *ctx;
@ -1170,7 +1113,7 @@ static struct wined3d_context *swapchain_create_context(struct IWineD3DSwapChain
return ctx;
}
struct wined3d_context *swapchain_get_context(struct IWineD3DSwapChainImpl *swapchain)
struct wined3d_context *swapchain_get_context(struct wined3d_swapchain *swapchain)
{
DWORD tid = GetCurrentThreadId();
unsigned int i;

View File

@ -77,6 +77,20 @@
@ cdecl wined3d_stateblock_decref(ptr)
@ cdecl wined3d_stateblock_incref(ptr)
@ cdecl wined3d_swapchain_decref(ptr)
@ cdecl wined3d_swapchain_get_back_buffer(ptr long long ptr)
@ cdecl wined3d_swapchain_get_device(ptr)
@ cdecl wined3d_swapchain_get_display_mode(ptr ptr)
@ cdecl wined3d_swapchain_get_front_buffer_data(ptr ptr)
@ cdecl wined3d_swapchain_get_gamma_ramp(ptr ptr)
@ cdecl wined3d_swapchain_get_parent(ptr)
@ cdecl wined3d_swapchain_get_present_parameters(ptr ptr)
@ cdecl wined3d_swapchain_get_raster_status(ptr ptr)
@ cdecl wined3d_swapchain_incref(ptr)
@ cdecl wined3d_swapchain_present(ptr ptr ptr ptr ptr long)
@ cdecl wined3d_swapchain_set_gamma_ramp(ptr long ptr)
@ cdecl wined3d_swapchain_set_window(ptr ptr)
@ cdecl wined3d_texture_add_dirty_region(ptr long ptr)
@ cdecl wined3d_texture_decref(ptr)
@ cdecl wined3d_texture_free_private_data(ptr ptr)

View File

@ -54,7 +54,8 @@
typedef struct IWineD3DSurfaceImpl IWineD3DSurfaceImpl;
typedef struct IWineD3DDeviceImpl IWineD3DDeviceImpl;
typedef struct IWineD3DSwapChainImpl IWineD3DSwapChainImpl;
typedef struct wined3d_swapchain IWineD3DSwapChainImpl;
typedef struct wined3d_swapchain IWineD3DSwapChain;
/* Texture format fixups */
@ -2015,7 +2016,7 @@ struct wined3d_subresource_container
enum wined3d_container_type type;
union
{
struct IWineD3DSwapChainImpl *swapchain;
struct wined3d_swapchain *swapchain;
struct wined3d_texture *texture;
void *base;
} u;
@ -2519,44 +2520,40 @@ void wined3d_rendertarget_view_init(struct wined3d_rendertarget_view *view,
struct wined3d_swapchain_ops
{
HRESULT (*swapchain_present)(struct IWineD3DSwapChainImpl *swapchain, const RECT *src_rect,
HRESULT (*swapchain_present)(struct wined3d_swapchain *swapchain, const RECT *src_rect,
const RECT *dst_rect, const RGNDATA *dirty_region, DWORD flags);
};
struct IWineD3DSwapChainImpl
struct wined3d_swapchain
{
/*IUnknown part*/
const IWineD3DSwapChainVtbl *lpVtbl;
LONG ref; /* Note: Ref counting not required */
LONG ref;
void *parent;
const struct wined3d_parent_ops *parent_ops;
const struct wined3d_swapchain_ops *swapchain_ops;
IWineD3DDeviceImpl *device;
/* IWineD3DSwapChain fields */
IWineD3DSurfaceImpl **back_buffers;
IWineD3DSurfaceImpl *front_buffer;
WINED3DPRESENT_PARAMETERS presentParms;
DWORD orig_width, orig_height;
DWORD orig_width, orig_height;
enum wined3d_format_id orig_fmt;
WINED3DGAMMARAMP orig_gamma;
BOOL render_to_fbo;
WINED3DGAMMARAMP orig_gamma;
BOOL render_to_fbo;
const struct wined3d_format *ds_format;
LONG prev_time, frames; /* Performance tracking */
unsigned int vSyncCounter;
struct wined3d_context **context;
unsigned int num_contexts;
unsigned int num_contexts;
HWND win_handle;
HWND win_handle;
HWND device_window;
};
void x11_copy_to_screen(IWineD3DSwapChainImpl *This, const RECT *rc) DECLSPEC_HIDDEN;
struct wined3d_context *swapchain_get_context(struct IWineD3DSwapChainImpl *swapchain) DECLSPEC_HIDDEN;
struct wined3d_context *swapchain_get_context(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface_type,
IWineD3DDeviceImpl *device, WINED3DPRESENT_PARAMETERS *present_parameters,
void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;

View File

@ -2088,7 +2088,6 @@ struct wined3d_parent_ops
interface IWineD3DSurface;
interface IWineD3DVolume;
interface IWineD3DSwapChain;
interface IWineD3DDevice;
struct wined3d;
struct wined3d_buffer;
@ -2099,6 +2098,7 @@ struct wined3d_resource;
struct wined3d_rendertarget_view;
struct wined3d_shader;
struct wined3d_stateblock;
struct wined3d_swapchain;
struct wined3d_texture;
struct wined3d_vertex_declaration;
@ -2159,7 +2159,7 @@ interface IWineD3DDeviceParent : IUnknown
HRESULT CreateSwapChain(
[in, out] WINED3DPRESENT_PARAMETERS *present_parameters,
[out] IWineD3DSwapChain **swapchain
[out] struct wined3d_swapchain **swapchain
);
}
typedef HRESULT (__stdcall *D3DCB_ENUMRESOURCES)(struct wined3d_resource *resource, void *pData);
@ -2325,52 +2325,6 @@ interface IWineD3DVolume : IWineD3DResource
);
}
[
object,
local,
uuid(34d01b10-6f30-11d9-c687-00046142c14f)
]
interface IWineD3DSwapChain : IWineD3DBase
{
HRESULT GetDevice(
[out] IWineD3DDevice **device
);
HRESULT Present(
[in] const RECT *src_rect,
[in] const RECT *dst_rect,
[in] HWND dst_window_override,
[in] const RGNDATA *dirty_region,
[in] DWORD flags
);
HRESULT SetDestWindowOverride(
[in] HWND window
);
HRESULT GetFrontBufferData(
[in] IWineD3DSurface *dst_surface
);
HRESULT GetBackBuffer(
[in] UINT backbuffer_idx,
[in] WINED3DBACKBUFFER_TYPE backbuffer_type,
[out] IWineD3DSurface **backbuffer
);
HRESULT GetRasterStatus(
[out] WINED3DRASTER_STATUS *raster_status
);
HRESULT GetDisplayMode(
[out] WINED3DDISPLAYMODE *mode
);
HRESULT GetPresentParameters(
[out] WINED3DPRESENT_PARAMETERS *present_parameters
);
HRESULT SetGammaRamp(
[in] DWORD flags,
[in] const WINED3DGAMMARAMP *ramp
);
HRESULT GetGammaRamp(
[out] WINED3DGAMMARAMP *ramp
);
}
[
object,
local,
@ -2479,7 +2433,7 @@ interface IWineD3DDevice : IUnknown
[in] WINED3DSURFTYPE surface_type,
[in] void *parent,
[in] const struct wined3d_parent_ops *parent_ops,
[out] IWineD3DSwapChain **swapchain
[out] struct wined3d_swapchain **swapchain
);
HRESULT CreateVertexDeclaration(
[in] const WINED3DVERTEXELEMENT *elements,
@ -2568,7 +2522,7 @@ interface IWineD3DDevice : IUnknown
);
HRESULT GetSwapChain(
[in] UINT swapchain_idx,
[out] IWineD3DSwapChain **swapchain
[out] struct wined3d_swapchain **swapchain
);
HRESULT Reset(
[in] WINED3DPRESENT_PARAMETERS *present_parameters
@ -3078,6 +3032,29 @@ HRESULT __cdecl wined3d_stateblock_capture(struct wined3d_stateblock *stateblock
ULONG __cdecl wined3d_stateblock_decref(struct wined3d_stateblock *stateblock);
ULONG __cdecl wined3d_stateblock_incref(struct wined3d_stateblock *stateblock);
ULONG __cdecl wined3d_swapchain_decref(struct wined3d_swapchain *swapchain);
HRESULT __cdecl wined3d_swapchain_get_back_buffer(const struct wined3d_swapchain *swapchain,
UINT backbuffer_idx, WINED3DBACKBUFFER_TYPE backbuffer_type, IWineD3DSurface **backbuffer);
IWineD3DDevice * __cdecl wined3d_swapchain_get_device(const struct wined3d_swapchain *swapchain);
HRESULT __cdecl wined3d_swapchain_get_display_mode(const struct wined3d_swapchain *swapchain,
WINED3DDISPLAYMODE *mode);
HRESULT __cdecl wined3d_swapchain_get_front_buffer_data(const struct wined3d_swapchain *swapchain,
IWineD3DSurface *dst_surface);
HRESULT __cdecl wined3d_swapchain_get_gamma_ramp(const struct wined3d_swapchain *swapchain,
WINED3DGAMMARAMP *ramp);
void * __cdecl wined3d_swapchain_get_parent(const struct wined3d_swapchain *swapchain);
HRESULT __cdecl wined3d_swapchain_get_present_parameters(const struct wined3d_swapchain *swapchain,
WINED3DPRESENT_PARAMETERS *present_parameters);
HRESULT __cdecl wined3d_swapchain_get_raster_status(const struct wined3d_swapchain *swapchain,
WINED3DRASTER_STATUS *raster_status);
ULONG __cdecl wined3d_swapchain_incref(struct wined3d_swapchain *swapchain);
HRESULT __cdecl wined3d_swapchain_present(struct wined3d_swapchain *swapchain,
const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override,
const RGNDATA *dirty_region, DWORD flags);
HRESULT __cdecl wined3d_swapchain_set_gamma_ramp(const struct wined3d_swapchain *swapchain,
DWORD flags, const WINED3DGAMMARAMP *ramp);
HRESULT __cdecl wined3d_swapchain_set_window(struct wined3d_swapchain *swapchain, HWND window);
HRESULT __cdecl wined3d_texture_add_dirty_region(struct wined3d_texture *texture,
UINT layer, const WINED3DBOX *dirty_region);
ULONG __cdecl wined3d_texture_decref(struct wined3d_texture *texture);

View File

@ -55,6 +55,6 @@ interface IWineDXGIDevice : IDXGIDevice
);
HRESULT create_swapchain(
[in] struct _WINED3DPRESENT_PARAMETERS *present_parameters,
[out] struct IWineD3DSwapChain **wined3d_swapchain
[out] struct wined3d_swapchain **wined3d_swapchain
);
}