d3d10core: Keep a reference to the wined3d device in the d3d10 device.
This commit is contained in:
parent
4fe8415070
commit
0048a0373b
|
@ -52,6 +52,8 @@ struct d3d10_device
|
||||||
const struct IWineD3DDeviceParentVtbl *device_parent_vtbl;
|
const struct IWineD3DDeviceParentVtbl *device_parent_vtbl;
|
||||||
IUnknown *outer_unknown;
|
IUnknown *outer_unknown;
|
||||||
LONG refcount;
|
LONG refcount;
|
||||||
|
|
||||||
|
IWineD3DDevice *wined3d_device;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ID3D10Texture2D */
|
/* ID3D10Texture2D */
|
||||||
|
|
|
@ -75,6 +75,8 @@ static ULONG STDMETHODCALLTYPE d3d10_device_inner_Release(IUnknown *iface)
|
||||||
|
|
||||||
TRACE("%p decreasing refcount to %u\n", This, refcount);
|
TRACE("%p decreasing refcount to %u\n", This, refcount);
|
||||||
|
|
||||||
|
if (This->wined3d_device) IWineD3DDevice_Release(This->wined3d_device);
|
||||||
|
|
||||||
return refcount;
|
return refcount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -590,6 +592,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture1D(ID3D10Device *ifac
|
||||||
static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture2D(ID3D10Device *iface,
|
static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture2D(ID3D10Device *iface,
|
||||||
const D3D10_TEXTURE2D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture2D **texture)
|
const D3D10_TEXTURE2D_DESC *desc, const D3D10_SUBRESOURCE_DATA *data, ID3D10Texture2D **texture)
|
||||||
{
|
{
|
||||||
|
struct d3d10_device *This = (struct d3d10_device *)iface;
|
||||||
struct d3d10_texture2d *object;
|
struct d3d10_texture2d *object;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
|
@ -608,7 +611,6 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture2D(ID3D10Device *ifac
|
||||||
|
|
||||||
if (desc->MipLevels == 1 && desc->ArraySize == 1)
|
if (desc->MipLevels == 1 && desc->ArraySize == 1)
|
||||||
{
|
{
|
||||||
IWineD3DDevice *wined3d_device;
|
|
||||||
IWineDXGIDevice *wine_device;
|
IWineDXGIDevice *wine_device;
|
||||||
|
|
||||||
hr = ID3D10Device_QueryInterface(iface, &IID_IWineDXGIDevice, (void **)&wine_device);
|
hr = ID3D10Device_QueryInterface(iface, &IID_IWineDXGIDevice, (void **)&wine_device);
|
||||||
|
@ -621,24 +623,20 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateTexture2D(ID3D10Device *ifac
|
||||||
|
|
||||||
hr = IWineDXGIDevice_create_surface(wine_device, NULL, 0, NULL,
|
hr = IWineDXGIDevice_create_surface(wine_device, NULL, 0, NULL,
|
||||||
(IUnknown *)object, (void **)&object->dxgi_surface);
|
(IUnknown *)object, (void **)&object->dxgi_surface);
|
||||||
|
IWineDXGIDevice_Release(wine_device);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
ERR("Failed to create DXGI surface, returning %#x\n", hr);
|
ERR("Failed to create DXGI surface, returning %#x\n", hr);
|
||||||
HeapFree(GetProcessHeap(), 0, object);
|
HeapFree(GetProcessHeap(), 0, object);
|
||||||
IWineDXGIDevice_Release(wine_device);
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
wined3d_device = IWineDXGIDevice_get_wined3d_device(wine_device);
|
|
||||||
IWineDXGIDevice_Release(wine_device);
|
|
||||||
|
|
||||||
FIXME("Implement DXGI<->wined3d usage conversion\n");
|
FIXME("Implement DXGI<->wined3d usage conversion\n");
|
||||||
|
|
||||||
hr = IWineD3DDevice_CreateSurface(wined3d_device, desc->Width, desc->Height,
|
hr = IWineD3DDevice_CreateSurface(This->wined3d_device, desc->Width, desc->Height,
|
||||||
wined3dformat_from_dxgi_format(desc->Format), FALSE, FALSE, 0,
|
wined3dformat_from_dxgi_format(desc->Format), FALSE, FALSE, 0,
|
||||||
&object->wined3d_surface, WINED3DRTYPE_SURFACE, desc->Usage, WINED3DPOOL_DEFAULT,
|
&object->wined3d_surface, WINED3DRTYPE_SURFACE, desc->Usage, WINED3DPOOL_DEFAULT,
|
||||||
desc->SampleDesc.Count, desc->SampleDesc.Quality, NULL, SURFACE_OPENGL, (IUnknown *)object);
|
desc->SampleDesc.Count, desc->SampleDesc.Quality, NULL, SURFACE_OPENGL, (IUnknown *)object);
|
||||||
IWineD3DDevice_Release(wined3d_device);
|
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
ERR("CreateSurface failed, returning %#x\n", hr);
|
ERR("CreateSurface failed, returning %#x\n", hr);
|
||||||
|
@ -1144,6 +1142,16 @@ static ULONG STDMETHODCALLTYPE device_parent_Release(IWineD3DDeviceParent *iface
|
||||||
|
|
||||||
/* IWineD3DDeviceParent methods */
|
/* IWineD3DDeviceParent methods */
|
||||||
|
|
||||||
|
static void STDMETHODCALLTYPE device_parent_WineD3DDeviceCreated(IWineD3DDeviceParent *iface, IWineD3DDevice *device)
|
||||||
|
{
|
||||||
|
struct d3d10_device *This = device_from_device_parent(iface);
|
||||||
|
|
||||||
|
TRACE("iface %p, device %p\n", iface, device);
|
||||||
|
|
||||||
|
IWineD3DDevice_AddRef(device);
|
||||||
|
This->wined3d_device = device;
|
||||||
|
}
|
||||||
|
|
||||||
static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParent *iface,
|
static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParent *iface,
|
||||||
IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, DWORD usage,
|
IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, DWORD usage,
|
||||||
WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, IWineD3DSurface **surface)
|
WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, IWineD3DSurface **surface)
|
||||||
|
@ -1287,6 +1295,7 @@ const struct IWineD3DDeviceParentVtbl d3d10_wined3d_device_parent_vtbl =
|
||||||
device_parent_AddRef,
|
device_parent_AddRef,
|
||||||
device_parent_Release,
|
device_parent_Release,
|
||||||
/* IWineD3DDeviceParent methods */
|
/* IWineD3DDeviceParent methods */
|
||||||
|
device_parent_WineD3DDeviceCreated,
|
||||||
device_parent_CreateSurface,
|
device_parent_CreateSurface,
|
||||||
device_parent_CreateRenderTarget,
|
device_parent_CreateRenderTarget,
|
||||||
device_parent_CreateDepthStencilSurface,
|
device_parent_CreateDepthStencilSurface,
|
||||||
|
|
|
@ -2394,6 +2394,11 @@ static ULONG STDMETHODCALLTYPE device_parent_Release(IWineD3DDeviceParent *iface
|
||||||
|
|
||||||
/* IWineD3DDeviceParent methods */
|
/* IWineD3DDeviceParent methods */
|
||||||
|
|
||||||
|
static void STDMETHODCALLTYPE device_parent_WineD3DDeviceCreated(IWineD3DDeviceParent *iface, IWineD3DDevice *device)
|
||||||
|
{
|
||||||
|
TRACE("iface %p, device %p\n", iface, device);
|
||||||
|
}
|
||||||
|
|
||||||
static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParent *iface,
|
static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParent *iface,
|
||||||
IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, DWORD usage,
|
IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, DWORD usage,
|
||||||
WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, IWineD3DSurface **surface)
|
WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, IWineD3DSurface **surface)
|
||||||
|
@ -2591,6 +2596,7 @@ const IWineD3DDeviceParentVtbl d3d8_wined3d_device_parent_vtbl =
|
||||||
device_parent_AddRef,
|
device_parent_AddRef,
|
||||||
device_parent_Release,
|
device_parent_Release,
|
||||||
/* IWineD3DDeviceParent methods */
|
/* IWineD3DDeviceParent methods */
|
||||||
|
device_parent_WineD3DDeviceCreated,
|
||||||
device_parent_CreateSurface,
|
device_parent_CreateSurface,
|
||||||
device_parent_CreateRenderTarget,
|
device_parent_CreateRenderTarget,
|
||||||
device_parent_CreateDepthStencilSurface,
|
device_parent_CreateDepthStencilSurface,
|
||||||
|
|
|
@ -1929,6 +1929,11 @@ static ULONG STDMETHODCALLTYPE device_parent_Release(IWineD3DDeviceParent *iface
|
||||||
|
|
||||||
/* IWineD3DDeviceParent methods */
|
/* IWineD3DDeviceParent methods */
|
||||||
|
|
||||||
|
static void STDMETHODCALLTYPE device_parent_WineD3DDeviceCreated(IWineD3DDeviceParent *iface, IWineD3DDevice *device)
|
||||||
|
{
|
||||||
|
TRACE("iface %p, device %p\n", iface, device);
|
||||||
|
}
|
||||||
|
|
||||||
static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParent *iface,
|
static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParent *iface,
|
||||||
IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, DWORD usage,
|
IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, DWORD usage,
|
||||||
WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, IWineD3DSurface **surface)
|
WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, IWineD3DSurface **surface)
|
||||||
|
@ -2130,6 +2135,7 @@ const IWineD3DDeviceParentVtbl d3d9_wined3d_device_parent_vtbl =
|
||||||
device_parent_AddRef,
|
device_parent_AddRef,
|
||||||
device_parent_Release,
|
device_parent_Release,
|
||||||
/* IWineD3DDeviceParent methods */
|
/* IWineD3DDeviceParent methods */
|
||||||
|
device_parent_WineD3DDeviceCreated,
|
||||||
device_parent_CreateSurface,
|
device_parent_CreateSurface,
|
||||||
device_parent_CreateRenderTarget,
|
device_parent_CreateRenderTarget,
|
||||||
device_parent_CreateDepthStencilSurface,
|
device_parent_CreateDepthStencilSurface,
|
||||||
|
|
|
@ -3409,6 +3409,11 @@ static ULONG STDMETHODCALLTYPE device_parent_Release(IWineD3DDeviceParent *iface
|
||||||
|
|
||||||
/* IWineD3DDeviceParent methods */
|
/* IWineD3DDeviceParent methods */
|
||||||
|
|
||||||
|
static void STDMETHODCALLTYPE device_parent_WineD3DDeviceCreated(IWineD3DDeviceParent *iface, IWineD3DDevice *device)
|
||||||
|
{
|
||||||
|
TRACE("iface %p, device %p\n", iface, device);
|
||||||
|
}
|
||||||
|
|
||||||
static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParent *iface,
|
static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParent *iface,
|
||||||
IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, DWORD usage,
|
IUnknown *superior, UINT width, UINT height, WINED3DFORMAT format, DWORD usage,
|
||||||
WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, IWineD3DSurface **surface)
|
WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, IWineD3DSurface **surface)
|
||||||
|
@ -3624,6 +3629,7 @@ const IWineD3DDeviceParentVtbl ddraw_wined3d_device_parent_vtbl =
|
||||||
device_parent_AddRef,
|
device_parent_AddRef,
|
||||||
device_parent_Release,
|
device_parent_Release,
|
||||||
/* IWineD3DDeviceParent methods */
|
/* IWineD3DDeviceParent methods */
|
||||||
|
device_parent_WineD3DDeviceCreated,
|
||||||
device_parent_CreateSurface,
|
device_parent_CreateSurface,
|
||||||
device_parent_CreateRenderTarget,
|
device_parent_CreateRenderTarget,
|
||||||
device_parent_CreateDepthStencilSurface,
|
device_parent_CreateDepthStencilSurface,
|
||||||
|
|
|
@ -3722,6 +3722,9 @@ static HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter,
|
||||||
for(i = 0; i < PATCHMAP_SIZE; i++) {
|
for(i = 0; i < PATCHMAP_SIZE; i++) {
|
||||||
list_init(&object->patches[i]);
|
list_init(&object->patches[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IWineD3DDeviceParent_WineD3DDeviceCreated(device_parent, *ppReturnedDeviceInterface);
|
||||||
|
|
||||||
return WINED3D_OK;
|
return WINED3D_OK;
|
||||||
}
|
}
|
||||||
#undef GLINFO_LOCATION
|
#undef GLINFO_LOCATION
|
||||||
|
|
|
@ -2188,6 +2188,10 @@ interface IWineD3DDevice;
|
||||||
]
|
]
|
||||||
interface IWineD3DDeviceParent : IUnknown
|
interface IWineD3DDeviceParent : IUnknown
|
||||||
{
|
{
|
||||||
|
void WineD3DDeviceCreated(
|
||||||
|
[in] IWineD3DDevice *device
|
||||||
|
);
|
||||||
|
|
||||||
HRESULT CreateSurface(
|
HRESULT CreateSurface(
|
||||||
[in] IUnknown *superior,
|
[in] IUnknown *superior,
|
||||||
[in] UINT width,
|
[in] UINT width,
|
||||||
|
|
Loading…
Reference in New Issue