mirror of
https://github.com/reactos/wine.git
synced 2024-11-28 14:10:32 +00:00
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.
This commit is contained in:
parent
f4ca7d2d1a
commit
a966293f59
@ -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 */
|
||||
|
@ -36,9 +36,6 @@
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(d3d8);
|
||||
|
||||
static HRESULT WINAPI D3D8CB_CreateSurface(IUnknown*,IUnknown*,UINT,UINT,WINED3DFORMAT,DWORD,WINED3DPOOL,UINT,WINED3DCUBEMAP_FACES,IWineD3DSurface**,HANDLE*);
|
||||
|
||||
|
||||
/* Shader handle functions */
|
||||
static shader_handle *alloc_shader_handle(IDirect3DDevice8Impl *This) {
|
||||
if (This->free_shader_handles) {
|
||||
@ -76,6 +73,13 @@ static HRESULT WINAPI IDirect3DDevice8Impl_QueryInterface(LPDIRECT3DDEVICE8 ifac
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
if (IsEqualGUID(riid, &IID_IWineD3DDeviceParent))
|
||||
{
|
||||
IUnknown_AddRef((IUnknown *)&This->device_parent_vtbl);
|
||||
*ppobj = &This->device_parent_vtbl;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
|
||||
*ppobj = NULL;
|
||||
return E_NOINTERFACE;
|
||||
@ -311,7 +315,8 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateAdditionalSwapChain(LPDIRECT3DD
|
||||
localParameters.AutoRestoreDisplayMode = TRUE;
|
||||
|
||||
EnterCriticalSection(&d3d8_cs);
|
||||
hrc = IWineD3DDevice_CreateSwapChain(This->WineD3DDevice, &localParameters, &object->wineD3DSwapChain, (IUnknown*)object, D3D8CB_CreateRenderTarget, D3D8CB_CreateDepthStencilSurface, SURFACE_OPENGL);
|
||||
hrc = IWineD3DDevice_CreateSwapChain(This->WineD3DDevice, &localParameters,
|
||||
&object->wineD3DSwapChain, (IUnknown *)object, SURFACE_OPENGL);
|
||||
LeaveCriticalSection(&d3d8_cs);
|
||||
|
||||
pPresentationParameters->BackBufferWidth = localParameters.BackBufferWidth;
|
||||
@ -465,7 +470,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateTexture(LPDIRECT3DDEVICE8 iface
|
||||
object->ref = 1;
|
||||
EnterCriticalSection(&d3d8_cs);
|
||||
hrc = IWineD3DDevice_CreateTexture(This->WineD3DDevice, Width, Height, Levels, Usage & WINED3DUSAGE_MASK,
|
||||
(WINED3DFORMAT)Format, (WINED3DPOOL) Pool, &object->wineD3DTexture, NULL, (IUnknown *)object, D3D8CB_CreateSurface);
|
||||
Format, Pool, &object->wineD3DTexture, NULL, (IUnknown *)object);
|
||||
LeaveCriticalSection(&d3d8_cs);
|
||||
|
||||
if (FAILED(hrc)) {
|
||||
@ -504,9 +509,8 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateVolumeTexture(LPDIRECT3DDEVICE8
|
||||
object->lpVtbl = &Direct3DVolumeTexture8_Vtbl;
|
||||
object->ref = 1;
|
||||
EnterCriticalSection(&d3d8_cs);
|
||||
hrc = IWineD3DDevice_CreateVolumeTexture(This->WineD3DDevice, Width, Height, Depth, Levels, Usage & WINED3DUSAGE_MASK,
|
||||
(WINED3DFORMAT)Format, (WINED3DPOOL) Pool, &object->wineD3DVolumeTexture, NULL,
|
||||
(IUnknown *)object, D3D8CB_CreateVolume);
|
||||
hrc = IWineD3DDevice_CreateVolumeTexture(This->WineD3DDevice, Width, Height, Depth, Levels,
|
||||
Usage & WINED3DUSAGE_MASK, Format, Pool, &object->wineD3DVolumeTexture, NULL, (IUnknown *)object);
|
||||
LeaveCriticalSection(&d3d8_cs);
|
||||
|
||||
if (hrc != D3D_OK) {
|
||||
@ -546,8 +550,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateCubeTexture(LPDIRECT3DDEVICE8 i
|
||||
object->ref = 1;
|
||||
EnterCriticalSection(&d3d8_cs);
|
||||
hr = IWineD3DDevice_CreateCubeTexture(This->WineD3DDevice, EdgeLength, Levels, Usage & WINED3DUSAGE_MASK,
|
||||
(WINED3DFORMAT)Format, (WINED3DPOOL) Pool, &object->wineD3DCubeTexture, NULL, (IUnknown*)object,
|
||||
D3D8CB_CreateSurface);
|
||||
Format, Pool, &object->wineD3DCubeTexture, NULL, (IUnknown *)object);
|
||||
LeaveCriticalSection(&d3d8_cs);
|
||||
|
||||
if (hr != D3D_OK){
|
||||
@ -2243,34 +2246,6 @@ const IDirect3DDevice8Vtbl Direct3DDevice8_Vtbl =
|
||||
IDirect3DDevice8Impl_DeletePatch
|
||||
};
|
||||
|
||||
/* Internal function called back during the CreateDevice to create a render target */
|
||||
static HRESULT WINAPI D3D8CB_CreateSurface(IUnknown *device, IUnknown *pSuperior, UINT Width, UINT Height,
|
||||
WINED3DFORMAT Format, DWORD Usage, WINED3DPOOL Pool, UINT Level,
|
||||
WINED3DCUBEMAP_FACES Face, IWineD3DSurface **ppSurface,
|
||||
HANDLE *pSharedHandle) {
|
||||
|
||||
HRESULT res = D3D_OK;
|
||||
IDirect3DSurface8Impl *d3dSurface = NULL;
|
||||
BOOL Lockable = TRUE;
|
||||
|
||||
if((WINED3DPOOL_DEFAULT == Pool && WINED3DUSAGE_DYNAMIC != Usage))
|
||||
Lockable = FALSE;
|
||||
|
||||
TRACE("relay\n");
|
||||
res = IDirect3DDevice8Impl_CreateSurface((IDirect3DDevice8 *)device, Width, Height, (D3DFORMAT)Format, Lockable, FALSE/*Discard*/, Level, (IDirect3DSurface8 **)&d3dSurface, D3DRTYPE_SURFACE, Usage, Pool, D3DMULTISAMPLE_NONE, 0 /* MultisampleQuality */);
|
||||
|
||||
if (SUCCEEDED(res)) {
|
||||
*ppSurface = d3dSurface->wineD3DSurface;
|
||||
d3dSurface->container = pSuperior;
|
||||
IUnknown_Release(d3dSurface->parentDevice);
|
||||
d3dSurface->parentDevice = NULL;
|
||||
d3dSurface->forwardReference = pSuperior;
|
||||
} else {
|
||||
FIXME("(%p) IDirect3DDevice8_CreateSurface failed\n", device);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
ULONG WINAPI D3D8CB_DestroySurface(IWineD3DSurface *pSurface) {
|
||||
IDirect3DSurface8Impl* surfaceParent;
|
||||
TRACE("(%p) call back\n", pSurface);
|
||||
@ -2281,3 +2256,234 @@ ULONG WINAPI D3D8CB_DestroySurface(IWineD3DSurface *pSurface) {
|
||||
surfaceParent->forwardReference = NULL;
|
||||
return IDirect3DSurface8_Release((IDirect3DSurface8*) surfaceParent);
|
||||
}
|
||||
|
||||
/* IWineD3DDeviceParent IUnknown methods */
|
||||
|
||||
static inline struct IDirect3DDevice8Impl *device_from_device_parent(IWineD3DDeviceParent *iface)
|
||||
{
|
||||
return (struct IDirect3DDevice8Impl *)((char*)iface
|
||||
- FIELD_OFFSET(struct IDirect3DDevice8Impl, device_parent_vtbl));
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE device_parent_QueryInterface(IWineD3DDeviceParent *iface, REFIID riid, void **object)
|
||||
{
|
||||
struct IDirect3DDevice8Impl *This = device_from_device_parent(iface);
|
||||
return IDirect3DDevice8Impl_QueryInterface((IDirect3DDevice8 *)This, riid, object);
|
||||
}
|
||||
|
||||
ULONG STDMETHODCALLTYPE device_parent_AddRef(IWineD3DDeviceParent *iface)
|
||||
{
|
||||
struct IDirect3DDevice8Impl *This = device_from_device_parent(iface);
|
||||
return IDirect3DDevice8Impl_AddRef((IDirect3DDevice8 *)This);
|
||||
}
|
||||
|
||||
ULONG STDMETHODCALLTYPE device_parent_Release(IWineD3DDeviceParent *iface)
|
||||
{
|
||||
struct IDirect3DDevice8Impl *This = device_from_device_parent(iface);
|
||||
return IDirect3DDevice8Impl_Release((IDirect3DDevice8 *)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)
|
||||
{
|
||||
struct IDirect3DDevice8Impl *This = device_from_device_parent(iface);
|
||||
IDirect3DSurface8Impl *d3d_surface;
|
||||
BOOL lockable = TRUE;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, superior %p, width %u, height %u, format %#x, usage %#x,\n"
|
||||
"\tpool %#x, level %u, face %u, surface %p\n",
|
||||
iface, superior, width, height, format, usage, pool, level, face, surface);
|
||||
|
||||
|
||||
if (pool == WINED3DPOOL_DEFAULT && usage != WINED3DUSAGE_DYNAMIC) lockable = FALSE;
|
||||
|
||||
hr = IDirect3DDevice8Impl_CreateSurface((IDirect3DDevice8 *)This, width, height,
|
||||
format, lockable, FALSE /* Discard */, level, (IDirect3DSurface8 **)&d3d_surface,
|
||||
D3DRTYPE_SURFACE, usage, pool, D3DMULTISAMPLE_NONE, 0 /* MultisampleQuality */);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
ERR("(%p) CreateSurface failed, returning %#x\n", iface, hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
*surface = d3d_surface->wineD3DSurface;
|
||||
d3d_surface->container = superior;
|
||||
IUnknown_Release(d3d_surface->parentDevice);
|
||||
d3d_surface->parentDevice = NULL;
|
||||
d3d_surface->forwardReference = superior;
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
struct IDirect3DDevice8Impl *This = device_from_device_parent(iface);
|
||||
IDirect3DSurface8Impl *d3d_surface;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, superior %p, width %u, height %u, format %#x, multisample_type %#x,\n"
|
||||
"\tmultisample_quality %u, lockable %u, surface %p\n",
|
||||
iface, superior, width, height, format, multisample_type, multisample_quality, lockable, surface);
|
||||
|
||||
hr = IDirect3DDevice8_CreateRenderTarget((IDirect3DDevice8 *)This, width, height, format,
|
||||
multisample_type, lockable, (IDirect3DSurface8 **)&d3d_surface);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
ERR("(%p) CreateRenderTarget failed, returning %#x\n", iface, hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
*surface = d3d_surface->wineD3DSurface;
|
||||
d3d_surface->container = (IUnknown *)This;
|
||||
d3d_surface->isImplicit = TRUE;
|
||||
/* Implicit surfaces are created with an refcount of 0 */
|
||||
IUnknown_Release((IUnknown *)d3d_surface);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
struct IDirect3DDevice8Impl *This = device_from_device_parent(iface);
|
||||
IDirect3DSurface8Impl *d3d_surface;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, superior %p, width %u, height %u, format %#x, multisample_type %#x,\n"
|
||||
"\tmultisample_quality %u, discard %u, surface %p\n",
|
||||
iface, superior, width, height, format, multisample_type, multisample_quality, discard, surface);
|
||||
|
||||
hr = IDirect3DDevice8_CreateDepthStencilSurface((IDirect3DDevice8 *)This, width, height, format,
|
||||
multisample_type, (IDirect3DSurface8 **)&d3d_surface);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
ERR("(%p) CreateDepthStencilSurface failed, returning %#x\n", iface, hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
*surface = d3d_surface->wineD3DSurface;
|
||||
d3d_surface->container = (IUnknown *)This;
|
||||
d3d_surface->isImplicit = TRUE;
|
||||
/* Implicit surfaces are created with an refcount of 0 */
|
||||
IUnknown_Release((IUnknown *)d3d_surface);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent *iface,
|
||||
IUnknown *superior, UINT width, UINT height, UINT depth, WINED3DFORMAT format,
|
||||
WINED3DPOOL pool, DWORD usage, IWineD3DVolume **volume)
|
||||
{
|
||||
struct IDirect3DDevice8Impl *This = device_from_device_parent(iface);
|
||||
IDirect3DVolume8Impl *object;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, superior %p, width %u, height %u, depth %u, format %#x, pool %#x, usage %#x, volume %p\n",
|
||||
iface, superior, width, height, depth, format, pool, usage, volume);
|
||||
|
||||
/* Allocate the storage for the device */
|
||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
||||
if (!object)
|
||||
{
|
||||
FIXME("Allocation of memory failed\n");
|
||||
*volume = NULL;
|
||||
return D3DERR_OUTOFVIDEOMEMORY;
|
||||
}
|
||||
|
||||
object->lpVtbl = &Direct3DVolume8_Vtbl;
|
||||
object->ref = 1;
|
||||
hr = IWineD3DDevice_CreateVolume(This->WineD3DDevice, width, height, depth, usage,
|
||||
format, pool, &object->wineD3DVolume, NULL, (IUnknown *)object);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
ERR("(%p) CreateVolume failed, returning %#x\n", iface, hr);
|
||||
HeapFree(GetProcessHeap(), 0, object);
|
||||
*volume = NULL;
|
||||
return hr;
|
||||
}
|
||||
|
||||
*volume = object->wineD3DVolume;
|
||||
object->container = superior;
|
||||
object->forwardReference = superior;
|
||||
|
||||
TRACE("(%p) Created volume %p\n", iface, *volume);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDeviceParent *iface,
|
||||
WINED3DPRESENT_PARAMETERS *present_parameters, IWineD3DSwapChain **swapchain)
|
||||
{
|
||||
struct IDirect3DDevice8Impl *This = device_from_device_parent(iface);
|
||||
IDirect3DSwapChain8Impl *d3d_swapchain;
|
||||
D3DPRESENT_PARAMETERS local_parameters;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, present_parameters %p, swapchain %p\n", iface, present_parameters, swapchain);
|
||||
|
||||
/* Copy the presentation parameters */
|
||||
local_parameters.BackBufferWidth = present_parameters->BackBufferWidth;
|
||||
local_parameters.BackBufferHeight = present_parameters->BackBufferHeight;
|
||||
local_parameters.BackBufferFormat = present_parameters->BackBufferFormat;
|
||||
local_parameters.BackBufferCount = present_parameters->BackBufferCount;
|
||||
local_parameters.MultiSampleType = present_parameters->MultiSampleType;
|
||||
local_parameters.SwapEffect = present_parameters->SwapEffect;
|
||||
local_parameters.hDeviceWindow = present_parameters->hDeviceWindow;
|
||||
local_parameters.Windowed = present_parameters->Windowed;
|
||||
local_parameters.EnableAutoDepthStencil = present_parameters->EnableAutoDepthStencil;
|
||||
local_parameters.AutoDepthStencilFormat = present_parameters->AutoDepthStencilFormat;
|
||||
local_parameters.Flags = present_parameters->Flags;
|
||||
local_parameters.FullScreen_RefreshRateInHz = present_parameters->FullScreen_RefreshRateInHz;
|
||||
local_parameters.FullScreen_PresentationInterval = present_parameters->PresentationInterval;
|
||||
|
||||
hr = IDirect3DDevice8_CreateAdditionalSwapChain((IDirect3DDevice8 *)This,
|
||||
&local_parameters, (IDirect3DSwapChain8 **)&d3d_swapchain);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
ERR("(%p) CreateAdditionalSwapChain failed, returning %#x\n", iface, hr);
|
||||
*swapchain = NULL;
|
||||
return hr;
|
||||
}
|
||||
|
||||
*swapchain = d3d_swapchain->wineD3DSwapChain;
|
||||
IUnknown_Release(d3d_swapchain->parentDevice);
|
||||
d3d_swapchain->parentDevice = NULL;
|
||||
|
||||
/* Copy back the presentation parameters */
|
||||
present_parameters->BackBufferWidth = local_parameters.BackBufferWidth;
|
||||
present_parameters->BackBufferHeight = local_parameters.BackBufferHeight;
|
||||
present_parameters->BackBufferFormat = local_parameters.BackBufferFormat;
|
||||
present_parameters->BackBufferCount = local_parameters.BackBufferCount;
|
||||
present_parameters->MultiSampleType = local_parameters.MultiSampleType;
|
||||
present_parameters->SwapEffect = local_parameters.SwapEffect;
|
||||
present_parameters->hDeviceWindow = local_parameters.hDeviceWindow;
|
||||
present_parameters->Windowed = local_parameters.Windowed;
|
||||
present_parameters->EnableAutoDepthStencil = local_parameters.EnableAutoDepthStencil;
|
||||
present_parameters->AutoDepthStencilFormat = local_parameters.AutoDepthStencilFormat;
|
||||
present_parameters->Flags = local_parameters.Flags;
|
||||
present_parameters->FullScreen_RefreshRateInHz = local_parameters.FullScreen_RefreshRateInHz;
|
||||
present_parameters->PresentationInterval = local_parameters.FullScreen_PresentationInterval;
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
const IWineD3DDeviceParentVtbl d3d8_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,
|
||||
};
|
||||
|
@ -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 */
|
||||
|
@ -59,6 +59,13 @@ static HRESULT WINAPI IDirect3DDevice9Impl_QueryInterface(LPDIRECT3DDEVICE9EX if
|
||||
}
|
||||
}
|
||||
|
||||
if (IsEqualGUID(riid, &IID_IWineD3DDeviceParent))
|
||||
{
|
||||
IUnknown_AddRef((IUnknown *)&This->device_parent_vtbl);
|
||||
*ppobj = &This->device_parent_vtbl;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
|
||||
*ppobj = NULL;
|
||||
return E_NOINTERFACE;
|
||||
@ -1748,37 +1755,6 @@ const IDirect3DDevice9ExVtbl Direct3DDevice9_Vtbl =
|
||||
IDirect3DDevice9ExImpl_GetDisplayModeEx
|
||||
};
|
||||
|
||||
|
||||
/* Internal function called back during the CreateDevice to create a render target */
|
||||
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) {
|
||||
|
||||
HRESULT res = D3D_OK;
|
||||
IDirect3DSurface9Impl *d3dSurface = NULL;
|
||||
BOOL Lockable = TRUE;
|
||||
|
||||
if((Pool == D3DPOOL_DEFAULT && Usage != D3DUSAGE_DYNAMIC))
|
||||
Lockable = FALSE;
|
||||
|
||||
TRACE("relay\n");
|
||||
res = IDirect3DDevice9Impl_CreateSurface((IDirect3DDevice9Ex *)device, Width, Height, (D3DFORMAT)Format,
|
||||
Lockable, FALSE/*Discard*/, Level, (IDirect3DSurface9 **)&d3dSurface, D3DRTYPE_SURFACE,
|
||||
Usage, (D3DPOOL) Pool, D3DMULTISAMPLE_NONE, 0 /* MultisampleQuality */, pSharedHandle);
|
||||
|
||||
if (SUCCEEDED(res)) {
|
||||
*ppSurface = d3dSurface->wineD3DSurface;
|
||||
d3dSurface->container = pSuperior;
|
||||
IDirect3DDevice9Ex_Release(d3dSurface->parentDevice);
|
||||
d3dSurface->parentDevice = NULL;
|
||||
d3dSurface->forwardReference = pSuperior;
|
||||
} else {
|
||||
FIXME("(%p) IDirect3DDevice9_CreateSurface failed\n", device);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
ULONG WINAPI D3D9CB_DestroySurface(IWineD3DSurface *pSurface) {
|
||||
IDirect3DSurface9Impl* surfaceParent;
|
||||
TRACE("(%p) call back\n", pSurface);
|
||||
@ -1789,3 +1765,236 @@ ULONG WINAPI D3D9CB_DestroySurface(IWineD3DSurface *pSurface) {
|
||||
surfaceParent->forwardReference = NULL;
|
||||
return IDirect3DSurface9_Release((IDirect3DSurface9*) surfaceParent);
|
||||
}
|
||||
|
||||
/* IWineD3DDeviceParent IUnknown methods */
|
||||
|
||||
static inline struct IDirect3DDevice9Impl *device_from_device_parent(IWineD3DDeviceParent *iface)
|
||||
{
|
||||
return (struct IDirect3DDevice9Impl *)((char*)iface
|
||||
- FIELD_OFFSET(struct IDirect3DDevice9Impl, device_parent_vtbl));
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE device_parent_QueryInterface(IWineD3DDeviceParent *iface, REFIID riid, void **object)
|
||||
{
|
||||
struct IDirect3DDevice9Impl *This = device_from_device_parent(iface);
|
||||
return IDirect3DDevice9Impl_QueryInterface((IDirect3DDevice9Ex *)This, riid, object);
|
||||
}
|
||||
|
||||
static ULONG STDMETHODCALLTYPE device_parent_AddRef(IWineD3DDeviceParent *iface)
|
||||
{
|
||||
struct IDirect3DDevice9Impl *This = device_from_device_parent(iface);
|
||||
return IDirect3DDevice9Impl_AddRef((IDirect3DDevice9Ex *)This);
|
||||
}
|
||||
|
||||
static ULONG STDMETHODCALLTYPE device_parent_Release(IWineD3DDeviceParent *iface)
|
||||
{
|
||||
struct IDirect3DDevice9Impl *This = device_from_device_parent(iface);
|
||||
return IDirect3DDevice9Impl_Release((IDirect3DDevice9Ex *)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)
|
||||
{
|
||||
struct IDirect3DDevice9Impl *This = device_from_device_parent(iface);
|
||||
IDirect3DSurface9Impl *d3d_surface;
|
||||
BOOL lockable = TRUE;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, superior %p, width %u, height %u, format %#x, usage %#x,\n"
|
||||
"\tpool %#x, level %u, face %u, surface %p\n",
|
||||
iface, superior, width, height, format, usage, pool, level, face, surface);
|
||||
|
||||
if (pool == D3DPOOL_DEFAULT && usage != D3DUSAGE_DYNAMIC) lockable = FALSE;
|
||||
|
||||
hr = IDirect3DDevice9Impl_CreateSurface((IDirect3DDevice9Ex *)This, width, height,
|
||||
format, lockable, FALSE /* Discard */, level, (IDirect3DSurface9 **)&d3d_surface,
|
||||
D3DRTYPE_SURFACE, usage, pool, D3DMULTISAMPLE_NONE, 0 /* MultisampleQuality */, NULL);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
ERR("(%p) CreateSurface failed, returning %#x\n", iface, hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
*surface = d3d_surface->wineD3DSurface;
|
||||
d3d_surface->container = superior;
|
||||
IDirect3DDevice9Ex_Release(d3d_surface->parentDevice);
|
||||
d3d_surface->parentDevice = NULL;
|
||||
d3d_surface->forwardReference = superior;
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
struct IDirect3DDevice9Impl *This = device_from_device_parent(iface);
|
||||
IDirect3DSurface9Impl *d3d_surface;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, superior %p, width %u, height %u, format %#x, multisample_type %#x,\n"
|
||||
"\tmultisample_quality %u, lockable %u, surface %p\n",
|
||||
iface, superior, width, height, format, multisample_type, multisample_quality, lockable, surface);
|
||||
|
||||
hr = IDirect3DDevice9Impl_CreateRenderTarget((IDirect3DDevice9Ex *)This, width, height, format,
|
||||
multisample_type, multisample_quality, lockable, (IDirect3DSurface9 **)&d3d_surface, NULL);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
ERR("(%p) CreateRenderTarget failed, returning %#x\n", iface, hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
*surface = d3d_surface->wineD3DSurface;
|
||||
d3d_surface->container = superior;
|
||||
d3d_surface->isImplicit = TRUE;
|
||||
/* Implicit surfaces are created with an refcount of 0 */
|
||||
IDirect3DSurface9_Release((IDirect3DSurface9 *)d3d_surface);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
struct IDirect3DDevice9Impl *This = device_from_device_parent(iface);
|
||||
IDirect3DSurface9Impl *d3d_surface;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, superior %p, width %u, height %u, format %#x, multisample_type %#x,\n"
|
||||
"\tmultisample_quality %u, discard %u, surface %p\n",
|
||||
iface, superior, width, height, format, multisample_type, multisample_quality, discard, surface);
|
||||
|
||||
hr = IDirect3DDevice9Impl_CreateDepthStencilSurface((IDirect3DDevice9Ex *)This, width, height, format,
|
||||
multisample_type, multisample_quality, discard, (IDirect3DSurface9 **)&d3d_surface, NULL);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
ERR("(%p) CreateDepthStencilSurface failed, returning %#x\n", iface, hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
*surface = d3d_surface->wineD3DSurface;
|
||||
d3d_surface->container = (IUnknown *)This;
|
||||
d3d_surface->isImplicit = TRUE;
|
||||
/* Implicit surfaces are created with an refcount of 0 */
|
||||
IDirect3DSurface9_Release((IDirect3DSurface9 *)d3d_surface);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent *iface,
|
||||
IUnknown *superior, UINT width, UINT height, UINT depth, WINED3DFORMAT format,
|
||||
WINED3DPOOL pool, DWORD usage, IWineD3DVolume **volume)
|
||||
{
|
||||
struct IDirect3DDevice9Impl *This = device_from_device_parent(iface);
|
||||
IDirect3DVolume9Impl *object;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, superior %p, width %u, height %u, depth %u, format %#x, pool %#x, usage %#x, volume %p\n",
|
||||
iface, superior, width, height, depth, format, pool, usage, volume);
|
||||
|
||||
/* Allocate the storage for the device */
|
||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
||||
if (!object)
|
||||
{
|
||||
FIXME("Allocation of memory failed\n");
|
||||
*volume = NULL;
|
||||
return D3DERR_OUTOFVIDEOMEMORY;
|
||||
}
|
||||
|
||||
object->lpVtbl = &Direct3DVolume9_Vtbl;
|
||||
object->ref = 1;
|
||||
hr = IWineD3DDevice_CreateVolume(This->WineD3DDevice, width, height, depth, usage & WINED3DUSAGE_MASK,
|
||||
format, pool, &object->wineD3DVolume, NULL, (IUnknown *)object);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
ERR("(%p) CreateVolume failed, returning %#x\n", iface, hr);
|
||||
HeapFree(GetProcessHeap(), 0, object);
|
||||
*volume = NULL;
|
||||
return hr;
|
||||
}
|
||||
|
||||
*volume = object->wineD3DVolume;
|
||||
object->container = superior;
|
||||
object->forwardReference = superior;
|
||||
|
||||
TRACE("(%p) Created volume %p\n", iface, *volume);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDeviceParent *iface,
|
||||
WINED3DPRESENT_PARAMETERS *present_parameters, IWineD3DSwapChain **swapchain)
|
||||
{
|
||||
struct IDirect3DDevice9Impl *This = device_from_device_parent(iface);
|
||||
IDirect3DSwapChain9Impl *d3d_swapchain;
|
||||
D3DPRESENT_PARAMETERS local_parameters;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, present_parameters %p, swapchain %p\n", iface, present_parameters, swapchain);
|
||||
|
||||
/* Copy the presentation parameters */
|
||||
local_parameters.BackBufferWidth = present_parameters->BackBufferWidth;
|
||||
local_parameters.BackBufferHeight = present_parameters->BackBufferHeight;
|
||||
local_parameters.BackBufferFormat = present_parameters->BackBufferFormat;
|
||||
local_parameters.BackBufferCount = present_parameters->BackBufferCount;
|
||||
local_parameters.MultiSampleType = present_parameters->MultiSampleType;
|
||||
local_parameters.MultiSampleQuality = present_parameters->MultiSampleQuality;
|
||||
local_parameters.SwapEffect = present_parameters->SwapEffect;
|
||||
local_parameters.hDeviceWindow = present_parameters->hDeviceWindow;
|
||||
local_parameters.Windowed = present_parameters->Windowed;
|
||||
local_parameters.EnableAutoDepthStencil = present_parameters->EnableAutoDepthStencil;
|
||||
local_parameters.AutoDepthStencilFormat = present_parameters->AutoDepthStencilFormat;
|
||||
local_parameters.Flags = present_parameters->Flags;
|
||||
local_parameters.FullScreen_RefreshRateInHz = present_parameters->FullScreen_RefreshRateInHz;
|
||||
local_parameters.PresentationInterval = present_parameters->PresentationInterval;
|
||||
|
||||
hr = IDirect3DDevice9Impl_CreateAdditionalSwapChain((IDirect3DDevice9Ex *)This,
|
||||
&local_parameters, (IDirect3DSwapChain9 **)&d3d_swapchain);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
ERR("(%p) CreateAdditionalSwapChain failed, returning %#x\n", iface, hr);
|
||||
*swapchain = NULL;
|
||||
return hr;
|
||||
}
|
||||
|
||||
*swapchain = d3d_swapchain->wineD3DSwapChain;
|
||||
d3d_swapchain->isImplicit = TRUE;
|
||||
/* Implicit swap chains are created with an refcount of 0 */
|
||||
IDirect3DSwapChain9_Release((IDirect3DSwapChain9 *)d3d_swapchain);
|
||||
|
||||
/* Copy back the presentation parameters */
|
||||
present_parameters->BackBufferWidth = local_parameters.BackBufferWidth;
|
||||
present_parameters->BackBufferHeight = local_parameters.BackBufferHeight;
|
||||
present_parameters->BackBufferFormat = local_parameters.BackBufferFormat;
|
||||
present_parameters->BackBufferCount = local_parameters.BackBufferCount;
|
||||
present_parameters->MultiSampleType = local_parameters.MultiSampleType;
|
||||
present_parameters->MultiSampleQuality = local_parameters.MultiSampleQuality;
|
||||
present_parameters->SwapEffect = local_parameters.SwapEffect;
|
||||
present_parameters->hDeviceWindow = local_parameters.hDeviceWindow;
|
||||
present_parameters->Windowed = local_parameters.Windowed;
|
||||
present_parameters->EnableAutoDepthStencil = local_parameters.EnableAutoDepthStencil;
|
||||
present_parameters->AutoDepthStencilFormat = local_parameters.AutoDepthStencilFormat;
|
||||
present_parameters->Flags = local_parameters.Flags;
|
||||
present_parameters->FullScreen_RefreshRateInHz = local_parameters.FullScreen_RefreshRateInHz;
|
||||
present_parameters->PresentationInterval = local_parameters.PresentationInterval;
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
const IWineD3DDeviceParentVtbl d3d9_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,
|
||||
};
|
||||
|
@ -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 */
|
||||
|
@ -195,6 +195,10 @@ IDirectDrawImpl_QueryInterface(IDirectDraw7 *iface,
|
||||
TRACE(" returning Direct3D7 interface at %p.\n", *obj);
|
||||
}
|
||||
}
|
||||
else if (IsEqualGUID(refiid, &IID_IWineD3DDeviceParent))
|
||||
{
|
||||
*obj = &This->device_parent_vtbl;
|
||||
}
|
||||
|
||||
/* Unknown interface */
|
||||
else
|
||||
@ -1820,100 +1824,6 @@ IDirectDrawImpl_RecreateAllSurfaces(IDirectDrawImpl *This)
|
||||
IDirectDrawImpl_RecreateSurfacesCallback);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* D3D7CB_CreateSurface
|
||||
*
|
||||
* Callback function for IDirect3DDevice_CreateTexture. It searches for the
|
||||
* correct mipmap sublevel, and returns it to WineD3D.
|
||||
* The surfaces are created already by IDirectDraw7::CreateSurface
|
||||
*
|
||||
* Params:
|
||||
* With, Height: With and height of the surface
|
||||
* Format: The requested format
|
||||
* Usage, Pool: D3DUSAGE and D3DPOOL of the surface
|
||||
* level: The mipmap level
|
||||
* Face: The cube map face type
|
||||
* Surface: Pointer to pass the created surface back at
|
||||
* SharedHandle: NULL
|
||||
*
|
||||
* Returns:
|
||||
* D3D_OK
|
||||
*
|
||||
*****************************************************************************/
|
||||
static HRESULT WINAPI
|
||||
D3D7CB_CreateSurface(IUnknown *device,
|
||||
IUnknown *pSuperior,
|
||||
UINT Width, UINT Height,
|
||||
WINED3DFORMAT Format,
|
||||
DWORD Usage, WINED3DPOOL Pool, UINT level,
|
||||
WINED3DCUBEMAP_FACES Face,
|
||||
IWineD3DSurface **Surface,
|
||||
HANDLE *SharedHandle)
|
||||
{
|
||||
ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw7, device);
|
||||
IDirectDrawSurfaceImpl *surf = NULL;
|
||||
UINT i = 0;
|
||||
DDSCAPS2 searchcaps = This->tex_root->surface_desc.ddsCaps;
|
||||
TRACE("(%p) call back. surf=%p. Face %d level %d\n", device, This->tex_root, Face, level);
|
||||
|
||||
searchcaps.dwCaps2 &= ~DDSCAPS2_CUBEMAP_ALLFACES;
|
||||
switch(Face)
|
||||
{
|
||||
case WINED3DCUBEMAP_FACE_POSITIVE_X:
|
||||
TRACE("Asked for positive x\n");
|
||||
if(searchcaps.dwCaps2 & DDSCAPS2_CUBEMAP) {
|
||||
searchcaps.dwCaps2 |= DDSCAPS2_CUBEMAP_POSITIVEX;
|
||||
}
|
||||
surf = This->tex_root; break;
|
||||
case WINED3DCUBEMAP_FACE_NEGATIVE_X:
|
||||
TRACE("Asked for negative x\n");
|
||||
searchcaps.dwCaps2 |= DDSCAPS2_CUBEMAP_NEGATIVEX; break;
|
||||
case WINED3DCUBEMAP_FACE_POSITIVE_Y:
|
||||
TRACE("Asked for positive y\n");
|
||||
searchcaps.dwCaps2 |= DDSCAPS2_CUBEMAP_POSITIVEY; break;
|
||||
case WINED3DCUBEMAP_FACE_NEGATIVE_Y:
|
||||
TRACE("Asked for negative y\n");
|
||||
searchcaps.dwCaps2 |= DDSCAPS2_CUBEMAP_NEGATIVEY; break;
|
||||
case WINED3DCUBEMAP_FACE_POSITIVE_Z:
|
||||
TRACE("Asked for positive z\n");
|
||||
searchcaps.dwCaps2 |= DDSCAPS2_CUBEMAP_POSITIVEZ; break;
|
||||
case WINED3DCUBEMAP_FACE_NEGATIVE_Z:
|
||||
TRACE("Asked for negative z\n");
|
||||
searchcaps.dwCaps2 |= DDSCAPS2_CUBEMAP_NEGATIVEZ; break;
|
||||
default: {ERR("Unexpected cube face\n");} /* Stupid compiler */
|
||||
}
|
||||
|
||||
if(!surf)
|
||||
{
|
||||
IDirectDrawSurface7 *attached;
|
||||
IDirectDrawSurface7_GetAttachedSurface(ICOM_INTERFACE(This->tex_root, IDirectDrawSurface7),
|
||||
&searchcaps,
|
||||
&attached);
|
||||
surf = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, attached);
|
||||
IDirectDrawSurface7_Release(attached);
|
||||
}
|
||||
if(!surf) ERR("root search surface not found\n");
|
||||
|
||||
/* Find the wanted mipmap. There are enough mipmaps in the chain */
|
||||
while(i < level)
|
||||
{
|
||||
IDirectDrawSurface7 *attached;
|
||||
IDirectDrawSurface7_GetAttachedSurface(ICOM_INTERFACE(surf, IDirectDrawSurface7),
|
||||
&searchcaps,
|
||||
&attached);
|
||||
if(!attached) ERR("Surface not found\n");
|
||||
surf = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, attached);
|
||||
IDirectDrawSurface7_Release(attached);
|
||||
i++;
|
||||
}
|
||||
|
||||
/* Return the surface */
|
||||
*Surface = surf->WineD3DSurface;
|
||||
|
||||
TRACE("Returning wineD3DSurface %p, it belongs to surface %p\n", *Surface, surf);
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
ULONG WINAPI D3D7CB_DestroySwapChain(IWineD3DSwapChain *pSwapChain) {
|
||||
IUnknown* swapChainParent;
|
||||
TRACE("(%p) call back\n", pSwapChain);
|
||||
@ -2827,29 +2737,15 @@ IDirectDrawImpl_CreateSurface(IDirectDraw7 *iface,
|
||||
*/
|
||||
if(desc2.ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP)
|
||||
{
|
||||
hr = IWineD3DDevice_CreateCubeTexture(This->wineD3DDevice,
|
||||
DDSD->dwWidth, /* Edgelength */
|
||||
levels,
|
||||
0, /* usage */
|
||||
Format,
|
||||
Pool,
|
||||
(IWineD3DCubeTexture **) &object->wineD3DTexture,
|
||||
0, /* SharedHandle */
|
||||
(IUnknown *) ICOM_INTERFACE(object, IDirectDrawSurface7),
|
||||
D3D7CB_CreateSurface);
|
||||
hr = IWineD3DDevice_CreateCubeTexture(This->wineD3DDevice, DDSD->dwWidth /* Edgelength */,
|
||||
levels, 0 /* usage */, Format, Pool, (IWineD3DCubeTexture **)&object->wineD3DTexture,
|
||||
0 /* SharedHandle */, (IUnknown *)ICOM_INTERFACE(object, IDirectDrawSurface7));
|
||||
}
|
||||
else
|
||||
{
|
||||
hr = IWineD3DDevice_CreateTexture(This->wineD3DDevice,
|
||||
DDSD->dwWidth, DDSD->dwHeight,
|
||||
levels, /* MipMapCount = Levels */
|
||||
0, /* usage */
|
||||
Format,
|
||||
Pool,
|
||||
(IWineD3DTexture **) &object->wineD3DTexture,
|
||||
0, /* SharedHandle */
|
||||
(IUnknown *) ICOM_INTERFACE(object, IDirectDrawSurface7),
|
||||
D3D7CB_CreateSurface );
|
||||
hr = IWineD3DDevice_CreateTexture(This->wineD3DDevice, DDSD->dwWidth, DDSD->dwHeight, levels,
|
||||
0 /* usage */, Format, Pool, (IWineD3DTexture **) &object->wineD3DTexture,
|
||||
0 /* SharedHandle */, (IUnknown *)ICOM_INTERFACE(object, IDirectDrawSurface7));
|
||||
}
|
||||
This->tex_root = NULL;
|
||||
}
|
||||
@ -3063,177 +2959,6 @@ findRenderTarget(IDirectDrawSurface7 *surface,
|
||||
else return DDENUMRET_OK; /* Continue with the next neighbor surface */
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* D3D7CB_CreateRenderTarget
|
||||
*
|
||||
* Callback called by WineD3D to create Surfaces for render target usage
|
||||
* This function takes the D3D target from the IDirectDrawImpl structure,
|
||||
* and returns the WineD3DSurface. To avoid double usage, the surface
|
||||
* is marked as render target afterwards
|
||||
*
|
||||
* Params
|
||||
* device: The WineD3DDevice's parent
|
||||
* Width, Height, Format: Dimensions and pixelformat of the render target
|
||||
* Ignored, because the surface already exists
|
||||
* MultiSample, MultisampleQuality, Lockable: Ignored for the same reason
|
||||
* Lockable: ignored
|
||||
* ppSurface: Address to pass the surface pointer back at
|
||||
* pSharedHandle: Ignored
|
||||
*
|
||||
* Returns:
|
||||
* Always returns D3D_OK
|
||||
*
|
||||
*****************************************************************************/
|
||||
static HRESULT WINAPI
|
||||
D3D7CB_CreateRenderTarget(IUnknown *device, IUnknown *pSuperior,
|
||||
UINT Width, UINT Height,
|
||||
WINED3DFORMAT Format,
|
||||
WINED3DMULTISAMPLE_TYPE MultiSample,
|
||||
DWORD MultisampleQuality,
|
||||
BOOL Lockable,
|
||||
IWineD3DSurface** ppSurface,
|
||||
HANDLE* pSharedHandle)
|
||||
{
|
||||
ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw7, device);
|
||||
IDirectDrawSurfaceImpl *d3dSurface = This->d3d_target, *target = NULL;
|
||||
TRACE("(%p) call back\n", device);
|
||||
|
||||
if(d3dSurface->isRenderTarget)
|
||||
{
|
||||
IDirectDrawSurface7_EnumAttachedSurfaces(ICOM_INTERFACE(d3dSurface, IDirectDrawSurface7),
|
||||
&target, findRenderTarget);
|
||||
}
|
||||
else
|
||||
{
|
||||
target = d3dSurface;
|
||||
}
|
||||
|
||||
if(!target)
|
||||
{
|
||||
target = This->d3d_target;
|
||||
ERR(" (%p) : No DirectDrawSurface found to create the back buffer. Using the front buffer as back buffer. Uncertain consequences\n", This);
|
||||
}
|
||||
|
||||
/* TODO: Return failure if the dimensions do not match, but this shouldn't happen */
|
||||
|
||||
*ppSurface = target->WineD3DSurface;
|
||||
target->isRenderTarget = TRUE;
|
||||
TRACE("Returning wineD3DSurface %p, it belongs to surface %p\n", *ppSurface, d3dSurface);
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI
|
||||
D3D7CB_CreateDepthStencilSurface(IUnknown *device,
|
||||
IUnknown *pSuperior,
|
||||
UINT Width,
|
||||
UINT Height,
|
||||
WINED3DFORMAT Format,
|
||||
WINED3DMULTISAMPLE_TYPE MultiSample,
|
||||
DWORD MultisampleQuality,
|
||||
BOOL Discard,
|
||||
IWineD3DSurface** ppSurface,
|
||||
HANDLE* pSharedHandle)
|
||||
{
|
||||
/* Create a Depth Stencil surface to make WineD3D happy */
|
||||
HRESULT hr = D3D_OK;
|
||||
ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw7, device);
|
||||
DDSURFACEDESC2 ddsd;
|
||||
|
||||
TRACE("(%p) call back\n", device);
|
||||
|
||||
*ppSurface = NULL;
|
||||
|
||||
/* Create a DirectDraw surface */
|
||||
memset(&ddsd, 0, sizeof(ddsd));
|
||||
ddsd.dwSize = sizeof(ddsd);
|
||||
ddsd.u4.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT);
|
||||
ddsd.dwFlags = DDSD_PIXELFORMAT | DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS;
|
||||
ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
|
||||
ddsd.dwHeight = Height;
|
||||
ddsd.dwWidth = Width;
|
||||
if(Format != 0)
|
||||
{
|
||||
PixelFormat_WineD3DtoDD(&ddsd.u4.ddpfPixelFormat, Format);
|
||||
}
|
||||
else
|
||||
{
|
||||
ddsd.dwFlags ^= DDSD_PIXELFORMAT;
|
||||
}
|
||||
|
||||
This->depthstencil = TRUE;
|
||||
hr = IDirectDraw7_CreateSurface((IDirectDraw7 *) This,
|
||||
&ddsd,
|
||||
(IDirectDrawSurface7 **) &This->DepthStencilBuffer,
|
||||
NULL);
|
||||
This->depthstencil = FALSE;
|
||||
if(FAILED(hr))
|
||||
{
|
||||
ERR(" (%p) Creating a DepthStencil Surface failed, result = %x\n", This, hr);
|
||||
return hr;
|
||||
}
|
||||
*ppSurface = This->DepthStencilBuffer->WineD3DSurface;
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* D3D7CB_CreateAdditionalSwapChain
|
||||
*
|
||||
* Callback function for WineD3D which creates a new WineD3DSwapchain
|
||||
* interface. It also creates an IParent interface to store that pointer,
|
||||
* so the WineD3DSwapchain has a parent and can be released when the D3D
|
||||
* device is destroyed
|
||||
*****************************************************************************/
|
||||
static HRESULT WINAPI
|
||||
D3D7CB_CreateAdditionalSwapChain(IUnknown *device,
|
||||
WINED3DPRESENT_PARAMETERS* pPresentationParameters,
|
||||
IWineD3DSwapChain ** ppSwapChain)
|
||||
{
|
||||
ICOM_THIS_FROM(IDirectDrawImpl, IDirectDraw7, device);
|
||||
IParentImpl *object = NULL;
|
||||
HRESULT res = D3D_OK;
|
||||
IWineD3DSwapChain *swapchain;
|
||||
IDirectDrawSurfaceImpl *iterator;
|
||||
TRACE("(%p) call back\n", device);
|
||||
|
||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IParentImpl));
|
||||
if (NULL == object)
|
||||
{
|
||||
FIXME("Allocation of memory failed\n");
|
||||
*ppSwapChain = NULL;
|
||||
return DDERR_OUTOFVIDEOMEMORY;
|
||||
}
|
||||
|
||||
ICOM_INIT_INTERFACE(object, IParent, IParent_Vtbl);
|
||||
object->ref = 1;
|
||||
|
||||
res = IWineD3DDevice_CreateSwapChain(This->wineD3DDevice,
|
||||
pPresentationParameters,
|
||||
&swapchain,
|
||||
(IUnknown*) ICOM_INTERFACE(object, IParent),
|
||||
D3D7CB_CreateRenderTarget,
|
||||
D3D7CB_CreateDepthStencilSurface,
|
||||
This->ImplType);
|
||||
if (res != D3D_OK)
|
||||
{
|
||||
FIXME("(%p) call to IWineD3DDevice_CreateSwapChain failed\n", This);
|
||||
HeapFree(GetProcessHeap(), 0 , object);
|
||||
*ppSwapChain = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
*ppSwapChain = swapchain;
|
||||
object->child = (IUnknown *) swapchain;
|
||||
This->d3d_target->wineD3DSwapChain = swapchain;
|
||||
iterator = This->d3d_target->complex_array[0];
|
||||
while(iterator) {
|
||||
iterator->wineD3DSwapChain = swapchain;
|
||||
iterator = iterator->complex_array[0];
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static HRESULT IDirectDrawImpl_CreateGDISwapChain(IDirectDrawImpl *This,
|
||||
IDirectDrawSurfaceImpl *primary) {
|
||||
HRESULT hr;
|
||||
@ -3263,9 +2988,7 @@ static HRESULT IDirectDrawImpl_CreateGDISwapChain(IDirectDrawImpl *This,
|
||||
presentation_parameters.PresentationInterval = WINED3DPRESENT_INTERVAL_DEFAULT;
|
||||
|
||||
This->d3d_target = primary;
|
||||
hr = IWineD3DDevice_InitGDI(This->wineD3DDevice,
|
||||
&presentation_parameters,
|
||||
D3D7CB_CreateAdditionalSwapChain);
|
||||
hr = IWineD3DDevice_InitGDI(This->wineD3DDevice, &presentation_parameters);
|
||||
This->d3d_target = NULL;
|
||||
|
||||
if (hr != D3D_OK)
|
||||
@ -3346,9 +3069,7 @@ IDirectDrawImpl_AttachD3DDevice(IDirectDrawImpl *This,
|
||||
*/
|
||||
This->d3d_initialized = TRUE;
|
||||
|
||||
hr = IWineD3DDevice_Init3D(This->wineD3DDevice,
|
||||
&localParameters,
|
||||
D3D7CB_CreateAdditionalSwapChain);
|
||||
hr = IWineD3DDevice_Init3D(This->wineD3DDevice, &localParameters);
|
||||
if(FAILED(hr))
|
||||
{
|
||||
This->d3d_target = NULL;
|
||||
@ -3674,3 +3395,254 @@ IDirectDrawImpl_FindDecl(IDirectDrawImpl *This,
|
||||
TRACE("Returning %p. %d decls in array\n", pDecl, This->numConvertedDecls);
|
||||
return pDecl;
|
||||
}
|
||||
|
||||
/* IWineD3DDeviceParent IUnknown methods */
|
||||
|
||||
static inline struct IDirectDrawImpl *ddraw_from_device_parent(IWineD3DDeviceParent *iface)
|
||||
{
|
||||
return (struct IDirectDrawImpl *)((char*)iface - FIELD_OFFSET(struct IDirectDrawImpl, device_parent_vtbl));
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE device_parent_QueryInterface(IWineD3DDeviceParent *iface, REFIID riid, void **object)
|
||||
{
|
||||
struct IDirectDrawImpl *This = ddraw_from_device_parent(iface);
|
||||
return IDirectDrawImpl_QueryInterface((IDirectDraw7 *)This, riid, object);
|
||||
}
|
||||
|
||||
ULONG STDMETHODCALLTYPE device_parent_AddRef(IWineD3DDeviceParent *iface)
|
||||
{
|
||||
struct IDirectDrawImpl *This = ddraw_from_device_parent(iface);
|
||||
return IDirectDrawImpl_AddRef((IDirectDraw7 *)This);
|
||||
}
|
||||
|
||||
ULONG STDMETHODCALLTYPE device_parent_Release(IWineD3DDeviceParent *iface)
|
||||
{
|
||||
struct IDirectDrawImpl *This = ddraw_from_device_parent(iface);
|
||||
return IDirectDrawImpl_Release((IDirectDraw7 *)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)
|
||||
{
|
||||
struct IDirectDrawImpl *This = ddraw_from_device_parent(iface);
|
||||
IDirectDrawSurfaceImpl *surf = NULL;
|
||||
UINT i = 0;
|
||||
DDSCAPS2 searchcaps = This->tex_root->surface_desc.ddsCaps;
|
||||
|
||||
TRACE("iface %p, superior %p, width %u, height %u, format %#x, usage %#x,\n"
|
||||
"\tpool %#x, level %u, face %u, surface %p\n",
|
||||
iface, superior, width, height, format, usage, pool, level, face, surface);
|
||||
|
||||
searchcaps.dwCaps2 &= ~DDSCAPS2_CUBEMAP_ALLFACES;
|
||||
switch(face)
|
||||
{
|
||||
case WINED3DCUBEMAP_FACE_POSITIVE_X:
|
||||
TRACE("Asked for positive x\n");
|
||||
if (searchcaps.dwCaps2 & DDSCAPS2_CUBEMAP)
|
||||
{
|
||||
searchcaps.dwCaps2 |= DDSCAPS2_CUBEMAP_POSITIVEX;
|
||||
}
|
||||
surf = This->tex_root; break;
|
||||
case WINED3DCUBEMAP_FACE_NEGATIVE_X:
|
||||
TRACE("Asked for negative x\n");
|
||||
searchcaps.dwCaps2 |= DDSCAPS2_CUBEMAP_NEGATIVEX; break;
|
||||
case WINED3DCUBEMAP_FACE_POSITIVE_Y:
|
||||
TRACE("Asked for positive y\n");
|
||||
searchcaps.dwCaps2 |= DDSCAPS2_CUBEMAP_POSITIVEY; break;
|
||||
case WINED3DCUBEMAP_FACE_NEGATIVE_Y:
|
||||
TRACE("Asked for negative y\n");
|
||||
searchcaps.dwCaps2 |= DDSCAPS2_CUBEMAP_NEGATIVEY; break;
|
||||
case WINED3DCUBEMAP_FACE_POSITIVE_Z:
|
||||
TRACE("Asked for positive z\n");
|
||||
searchcaps.dwCaps2 |= DDSCAPS2_CUBEMAP_POSITIVEZ; break;
|
||||
case WINED3DCUBEMAP_FACE_NEGATIVE_Z:
|
||||
TRACE("Asked for negative z\n");
|
||||
searchcaps.dwCaps2 |= DDSCAPS2_CUBEMAP_NEGATIVEZ; break;
|
||||
default: {ERR("Unexpected cube face\n");} /* Stupid compiler */
|
||||
}
|
||||
|
||||
if (!surf)
|
||||
{
|
||||
IDirectDrawSurface7 *attached;
|
||||
IDirectDrawSurface7_GetAttachedSurface(ICOM_INTERFACE(This->tex_root, IDirectDrawSurface7),
|
||||
&searchcaps, &attached);
|
||||
surf = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, attached);
|
||||
IDirectDrawSurface7_Release(attached);
|
||||
}
|
||||
if (!surf) ERR("root search surface not found\n");
|
||||
|
||||
/* Find the wanted mipmap. There are enough mipmaps in the chain */
|
||||
while (i < level)
|
||||
{
|
||||
IDirectDrawSurface7 *attached;
|
||||
IDirectDrawSurface7_GetAttachedSurface(ICOM_INTERFACE(surf, IDirectDrawSurface7), &searchcaps, &attached);
|
||||
if(!attached) ERR("Surface not found\n");
|
||||
surf = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirectDrawSurface7, attached);
|
||||
IDirectDrawSurface7_Release(attached);
|
||||
++i;
|
||||
}
|
||||
|
||||
/* Return the surface */
|
||||
*surface = surf->WineD3DSurface;
|
||||
|
||||
TRACE("Returning wineD3DSurface %p, it belongs to surface %p\n", *surface, surf);
|
||||
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
struct IDirectDrawImpl *This = ddraw_from_device_parent(iface);
|
||||
IDirectDrawSurfaceImpl *d3d_surface = This->d3d_target;
|
||||
IDirectDrawSurfaceImpl *target = NULL;
|
||||
|
||||
TRACE("iface %p, superior %p, width %u, height %u, format %#x, multisample_type %#x,\n"
|
||||
"\tmultisample_quality %u, lockable %u, surface %p\n",
|
||||
iface, superior, width, height, format, multisample_type, multisample_quality, lockable, surface);
|
||||
|
||||
if (d3d_surface->isRenderTarget)
|
||||
{
|
||||
IDirectDrawSurface7_EnumAttachedSurfaces(ICOM_INTERFACE(d3d_surface, IDirectDrawSurface7),
|
||||
&target, findRenderTarget);
|
||||
}
|
||||
else
|
||||
{
|
||||
target = d3d_surface;
|
||||
}
|
||||
|
||||
if (!target)
|
||||
{
|
||||
target = This->d3d_target;
|
||||
ERR(" (%p) : No DirectDrawSurface found to create the back buffer. Using the front buffer as back buffer. Uncertain consequences\n", This);
|
||||
}
|
||||
|
||||
/* TODO: Return failure if the dimensions do not match, but this shouldn't happen */
|
||||
|
||||
*surface = target->WineD3DSurface;
|
||||
target->isRenderTarget = TRUE;
|
||||
|
||||
TRACE("Returning wineD3DSurface %p, it belongs to surface %p\n", *surface, d3d_surface);
|
||||
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
struct IDirectDrawImpl *This = ddraw_from_device_parent(iface);
|
||||
/* Create a Depth Stencil surface to make WineD3D happy */
|
||||
DDSURFACEDESC2 ddsd;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, superior %p, width %u, height %u, format %#x, multisample_type %#x,\n"
|
||||
"\tmultisample_quality %u, discard %u, surface %p\n",
|
||||
iface, superior, width, height, format, multisample_type, multisample_quality, discard, surface);
|
||||
|
||||
*surface = NULL;
|
||||
|
||||
/* Create a DirectDraw surface */
|
||||
memset(&ddsd, 0, sizeof(ddsd));
|
||||
ddsd.dwSize = sizeof(ddsd);
|
||||
ddsd.u4.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT);
|
||||
ddsd.dwFlags = DDSD_PIXELFORMAT | DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS;
|
||||
ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
|
||||
ddsd.dwHeight = height;
|
||||
ddsd.dwWidth = width;
|
||||
if (format)
|
||||
{
|
||||
PixelFormat_WineD3DtoDD(&ddsd.u4.ddpfPixelFormat, format);
|
||||
}
|
||||
else
|
||||
{
|
||||
ddsd.dwFlags ^= DDSD_PIXELFORMAT;
|
||||
}
|
||||
|
||||
This->depthstencil = TRUE;
|
||||
hr = IDirectDraw7_CreateSurface((IDirectDraw7 *)This,
|
||||
&ddsd, (IDirectDrawSurface7 **)&This->DepthStencilBuffer, NULL);
|
||||
This->depthstencil = FALSE;
|
||||
if(FAILED(hr))
|
||||
{
|
||||
ERR(" (%p) Creating a DepthStencil Surface failed, result = %x\n", This, hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
*surface = This->DepthStencilBuffer->WineD3DSurface;
|
||||
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent *iface,
|
||||
IUnknown *superior, UINT width, UINT height, UINT depth, WINED3DFORMAT format,
|
||||
WINED3DPOOL pool, DWORD usage, IWineD3DVolume **volume)
|
||||
{
|
||||
TRACE("iface %p, superior %p, width %u, height %u, depth %u, format %#x, pool %#x, usage %#x, volume %p\n",
|
||||
iface, superior, width, height, depth, format, pool, usage, volume);
|
||||
|
||||
ERR("Not implemented!\n");
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDeviceParent *iface,
|
||||
WINED3DPRESENT_PARAMETERS *present_parameters, IWineD3DSwapChain **swapchain)
|
||||
{
|
||||
struct IDirectDrawImpl *This = ddraw_from_device_parent(iface);
|
||||
IDirectDrawSurfaceImpl *iterator;
|
||||
IParentImpl *object;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, present_parameters %p, swapchain %p\n", iface, present_parameters, swapchain);
|
||||
|
||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IParentImpl));
|
||||
if (!object)
|
||||
{
|
||||
FIXME("Allocation of memory failed\n");
|
||||
*swapchain = NULL;
|
||||
return DDERR_OUTOFVIDEOMEMORY;
|
||||
}
|
||||
|
||||
ICOM_INIT_INTERFACE(object, IParent, IParent_Vtbl);
|
||||
object->ref = 1;
|
||||
|
||||
hr = IWineD3DDevice_CreateSwapChain(This->wineD3DDevice, present_parameters,
|
||||
swapchain, (IUnknown *)ICOM_INTERFACE(object, IParent), This->ImplType);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
FIXME("(%p) CreateSwapChain failed, returning %#x\n", iface, hr);
|
||||
HeapFree(GetProcessHeap(), 0 , object);
|
||||
*swapchain = NULL;
|
||||
return hr;
|
||||
}
|
||||
|
||||
object->child = (IUnknown *)*swapchain;
|
||||
This->d3d_target->wineD3DSwapChain = *swapchain;
|
||||
iterator = This->d3d_target->complex_array[0];
|
||||
while (iterator)
|
||||
{
|
||||
iterator->wineD3DSwapChain = *swapchain;
|
||||
iterator = iterator->complex_array[0];
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
const IWineD3DDeviceParentVtbl ddraw_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,
|
||||
};
|
||||
|
@ -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,10 +304,18 @@ HRESULT WINAPI DXGID3D10CreateDevice(HMODULE d3d10core, IDXGIFactory *factory, I
|
||||
adapter_ordinal = IWineDXGIAdapter_get_ordinal(wine_adapter);
|
||||
IWineDXGIAdapter_Release(wine_adapter);
|
||||
|
||||
hr = IUnknown_QueryInterface((IUnknown *)dxgi_device, &IID_IWineD3DDeviceParent, (void **)&wined3d_device_parent);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
ERR("DXGI device should implement IWineD3DDeviceParent\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
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);
|
||||
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))
|
||||
@ -305,16 +324,6 @@ HRESULT WINAPI DXGID3D10CreateDevice(HMODULE d3d10core, IDXGIFactory *factory, I
|
||||
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);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
WARN("Failed to create device, returning %#x\n", hr);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
*device = dxgi_device;
|
||||
|
||||
return hr;
|
||||
@ -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;
|
||||
|
@ -751,11 +751,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateSurface(IWineD3DDevice *iface, U
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IWineD3DDeviceImpl_CreateTexture(IWineD3DDevice *iface, UINT Width, UINT Height, UINT Levels,
|
||||
DWORD Usage, WINED3DFORMAT Format, WINED3DPOOL Pool,
|
||||
IWineD3DTexture** ppTexture, HANDLE* pSharedHandle, IUnknown *parent,
|
||||
D3DCB_CREATESURFACEFN D3DCB_CreateSurface) {
|
||||
|
||||
static HRESULT WINAPI IWineD3DDeviceImpl_CreateTexture(IWineD3DDevice *iface,
|
||||
UINT Width, UINT Height, UINT Levels, DWORD Usage, WINED3DFORMAT Format, WINED3DPOOL Pool,
|
||||
IWineD3DTexture **ppTexture, HANDLE *pSharedHandle, IUnknown *parent)
|
||||
{
|
||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||
IWineD3DTextureImpl *object;
|
||||
unsigned int i;
|
||||
@ -902,7 +901,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateTexture(IWineD3DDevice *iface, U
|
||||
for (i = 0; i < object->baseTexture.levels; i++)
|
||||
{
|
||||
/* use the callback to create the texture surface */
|
||||
hr = D3DCB_CreateSurface(This->parent, parent, tmpW, tmpH, Format, Usage, Pool, i, WINED3DCUBEMAP_FACE_POSITIVE_X, &object->surfaces[i],NULL);
|
||||
hr = IWineD3DDeviceParent_CreateSurface(This->device_parent, parent, tmpW, tmpH, Format,
|
||||
Usage, Pool, i, WINED3DCUBEMAP_FACE_POSITIVE_X, &object->surfaces[i]);
|
||||
if (hr!= WINED3D_OK || ( (IWineD3DSurfaceImpl *) object->surfaces[i])->Flags & SFLAG_OVERSIZE) {
|
||||
FIXME("Failed to create surface %p\n", object);
|
||||
/* clean up */
|
||||
@ -927,13 +927,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateTexture(IWineD3DDevice *iface, U
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolumeTexture(IWineD3DDevice *iface,
|
||||
UINT Width, UINT Height, UINT Depth,
|
||||
UINT Levels, DWORD Usage,
|
||||
WINED3DFORMAT Format, WINED3DPOOL Pool,
|
||||
IWineD3DVolumeTexture **ppVolumeTexture,
|
||||
HANDLE *pSharedHandle, IUnknown *parent,
|
||||
D3DCB_CREATEVOLUMEFN D3DCB_CreateVolume) {
|
||||
|
||||
UINT Width, UINT Height, UINT Depth, UINT Levels, DWORD Usage, WINED3DFORMAT Format, WINED3DPOOL Pool,
|
||||
IWineD3DVolumeTexture **ppVolumeTexture, HANDLE *pSharedHandle, IUnknown *parent)
|
||||
{
|
||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||
IWineD3DVolumeTextureImpl *object;
|
||||
unsigned int i;
|
||||
@ -1029,9 +1025,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolumeTexture(IWineD3DDevice *ifa
|
||||
{
|
||||
HRESULT hr;
|
||||
/* Create the volume */
|
||||
hr = D3DCB_CreateVolume(This->parent, parent, tmpW, tmpH, tmpD, Format, Pool, Usage,
|
||||
&object->volumes[i], pSharedHandle);
|
||||
|
||||
hr = IWineD3DDeviceParent_CreateVolume(This->device_parent, parent,
|
||||
tmpW, tmpH, tmpD, Format, Pool, Usage, &object->volumes[i]);
|
||||
if(FAILED(hr)) {
|
||||
ERR("Creating a volume for the volume texture failed(%08x)\n", hr);
|
||||
IWineD3DVolumeTexture_Release((IWineD3DVolumeTexture *) object);
|
||||
@ -1115,13 +1110,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolume(IWineD3DDevice *iface,
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IWineD3DDeviceImpl_CreateCubeTexture(IWineD3DDevice *iface, UINT EdgeLength,
|
||||
UINT Levels, DWORD Usage,
|
||||
WINED3DFORMAT Format, WINED3DPOOL Pool,
|
||||
IWineD3DCubeTexture **ppCubeTexture,
|
||||
HANDLE *pSharedHandle, IUnknown *parent,
|
||||
D3DCB_CREATESURFACEFN D3DCB_CreateSurface) {
|
||||
|
||||
static HRESULT WINAPI IWineD3DDeviceImpl_CreateCubeTexture(IWineD3DDevice *iface,
|
||||
UINT EdgeLength, UINT Levels, DWORD Usage, WINED3DFORMAT Format, WINED3DPOOL Pool,
|
||||
IWineD3DCubeTexture **ppCubeTexture, HANDLE *pSharedHandle, IUnknown *parent)
|
||||
{
|
||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||
IWineD3DCubeTextureImpl *object; /** NOTE: impl ref allowed since this is a create function **/
|
||||
unsigned int i, j;
|
||||
@ -1233,9 +1225,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateCubeTexture(IWineD3DDevice *iface
|
||||
GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB
|
||||
};
|
||||
|
||||
hr=D3DCB_CreateSurface(This->parent, parent, tmpW, tmpW, Format, Usage, Pool,
|
||||
i /* Level */, j, &object->surfaces[j][i],pSharedHandle);
|
||||
|
||||
hr = IWineD3DDeviceParent_CreateSurface(This->device_parent, parent, tmpW, tmpW,
|
||||
Format, Usage, Pool, i /* Level */, j, &object->surfaces[j][i]);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
FIXME("(%p) Failed to create surface\n",object);
|
||||
@ -1486,10 +1477,9 @@ static void IWineD3DDeviceImpl_RestoreWindow(IWineD3DDevice *iface, HWND window)
|
||||
}
|
||||
|
||||
/* example at http://www.fairyengine.com/articles/dxmultiviews.htm */
|
||||
static HRESULT WINAPI IWineD3DDeviceImpl_CreateSwapChain(IWineD3DDevice* iface,
|
||||
WINED3DPRESENT_PARAMETERS* pPresentationParameters, IWineD3DSwapChain** ppSwapChain,
|
||||
IUnknown* parent, D3DCB_CREATERENDERTARGETFN D3DCB_CreateRenderTarget,
|
||||
D3DCB_CREATEDEPTHSTENCILSURFACEFN D3DCB_CreateDepthStencil, WINED3DSURFTYPE surface_type)
|
||||
static HRESULT WINAPI IWineD3DDeviceImpl_CreateSwapChain(IWineD3DDevice *iface,
|
||||
WINED3DPRESENT_PARAMETERS *pPresentationParameters, IWineD3DSwapChain **ppSwapChain,
|
||||
IUnknown *parent, WINED3DSURFTYPE surface_type)
|
||||
{
|
||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||
|
||||
@ -1599,16 +1589,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateSwapChain(IWineD3DDevice* iface,
|
||||
object->presentParms = *pPresentationParameters;
|
||||
|
||||
TRACE("calling rendertarget CB\n");
|
||||
hr = D3DCB_CreateRenderTarget(This->parent,
|
||||
parent,
|
||||
object->presentParms.BackBufferWidth,
|
||||
object->presentParms.BackBufferHeight,
|
||||
object->presentParms.BackBufferFormat,
|
||||
object->presentParms.MultiSampleType,
|
||||
object->presentParms.MultiSampleQuality,
|
||||
TRUE /* Lockable */,
|
||||
&object->frontBuffer,
|
||||
NULL /* pShared (always null)*/);
|
||||
hr = IWineD3DDeviceParent_CreateRenderTarget(This->device_parent, parent,
|
||||
object->presentParms.BackBufferWidth, object->presentParms.BackBufferHeight,
|
||||
object->presentParms.BackBufferFormat, object->presentParms.MultiSampleType,
|
||||
object->presentParms.MultiSampleQuality, TRUE /* Lockable */, &object->frontBuffer);
|
||||
if (SUCCEEDED(hr)) {
|
||||
IWineD3DSurface_SetContainer(object->frontBuffer, (IWineD3DBase *)object);
|
||||
if(surface_type == SURFACE_OPENGL) {
|
||||
@ -1687,16 +1671,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateSwapChain(IWineD3DDevice* iface,
|
||||
|
||||
for(i = 0; i < object->presentParms.BackBufferCount; i++) {
|
||||
TRACE("calling rendertarget CB\n");
|
||||
hr = D3DCB_CreateRenderTarget(This->parent,
|
||||
parent,
|
||||
object->presentParms.BackBufferWidth,
|
||||
object->presentParms.BackBufferHeight,
|
||||
object->presentParms.BackBufferFormat,
|
||||
object->presentParms.MultiSampleType,
|
||||
object->presentParms.MultiSampleQuality,
|
||||
TRUE /* Lockable */,
|
||||
&object->backBuffer[i],
|
||||
NULL /* pShared (always null)*/);
|
||||
hr = IWineD3DDeviceParent_CreateRenderTarget(This->device_parent, parent,
|
||||
object->presentParms.BackBufferWidth, object->presentParms.BackBufferHeight,
|
||||
object->presentParms.BackBufferFormat, object->presentParms.MultiSampleType,
|
||||
object->presentParms.MultiSampleQuality, TRUE /* Lockable */, &object->backBuffer[i]);
|
||||
if(SUCCEEDED(hr)) {
|
||||
IWineD3DSurface_SetContainer(object->backBuffer[i], (IWineD3DBase *)object);
|
||||
} else {
|
||||
@ -1726,16 +1704,11 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateSwapChain(IWineD3DDevice* iface,
|
||||
if (pPresentationParameters->EnableAutoDepthStencil && surface_type == SURFACE_OPENGL) {
|
||||
TRACE("Creating depth stencil buffer\n");
|
||||
if (This->auto_depth_stencil_buffer == NULL ) {
|
||||
hr = D3DCB_CreateDepthStencil(This->parent,
|
||||
parent,
|
||||
object->presentParms.BackBufferWidth,
|
||||
object->presentParms.BackBufferHeight,
|
||||
object->presentParms.AutoDepthStencilFormat,
|
||||
object->presentParms.MultiSampleType,
|
||||
object->presentParms.MultiSampleQuality,
|
||||
FALSE /* FIXME: Discard */,
|
||||
&This->auto_depth_stencil_buffer,
|
||||
NULL /* pShared (always null)*/ );
|
||||
hr = IWineD3DDeviceParent_CreateDepthStencilSurface(This->device_parent, parent,
|
||||
object->presentParms.BackBufferWidth, object->presentParms.BackBufferHeight,
|
||||
object->presentParms.AutoDepthStencilFormat, object->presentParms.MultiSampleType,
|
||||
object->presentParms.MultiSampleQuality, FALSE /* FIXME: Discard */,
|
||||
&This->auto_depth_stencil_buffer);
|
||||
if (SUCCEEDED(hr)) {
|
||||
IWineD3DSurface_SetContainer(This->auto_depth_stencil_buffer, 0);
|
||||
} else {
|
||||
@ -2224,14 +2197,17 @@ static void create_dummy_textures(IWineD3DDeviceImpl *This) {
|
||||
LEAVE_GL();
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface, WINED3DPRESENT_PARAMETERS* pPresentationParameters, D3DCB_CREATESWAPCHAIN D3DCB_CreateSwapChain) {
|
||||
static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface,
|
||||
WINED3DPRESENT_PARAMETERS *pPresentationParameters)
|
||||
{
|
||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
|
||||
IWineD3DSwapChainImpl *swapchain = NULL;
|
||||
HRESULT hr;
|
||||
DWORD state;
|
||||
unsigned int i;
|
||||
|
||||
TRACE("(%p)->(%p,%p)\n", This, pPresentationParameters, D3DCB_CreateSwapChain);
|
||||
TRACE("(%p)->(%p)\n", This, pPresentationParameters);
|
||||
|
||||
if(This->d3d_initialized) return WINED3DERR_INVALIDCALL;
|
||||
if(!This->adapter->opengl) return WINED3DERR_INVALIDCALL;
|
||||
|
||||
@ -2286,8 +2262,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface, WINED3DPR
|
||||
|
||||
/* Setup the implicit swapchain */
|
||||
TRACE("Creating implicit swapchain\n");
|
||||
hr=D3DCB_CreateSwapChain(This->parent, pPresentationParameters, (IWineD3DSwapChain **)&swapchain);
|
||||
if (FAILED(hr) || !swapchain) {
|
||||
hr = IWineD3DDeviceParent_CreateSwapChain(This->device_parent,
|
||||
pPresentationParameters, (IWineD3DSwapChain **)&swapchain);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
WARN("Failed to create implicit swapchain\n");
|
||||
goto err_out;
|
||||
}
|
||||
@ -2414,15 +2392,19 @@ err_out:
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IWineD3DDeviceImpl_InitGDI(IWineD3DDevice *iface, WINED3DPRESENT_PARAMETERS* pPresentationParameters, D3DCB_CREATESWAPCHAIN D3DCB_CreateSwapChain) {
|
||||
static HRESULT WINAPI IWineD3DDeviceImpl_InitGDI(IWineD3DDevice *iface,
|
||||
WINED3DPRESENT_PARAMETERS *pPresentationParameters)
|
||||
{
|
||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
|
||||
IWineD3DSwapChainImpl *swapchain = NULL;
|
||||
HRESULT hr;
|
||||
|
||||
/* Setup the implicit swapchain */
|
||||
TRACE("Creating implicit swapchain\n");
|
||||
hr=D3DCB_CreateSwapChain(This->parent, pPresentationParameters, (IWineD3DSwapChain **)&swapchain);
|
||||
if (FAILED(hr) || !swapchain) {
|
||||
hr = IWineD3DDeviceParent_CreateSwapChain(This->device_parent,
|
||||
pPresentationParameters, (IWineD3DSwapChain **)&swapchain);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
WARN("Failed to create implicit swapchain\n");
|
||||
goto err_out;
|
||||
}
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user