Commit a966293f authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Add an IWineD3DDeviceParent interface.

Other than being a bit nicer than passing function pointers all over the place, this helps dxgi/d3d10. While the swapchain itself is created in dxgi, its surfaces are constructed in d3d10core, which makes it impractical for dxgi to pass the appropriate function pointers.
parent f4ca7d2d
......@@ -20,6 +20,7 @@
#include "config.h"
#include "wine/port.h"
#define D3D10CORE_INIT_GUID
#include "d3d10core_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d10core);
......@@ -83,6 +84,7 @@ static HRESULT WINAPI layer_create(enum dxgi_device_layer_id id, void **layer_ba
object->vtbl = &d3d10_device_vtbl;
object->inner_unknown_vtbl = &d3d10_device_inner_unknown_vtbl;
object->device_parent_vtbl = &d3d10_wined3d_device_parent_vtbl;
object->refcount = 1;
object->outer_unknown = device_object;
......
......@@ -23,10 +23,15 @@
#define COBJMACROS
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "objbase.h"
#include "d3d10.h"
#ifdef D3D10CORE_INIT_GUID
#include "initguid.h"
#endif
#include "wine/wined3d.h"
/* TRACE helper functions */
const char *debug_d3d10_primitive_topology(D3D10_PRIMITIVE_TOPOLOGY topology);
......@@ -35,10 +40,12 @@ const char *debug_dxgi_format(DXGI_FORMAT format);
/* IDirect3D10Device */
extern const struct ID3D10DeviceVtbl d3d10_device_vtbl;
extern const struct IUnknownVtbl d3d10_device_inner_unknown_vtbl;
extern const struct IWineD3DDeviceParentVtbl d3d10_wined3d_device_parent_vtbl;
struct d3d10_device
{
const struct ID3D10DeviceVtbl *vtbl;
const struct IUnknownVtbl *inner_unknown_vtbl;
const struct IWineD3DDeviceParentVtbl *device_parent_vtbl;
IUnknown *outer_unknown;
LONG refcount;
};
......
......@@ -45,6 +45,13 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_inner_QueryInterface(IUnknown *ifa
return S_OK;
}
if (IsEqualGUID(riid, &IID_IWineD3DDeviceParent))
{
IUnknown_AddRef((IUnknown *)&This->device_parent_vtbl);
*object = &This->device_parent_vtbl;
return S_OK;
}
WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
*object = NULL;
......@@ -898,3 +905,96 @@ const struct IUnknownVtbl d3d10_device_inner_unknown_vtbl =
d3d10_device_inner_AddRef,
d3d10_device_inner_Release,
};
/* IWineD3DDeviceParent IUnknown methods */
static inline struct d3d10_device *device_from_device_parent(IWineD3DDeviceParent *iface)
{
return (struct d3d10_device *)((char*)iface - FIELD_OFFSET(struct d3d10_device, device_parent_vtbl));
}
HRESULT STDMETHODCALLTYPE device_parent_QueryInterface(IWineD3DDeviceParent *iface, REFIID riid, void **object)
{
struct d3d10_device *This = device_from_device_parent(iface);
return d3d10_device_QueryInterface((ID3D10Device *)This, riid, object);
}
ULONG STDMETHODCALLTYPE device_parent_AddRef(IWineD3DDeviceParent *iface)
{
struct d3d10_device *This = device_from_device_parent(iface);
return d3d10_device_AddRef((ID3D10Device *)This);
}
ULONG STDMETHODCALLTYPE device_parent_Release(IWineD3DDeviceParent *iface)
{
struct d3d10_device *This = device_from_device_parent(iface);
return d3d10_device_Release((ID3D10Device *)This);
}
/* IWineD3DDeviceParent methods */
static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParent *iface,
IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, DWORD usage,
WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, IWineD3DSurface **surface)
{
FIXME("iface %p, superior %p, width %u, height %u, format %#x, usage %#x,\n"
"\tpool %#x, level %u, face %u, surface %p stub!\n",
iface, superior, width, height, format, usage, pool, level, face, surface);
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDeviceParent *iface,
IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, WINED3DMULTISAMPLE_TYPE multisample_type,
DWORD multisample_quality, BOOL lockable, IWineD3DSurface **surface)
{
FIXME("iface %p, superior %p, width %u, height %u, format %#x, multisample_type %#x,\n"
"\tmultisample_quality %u, lockable %u, surface %p stub!\n",
iface, superior, width, height, format, multisample_type, multisample_quality, lockable, surface);
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3DDeviceParent *iface,
IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, WINED3DMULTISAMPLE_TYPE multisample_type,
DWORD multisample_quality, BOOL discard, IWineD3DSurface **surface)
{
FIXME("iface %p, superior %p, width %u, height %u, format %#x, multisample_type %#x,\n"
"\tmultisample_quality %u, discard %u, surface %p stub!\n",
iface, superior, width, height, format, multisample_type, multisample_quality, discard, surface);
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent *iface,
IUnknown *superior, UINT width, UINT height, UINT depth, WINED3DFORMAT format,
WINED3DPOOL pool, DWORD usage, IWineD3DVolume **volume)
{
FIXME("iface %p, superior %p, width %u, height %u, depth %u, format %#x, pool %#x, usage %#x, volume %p stub!\n",
iface, superior, width, height, depth, format, pool, usage, volume);
return E_NOTIMPL;
}
static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDeviceParent *iface,
WINED3DPRESENT_PARAMETERS *present_parameters, IWineD3DSwapChain **swapchain)
{
FIXME("iface %p, present_parameters %p, swapchain %p stub!\n", iface, present_parameters, swapchain);
return E_NOTIMPL;
}
const struct IWineD3DDeviceParentVtbl d3d10_wined3d_device_parent_vtbl =
{
/* IUnknown methods */
device_parent_QueryInterface,
device_parent_AddRef,
device_parent_Release,
/* IWineD3DDeviceParent methods */
device_parent_CreateSurface,
device_parent_CreateRenderTarget,
device_parent_CreateDepthStencilSurface,
device_parent_CreateVolume,
device_parent_CreateSwapChain,
};
......@@ -160,6 +160,7 @@ struct IDirect3D8Impl
* Predeclare the interface implementation structures
*/
extern const IDirect3DDevice8Vtbl Direct3DDevice8_Vtbl;
extern const IWineD3DDeviceParentVtbl d3d8_wined3d_device_parent_vtbl;
/*****************************************************************************
* IDirect3DDevice8 implementation structure
......@@ -177,6 +178,7 @@ struct IDirect3DDevice8Impl
{
/* IUnknown fields */
const IDirect3DDevice8Vtbl *lpVtbl;
const IWineD3DDeviceParentVtbl *device_parent_vtbl;
LONG ref;
/* But what about baseVertexIndex in state blocks? hmm... it may be a better idea to pass this to wined3d */
IWineD3DDevice *WineD3DDevice;
......@@ -200,6 +202,7 @@ struct IDirect3DDevice8Impl
/*****************************************************************************
* IDirect3DVolume8 implementation structure
*/
extern const IDirect3DVolume8Vtbl Direct3DVolume8_Vtbl;
struct IDirect3DVolume8Impl
{
/* IUnknown fields */
......@@ -624,29 +627,10 @@ UINT convert_to_wined3d_declaration(const DWORD *d3d8_elements, DWORD *d3d8_elem
size_t parse_token(const DWORD* pToken);
/* Callbacks */
extern HRESULT WINAPI D3D8CB_CreateVolume(IUnknown *pDevice, IUnknown *pSuperior, UINT Width, UINT Height, UINT Depth,
WINED3DFORMAT Format, WINED3DPOOL Pool, DWORD Usage,
IWineD3DVolume **ppVolume,
HANDLE * pSharedHandle);
extern HRESULT WINAPI D3D8CB_CreateDepthStencilSurface(IUnknown *device, IUnknown *pSuperior, UINT Width, UINT Height,
WINED3DFORMAT Format, WINED3DMULTISAMPLE_TYPE MultiSample,
DWORD MultisampleQuality, BOOL Discard,
IWineD3DSurface** ppSurface, HANDLE* pSharedHandle);
extern HRESULT WINAPI D3D8CB_CreateRenderTarget(IUnknown *device, IUnknown *pSuperior, UINT Width, UINT Height,
WINED3DFORMAT Format, WINED3DMULTISAMPLE_TYPE MultiSample,
DWORD MultisampleQuality, BOOL Lockable,
IWineD3DSurface** ppSurface, HANDLE* pSharedHandle);
extern ULONG WINAPI D3D8CB_DestroySwapChain (IWineD3DSwapChain *pSwapChain);
extern ULONG WINAPI D3D8CB_DestroyDepthStencilSurface (IWineD3DSurface *pSurface);
extern ULONG WINAPI D3D8CB_DestroyRenderTarget (IWineD3DSurface *pSurface);
extern ULONG WINAPI D3D8CB_DestroySurface(IWineD3DSurface *pSurface);
extern ULONG WINAPI D3D8CB_DestroyVolume(IWineD3DVolume *pVolume);
#endif /* __WINE_D3DX8_PRIVATE_H */
......@@ -260,31 +260,6 @@ static HMONITOR WINAPI IDirect3D8Impl_GetAdapterMonitor(LPDIRECT3D8 iface, UINT
return ret;
}
/* Internal function called back during the CreateDevice to create a render target */
HRESULT WINAPI D3D8CB_CreateRenderTarget(IUnknown *device, IUnknown *pSuperior, UINT Width, UINT Height,
WINED3DFORMAT Format, WINED3DMULTISAMPLE_TYPE MultiSample,
DWORD MultisampleQuality, BOOL Lockable,
IWineD3DSurface** ppSurface, HANDLE* pSharedHandle) {
HRESULT res = D3D_OK;
IDirect3DSurface8Impl *d3dSurface = NULL;
TRACE("(%p) call back\n", device);
res = IDirect3DDevice8_CreateRenderTarget((IDirect3DDevice8 *)device, Width, Height,
(D3DFORMAT)Format, MultiSample, Lockable,
(IDirect3DSurface8 **)&d3dSurface);
if (SUCCEEDED(res)) {
*ppSurface = d3dSurface->wineD3DSurface;
d3dSurface->container = device;
d3dSurface->isImplicit = TRUE;
/* Implicit surfaces are created with an refcount of 0 */
IUnknown_Release((IUnknown *)d3dSurface);
} else {
*ppSurface = NULL;
}
return res;
}
ULONG WINAPI D3D8CB_DestroyRenderTarget(IWineD3DSurface *pSurface) {
IDirect3DSurface8Impl* surfaceParent;
TRACE("(%p) call back\n", pSurface);
......@@ -295,58 +270,6 @@ ULONG WINAPI D3D8CB_DestroyRenderTarget(IWineD3DSurface *pSurface) {
return IDirect3DSurface8_Release((IDirect3DSurface8*) surfaceParent);
}
/* Callback for creating the implicit swapchain when the device is created */
static HRESULT WINAPI D3D8CB_CreateAdditionalSwapChain(IUnknown *device,
WINED3DPRESENT_PARAMETERS* pPresentationParameters,
IWineD3DSwapChain ** ppSwapChain){
HRESULT res = D3D_OK;
IDirect3DSwapChain8Impl *d3dSwapChain = NULL;
D3DPRESENT_PARAMETERS localParameters;
TRACE("(%p) call back\n", device);
/* Copy the presentation parameters */
localParameters.BackBufferWidth = pPresentationParameters->BackBufferWidth;
localParameters.BackBufferHeight = pPresentationParameters->BackBufferHeight;
localParameters.BackBufferFormat = pPresentationParameters->BackBufferFormat;
localParameters.BackBufferCount = pPresentationParameters->BackBufferCount;
localParameters.MultiSampleType = pPresentationParameters->MultiSampleType;
localParameters.SwapEffect = pPresentationParameters->SwapEffect;
localParameters.hDeviceWindow = pPresentationParameters->hDeviceWindow;
localParameters.Windowed = pPresentationParameters->Windowed;
localParameters.EnableAutoDepthStencil = pPresentationParameters->EnableAutoDepthStencil;
localParameters.AutoDepthStencilFormat = pPresentationParameters->AutoDepthStencilFormat;
localParameters.Flags = pPresentationParameters->Flags;
localParameters.FullScreen_RefreshRateInHz = pPresentationParameters->FullScreen_RefreshRateInHz;
localParameters.FullScreen_PresentationInterval = pPresentationParameters->PresentationInterval;
res = IDirect3DDevice8_CreateAdditionalSwapChain((IDirect3DDevice8 *)device, &localParameters, (IDirect3DSwapChain8 **)&d3dSwapChain);
/* Copy back the presentation parameters */
pPresentationParameters->BackBufferWidth = localParameters.BackBufferWidth;
pPresentationParameters->BackBufferHeight = localParameters.BackBufferHeight;
pPresentationParameters->BackBufferFormat = localParameters.BackBufferFormat;
pPresentationParameters->BackBufferCount = localParameters.BackBufferCount;
pPresentationParameters->MultiSampleType = localParameters.MultiSampleType;
pPresentationParameters->SwapEffect = localParameters.SwapEffect;
pPresentationParameters->hDeviceWindow = localParameters.hDeviceWindow;
pPresentationParameters->Windowed = localParameters.Windowed;
pPresentationParameters->EnableAutoDepthStencil = localParameters.EnableAutoDepthStencil;
pPresentationParameters->AutoDepthStencilFormat = localParameters.AutoDepthStencilFormat;
pPresentationParameters->Flags = localParameters.Flags;
pPresentationParameters->FullScreen_RefreshRateInHz = localParameters.FullScreen_RefreshRateInHz;
pPresentationParameters->PresentationInterval = localParameters.FullScreen_PresentationInterval;
if (SUCCEEDED(res)) {
*ppSwapChain = d3dSwapChain->wineD3DSwapChain;
IUnknown_Release(d3dSwapChain->parentDevice);
d3dSwapChain->parentDevice = NULL;
} else {
*ppSwapChain = NULL;
}
return res;
}
ULONG WINAPI D3D8CB_DestroySwapChain(IWineD3DSwapChain *pSwapChain) {
IUnknown* swapChainParent;
TRACE("(%p) call back\n", pSwapChain);
......@@ -356,27 +279,6 @@ ULONG WINAPI D3D8CB_DestroySwapChain(IWineD3DSwapChain *pSwapChain) {
return IUnknown_Release(swapChainParent);
}
/* Internal function called back during the CreateDevice to create a render target */
HRESULT WINAPI D3D8CB_CreateDepthStencilSurface(IUnknown *device, IUnknown *pSuperior, UINT Width, UINT Height,
WINED3DFORMAT Format, WINED3DMULTISAMPLE_TYPE MultiSample,
DWORD MultisampleQuality, BOOL Discard,
IWineD3DSurface** ppSurface, HANDLE* pSharedHandle) {
HRESULT res = D3D_OK;
IDirect3DSurface8Impl *d3dSurface = NULL;
TRACE("(%p) call back\n", device);
res = IDirect3DDevice8_CreateDepthStencilSurface((IDirect3DDevice8 *)device, Width, Height,
(D3DFORMAT)Format, MultiSample, (IDirect3DSurface8 **)&d3dSurface);
if (SUCCEEDED(res)) {
*ppSurface = d3dSurface->wineD3DSurface;
d3dSurface->container = device;
d3dSurface->isImplicit = TRUE;
/* Implicit surfaces are created with an refcount of 0 */
IUnknown_Release((IUnknown *)d3dSurface);
}
return res;
}
ULONG WINAPI D3D8CB_DestroyDepthStencilSurface(IWineD3DSurface *pSurface) {
IDirect3DSurface8Impl* surfaceParent;
TRACE("(%p) call back\n", pSurface);
......@@ -412,6 +314,7 @@ static HRESULT WINAPI IDirect3D8Impl_CreateDevice(LPDIRECT3D8 iface, UINT Adapte
}
object->lpVtbl = &Direct3DDevice8_Vtbl;
object->device_parent_vtbl = &d3d8_wined3d_device_parent_vtbl;
object->ref = 1;
object->shader_handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, INITIAL_SHADER_HANDLE_TABLE_SIZE * sizeof(shader_handle));
object->shader_handle_table_size = INITIAL_SHADER_HANDLE_TABLE_SIZE;
......@@ -419,7 +322,8 @@ static HRESULT WINAPI IDirect3D8Impl_CreateDevice(LPDIRECT3D8 iface, UINT Adapte
/* Allocate an associated WineD3DDevice object */
EnterCriticalSection(&d3d8_cs);
hr =IWineD3D_CreateDevice(This->WineD3D, Adapter, DeviceType, hFocusWindow, BehaviourFlags, &object->WineD3DDevice, (IUnknown *)object);
hr = IWineD3D_CreateDevice(This->WineD3D, Adapter, DeviceType, hFocusWindow, BehaviourFlags,
(IUnknown *)object, (IWineD3DDeviceParent *)&object->device_parent_vtbl, &object->WineD3DDevice);
if (hr != D3D_OK) {
HeapFree(GetProcessHeap(), 0, object);
......@@ -450,7 +354,7 @@ static HRESULT WINAPI IDirect3D8Impl_CreateDevice(LPDIRECT3D8 iface, UINT Adapte
IWineD3DDevice_SetMultithreaded(object->WineD3DDevice);
}
hr = IWineD3DDevice_Init3D(object->WineD3DDevice, &localParameters, D3D8CB_CreateAdditionalSwapChain);
hr = IWineD3DDevice_Init3D(object->WineD3DDevice, &localParameters);
LeaveCriticalSection(&d3d8_cs);
pPresentationParameters->BackBufferWidth = localParameters.BackBufferWidth;
......
......@@ -192,7 +192,7 @@ static HRESULT WINAPI IDirect3DVolume8Impl_UnlockBox(LPDIRECT3DVOLUME8 iface) {
return hr;
}
static const IDirect3DVolume8Vtbl Direct3DVolume8_Vtbl =
const IDirect3DVolume8Vtbl Direct3DVolume8_Vtbl =
{
/* IUnknown */
IDirect3DVolume8Impl_QueryInterface,
......@@ -209,42 +209,6 @@ static const IDirect3DVolume8Vtbl Direct3DVolume8_Vtbl =
IDirect3DVolume8Impl_UnlockBox
};
/* Internal function called back during the CreateVolumeTexture */
HRESULT WINAPI D3D8CB_CreateVolume(IUnknown *pDevice, IUnknown *pSuperior, UINT Width, UINT Height, UINT Depth,
WINED3DFORMAT Format, WINED3DPOOL Pool, DWORD Usage,
IWineD3DVolume **ppVolume,
HANDLE * pSharedHandle) {
IDirect3DVolume8Impl *object;
IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)pDevice;
HRESULT hrc = D3D_OK;
/* Allocate the storage for the device */
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DVolume8Impl));
if (NULL == object) {
FIXME("Allocation of memory failed\n");
*ppVolume = NULL;
return D3DERR_OUTOFVIDEOMEMORY;
}
object->lpVtbl = &Direct3DVolume8_Vtbl;
object->ref = 1;
hrc = IWineD3DDevice_CreateVolume(This->WineD3DDevice, Width, Height, Depth, Usage, Format,
Pool, &object->wineD3DVolume, pSharedHandle, (IUnknown *)object);
if (hrc != D3D_OK) {
/* free up object */
FIXME("(%p) call to IWineD3DDevice_CreateVolume failed\n", This);
HeapFree(GetProcessHeap(), 0, object);
*ppVolume = NULL;
} else {
*ppVolume = object->wineD3DVolume;
object->container = pSuperior;
object->forwardReference = pSuperior;
}
TRACE("(%p) Created volume %p\n", This, *ppVolume);
return hrc;
}
ULONG WINAPI D3D8CB_DestroyVolume(IWineD3DVolume *pVolume) {
IDirect3DVolume8Impl* volumeParent;
......
......@@ -355,8 +355,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateCubeTexture(LPDIRECT3DDEVICE9EX ifac
object->ref = 1;
EnterCriticalSection(&d3d9_cs);
hr = IWineD3DDevice_CreateCubeTexture(This->WineD3DDevice, EdgeLength, Levels, Usage,
(WINED3DFORMAT)Format, (WINED3DPOOL) Pool, &object->wineD3DCubeTexture, pSharedHandle, (IUnknown*)object,
D3D9CB_CreateSurface);
Format, Pool, &object->wineD3DCubeTexture, pSharedHandle, (IUnknown*)object);
LeaveCriticalSection(&d3d9_cs);
if (hr != D3D_OK){
......
......@@ -167,6 +167,7 @@ void filter_caps(D3DCAPS9* pCaps);
* Predeclare the interface implementation structures
*/
extern const IDirect3DDevice9ExVtbl Direct3DDevice9_Vtbl;
extern const IWineD3DDeviceParentVtbl d3d9_wined3d_device_parent_vtbl;
/*****************************************************************************
* IDirect3DDevice9 implementation structure
......@@ -175,6 +176,7 @@ typedef struct IDirect3DDevice9Impl
{
/* IUnknown fields */
const IDirect3DDevice9ExVtbl *lpVtbl;
const IWineD3DDeviceParentVtbl *device_parent_vtbl;
LONG ref;
/* IDirect3DDevice9 fields */
......@@ -233,6 +235,7 @@ extern HRESULT WINAPI IDirect3DDevice9Impl_CreateQuery(LPDIRECT3DDEVICE9EX ifa
/*****************************************************************************
* IDirect3DVolume9 implementation structure
*/
extern const IDirect3DVolume9Vtbl Direct3DVolume9_Vtbl;
typedef struct IDirect3DVolume9Impl
{
/* IUnknown fields */
......@@ -551,34 +554,10 @@ typedef struct IDirect3DQuery9Impl {
/* Callbacks */
extern HRESULT WINAPI D3D9CB_CreateSurface(IUnknown *device, IUnknown *pSuperior, UINT Width, UINT Height,
WINED3DFORMAT Format, DWORD Usage, WINED3DPOOL Pool, UINT Level,
WINED3DCUBEMAP_FACES Face, IWineD3DSurface** ppSurface,
HANDLE* pSharedHandle);
extern HRESULT WINAPI D3D9CB_CreateVolume(IUnknown *pDevice, IUnknown *pSuperior, UINT Width, UINT Height, UINT Depth,
WINED3DFORMAT Format, WINED3DPOOL Pool, DWORD Usage,
IWineD3DVolume **ppVolume,
HANDLE * pSharedHandle);
extern HRESULT WINAPI D3D9CB_CreateDepthStencilSurface(IUnknown *device, IUnknown *pSuperior, UINT Width, UINT Height,
WINED3DFORMAT Format, WINED3DMULTISAMPLE_TYPE MultiSample,
DWORD MultisampleQuality, BOOL Discard,
IWineD3DSurface** ppSurface, HANDLE* pSharedHandle);
extern HRESULT WINAPI D3D9CB_CreateRenderTarget(IUnknown *device, IUnknown *pSuperior, UINT Width, UINT Height,
WINED3DFORMAT Format, WINED3DMULTISAMPLE_TYPE MultiSample,
DWORD MultisampleQuality, BOOL Lockable,
IWineD3DSurface** ppSurface, HANDLE* pSharedHandle);
extern ULONG WINAPI D3D9CB_DestroySwapChain (IWineD3DSwapChain *pSwapChain);
extern ULONG WINAPI D3D9CB_DestroyDepthStencilSurface (IWineD3DSurface *pSurface);
extern ULONG WINAPI D3D9CB_DestroyRenderTarget (IWineD3DSurface *pSurface);
extern ULONG WINAPI D3D9CB_DestroySurface(IWineD3DSurface *pSurface);
extern ULONG WINAPI D3D9CB_DestroyVolume(IWineD3DVolume *pVolume);
#endif /* __WINE_D3D9_PRIVATE_H */
......@@ -329,30 +329,6 @@ static HMONITOR WINAPI IDirect3D9Impl_GetAdapterMonitor(LPDIRECT3D9EX iface, UIN
return ret;
}
/* Internal function called back during the CreateDevice to create a render target */
HRESULT WINAPI D3D9CB_CreateRenderTarget(IUnknown *device, IUnknown *pSuperior, UINT Width, UINT Height,
WINED3DFORMAT Format, WINED3DMULTISAMPLE_TYPE MultiSample,
DWORD MultisampleQuality, BOOL Lockable,
IWineD3DSurface** ppSurface, HANDLE* pSharedHandle) {
HRESULT res = D3D_OK;
IDirect3DSurface9Impl *d3dSurface = NULL;
TRACE("(%p) call back\n", device);
res = IDirect3DDevice9_CreateRenderTarget((IDirect3DDevice9 *)device, Width, Height,
(D3DFORMAT)Format, MultiSample, MultisampleQuality, Lockable,
(IDirect3DSurface9 **)&d3dSurface, pSharedHandle);
if (SUCCEEDED(res)) {
*ppSurface = d3dSurface->wineD3DSurface;
d3dSurface->container = pSuperior;
d3dSurface->isImplicit = TRUE;
/* Implicit surfaces are created with an refcount of 0 */
IDirect3DSurface9_Release((IDirect3DSurface9 *)d3dSurface);
} else {
*ppSurface = NULL;
}
return res;
}
ULONG WINAPI D3D9CB_DestroyRenderTarget(IWineD3DSurface *pSurface) {
IDirect3DSurface9Impl* surfaceParent;
TRACE("(%p) call back\n", pSurface);
......@@ -363,60 +339,6 @@ ULONG WINAPI D3D9CB_DestroyRenderTarget(IWineD3DSurface *pSurface) {
return IDirect3DSurface9_Release((IDirect3DSurface9*) surfaceParent);
}
static HRESULT WINAPI D3D9CB_CreateAdditionalSwapChain(IUnknown *device,
WINED3DPRESENT_PARAMETERS* pPresentationParameters,
IWineD3DSwapChain ** ppSwapChain) {
HRESULT res = D3D_OK;
IDirect3DSwapChain9Impl *d3dSwapChain = NULL;
D3DPRESENT_PARAMETERS localParameters;
TRACE("(%p) call back\n", device);
/* Copy the presentation parameters */
localParameters.BackBufferWidth = pPresentationParameters->BackBufferWidth;
localParameters.BackBufferHeight = pPresentationParameters->BackBufferHeight;
localParameters.BackBufferFormat = pPresentationParameters->BackBufferFormat;
localParameters.BackBufferCount = pPresentationParameters->BackBufferCount;
localParameters.MultiSampleType = pPresentationParameters->MultiSampleType;
localParameters.MultiSampleQuality = pPresentationParameters->MultiSampleQuality;
localParameters.SwapEffect = pPresentationParameters->SwapEffect;
localParameters.hDeviceWindow = pPresentationParameters->hDeviceWindow;
localParameters.Windowed = pPresentationParameters->Windowed;
localParameters.EnableAutoDepthStencil = pPresentationParameters->EnableAutoDepthStencil;
localParameters.AutoDepthStencilFormat = pPresentationParameters->AutoDepthStencilFormat;
localParameters.Flags = pPresentationParameters->Flags;
localParameters.FullScreen_RefreshRateInHz = pPresentationParameters->FullScreen_RefreshRateInHz;
localParameters.PresentationInterval = pPresentationParameters->PresentationInterval;
res = IDirect3DDevice9_CreateAdditionalSwapChain((IDirect3DDevice9 *)device, &localParameters, (IDirect3DSwapChain9 **)&d3dSwapChain);
if (SUCCEEDED(res)) {
*ppSwapChain = d3dSwapChain->wineD3DSwapChain;
d3dSwapChain->isImplicit = TRUE;
/* Implicit swap chains are created with an refcount of 0 */
IDirect3DSwapChain9_Release((IDirect3DSwapChain9 *)d3dSwapChain);
} else {
*ppSwapChain = NULL;
}
/* Copy back the presentation parameters */
pPresentationParameters->BackBufferWidth = localParameters.BackBufferWidth;
pPresentationParameters->BackBufferHeight = localParameters.BackBufferHeight;
pPresentationParameters->BackBufferFormat = localParameters.BackBufferFormat;
pPresentationParameters->BackBufferCount = localParameters.BackBufferCount;
pPresentationParameters->MultiSampleType = localParameters.MultiSampleType;
pPresentationParameters->MultiSampleQuality = localParameters.MultiSampleQuality;
pPresentationParameters->SwapEffect = localParameters.SwapEffect;
pPresentationParameters->hDeviceWindow = localParameters.hDeviceWindow;
pPresentationParameters->Windowed = localParameters.Windowed;
pPresentationParameters->EnableAutoDepthStencil = localParameters.EnableAutoDepthStencil;
pPresentationParameters->AutoDepthStencilFormat = localParameters.AutoDepthStencilFormat;
pPresentationParameters->Flags = localParameters.Flags;
pPresentationParameters->FullScreen_RefreshRateInHz = localParameters.FullScreen_RefreshRateInHz;
pPresentationParameters->PresentationInterval = localParameters.PresentationInterval;
return res;
}
ULONG WINAPI D3D9CB_DestroySwapChain(IWineD3DSwapChain *pSwapChain) {
IDirect3DSwapChain9Impl* swapChainParent;
TRACE("(%p) call back\n", pSwapChain);
......@@ -427,28 +349,6 @@ ULONG WINAPI D3D9CB_DestroySwapChain(IWineD3DSwapChain *pSwapChain) {
return IDirect3DSwapChain9_Release((IDirect3DSwapChain9*) swapChainParent);
}
/* Internal function called back during the CreateDevice to create a render target */
HRESULT WINAPI D3D9CB_CreateDepthStencilSurface(IUnknown *device, IUnknown *pSuperior, UINT Width, UINT Height,
WINED3DFORMAT Format, WINED3DMULTISAMPLE_TYPE MultiSample,
DWORD MultisampleQuality, BOOL Discard,
IWineD3DSurface** ppSurface, HANDLE* pSharedHandle) {
HRESULT res = D3D_OK;
IDirect3DSurface9Impl *d3dSurface = NULL;
TRACE("(%p) call back\n", device);
res = IDirect3DDevice9_CreateDepthStencilSurface((IDirect3DDevice9 *)device, Width, Height,
(D3DFORMAT)Format, MultiSample, MultisampleQuality, Discard,
(IDirect3DSurface9 **)&d3dSurface, pSharedHandle);
if (SUCCEEDED(res)) {
*ppSurface = d3dSurface->wineD3DSurface;
d3dSurface->container = device;
d3dSurface->isImplicit = TRUE;
/* Implicit surfaces are created with an refcount of 0 */
IDirect3DSurface9_Release((IDirect3DSurface9 *)d3dSurface);
}
return res;
}
ULONG WINAPI D3D9CB_DestroyDepthStencilSurface(IWineD3DSurface *pSurface) {
IDirect3DSurface9Impl* surfaceParent;
TRACE("(%p) call back\n", pSurface);
......@@ -485,13 +385,14 @@ static HRESULT WINAPI IDirect3D9Impl_CreateDevice(LPDIRECT3D9EX iface, UINT Adap
}
object->lpVtbl = &Direct3DDevice9_Vtbl;
object->device_parent_vtbl = &d3d9_wined3d_device_parent_vtbl;
object->ref = 1;
*ppReturnedDeviceInterface = (IDirect3DDevice9 *)object;
/* Allocate an associated WineD3DDevice object */
EnterCriticalSection(&d3d9_cs);
hr =IWineD3D_CreateDevice(This->WineD3D, Adapter, DeviceType, hFocusWindow, BehaviourFlags, &object->WineD3DDevice, (IUnknown *)object);
hr = IWineD3D_CreateDevice(This->WineD3D, Adapter, DeviceType, hFocusWindow, BehaviourFlags,
(IUnknown *)object, (IWineD3DDeviceParent *)&object->device_parent_vtbl, &object->WineD3DDevice);
if (hr != D3D_OK) {
HeapFree(GetProcessHeap(), 0, object);
*ppReturnedDeviceInterface = NULL;
......@@ -521,7 +422,7 @@ static HRESULT WINAPI IDirect3D9Impl_CreateDevice(LPDIRECT3D9EX iface, UINT Adap
IWineD3DDevice_SetMultithreaded(object->WineD3DDevice);
}
hr = IWineD3DDevice_Init3D(object->WineD3DDevice, &localParameters, D3D9CB_CreateAdditionalSwapChain);
hr = IWineD3DDevice_Init3D(object->WineD3DDevice, &localParameters);
pPresentationParameters->BackBufferWidth = localParameters.BackBufferWidth;
pPresentationParameters->BackBufferHeight = localParameters.BackBufferHeight;
......
......@@ -230,7 +230,8 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateAdditionalSwapChain(LPDIRECT3DDEVICE
localParameters.AutoRestoreDisplayMode = TRUE;
EnterCriticalSection(&d3d9_cs);
hrc = IWineD3DDevice_CreateSwapChain(This->WineD3DDevice, &localParameters, &object->wineD3DSwapChain, (IUnknown*)object, D3D9CB_CreateRenderTarget, D3D9CB_CreateDepthStencilSurface, SURFACE_OPENGL);
hrc = IWineD3DDevice_CreateSwapChain(This->WineD3DDevice, &localParameters,
&object->wineD3DSwapChain, (IUnknown*)object, SURFACE_OPENGL);
LeaveCriticalSection(&d3d9_cs);
pPresentationParameters->BackBufferWidth = localParameters.BackBufferWidth;
......
......@@ -347,9 +347,8 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateTexture(LPDIRECT3DDEVICE9EX iface, U
object->ref = 1;
EnterCriticalSection(&d3d9_cs);
hrc = IWineD3DDevice_CreateTexture(This->WineD3DDevice, Width, Height, Levels, Usage & WINED3DUSAGE_MASK,
(WINED3DFORMAT)Format, (WINED3DPOOL) Pool, &object->wineD3DTexture, pSharedHandle, (IUnknown *)object, D3D9CB_CreateSurface);
Format, Pool, &object->wineD3DTexture, pSharedHandle, (IUnknown *)object);
LeaveCriticalSection(&d3d9_cs);
if (FAILED(hrc)) {
/* free up object */
......
......@@ -160,7 +160,7 @@ static HRESULT WINAPI IDirect3DVolume9Impl_UnlockBox(LPDIRECT3DVOLUME9 iface) {
return IWineD3DVolume_UnlockBox(This->wineD3DVolume);
}
static const IDirect3DVolume9Vtbl Direct3DVolume9_Vtbl =
const IDirect3DVolume9Vtbl Direct3DVolume9_Vtbl =
{
/* IUnknown */
IDirect3DVolume9Impl_QueryInterface,
......@@ -177,42 +177,6 @@ static const IDirect3DVolume9Vtbl Direct3DVolume9_Vtbl =
IDirect3DVolume9Impl_UnlockBox
};
/* Internal function called back during the CreateVolumeTexture */
HRESULT WINAPI D3D9CB_CreateVolume(IUnknown *pDevice, IUnknown *pSuperior, UINT Width, UINT Height, UINT Depth,
WINED3DFORMAT Format, WINED3DPOOL Pool, DWORD Usage,
IWineD3DVolume **ppVolume,
HANDLE * pSharedHandle) {
IDirect3DVolume9Impl *object;
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)pDevice;
HRESULT hrc = D3D_OK;
/* Allocate the storage for the device */
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DVolume9Impl));
if (NULL == object) {
FIXME("Allocation of memory failed\n");
*ppVolume = NULL;
return D3DERR_OUTOFVIDEOMEMORY;
}
object->lpVtbl = &Direct3DVolume9_Vtbl;
object->ref = 1;
hrc = IWineD3DDevice_CreateVolume(This->WineD3DDevice, Width, Height, Depth, Usage & WINED3DUSAGE_MASK, Format,
Pool, &object->wineD3DVolume, pSharedHandle, (IUnknown *)object);
if (hrc != D3D_OK) {
/* free up object */
FIXME("(%p) call to IWineD3DDevice_CreateVolume failed\n", This);
HeapFree(GetProcessHeap(), 0, object);
*ppVolume = NULL;
} else {
*ppVolume = object->wineD3DVolume;
object->container = pSuperior;
object->forwardReference = pSuperior;
}
TRACE("(%p) Created volume %p\n", This, *ppVolume);
return hrc;
}
ULONG WINAPI D3D9CB_DestroyVolume(IWineD3DVolume *pVolume) {
IDirect3DVolume9Impl* volumeParent;
......
......@@ -258,11 +258,8 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateVolumeTexture(LPDIRECT3DDEVICE9EX if
object->lpVtbl = &Direct3DVolumeTexture9_Vtbl;
object->ref = 1;
hrc = IWineD3DDevice_CreateVolumeTexture(This->WineD3DDevice, Width, Height, Depth, Levels, Usage & WINED3DUSAGE_MASK,
(WINED3DFORMAT)Format, (WINED3DPOOL) Pool, &object->wineD3DVolumeTexture, pSharedHandle,
(IUnknown *)object, D3D9CB_CreateVolume);
hrc = IWineD3DDevice_CreateVolumeTexture(This->WineD3DDevice, Width, Height, Depth, Levels,
Usage & WINED3DUSAGE_MASK, Format, Pool, &object->wineD3DVolumeTexture, pSharedHandle, (IUnknown *)object);
if (hrc != D3D_OK) {
/* free up object */
......
......@@ -35,8 +35,11 @@
#include "ddcomimpl.h"
#include "wine/wined3d.h"
#include "wine/list.h"
#ifdef DDRAW_INIT_GUID
#include "initguid.h"
#endif
#include "wine/wined3d.h"
/*****************************************************************************
* IParent - a helper interface
......@@ -106,6 +109,7 @@ struct IDirectDrawImpl
ICOM_VFIELD_MULTI(IDirect3D3);
ICOM_VFIELD_MULTI(IDirect3D2);
ICOM_VFIELD_MULTI(IDirect3D);
const IWineD3DDeviceParentVtbl *device_parent_vtbl;
/* See comment in IDirectDraw::AddRef */
LONG ref7, ref4, ref2, ref3, ref1, numIfaces;
......@@ -170,6 +174,7 @@ const IDirectDraw4Vtbl IDirectDraw4_Vtbl;
const IDirectDraw3Vtbl IDirectDraw3_Vtbl;
const IDirectDraw2Vtbl IDirectDraw2_Vtbl;
const IDirectDrawVtbl IDirectDraw1_Vtbl;
extern const IWineD3DDeviceParentVtbl ddraw_wined3d_device_parent_vtbl;
/* Helper structures */
typedef struct EnumDisplayModesCBS
......
......@@ -45,6 +45,7 @@
#include "ddraw.h"
#include "d3d.h"
#define DDRAW_INIT_GUID
#include "ddraw_private.h"
static typeof(WineDirect3DCreate) *pWineDirect3DCreate;
......@@ -179,6 +180,7 @@ DDRAW_Create(const GUID *guid,
ICOM_INIT_INTERFACE(This, IDirect3D2, IDirect3D2_Vtbl);
ICOM_INIT_INTERFACE(This, IDirect3D3, IDirect3D3_Vtbl);
ICOM_INIT_INTERFACE(This, IDirect3D7, IDirect3D7_Vtbl);
This->device_parent_vtbl = &ddraw_wined3d_device_parent_vtbl;
/* See comments in IDirectDrawImpl_CreateNewSurface for a description
* of this member.
......@@ -230,13 +232,9 @@ DDRAW_Create(const GUID *guid,
* When a Direct3DDevice7 is created, the D3D capabilities of WineD3D are
* initialized
*/
hr = IWineD3D_CreateDevice(wineD3D,
0 /*D3D_ADAPTER_DEFAULT*/,
devicetype,
NULL, /* FocusWindow, don't know yet */
0, /* BehaviorFlags */
&wineD3DDevice,
(IUnknown *) ICOM_INTERFACE(This, IDirectDraw7));
hr = IWineD3D_CreateDevice(wineD3D, 0 /* D3D_ADAPTER_DEFAULT */, devicetype, NULL /* FocusWindow, don't know yet */,
0 /* BehaviorFlags */, (IUnknown *)ICOM_INTERFACE(This, IDirectDraw7),
(IWineD3DDeviceParent *)&This->device_parent_vtbl, &wineD3DDevice);
if(FAILED(hr))
{
ERR("Failed to create a wineD3DDevice, result = %x\n", hr);
......
......@@ -45,8 +45,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
const GUID IID_IParent = {0xc20e4c88, 0x74e7, 0x4940, {0xba, 0x9f, 0x2e, 0x32, 0x3f, 0x9d, 0xc9, 0x81}};
/*****************************************************************************
* IUnknown methods
*****************************************************************************/
......
......@@ -215,6 +215,7 @@ static HRESULT register_d3d10core_layers(HMODULE d3d10core)
HRESULT WINAPI DXGID3D10CreateDevice(HMODULE d3d10core, IDXGIFactory *factory, IDXGIAdapter *adapter,
UINT flags, DWORD unknown0, void **device)
{
IWineD3DDeviceParent *wined3d_device_parent;
struct layer_get_size_args get_size_args;
struct dxgi_device *dxgi_device;
struct dxgi_device_layer d3d10_layer;
......@@ -273,6 +274,16 @@ HRESULT WINAPI DXGID3D10CreateDevice(HMODULE d3d10core, IDXGIFactory *factory, I
dxgi_device->vtbl = &dxgi_device_vtbl;
dxgi_device->refcount = 1;
layer_base = dxgi_device + 1;
hr = d3d10_layer.create(d3d10_layer.id, &layer_base, 0,
dxgi_device, &IID_IUnknown, (void **)&dxgi_device->child_layer);
if (FAILED(hr))
{
WARN("Failed to create device, returning %#x\n", hr);
goto fail;
}
hr = IDXGIFactory_QueryInterface(factory, &IID_IWineDXGIFactory, (void **)&dxgi_device->factory);
if (FAILED(hr))
{
......@@ -293,25 +304,23 @@ HRESULT WINAPI DXGID3D10CreateDevice(HMODULE d3d10core, IDXGIFactory *factory, I
adapter_ordinal = IWineDXGIAdapter_get_ordinal(wine_adapter);
IWineDXGIAdapter_Release(wine_adapter);
FIXME("Ignoring adapter type\n");
EnterCriticalSection(&dxgi_cs);
hr = IWineD3D_CreateDevice(wined3d, adapter_ordinal, WINED3DDEVTYPE_HAL, NULL,
0, &dxgi_device->wined3d_device, (IUnknown *)dxgi_device);
IWineD3D_Release(wined3d);
LeaveCriticalSection(&dxgi_cs);
hr = IUnknown_QueryInterface((IUnknown *)dxgi_device, &IID_IWineD3DDeviceParent, (void **)&wined3d_device_parent);
if (FAILED(hr))
{
WARN("Failed to create a WineD3D device, returning %#x\n", hr);
ERR("DXGI device should implement IWineD3DDeviceParent\n");
goto fail;
}
layer_base = dxgi_device + 1;
hr = d3d10_layer.create(d3d10_layer.id, &layer_base, 0,
dxgi_device, &IID_IUnknown, (void **)&dxgi_device->child_layer);
FIXME("Ignoring adapter type\n");
EnterCriticalSection(&dxgi_cs);
hr = IWineD3D_CreateDevice(wined3d, adapter_ordinal, WINED3DDEVTYPE_HAL, NULL, 0,
(IUnknown *)dxgi_device, wined3d_device_parent, &dxgi_device->wined3d_device);
IWineD3DDeviceParent_Release(wined3d_device_parent);
IWineD3D_Release(wined3d);
LeaveCriticalSection(&dxgi_cs);
if (FAILED(hr))
{
WARN("Failed to create device, returning %#x\n", hr);
WARN("Failed to create a WineD3D device, returning %#x\n", hr);
goto fail;
}
......@@ -327,6 +336,7 @@ fail:
LeaveCriticalSection(&dxgi_cs);
}
if (dxgi_device->factory) IWineDXGIFactory_Release(dxgi_device->factory);
if (dxgi_device->child_layer) IUnknown_Release(dxgi_device->child_layer);
HeapFree(GetProcessHeap(), 0, dxgi_device);
*device = NULL;
return hr;
......
......@@ -28,10 +28,10 @@
#include "objbase.h"
#include "dxgi.h"
#include "wine/wined3d.h"
#ifdef DXGI_INIT_GUID
#include "initguid.h"
#endif
#include "wine/wined3d.h"
#include "dxgi_private_interface.h"
extern CRITICAL_SECTION dxgi_cs;
......
......@@ -3621,10 +3621,10 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter,
/* Note due to structure differences between dx8 and dx9 D3DPRESENT_PARAMETERS,
and fields being inserted in the middle, a new structure is used in place */
static HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter, WINED3DDEVTYPE DeviceType, HWND hFocusWindow,
DWORD BehaviourFlags, IWineD3DDevice** ppReturnedDeviceInterface,
IUnknown *parent) {
static HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter,
WINED3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviourFlags, IUnknown *parent,
IWineD3DDeviceParent *device_parent, IWineD3DDevice **ppReturnedDeviceInterface)
{
IWineD3DDeviceImpl *object = NULL;
IWineD3DImpl *This = (IWineD3DImpl *)iface;
WINED3DDISPLAYMODE mode;
......@@ -3655,6 +3655,7 @@ static HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter,
object->adapter = numAdapters ? &Adapters[Adapter] : NULL;
IWineD3D_AddRef(object->wineD3D);
object->parent = parent;
object->device_parent = device_parent;
list_init(&object->resources);
list_init(&object->shaders);
......
......@@ -1037,6 +1037,7 @@ struct IWineD3DDeviceImpl
/* WineD3D Information */
IUnknown *parent;
IWineD3DDeviceParent *device_parent;
IWineD3D *wineD3D;
struct WineD3DAdapter *adapter;
......
......@@ -2109,22 +2109,65 @@ interface IWineD3DVolume;
interface IWineD3DSwapChain;
interface IWineD3DDevice;
typedef HRESULT (*D3DCB_CREATESURFACEFN)(IUnknown *pDevice, IUnknown *pSuperior, UINT Width,
UINT Height, WINED3DFORMAT Format, DWORD Usage, WINED3DPOOL Pool, UINT Level, WINED3DCUBEMAP_FACES Face,
IWineD3DSurface **ppSurface, HANDLE *pSharedHandle);
typedef HRESULT (*D3DCB_CREATERENDERTARGETFN)(IUnknown *pDevice, IUnknown *pSuperior, UINT Width,
UINT Height, WINED3DFORMAT Format, WINED3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality,
BOOL Lockable, IWineD3DSurface **ppSurface, HANDLE *pSharedHandle);
typedef HRESULT (*D3DCB_CREATEDEPTHSTENCILSURFACEFN)(IUnknown *pDevice, IUnknown *pSuperior, UINT Width,
UINT Height, WINED3DFORMAT Format, WINED3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality,
BOOL Discard, IWineD3DSurface **ppSurface, HANDLE *pSharedHandle);
[
object,
local,
uuid(aeb62dfc-bdcb-4f02-9519-1eeea00c15cd)
]
interface IWineD3DDeviceParent : IUnknown
{
HRESULT CreateSurface(
[in] IUnknown *superior,
[in] UINT width,
[in] UINT height,
[in] WINED3DFORMAT format,
[in] DWORD usage,
[in] WINED3DPOOL pool,
[in] UINT level,
[in] WINED3DCUBEMAP_FACES face,
[out] IWineD3DSurface **surface
);
HRESULT CreateRenderTarget(
[in] IUnknown *superior,
[in] UINT width,
[in] UINT height,
[in] WINED3DFORMAT format,
[in] WINED3DMULTISAMPLE_TYPE multisample_type,
[in] DWORD multisample_quality,
[in] BOOL lockable,
[out] IWineD3DSurface **surface
);
HRESULT CreateDepthStencilSurface(
[in] IUnknown *superior,
[in] UINT width,
[in] UINT height,
[in] WINED3DFORMAT format,
[in] WINED3DMULTISAMPLE_TYPE multisample_type,
[in] DWORD multisample_quality,
[in] BOOL discard,
[out] IWineD3DSurface **surface
);
HRESULT CreateVolume(
[in] IUnknown *superior,
[in] UINT width,
[in] UINT height,
[in] UINT depth,
[in] WINED3DFORMAT format,
[in] WINED3DPOOL pool,
[in] DWORD usage,
[out] IWineD3DVolume **volume
);
HRESULT CreateSwapChain(
[in, out] WINED3DPRESENT_PARAMETERS *present_parameters,
[out] IWineD3DSwapChain **swapchain
);
}
typedef ULONG (*D3DCB_DESTROYSURFACEFN)(IWineD3DSurface *pSurface);
typedef HRESULT (*D3DCB_CREATEVOLUMEFN)(IUnknown *pDevice, IUnknown *pSuperior, UINT Width,
UINT Height, UINT Depth, WINED3DFORMAT Format, WINED3DPOOL Pool, DWORD Usage,
IWineD3DVolume **ppVolume, HANDLE *pSharedHandle);
typedef ULONG (*D3DCB_DESTROYVOLUMEFN)(IWineD3DVolume *pVolume);
typedef HRESULT (*D3DCB_CREATESWAPCHAIN)(IUnknown *pDevice, WINED3DPRESENT_PARAMETERS *pPresentationParameters,
IWineD3DSwapChain **pSwapChain);
typedef ULONG (*D3DCB_DESTROYSWAPCHAINFN)(IWineD3DSwapChain *pSwapChain);
typedef HRESULT (*D3DCB_ENUMRESOURCES)(IWineD3DResource *resource, void *pData);
......@@ -2221,8 +2264,9 @@ interface IWineD3D : IWineD3DBase
[in] WINED3DDEVTYPE device_type,
[in] HWND focus_window,
[in] DWORD behaviour_flags,
[out] IWineD3DDevice **device,
[in] IUnknown *parent
[in] IUnknown *parent,
[in] IWineD3DDeviceParent *device_parent,
[out] IWineD3DDevice **device
);
}
......@@ -2875,8 +2919,7 @@ interface IWineD3DDevice : IWineD3DBase
[in] WINED3DPOOL pool,
[out] IWineD3DTexture **texture,
[in] HANDLE *shared_handle,
[in] IUnknown *parent,
[in] D3DCB_CREATESURFACEFN create_surface_callback
[in] IUnknown *parent
);
HRESULT CreateVolumeTexture(
[in] UINT width,
......@@ -2888,8 +2931,7 @@ interface IWineD3DDevice : IWineD3DBase
[in] WINED3DPOOL pool,
[out] IWineD3DVolumeTexture **texture,
[in] HANDLE *shared_handle,
[in] IUnknown *parent,
[in] D3DCB_CREATEVOLUMEFN create_volume_callback
[in] IUnknown *parent
);
HRESULT CreateVolume(
[in] UINT width,
......@@ -2910,8 +2952,7 @@ interface IWineD3DDevice : IWineD3DBase
[in] WINED3DPOOL pool,
[out] IWineD3DCubeTexture **texture,
[in] HANDLE *shared_handle,
[in] IUnknown *parent,
[in] D3DCB_CREATESURFACEFN create_surface_callback
[in] IUnknown *parent
);
HRESULT CreateQuery(
[in] WINED3DQUERYTYPE type,
......@@ -2922,8 +2963,6 @@ interface IWineD3DDevice : IWineD3DBase
[in] WINED3DPRESENT_PARAMETERS *present_parameters,
[out] IWineD3DSwapChain **swapchain,
[in] IUnknown *parent,
[in] D3DCB_CREATERENDERTARGETFN create_render_target_callback,
[in] D3DCB_CREATEDEPTHSTENCILSURFACEFN create_depth_stencil_callback,
[in] WINED3DSURFTYPE surface_type
);
HRESULT CreateVertexDeclaration(
......@@ -2955,12 +2994,10 @@ interface IWineD3DDevice : IWineD3DBase
[in] IUnknown *parent
);
HRESULT Init3D(
[in] WINED3DPRESENT_PARAMETERS *present_parameters,
[in] D3DCB_CREATESWAPCHAIN create_swapchain_callback
[in] WINED3DPRESENT_PARAMETERS *present_parameters
);
HRESULT InitGDI(
[in] WINED3DPRESENT_PARAMETERS *present_parameters,
[in] D3DCB_CREATESWAPCHAIN create_swapchain_callback
[in] WINED3DPRESENT_PARAMETERS *present_parameters
);
HRESULT Uninit3D(
[in] D3DCB_DESTROYSURFACEFN destroy_surface_callback,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment