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, 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; IWineDXGIDevice *wine_device;
HRESULT hr; HRESULT hr;

View File

@ -229,12 +229,8 @@ struct IDirect3DSwapChain8Impl
/* IUnknown fields */ /* IUnknown fields */
IDirect3DSwapChain8 IDirect3DSwapChain8_iface; IDirect3DSwapChain8 IDirect3DSwapChain8_iface;
LONG ref; LONG ref;
struct wined3d_swapchain *wined3d_swapchain;
/* IDirect3DSwapChain8 fields */ IDirect3DDevice8 *parentDevice;
IWineD3DSwapChain *wineD3DSwapChain;
/* Parent reference */
IDirect3DDevice8 *parentDevice;
}; };
HRESULT swapchain_init(IDirect3DSwapChain8Impl *swapchain, IDirect3DDevice8Impl *device, 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, 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); IDirect3DDevice8Impl *This = impl_from_IWineD3DDeviceParent(iface);
D3DPRESENT_PARAMETERS local_parameters; D3DPRESENT_PARAMETERS local_parameters;
@ -2933,8 +2933,8 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDevicePar
return hr; return hr;
} }
*swapchain = ((IDirect3DSwapChain8Impl *)d3d_swapchain)->wineD3DSwapChain; *swapchain = ((IDirect3DSwapChain8Impl *)d3d_swapchain)->wined3d_swapchain;
IWineD3DSwapChain_AddRef(*swapchain); wined3d_swapchain_incref(*swapchain);
IDirect3DSwapChain8_Release(d3d_swapchain); IDirect3DSwapChain8_Release(d3d_swapchain);
/* Copy back the presentation parameters */ /* Copy back the presentation parameters */

View File

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

View File

@ -216,12 +216,8 @@ typedef struct IDirect3DSwapChain9Impl
/* IUnknown fields */ /* IUnknown fields */
const IDirect3DSwapChain9Vtbl *lpVtbl; const IDirect3DSwapChain9Vtbl *lpVtbl;
LONG ref; LONG ref;
struct wined3d_swapchain *wined3d_swapchain;
/* IDirect3DSwapChain9 fields */ IDirect3DDevice9Ex *parentDevice;
IWineD3DSwapChain *wineD3DSwapChain;
/* Parent reference */
LPDIRECT3DDEVICE9EX parentDevice;
} IDirect3DSwapChain9Impl; } IDirect3DSwapChain9Impl;
HRESULT swapchain_init(IDirect3DSwapChain9Impl *swapchain, IDirect3DDevice9Impl *device, 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, static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_GetSwapChain(IDirect3DDevice9Ex *iface,
UINT swapchain_idx, IDirect3DSwapChain9 **swapchain) UINT swapchain_idx, IDirect3DSwapChain9 **swapchain)
{ {
IWineD3DSwapChain *wined3d_swapchain = NULL; struct wined3d_swapchain *wined3d_swapchain = NULL;
HRESULT hr; HRESULT hr;
TRACE("iface %p, swapchain_idx %u, swapchain %p.\n", iface, swapchain_idx, swapchain); 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); swapchain_idx, &wined3d_swapchain);
if (SUCCEEDED(hr) && wined3d_swapchain) if (SUCCEEDED(hr) && wined3d_swapchain)
{ {
*swapchain = IWineD3DSwapChain_GetParent(wined3d_swapchain); *swapchain = wined3d_swapchain_get_parent(wined3d_swapchain);
IDirect3DSwapChain9_AddRef(*swapchain); IDirect3DSwapChain9_AddRef(*swapchain);
IWineD3DSwapChain_Release(wined3d_swapchain); wined3d_swapchain_decref(wined3d_swapchain);
} }
else else
{ {
@ -3159,7 +3159,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent
} }
static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDeviceParent *iface, 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); struct IDirect3DDevice9Impl *This = device_from_device_parent(iface);
D3DPRESENT_PARAMETERS local_parameters; D3DPRESENT_PARAMETERS local_parameters;
@ -3193,8 +3193,8 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDevicePar
return hr; return hr;
} }
*swapchain = ((IDirect3DSwapChain9Impl *)d3d_swapchain)->wineD3DSwapChain; *swapchain = ((IDirect3DSwapChain9Impl *)d3d_swapchain)->wined3d_swapchain;
IWineD3DSwapChain_AddRef(*swapchain); wined3d_swapchain_incref(*swapchain);
IDirect3DSwapChain9_Release((IDirect3DSwapChain9 *)d3d_swapchain); IDirect3DSwapChain9_Release((IDirect3DSwapChain9 *)d3d_swapchain);
/* Copy back the presentation parameters */ /* Copy back the presentation parameters */

View File

@ -56,7 +56,7 @@ static ULONG WINAPI IDirect3DSwapChain9Impl_AddRef(LPDIRECT3DSWAPCHAIN9 iface) {
IDirect3DDevice9Ex_AddRef(This->parentDevice); IDirect3DDevice9Ex_AddRef(This->parentDevice);
wined3d_mutex_lock(); wined3d_mutex_lock();
IWineD3DSwapChain_AddRef(This->wineD3DSwapChain); wined3d_swapchain_incref(This->wined3d_swapchain);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
} }
@ -73,7 +73,7 @@ static ULONG WINAPI IDirect3DSwapChain9Impl_Release(LPDIRECT3DSWAPCHAIN9 iface)
IDirect3DDevice9Ex *parentDevice = This->parentDevice; IDirect3DDevice9Ex *parentDevice = This->parentDevice;
wined3d_mutex_lock(); wined3d_mutex_lock();
IWineD3DSwapChain_Release(This->wineD3DSwapChain); wined3d_swapchain_decref(This->wined3d_swapchain);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
/* Release the device last, as it may cause the device to be destroyed. */ /* 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); iface, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion, dwFlags);
wined3d_mutex_lock(); 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(); wined3d_mutex_unlock();
return hr; return hr;
@ -104,7 +105,8 @@ static HRESULT WINAPI IDirect3DSwapChain9Impl_GetFrontBufferData(LPDIRECT3DSWAPC
TRACE("iface %p, surface %p.\n", iface, pDestSurface); TRACE("iface %p, surface %p.\n", iface, pDestSurface);
wined3d_mutex_lock(); 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(); wined3d_mutex_unlock();
return hr; return hr;
@ -121,8 +123,8 @@ static HRESULT WINAPI IDirect3DSwapChain9Impl_GetBackBuffer(IDirect3DSwapChain9
iface, iBackBuffer, Type, ppBackBuffer); iface, iBackBuffer, Type, ppBackBuffer);
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DSwapChain_GetBackBuffer(This->wineD3DSwapChain, iBackBuffer, hr = wined3d_swapchain_get_back_buffer(This->wined3d_swapchain,
(WINED3DBACKBUFFER_TYPE)Type, &mySurface); iBackBuffer, (WINED3DBACKBUFFER_TYPE)Type, &mySurface);
if (SUCCEEDED(hr) && mySurface) if (SUCCEEDED(hr) && mySurface)
{ {
*ppBackBuffer = IWineD3DSurface_GetParent(mySurface); *ppBackBuffer = IWineD3DSurface_GetParent(mySurface);
@ -142,7 +144,7 @@ static HRESULT WINAPI IDirect3DSwapChain9Impl_GetRasterStatus(LPDIRECT3DSWAPCHAI
TRACE("iface %p, raster_status %p.\n", iface, pRasterStatus); TRACE("iface %p, raster_status %p.\n", iface, pRasterStatus);
wined3d_mutex_lock(); 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(); wined3d_mutex_unlock();
return hr; return hr;
@ -155,7 +157,7 @@ static HRESULT WINAPI IDirect3DSwapChain9Impl_GetDisplayMode(LPDIRECT3DSWAPCHAIN
TRACE("iface %p, mode %p.\n", iface, pMode); TRACE("iface %p, mode %p.\n", iface, pMode);
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DSwapChain_GetDisplayMode(This->wineD3DSwapChain, (WINED3DDISPLAYMODE *) pMode); hr = wined3d_swapchain_get_display_mode(This->wined3d_swapchain, (WINED3DDISPLAYMODE *)pMode);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
if (SUCCEEDED(hr)) pMode->Format = d3dformat_from_wined3dformat(pMode->Format); 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); TRACE("iface %p, parameters %p.\n", iface, pPresentationParameters);
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DSwapChain_GetPresentParameters(This->wineD3DSwapChain, &winePresentParameters); hr = wined3d_swapchain_get_present_parameters(This->wined3d_swapchain, &winePresentParameters);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
pPresentationParameters->BackBufferWidth = winePresentParameters.BackBufferWidth; pPresentationParameters->BackBufferWidth = winePresentParameters.BackBufferWidth;
@ -259,7 +261,7 @@ HRESULT swapchain_init(IDirect3DSwapChain9Impl *swapchain, IDirect3DDevice9Impl
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_CreateSwapChain(device->WineD3DDevice, &wined3d_parameters, hr = IWineD3DDevice_CreateSwapChain(device->WineD3DDevice, &wined3d_parameters,
SURFACE_OPENGL, swapchain, &d3d9_swapchain_wined3d_parent_ops, SURFACE_OPENGL, swapchain, &d3d9_swapchain_wined3d_parent_ops,
&swapchain->wineD3DSwapChain); &swapchain->wined3d_swapchain);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
present_parameters->BackBufferWidth = wined3d_parameters.BackBufferWidth; 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; IDirectDrawImpl *This = surfImpl->ddraw;
struct wined3d_clipper *clipper = NULL; struct wined3d_clipper *clipper = NULL;
IWineD3DSurface *wineD3DSurface; IWineD3DSurface *wineD3DSurface;
IWineD3DSwapChain *swapchain; struct wined3d_swapchain *swapchain;
void *parent; void *parent;
HRESULT hr; HRESULT hr;
@ -2533,8 +2533,8 @@ HRESULT WINAPI ddraw_recreate_surfaces_cb(IDirectDrawSurface7 *surf, DDSURFACEDE
if(surfImpl->ImplType == This->ImplType) return DDENUMRET_OK; /* Continue */ if(surfImpl->ImplType == This->ImplType) return DDENUMRET_OK; /* Continue */
/* Get the objects */ /* Get the objects */
swapchain = surfImpl->wineD3DSwapChain; swapchain = surfImpl->wined3d_swapchain;
surfImpl->wineD3DSwapChain = NULL; surfImpl->wined3d_swapchain = NULL;
wineD3DSurface = surfImpl->WineD3DSurface; wineD3DSurface = surfImpl->WineD3DSurface;
/* get the clipper */ /* get the clipper */
@ -2934,7 +2934,7 @@ static HRESULT ddraw_create_gdi_swapchain(IDirectDrawImpl *ddraw, IDirectDrawSur
if (FAILED(hr)) if (FAILED(hr))
{ {
WARN("Failed to initialize GDI ddraw implementation, hr %#x.\n", hr); WARN("Failed to initialize GDI ddraw implementation, hr %#x.\n", hr);
primary->wineD3DSwapChain = NULL; primary->wined3d_swapchain = NULL;
} }
return hr; return hr;
@ -5888,7 +5888,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent
} }
static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDeviceParent *iface, 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); struct IDirectDrawImpl *This = ddraw_from_device_parent(iface);
IDirectDrawSurfaceImpl *iterator; IDirectDrawSurfaceImpl *iterator;
@ -5905,11 +5905,11 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDevicePar
return hr; return hr;
} }
This->d3d_target->wineD3DSwapChain = *swapchain; This->d3d_target->wined3d_swapchain = *swapchain;
iterator = This->d3d_target->complex_array[0]; iterator = This->d3d_target->complex_array[0];
while (iterator) while (iterator)
{ {
iterator->wineD3DSwapChain = *swapchain; iterator->wined3d_swapchain = *swapchain;
iterator = iterator->complex_array[0]; iterator = iterator->complex_array[0];
} }

View File

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

View File

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

View File

@ -126,7 +126,7 @@ struct dxgi_swapchain
{ {
const struct IDXGISwapChainVtbl *vtbl; const struct IDXGISwapChainVtbl *vtbl;
LONG refcount; LONG refcount;
IWineD3DSwapChain *wined3d_swapchain; struct wined3d_swapchain *wined3d_swapchain;
}; };
HRESULT dxgi_swapchain_init(struct dxgi_swapchain *swapchain, struct dxgi_device *device, 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) IUnknown *device, DXGI_SWAP_CHAIN_DESC *desc, IDXGISwapChain **swapchain)
{ {
WINED3DPRESENT_PARAMETERS present_parameters; WINED3DPRESENT_PARAMETERS present_parameters;
IWineD3DSwapChain *wined3d_swapchain; struct wined3d_swapchain *wined3d_swapchain;
IWineD3DDevice *wined3d_device; IWineD3DDevice *wined3d_device;
IWineDXGIDevice *dxgi_device; IWineDXGIDevice *dxgi_device;
UINT count; UINT count;
@ -235,8 +235,8 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSwapChain(IWineDXGIFactory *
return hr; return hr;
} }
*swapchain = IWineD3DSwapChain_GetParent(wined3d_swapchain); *swapchain = wined3d_swapchain_get_parent(wined3d_swapchain);
IUnknown_Release(wined3d_swapchain); wined3d_swapchain_decref(wined3d_swapchain);
/* FIXME? The swapchain is created with refcount 1 by the wined3d device, /* FIXME? The swapchain is created with refcount 1 by the wined3d device,
* but the wined3d device can't hold a real reference. */ * 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); TRACE("%p increasing refcount to %u\n", This, refcount);
if (refcount == 1) if (refcount == 1)
IWineD3DSwapChain_AddRef(This->wined3d_swapchain); wined3d_swapchain_incref(This->wined3d_swapchain);
return refcount; return refcount;
} }
@ -73,19 +73,11 @@ static ULONG STDMETHODCALLTYPE dxgi_swapchain_Release(IDXGISwapChain *iface)
FIXME("Only a single swapchain is supported\n"); 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)) if (FAILED(hr))
{ {
ERR("Failed to get the wined3d device, hr %#x\n", hr); ERR("Uninit3D failed, hr %#x\n", hr);
}
else
{
hr = IWineD3DDevice_Uninit3D(wined3d_device);
IWineD3DDevice_Release(wined3d_device);
if (FAILED(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 (sync_interval) FIXME("Unimplemented sync interval %u\n", sync_interval);
if (flags) FIXME("Unimplemented flags %#x\n", flags); 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, static HRESULT STDMETHODCALLTYPE dxgi_swapchain_GetBuffer(IDXGISwapChain *iface,
@ -161,7 +153,8 @@ static HRESULT STDMETHODCALLTYPE dxgi_swapchain_GetBuffer(IDXGISwapChain *iface,
EnterCriticalSection(&dxgi_cs); 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)) if (FAILED(hr))
{ {
LeaveCriticalSection(&dxgi_cs); LeaveCriticalSection(&dxgi_cs);

View File

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

View File

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

View File

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

View File

@ -3,6 +3,7 @@
* Copyright 2002-2003 Raphael Junqueira * Copyright 2002-2003 Raphael Junqueira
* Copyright 2005 Oliver Stieber * Copyright 2005 Oliver Stieber
* Copyright 2007-2008 Stefan Dösinger for CodeWeavers * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * 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); 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] /* Release the swapchain's draw buffers. Make sure swapchain->back_buffers[0]
* is the last buffer to be destroyed, FindContext() depends on that. */ * 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); ULONG refcount = InterlockedIncrement(&swapchain->ref);
TRACE("%p increasing refcount to %u.\n", swapchain, refcount); 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. */ /* 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); ULONG refcount = InterlockedDecrement(&swapchain->ref);
TRACE("%p decreasing refcount to %u.\n", swapchain, refcount); TRACE("%p decreasing refcount to %u.\n", swapchain, refcount);
@ -128,17 +108,15 @@ static ULONG WINAPI IWineD3DBaseSwapChainImpl_Release(IWineD3DSwapChain *iface)
return refcount; 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) if (!window)
window = swapchain->device_window; window = swapchain->device_window;
if (window == swapchain->win_handle) if (window == swapchain->win_handle)
@ -151,29 +129,26 @@ static HRESULT WINAPI IWineD3DBaseSwapChainImpl_SetDestWindowOverride(IWineD3DSw
return WINED3D_OK; 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 RECT *src_rect, const RECT *dst_rect, HWND dst_window_override,
const RGNDATA *dirty_region, DWORD flags) const RGNDATA *dirty_region, DWORD flags)
{ {
IWineD3DSwapChainImpl *swapchain = (IWineD3DSwapChainImpl *)iface; 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),
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),
dst_window_override, dirty_region, flags); 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, return swapchain->swapchain_ops->swapchain_present(swapchain,
src_rect, dst_rect, dirty_region, flags); 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) IWineD3DSurface *dst_surface)
{ {
IWineD3DSwapChainImpl *swapchain = (IWineD3DSwapChainImpl *)iface;
POINT offset = {0, 0}; 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) if (swapchain->presentParms.Windowed)
MapWindowPoints(swapchain->win_handle, NULL, &offset, 1); MapWindowPoints(swapchain->win_handle, NULL, &offset, 1);
@ -184,13 +159,11 @@ static HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetFrontBufferData(IWineD3DSwapC
return WINED3D_OK; 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) UINT back_buffer_idx, WINED3DBACKBUFFER_TYPE type, IWineD3DSurface **back_buffer)
{ {
IWineD3DSwapChainImpl *swapchain = (IWineD3DSwapChainImpl *)iface; TRACE("swapchain %p, back_buffer_idx %u, type %#x, back_buffer %p.\n",
swapchain, back_buffer_idx, type, back_buffer);
TRACE("iface %p, back_buffer_idx %u, type %#x, back_buffer %p.\n",
iface, back_buffer_idx, type, back_buffer);
/* Return invalid if there is no backbuffer array, otherwise it will /* Return invalid if there is no backbuffer array, otherwise it will
* crash when ddraw is used (there swapchain->back_buffers is always * crash when ddraw is used (there swapchain->back_buffers is always
@ -214,14 +187,14 @@ static HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetBackBuffer(IWineD3DSwapChain
return WINED3D_OK; 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) WINED3DRASTER_STATUS *raster_status)
{ {
static BOOL warned; static BOOL warned;
/* No OpenGL equivalent */ /* No OpenGL equivalent */
if (!warned) 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; warned = TRUE;
} }
@ -233,12 +206,11 @@ static HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetRasterStatus(IWineD3DSwapChai
return WINED3DERR_INVALIDCALL; 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; 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); 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; 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); return (IWineD3DDevice *)swapchain->device;
*device = (IWineD3DDevice *)swapchain->device;
IWineD3DDevice_AddRef(*device);
return WINED3D_OK;
} }
static HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetPresentParameters(IWineD3DSwapChain *iface, HRESULT CDECL wined3d_swapchain_get_present_parameters(const struct wined3d_swapchain *swapchain,
WINED3DPRESENT_PARAMETERS *present_parameters) WINED3DPRESENT_PARAMETERS *present_parameters)
{ {
IWineD3DSwapChainImpl *swapchain = (IWineD3DSwapChainImpl *)iface; TRACE("swapchain %p, present_parameters %p.\n", swapchain, present_parameters);
TRACE("iface %p, present_parameters %p.\n", iface, present_parameters);
*present_parameters = swapchain->presentParms; *present_parameters = swapchain->presentParms;
return WINED3D_OK; 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) DWORD flags, const WINED3DGAMMARAMP *ramp)
{ {
IWineD3DSwapChainImpl *swapchain = (IWineD3DSwapChainImpl *)iface;
HDC dc; 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) if (flags)
FIXME("Ignoring flags %#x.\n", flags); FIXME("Ignoring flags %#x.\n", flags);
@ -290,13 +254,12 @@ static HRESULT WINAPI IWineD3DBaseSwapChainImpl_SetGammaRamp(IWineD3DSwapChain *
return WINED3D_OK; return WINED3D_OK;
} }
static HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetGammaRamp(IWineD3DSwapChain *iface, HRESULT CDECL wined3d_swapchain_get_gamma_ramp(const struct wined3d_swapchain *swapchain,
WINED3DGAMMARAMP *ramp) WINED3DGAMMARAMP *ramp)
{ {
IWineD3DSwapChainImpl *swapchain = (IWineD3DSwapChainImpl *)iface;
HDC dc; HDC dc;
TRACE("iface %p, ramp %p.\n", iface, ramp); TRACE("swapchain %p, ramp %p.\n", swapchain, ramp);
dc = GetDC(swapchain->device_window); dc = GetDC(swapchain->device_window);
GetDeviceGammaRamp(dc, ramp); GetDeviceGammaRamp(dc, ramp);
@ -305,24 +268,6 @@ static HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetGammaRamp(IWineD3DSwapChain *
return WINED3D_OK; 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 */ /* A GL context is provided by the caller */
static void swapchain_blit(IWineD3DSwapChainImpl *This, struct wined3d_context *context, static void swapchain_blit(IWineD3DSwapChainImpl *This, struct wined3d_context *context,
const RECT *src_rect, const RECT *dst_rect) 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"); "Please configure the application to use double buffering (1 back buffer) if possible.\n");
} }
swapchain->lpVtbl = &IWineD3DSwapChain_Vtbl;
switch (surface_type) switch (surface_type)
{ {
case SURFACE_GDI: 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; return WINED3D_OK;
@ -1140,7 +1083,7 @@ err:
} }
/* Do not call while under the GL lock. */ /* 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 **newArray;
struct wined3d_context *ctx; struct wined3d_context *ctx;
@ -1170,7 +1113,7 @@ static struct wined3d_context *swapchain_create_context(struct IWineD3DSwapChain
return ctx; return ctx;
} }
struct wined3d_context *swapchain_get_context(struct IWineD3DSwapChainImpl *swapchain) struct wined3d_context *swapchain_get_context(struct wined3d_swapchain *swapchain)
{ {
DWORD tid = GetCurrentThreadId(); DWORD tid = GetCurrentThreadId();
unsigned int i; unsigned int i;

View File

@ -77,6 +77,20 @@
@ cdecl wined3d_stateblock_decref(ptr) @ cdecl wined3d_stateblock_decref(ptr)
@ cdecl wined3d_stateblock_incref(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_add_dirty_region(ptr long ptr)
@ cdecl wined3d_texture_decref(ptr) @ cdecl wined3d_texture_decref(ptr)
@ cdecl wined3d_texture_free_private_data(ptr ptr) @ cdecl wined3d_texture_free_private_data(ptr ptr)

View File

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

View File

@ -2088,7 +2088,6 @@ struct wined3d_parent_ops
interface IWineD3DSurface; interface IWineD3DSurface;
interface IWineD3DVolume; interface IWineD3DVolume;
interface IWineD3DSwapChain;
interface IWineD3DDevice; interface IWineD3DDevice;
struct wined3d; struct wined3d;
struct wined3d_buffer; struct wined3d_buffer;
@ -2099,6 +2098,7 @@ struct wined3d_resource;
struct wined3d_rendertarget_view; struct wined3d_rendertarget_view;
struct wined3d_shader; struct wined3d_shader;
struct wined3d_stateblock; struct wined3d_stateblock;
struct wined3d_swapchain;
struct wined3d_texture; struct wined3d_texture;
struct wined3d_vertex_declaration; struct wined3d_vertex_declaration;
@ -2159,7 +2159,7 @@ interface IWineD3DDeviceParent : IUnknown
HRESULT CreateSwapChain( HRESULT CreateSwapChain(
[in, out] WINED3DPRESENT_PARAMETERS *present_parameters, [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); 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, object,
local, local,
@ -2479,7 +2433,7 @@ interface IWineD3DDevice : IUnknown
[in] WINED3DSURFTYPE surface_type, [in] WINED3DSURFTYPE surface_type,
[in] void *parent, [in] void *parent,
[in] const struct wined3d_parent_ops *parent_ops, [in] const struct wined3d_parent_ops *parent_ops,
[out] IWineD3DSwapChain **swapchain [out] struct wined3d_swapchain **swapchain
); );
HRESULT CreateVertexDeclaration( HRESULT CreateVertexDeclaration(
[in] const WINED3DVERTEXELEMENT *elements, [in] const WINED3DVERTEXELEMENT *elements,
@ -2568,7 +2522,7 @@ interface IWineD3DDevice : IUnknown
); );
HRESULT GetSwapChain( HRESULT GetSwapChain(
[in] UINT swapchain_idx, [in] UINT swapchain_idx,
[out] IWineD3DSwapChain **swapchain [out] struct wined3d_swapchain **swapchain
); );
HRESULT Reset( HRESULT Reset(
[in] WINED3DPRESENT_PARAMETERS *present_parameters [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_decref(struct wined3d_stateblock *stateblock);
ULONG __cdecl wined3d_stateblock_incref(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, HRESULT __cdecl wined3d_texture_add_dirty_region(struct wined3d_texture *texture,
UINT layer, const WINED3DBOX *dirty_region); UINT layer, const WINED3DBOX *dirty_region);
ULONG __cdecl wined3d_texture_decref(struct wined3d_texture *texture); ULONG __cdecl wined3d_texture_decref(struct wined3d_texture *texture);

View File

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