wined3d: Don't require wined3d object parents to be COM objects.

This commit is contained in:
Henri Verbeet 2010-08-31 18:41:40 +02:00 committed by Alexandre Julliard
parent b84d1ce5f7
commit 6c4c351791
56 changed files with 613 additions and 603 deletions

View File

@ -227,8 +227,8 @@ HRESULT d3d10_input_layout_init(struct d3d10_input_layout *layout, struct d3d10_
return hr; return hr;
} }
hr = IWineD3DDevice_CreateVertexDeclaration(device->wined3d_device, &layout->wined3d_decl, hr = IWineD3DDevice_CreateVertexDeclaration(device->wined3d_device, wined3d_elements, wined3d_element_count,
(IUnknown *)layout, &d3d10_input_layout_wined3d_parent_ops, wined3d_elements, wined3d_element_count); layout, &d3d10_input_layout_wined3d_parent_ops, &layout->wined3d_decl);
HeapFree(GetProcessHeap(), 0, wined3d_elements); HeapFree(GetProcessHeap(), 0, wined3d_elements);
if (FAILED(hr)) if (FAILED(hr))
{ {

View File

@ -259,9 +259,8 @@ HRESULT d3d10_vertex_shader_init(struct d3d10_vertex_shader *shader, struct d3d1
return hr; return hr;
} }
hr = IWineD3DDevice_CreateVertexShader(device->wined3d_device, hr = IWineD3DDevice_CreateVertexShader(device->wined3d_device, shader_info.shader_code,
shader_info.shader_code, &shader->output_signature, &shader->wined3d_shader, &shader->output_signature, shader, &d3d10_vertex_shader_wined3d_parent_ops, &shader->wined3d_shader);
(IUnknown *)shader, &d3d10_vertex_shader_wined3d_parent_ops);
if (FAILED(hr)) if (FAILED(hr))
{ {
WARN("Failed to create wined3d vertex shader, hr %#x.\n", hr); WARN("Failed to create wined3d vertex shader, hr %#x.\n", hr);
@ -394,9 +393,8 @@ HRESULT d3d10_geometry_shader_init(struct d3d10_geometry_shader *shader, struct
return hr; return hr;
} }
hr = IWineD3DDevice_CreateGeometryShader(device->wined3d_device, hr = IWineD3DDevice_CreateGeometryShader(device->wined3d_device, shader_info.shader_code,
shader_info.shader_code, &shader->output_signature, &shader->wined3d_shader, &shader->output_signature, shader, &d3d10_geometry_shader_wined3d_parent_ops, &shader->wined3d_shader);
(IUnknown *)shader, &d3d10_geometry_shader_wined3d_parent_ops);
if (FAILED(hr)) if (FAILED(hr))
{ {
WARN("Failed to create wined3d vertex shader, hr %#x.\n", hr); WARN("Failed to create wined3d vertex shader, hr %#x.\n", hr);
@ -534,9 +532,8 @@ HRESULT d3d10_pixel_shader_init(struct d3d10_pixel_shader *shader, struct d3d10_
return hr; return hr;
} }
hr = IWineD3DDevice_CreatePixelShader(device->wined3d_device, hr = IWineD3DDevice_CreatePixelShader(device->wined3d_device, shader_info.shader_code,
shader_info.shader_code, &shader->output_signature, &shader->wined3d_shader, &shader->output_signature, shader, &d3d10_pixel_shader_wined3d_parent_ops, &shader->wined3d_shader);
(IUnknown *)shader, &d3d10_pixel_shader_wined3d_parent_ops);
if (FAILED(hr)) if (FAILED(hr))
{ {
WARN("Failed to create wined3d pixel shader, hr %#x.\n", hr); WARN("Failed to create wined3d pixel shader, hr %#x.\n", hr);

View File

@ -228,11 +228,10 @@ HRESULT d3d10_texture2d_init(struct d3d10_texture2d *texture, struct d3d10_devic
FIXME("Implement DXGI<->wined3d usage conversion\n"); FIXME("Implement DXGI<->wined3d usage conversion\n");
hr = IWineD3DDevice_CreateSurface(device->wined3d_device, desc->Width, desc->Height, hr = IWineD3DDevice_CreateSurface(device->wined3d_device, desc->Width, desc->Height,
wined3dformat_from_dxgi_format(desc->Format), FALSE, FALSE, 0, wined3dformat_from_dxgi_format(desc->Format), FALSE, FALSE, 0, desc->Usage, WINED3DPOOL_DEFAULT,
&texture->wined3d_surface, desc->Usage, WINED3DPOOL_DEFAULT,
desc->SampleDesc.Count > 1 ? desc->SampleDesc.Count : WINED3DMULTISAMPLE_NONE, desc->SampleDesc.Count > 1 ? desc->SampleDesc.Count : WINED3DMULTISAMPLE_NONE,
desc->SampleDesc.Quality, SURFACE_OPENGL, (IUnknown *)texture, desc->SampleDesc.Quality, SURFACE_OPENGL, texture, &d3d10_texture2d_wined3d_parent_ops,
&d3d10_texture2d_wined3d_parent_ops); &texture->wined3d_surface);
if (FAILED(hr)) if (FAILED(hr))
{ {
ERR("CreateSurface failed, returning %#x\n", hr); ERR("CreateSurface failed, returning %#x\n", hr);

View File

@ -388,17 +388,9 @@ static void STDMETHODCALLTYPE d3d10_rendertarget_view_GetResource(ID3D10RenderTa
return; return;
} }
hr = IWineD3DResource_GetParent(wined3d_resource, &parent); parent = IWineD3DResource_GetParent(wined3d_resource);
IWineD3DResource_Release(wined3d_resource);
if (FAILED(hr))
{
ERR("Failed to get wined3d resource parent, hr %#x\n", hr);
*resource = NULL;
return;
}
hr = IUnknown_QueryInterface(parent, &IID_ID3D10Resource, (void **)&resource); hr = IUnknown_QueryInterface(parent, &IID_ID3D10Resource, (void **)&resource);
IUnknown_Release(parent); IWineD3DResource_Release(wined3d_resource);
if (FAILED(hr)) if (FAILED(hr))
{ {
ERR("Resource parent isn't a d3d10 resource, hr %#x\n", hr); ERR("Resource parent isn't a d3d10 resource, hr %#x\n", hr);

View File

@ -253,22 +253,27 @@ static HRESULT WINAPI IDirect3DCubeTexture8Impl_GetLevelDesc(LPDIRECT3DCUBETEXTU
return hr; return hr;
} }
static HRESULT WINAPI IDirect3DCubeTexture8Impl_GetCubeMapSurface(LPDIRECT3DCUBETEXTURE8 iface, D3DCUBEMAP_FACES FaceType, UINT Level, IDirect3DSurface8 **ppCubeMapSurface) { static HRESULT WINAPI IDirect3DCubeTexture8Impl_GetCubeMapSurface(IDirect3DCubeTexture8 *iface,
D3DCUBEMAP_FACES FaceType, UINT Level, IDirect3DSurface8 **ppCubeMapSurface)
{
IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface; IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface;
HRESULT hrc = D3D_OK;
IWineD3DSurface *mySurface = NULL; IWineD3DSurface *mySurface = NULL;
HRESULT hr;
TRACE("iface %p, face %#x, level %u, surface %p.\n", iface, FaceType, Level, ppCubeMapSurface); TRACE("iface %p, face %#x, level %u, surface %p.\n", iface, FaceType, Level, ppCubeMapSurface);
wined3d_mutex_lock(); wined3d_mutex_lock();
hrc = IWineD3DCubeTexture_GetCubeMapSurface(This->wineD3DCubeTexture, (WINED3DCUBEMAP_FACES) FaceType, Level, &mySurface); hr = IWineD3DCubeTexture_GetCubeMapSurface(This->wineD3DCubeTexture,
if (hrc == D3D_OK && NULL != ppCubeMapSurface) { (WINED3DCUBEMAP_FACES) FaceType, Level, &mySurface);
IWineD3DCubeTexture_GetParent(mySurface, (IUnknown **)ppCubeMapSurface); if (SUCCEEDED(hr) && ppCubeMapSurface)
{
*ppCubeMapSurface = IWineD3DCubeTexture_GetParent(mySurface);
IDirect3DSurface8_AddRef(*ppCubeMapSurface);
IWineD3DCubeTexture_Release(mySurface); IWineD3DCubeTexture_Release(mySurface);
} }
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hrc; return hr;
} }
static HRESULT WINAPI IDirect3DCubeTexture8Impl_LockRect(LPDIRECT3DCUBETEXTURE8 iface, D3DCUBEMAP_FACES FaceType, UINT Level, D3DLOCKED_RECT* pLockedRect, CONST RECT *pRect, DWORD Flags) { static HRESULT WINAPI IDirect3DCubeTexture8Impl_LockRect(LPDIRECT3DCUBETEXTURE8 iface, D3DCUBEMAP_FACES FaceType, UINT Level, D3DLOCKED_RECT* pLockedRect, CONST RECT *pRect, DWORD Flags) {
@ -357,9 +362,9 @@ HRESULT cubetexture_init(IDirect3DCubeTexture8Impl *texture, IDirect3DDevice8Imp
texture->ref = 1; texture->ref = 1;
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_CreateCubeTexture(device->WineD3DDevice, edge_length, levels, usage & WINED3DUSAGE_MASK, hr = IWineD3DDevice_CreateCubeTexture(device->WineD3DDevice, edge_length, levels,
wined3dformat_from_d3dformat(format), pool, &texture->wineD3DCubeTexture, usage & WINED3DUSAGE_MASK, wined3dformat_from_d3dformat(format), pool, texture,
(IUnknown *)texture, &d3d8_cubetexture_wined3d_parent_ops); &d3d8_cubetexture_wined3d_parent_ops, &texture->wineD3DCubeTexture);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
if (FAILED(hr)) if (FAILED(hr))
{ {

View File

@ -260,8 +260,7 @@ static ULONG WINAPI D3D8CB_DestroySwapChain(IWineD3DSwapChain *swapchain)
TRACE("swapchain %p.\n", swapchain); TRACE("swapchain %p.\n", swapchain);
IWineD3DSwapChain_GetParent(swapchain, &parent); parent = IWineD3DSwapChain_GetParent(swapchain);
IUnknown_Release(parent);
return IUnknown_Release(parent); return IUnknown_Release(parent);
} }
@ -370,10 +369,11 @@ static HRESULT WINAPI IDirect3DDevice8Impl_ResourceManagerDiscardBytes(LPDIRECT3
return hr; return hr;
} }
static HRESULT WINAPI IDirect3DDevice8Impl_GetDirect3D(LPDIRECT3DDEVICE8 iface, IDirect3D8** ppD3D8) { static HRESULT WINAPI IDirect3DDevice8Impl_GetDirect3D(IDirect3DDevice8 *iface, IDirect3D8 **ppD3D8)
{
IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
HRESULT hr = D3D_OK; IWineD3D *pWineD3D;
IWineD3D* pWineD3D; HRESULT hr;
TRACE("iface %p, d3d8 %p.\n", iface, ppD3D8); TRACE("iface %p, d3d8 %p.\n", iface, ppD3D8);
@ -383,11 +383,14 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetDirect3D(LPDIRECT3DDEVICE8 iface,
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_GetDirect3D(This->WineD3DDevice, &pWineD3D); hr = IWineD3DDevice_GetDirect3D(This->WineD3DDevice, &pWineD3D);
if (hr == D3D_OK && pWineD3D != NULL) if (SUCCEEDED(hr) && pWineD3D)
{ {
IWineD3D_GetParent(pWineD3D,(IUnknown **)ppD3D8); *ppD3D8 = IWineD3D_GetParent(pWineD3D);
IDirect3D8_AddRef(*ppD3D8);
IWineD3D_Release(pWineD3D); IWineD3D_Release(pWineD3D);
} else { }
else
{
FIXME("Call to IWineD3DDevice_GetDirect3D failed\n"); FIXME("Call to IWineD3DDevice_GetDirect3D failed\n");
*ppD3D8 = NULL; *ppD3D8 = NULL;
} }
@ -589,23 +592,27 @@ static HRESULT WINAPI IDirect3DDevice8Impl_Present(LPDIRECT3DDEVICE8 iface, CONS
return hr; return hr;
} }
static HRESULT WINAPI IDirect3DDevice8Impl_GetBackBuffer(LPDIRECT3DDEVICE8 iface, UINT BackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface8** ppBackBuffer) { static HRESULT WINAPI IDirect3DDevice8Impl_GetBackBuffer(IDirect3DDevice8 *iface,
UINT BackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface8 **ppBackBuffer)
{
IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
IWineD3DSurface *retSurface = NULL; IWineD3DSurface *retSurface = NULL;
HRESULT rc = D3D_OK; HRESULT hr;
TRACE("iface %p, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n", TRACE("iface %p, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n",
iface, BackBuffer, Type, ppBackBuffer); iface, BackBuffer, Type, ppBackBuffer);
wined3d_mutex_lock(); wined3d_mutex_lock();
rc = IWineD3DDevice_GetBackBuffer(This->WineD3DDevice, 0, BackBuffer, (WINED3DBACKBUFFER_TYPE) Type, &retSurface); hr = IWineD3DDevice_GetBackBuffer(This->WineD3DDevice, 0, BackBuffer, (WINED3DBACKBUFFER_TYPE)Type, &retSurface);
if (rc == D3D_OK && NULL != retSurface && NULL != ppBackBuffer) { if (SUCCEEDED(hr) && retSurface && ppBackBuffer)
IWineD3DSurface_GetParent(retSurface, (IUnknown **)ppBackBuffer); {
*ppBackBuffer = IWineD3DSurface_GetParent(retSurface);
IDirect3DSurface8_AddRef(*ppBackBuffer);
IWineD3DSurface_Release(retSurface); IWineD3DSurface_Release(retSurface);
} }
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return rc; return hr;
} }
static HRESULT WINAPI IDirect3DDevice8Impl_GetRasterStatus(LPDIRECT3DDEVICE8 iface, D3DRASTER_STATUS* pRasterStatus) { static HRESULT WINAPI IDirect3DDevice8Impl_GetRasterStatus(LPDIRECT3DDEVICE8 iface, D3DRASTER_STATUS* pRasterStatus) {
@ -984,10 +991,12 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetRenderTarget(LPDIRECT3DDEVICE8 ifa
return hr; return hr;
} }
static HRESULT WINAPI IDirect3DDevice8Impl_GetRenderTarget(LPDIRECT3DDEVICE8 iface, IDirect3DSurface8** ppRenderTarget) { static HRESULT WINAPI IDirect3DDevice8Impl_GetRenderTarget(IDirect3DDevice8 *iface,
IDirect3DSurface8 **ppRenderTarget)
{
IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
HRESULT hr = D3D_OK;
IWineD3DSurface *pRenderTarget; IWineD3DSurface *pRenderTarget;
HRESULT hr;
TRACE("iface %p, render_target %p.\n", iface, ppRenderTarget); TRACE("iface %p, render_target %p.\n", iface, ppRenderTarget);
@ -997,11 +1006,14 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetRenderTarget(LPDIRECT3DDEVICE8 i
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_GetRenderTarget(This->WineD3DDevice, 0, &pRenderTarget); hr = IWineD3DDevice_GetRenderTarget(This->WineD3DDevice, 0, &pRenderTarget);
if (SUCCEEDED(hr) && pRenderTarget)
if (hr == D3D_OK && pRenderTarget != NULL) { {
IWineD3DSurface_GetParent(pRenderTarget,(IUnknown**)ppRenderTarget); *ppRenderTarget = IWineD3DSurface_GetParent(pRenderTarget);
IDirect3DSurface8_AddRef(*ppRenderTarget);
IWineD3DSurface_Release(pRenderTarget); IWineD3DSurface_Release(pRenderTarget);
} else { }
else
{
FIXME("Call to IWineD3DDevice_GetRenderTarget failed\n"); FIXME("Call to IWineD3DDevice_GetRenderTarget failed\n");
*ppRenderTarget = NULL; *ppRenderTarget = NULL;
} }
@ -1010,10 +1022,12 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetRenderTarget(LPDIRECT3DDEVICE8 i
return hr; return hr;
} }
static HRESULT WINAPI IDirect3DDevice8Impl_GetDepthStencilSurface(LPDIRECT3DDEVICE8 iface, IDirect3DSurface8** ppZStencilSurface) { static HRESULT WINAPI IDirect3DDevice8Impl_GetDepthStencilSurface(IDirect3DDevice8 *iface,
IDirect3DSurface8 **ppZStencilSurface)
{
IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
HRESULT hr = D3D_OK;
IWineD3DSurface *pZStencilSurface; IWineD3DSurface *pZStencilSurface;
HRESULT hr;
TRACE("iface %p, depth_stencil %p.\n", iface, ppZStencilSurface); TRACE("iface %p, depth_stencil %p.\n", iface, ppZStencilSurface);
@ -1022,11 +1036,15 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetDepthStencilSurface(LPDIRECT3DDE
} }
wined3d_mutex_lock(); wined3d_mutex_lock();
hr=IWineD3DDevice_GetDepthStencilSurface(This->WineD3DDevice,&pZStencilSurface); hr = IWineD3DDevice_GetDepthStencilSurface(This->WineD3DDevice, &pZStencilSurface);
if (hr == WINED3D_OK) { if (SUCCEEDED(hr))
IWineD3DSurface_GetParent(pZStencilSurface,(IUnknown**)ppZStencilSurface); {
*ppZStencilSurface = IWineD3DSurface_GetParent(pZStencilSurface);
IDirect3DSurface8_AddRef(*ppZStencilSurface);
IWineD3DSurface_Release(pZStencilSurface); IWineD3DSurface_Release(pZStencilSurface);
}else{ }
else
{
if (hr != WINED3DERR_NOTFOUND) if (hr != WINED3DERR_NOTFOUND)
FIXME("Call to IWineD3DDevice_GetDepthStencilSurface failed with 0x%08x\n", hr); FIXME("Call to IWineD3DDevice_GetDepthStencilSurface failed with 0x%08x\n", hr);
*ppZStencilSurface = NULL; *ppZStencilSurface = NULL;
@ -1467,7 +1485,9 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetClipStatus(LPDIRECT3DDEVICE8 iface
return hr; return hr;
} }
static HRESULT WINAPI IDirect3DDevice8Impl_GetTexture(LPDIRECT3DDEVICE8 iface, DWORD Stage,IDirect3DBaseTexture8** ppTexture) { static HRESULT WINAPI IDirect3DDevice8Impl_GetTexture(IDirect3DDevice8 *iface,
DWORD Stage, IDirect3DBaseTexture8 **ppTexture)
{
IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
IWineD3DBaseTexture *retTexture; IWineD3DBaseTexture *retTexture;
HRESULT hr; HRESULT hr;
@ -1490,7 +1510,8 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetTexture(LPDIRECT3DDEVICE8 iface, D
if (retTexture) if (retTexture)
{ {
IWineD3DBaseTexture_GetParent(retTexture, (IUnknown **)ppTexture); *ppTexture = IWineD3DBaseTexture_GetParent(retTexture);
IDirect3DBaseTexture8_AddRef(*ppTexture);
IWineD3DBaseTexture_Release(retTexture); IWineD3DBaseTexture_Release(retTexture);
} }
else else
@ -1900,22 +1921,23 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetVertexShader(LPDIRECT3DDEVICE8 ifa
return hr; return hr;
} }
static HRESULT WINAPI IDirect3DDevice8Impl_GetVertexShader(LPDIRECT3DDEVICE8 iface, DWORD* ppShader) { static HRESULT WINAPI IDirect3DDevice8Impl_GetVertexShader(IDirect3DDevice8 *iface, DWORD *ppShader)
{
IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
IWineD3DVertexDeclaration *wined3d_declaration; IWineD3DVertexDeclaration *wined3d_declaration;
IDirect3DVertexDeclaration8 *d3d8_declaration; IDirect3DVertexDeclaration8 *d3d8_declaration;
HRESULT hrc; HRESULT hr;
TRACE("iface %p, shader %p.\n", iface, ppShader); TRACE("iface %p, shader %p.\n", iface, ppShader);
wined3d_mutex_lock(); wined3d_mutex_lock();
hrc = IWineD3DDevice_GetVertexDeclaration(This->WineD3DDevice, &wined3d_declaration); hr = IWineD3DDevice_GetVertexDeclaration(This->WineD3DDevice, &wined3d_declaration);
if (FAILED(hrc)) if (FAILED(hr))
{ {
wined3d_mutex_unlock(); wined3d_mutex_unlock();
WARN("(%p) : Call to IWineD3DDevice_GetVertexDeclaration failed %#x (device %p)\n", WARN("(%p) : Call to IWineD3DDevice_GetVertexDeclaration failed %#x (device %p)\n",
This, hrc, This->WineD3DDevice); This, hr, This->WineD3DDevice);
return hrc; return hr;
} }
if (!wined3d_declaration) if (!wined3d_declaration)
@ -1925,18 +1947,14 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetVertexShader(LPDIRECT3DDEVICE8 ifa
return D3D_OK; return D3D_OK;
} }
hrc = IWineD3DVertexDeclaration_GetParent(wined3d_declaration, (IUnknown **)&d3d8_declaration); d3d8_declaration = IWineD3DVertexDeclaration_GetParent(wined3d_declaration);
IWineD3DVertexDeclaration_Release(wined3d_declaration); IWineD3DVertexDeclaration_Release(wined3d_declaration);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
if (SUCCEEDED(hrc)) *ppShader = ((IDirect3DVertexDeclaration8Impl *)d3d8_declaration)->shader_handle;
{
*ppShader = ((IDirect3DVertexDeclaration8Impl *)d3d8_declaration)->shader_handle;
IDirect3DVertexDeclaration8_Release(d3d8_declaration);
}
TRACE("(%p) : returning %#x\n", This, *ppShader); TRACE("(%p) : returning %#x\n", This, *ppShader);
return hrc; return hr;
} }
static HRESULT WINAPI IDirect3DDevice8Impl_DeleteVertexShader(LPDIRECT3DDEVICE8 iface, DWORD pShader) { static HRESULT WINAPI IDirect3DDevice8Impl_DeleteVertexShader(LPDIRECT3DDEVICE8 iface, DWORD pShader) {
@ -2105,10 +2123,12 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetIndices(LPDIRECT3DDEVICE8 iface, I
return hr; return hr;
} }
static HRESULT WINAPI IDirect3DDevice8Impl_GetIndices(LPDIRECT3DDEVICE8 iface, IDirect3DIndexBuffer8** ppIndexData,UINT* pBaseVertexIndex) { static HRESULT WINAPI IDirect3DDevice8Impl_GetIndices(IDirect3DDevice8 *iface,
IDirect3DIndexBuffer8 **ppIndexData, UINT *pBaseVertexIndex)
{
IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
IWineD3DBuffer *retIndexData = NULL; IWineD3DBuffer *retIndexData = NULL;
HRESULT rc = D3D_OK; HRESULT hr;
TRACE("iface %p, buffer %p, base_vertex_index %p.\n", iface, ppIndexData, pBaseVertexIndex); TRACE("iface %p, buffer %p, base_vertex_index %p.\n", iface, ppIndexData, pBaseVertexIndex);
@ -2119,17 +2139,19 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetIndices(LPDIRECT3DDEVICE8 iface, I
/* The case from UINT to INT is safe because d3d8 will never set negative values */ /* The case from UINT to INT is safe because d3d8 will never set negative values */
wined3d_mutex_lock(); wined3d_mutex_lock();
IWineD3DDevice_GetBaseVertexIndex(This->WineD3DDevice, (INT *) pBaseVertexIndex); IWineD3DDevice_GetBaseVertexIndex(This->WineD3DDevice, (INT *) pBaseVertexIndex);
rc = IWineD3DDevice_GetIndexBuffer(This->WineD3DDevice, &retIndexData); hr = IWineD3DDevice_GetIndexBuffer(This->WineD3DDevice, &retIndexData);
if (SUCCEEDED(rc) && retIndexData) { if (SUCCEEDED(hr) && retIndexData)
IWineD3DBuffer_GetParent(retIndexData, (IUnknown **)ppIndexData); {
*ppIndexData = IWineD3DBuffer_GetParent(retIndexData);
IDirect3DIndexBuffer8_AddRef(*ppIndexData);
IWineD3DBuffer_Release(retIndexData); IWineD3DBuffer_Release(retIndexData);
} else { } else {
if (FAILED(rc)) FIXME("Call to GetIndices failed\n"); if (FAILED(hr)) FIXME("Call to GetIndices failed\n");
*ppIndexData = NULL; *ppIndexData = NULL;
} }
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return rc; return hr;
} }
static HRESULT WINAPI IDirect3DDevice8Impl_CreatePixelShader(IDirect3DDevice8 *iface, static HRESULT WINAPI IDirect3DDevice8Impl_CreatePixelShader(IDirect3DDevice8 *iface,
@ -2217,10 +2239,11 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetPixelShader(LPDIRECT3DDEVICE8 ifac
return hr; return hr;
} }
static HRESULT WINAPI IDirect3DDevice8Impl_GetPixelShader(LPDIRECT3DDEVICE8 iface, DWORD* ppShader) { static HRESULT WINAPI IDirect3DDevice8Impl_GetPixelShader(IDirect3DDevice8 *iface, DWORD *ppShader)
{
IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
IWineD3DPixelShader *object; IWineD3DPixelShader *object;
HRESULT hrc = D3D_OK; HRESULT hr;
TRACE("iface %p, shader %p.\n", iface, ppShader); TRACE("iface %p, shader %p.\n", iface, ppShader);
@ -2230,21 +2253,23 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetPixelShader(LPDIRECT3DDEVICE8 ifac
} }
wined3d_mutex_lock(); wined3d_mutex_lock();
hrc = IWineD3DDevice_GetPixelShader(This->WineD3DDevice, &object); hr = IWineD3DDevice_GetPixelShader(This->WineD3DDevice, &object);
if (D3D_OK == hrc && NULL != object) { if (SUCCEEDED(hr) && object)
{
IDirect3DPixelShader8Impl *d3d8_shader; IDirect3DPixelShader8Impl *d3d8_shader;
hrc = IWineD3DPixelShader_GetParent(object, (IUnknown **)&d3d8_shader); d3d8_shader = IWineD3DPixelShader_GetParent(object);
IWineD3DPixelShader_Release(object); IWineD3DPixelShader_Release(object);
*ppShader = d3d8_shader->handle; *ppShader = d3d8_shader->handle;
IDirect3DPixelShader8_Release((IDirect3DPixelShader8 *)d3d8_shader); }
} else { else
{
*ppShader = 0; *ppShader = 0;
} }
wined3d_mutex_unlock(); wined3d_mutex_unlock();
TRACE("(%p) : returning %#x\n", This, *ppShader); TRACE("(%p) : returning %#x\n", This, *ppShader);
return hrc; return hr;
} }
static HRESULT WINAPI IDirect3DDevice8Impl_DeletePixelShader(LPDIRECT3DDEVICE8 iface, DWORD pShader) { static HRESULT WINAPI IDirect3DDevice8Impl_DeletePixelShader(LPDIRECT3DDEVICE8 iface, DWORD pShader) {
@ -2391,10 +2416,12 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetStreamSource(LPDIRECT3DDEVICE8 ifa
return hr; return hr;
} }
static HRESULT WINAPI IDirect3DDevice8Impl_GetStreamSource(LPDIRECT3DDEVICE8 iface, UINT StreamNumber,IDirect3DVertexBuffer8** pStream,UINT* pStride) { static HRESULT WINAPI IDirect3DDevice8Impl_GetStreamSource(IDirect3DDevice8 *iface,
UINT StreamNumber, IDirect3DVertexBuffer8 **pStream, UINT *pStride)
{
IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
IWineD3DBuffer *retStream = NULL; IWineD3DBuffer *retStream = NULL;
HRESULT rc = D3D_OK; HRESULT hr;
TRACE("iface %p, stream_idx %u, buffer %p, stride %p.\n", TRACE("iface %p, stream_idx %u, buffer %p, stride %p.\n",
iface, StreamNumber, pStream, pStride); iface, StreamNumber, pStream, pStride);
@ -2404,19 +2431,22 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetStreamSource(LPDIRECT3DDEVICE8 ifa
} }
wined3d_mutex_lock(); wined3d_mutex_lock();
rc = IWineD3DDevice_GetStreamSource(This->WineD3DDevice, StreamNumber, &retStream, 0 /* Offset in bytes */, pStride); hr = IWineD3DDevice_GetStreamSource(This->WineD3DDevice, StreamNumber,
if (rc == D3D_OK && NULL != retStream) { &retStream, 0 /* Offset in bytes */, pStride);
IWineD3DBuffer_GetParent(retStream, (IUnknown **)pStream); if (SUCCEEDED(hr) && retStream)
{
*pStream = IWineD3DBuffer_GetParent(retStream);
IDirect3DVertexBuffer8_AddRef(*pStream);
IWineD3DBuffer_Release(retStream); IWineD3DBuffer_Release(retStream);
}else{ }
if (rc != D3D_OK){ else
FIXME("Call to GetStreamSource failed %p\n", pStride); {
} if (FAILED(hr)) FIXME("Call to GetStreamSource failed, hr %#x.\n", hr);
*pStream = NULL; *pStream = NULL;
} }
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return rc; return hr;
} }
static const IDirect3DDevice8Vtbl Direct3DDevice8_Vtbl = static const IDirect3DDevice8Vtbl Direct3DDevice8_Vtbl =

View File

@ -268,9 +268,8 @@ HRESULT indexbuffer_init(IDirect3DIndexBuffer8Impl *buffer, IDirect3DDevice8Impl
buffer->format = wined3dformat_from_d3dformat(format); buffer->format = wined3dformat_from_d3dformat(format);
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_CreateIndexBuffer(device->WineD3DDevice, size, hr = IWineD3DDevice_CreateIndexBuffer(device->WineD3DDevice, size, usage & WINED3DUSAGE_MASK,
usage & WINED3DUSAGE_MASK, (WINED3DPOOL)pool, &buffer->wineD3DIndexBuffer, (WINED3DPOOL)pool, buffer, &d3d8_indexbuffer_wined3d_parent_ops, &buffer->wineD3DIndexBuffer);
(IUnknown *)buffer, &d3d8_indexbuffer_wined3d_parent_ops);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
if (FAILED(hr)) if (FAILED(hr))
{ {

View File

@ -100,9 +100,8 @@ HRESULT pixelshader_init(IDirect3DPixelShader8Impl *shader, IDirect3DDevice8Impl
shader->handle = shader_handle; shader->handle = shader_handle;
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_CreatePixelShader(device->WineD3DDevice, byte_code, hr = IWineD3DDevice_CreatePixelShader(device->WineD3DDevice, byte_code, NULL, shader,
NULL, &shader->wineD3DPixelShader, (IUnknown *)shader, &d3d8_pixelshader_wined3d_parent_ops, &shader->wineD3DPixelShader);
&d3d8_pixelshader_wined3d_parent_ops);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
if (FAILED(hr)) if (FAILED(hr))
{ {

View File

@ -306,9 +306,8 @@ HRESULT surface_init(IDirect3DSurface8Impl *surface, IDirect3DDevice8Impl *devic
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_CreateSurface(device->WineD3DDevice, width, height, wined3dformat_from_d3dformat(format), hr = IWineD3DDevice_CreateSurface(device->WineD3DDevice, width, height, wined3dformat_from_d3dformat(format),
lockable, discard, level, &surface->wineD3DSurface, usage & WINED3DUSAGE_MASK, (WINED3DPOOL)pool, lockable, discard, level, usage & WINED3DUSAGE_MASK, (WINED3DPOOL)pool, multisample_type,
multisample_type, multisample_quality, SURFACE_OPENGL, (IUnknown *)surface, multisample_quality, SURFACE_OPENGL, surface, &d3d8_surface_wined3d_parent_ops, &surface->wineD3DSurface);
&d3d8_surface_wined3d_parent_ops);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
if (FAILED(hr)) if (FAILED(hr))
{ {

View File

@ -83,23 +83,28 @@ static HRESULT WINAPI IDirect3DSwapChain8Impl_Present(LPDIRECT3DSWAPCHAIN8 iface
return hr; return hr;
} }
static HRESULT WINAPI IDirect3DSwapChain8Impl_GetBackBuffer(LPDIRECT3DSWAPCHAIN8 iface, UINT iBackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface8** ppBackBuffer) { static HRESULT WINAPI IDirect3DSwapChain8Impl_GetBackBuffer(IDirect3DSwapChain8 *iface,
UINT iBackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface8 **ppBackBuffer)
{
IDirect3DSwapChain8Impl *This = (IDirect3DSwapChain8Impl *)iface; IDirect3DSwapChain8Impl *This = (IDirect3DSwapChain8Impl *)iface;
HRESULT hrc = D3D_OK;
IWineD3DSurface *mySurface = NULL; IWineD3DSurface *mySurface = NULL;
HRESULT hr;
TRACE("iface %p, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n", TRACE("iface %p, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n",
iface, iBackBuffer, Type, ppBackBuffer); iface, iBackBuffer, Type, ppBackBuffer);
wined3d_mutex_lock(); wined3d_mutex_lock();
hrc = IWineD3DSwapChain_GetBackBuffer(This->wineD3DSwapChain, iBackBuffer, (WINED3DBACKBUFFER_TYPE )Type, &mySurface); hr = IWineD3DSwapChain_GetBackBuffer(This->wineD3DSwapChain, iBackBuffer,
if (hrc == D3D_OK && NULL != mySurface) { (WINED3DBACKBUFFER_TYPE)Type, &mySurface);
IWineD3DSurface_GetParent(mySurface, (IUnknown **)ppBackBuffer); if (SUCCEEDED(hr) && mySurface)
IWineD3DSurface_Release(mySurface); {
*ppBackBuffer = IWineD3DSurface_GetParent(mySurface);
IDirect3DSurface8_AddRef(*ppBackBuffer);
IWineD3DSurface_Release(mySurface);
} }
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hrc; return hr;
} }
static const IDirect3DSwapChain8Vtbl Direct3DSwapChain8_Vtbl = static const IDirect3DSwapChain8Vtbl Direct3DSwapChain8_Vtbl =
@ -138,7 +143,7 @@ HRESULT swapchain_init(IDirect3DSwapChain8Impl *swapchain, IDirect3DDevice8Impl
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_CreateSwapChain(device->WineD3DDevice, &wined3d_parameters, hr = IWineD3DDevice_CreateSwapChain(device->WineD3DDevice, &wined3d_parameters,
&swapchain->wineD3DSwapChain, (IUnknown *)swapchain, SURFACE_OPENGL); SURFACE_OPENGL, swapchain, &swapchain->wineD3DSwapChain);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
present_parameters->BackBufferWidth = wined3d_parameters.BackBufferWidth; present_parameters->BackBufferWidth = wined3d_parameters.BackBufferWidth;

View File

@ -251,22 +251,26 @@ static HRESULT WINAPI IDirect3DTexture8Impl_GetLevelDesc(LPDIRECT3DTEXTURE8 ifac
return hr; return hr;
} }
static HRESULT WINAPI IDirect3DTexture8Impl_GetSurfaceLevel(LPDIRECT3DTEXTURE8 iface, UINT Level, IDirect3DSurface8 **ppSurfaceLevel) { static HRESULT WINAPI IDirect3DTexture8Impl_GetSurfaceLevel(IDirect3DTexture8 *iface,
UINT Level, IDirect3DSurface8 **ppSurfaceLevel)
{
IDirect3DTexture8Impl *This = (IDirect3DTexture8Impl *)iface; IDirect3DTexture8Impl *This = (IDirect3DTexture8Impl *)iface;
HRESULT hrc = D3D_OK;
IWineD3DSurface *mySurface = NULL; IWineD3DSurface *mySurface = NULL;
HRESULT hr;
TRACE("iface %p, level %u, surface %p.\n", iface, Level, ppSurfaceLevel); TRACE("iface %p, level %u, surface %p.\n", iface, Level, ppSurfaceLevel);
wined3d_mutex_lock(); wined3d_mutex_lock();
hrc = IWineD3DTexture_GetSurfaceLevel(This->wineD3DTexture, Level, &mySurface); hr = IWineD3DTexture_GetSurfaceLevel(This->wineD3DTexture, Level, &mySurface);
if (hrc == D3D_OK && NULL != ppSurfaceLevel) { if (SUCCEEDED(hr) && ppSurfaceLevel)
IWineD3DSurface_GetParent(mySurface, (IUnknown **)ppSurfaceLevel); {
*ppSurfaceLevel = IWineD3DSurface_GetParent(mySurface);
IDirect3DSurface8_AddRef(*ppSurfaceLevel);
IWineD3DSurface_Release(mySurface); IWineD3DSurface_Release(mySurface);
} }
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hrc; return hr;
} }
static HRESULT WINAPI IDirect3DTexture8Impl_LockRect(LPDIRECT3DTEXTURE8 iface, UINT Level, D3DLOCKED_RECT *pLockedRect, CONST RECT *pRect, DWORD Flags) { static HRESULT WINAPI IDirect3DTexture8Impl_LockRect(LPDIRECT3DTEXTURE8 iface, UINT Level, D3DLOCKED_RECT *pLockedRect, CONST RECT *pRect, DWORD Flags) {
@ -357,7 +361,7 @@ HRESULT texture_init(IDirect3DTexture8Impl *texture, IDirect3DDevice8Impl *devic
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_CreateTexture(device->WineD3DDevice, width, height, levels, hr = IWineD3DDevice_CreateTexture(device->WineD3DDevice, width, height, levels,
usage & WINED3DUSAGE_MASK, wined3dformat_from_d3dformat(format), pool, usage & WINED3DUSAGE_MASK, wined3dformat_from_d3dformat(format), pool,
&texture->wineD3DTexture, (IUnknown *)texture, &d3d8_texture_wined3d_parent_ops); texture, &d3d8_texture_wined3d_parent_ops, &texture->wineD3DTexture);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
if (FAILED(hr)) if (FAILED(hr))
{ {

View File

@ -271,9 +271,8 @@ HRESULT vertexbuffer_init(IDirect3DVertexBuffer8Impl *buffer, IDirect3DDevice8Im
buffer->fvf = fvf; buffer->fvf = fvf;
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_CreateVertexBuffer(device->WineD3DDevice, size, hr = IWineD3DDevice_CreateVertexBuffer(device->WineD3DDevice, size, usage & WINED3DUSAGE_MASK,
usage & WINED3DUSAGE_MASK, (WINED3DPOOL)pool, &buffer->wineD3DVertexBuffer, (WINED3DPOOL)pool, buffer, &d3d8_vertexbuffer_wined3d_parent_ops, &buffer->wineD3DVertexBuffer);
(IUnknown *)buffer, &d3d8_vertexbuffer_wined3d_parent_ops);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
if (FAILED(hr)) if (FAILED(hr))
{ {

View File

@ -399,9 +399,8 @@ HRESULT vertexdeclaration_init(IDirect3DVertexDeclaration8Impl *declaration,
memcpy(declaration->elements, elements, declaration->elements_size); memcpy(declaration->elements, elements, declaration->elements_size);
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_CreateVertexDeclaration(device->WineD3DDevice, &declaration->wined3d_vertex_declaration, hr = IWineD3DDevice_CreateVertexDeclaration(device->WineD3DDevice, wined3d_elements, wined3d_element_count,
(IUnknown *)declaration, &d3d8_vertexdeclaration_wined3d_parent_ops, declaration, &d3d8_vertexdeclaration_wined3d_parent_ops, &declaration->wined3d_vertex_declaration);
wined3d_elements, wined3d_element_count);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
HeapFree(GetProcessHeap(), 0, wined3d_elements); HeapFree(GetProcessHeap(), 0, wined3d_elements);
if (FAILED(hr)) if (FAILED(hr))
@ -425,9 +424,8 @@ HRESULT vertexdeclaration_init_fvf(IDirect3DVertexDeclaration8Impl *declaration,
declaration->elements_size = 0; declaration->elements_size = 0;
declaration->shader_handle = fvf; declaration->shader_handle = fvf;
hr = IWineD3DDevice_CreateVertexDeclarationFromFVF(device->WineD3DDevice, hr = IWineD3DDevice_CreateVertexDeclarationFromFVF(device->WineD3DDevice, fvf, declaration,
&declaration->wined3d_vertex_declaration, (IUnknown *)declaration, &d3d8_vertexdeclaration_wined3d_parent_ops, &declaration->wined3d_vertex_declaration);
&d3d8_vertexdeclaration_wined3d_parent_ops, fvf);
if (FAILED(hr)) if (FAILED(hr))
{ {
WARN("Failed to create wined3d vertex declaration, hr %#x.\n", hr); WARN("Failed to create wined3d vertex declaration, hr %#x.\n", hr);

View File

@ -169,9 +169,8 @@ HRESULT vertexshader_init(IDirect3DVertexShader8Impl *shader, IDirect3DDevice8Im
if (usage) FIXME("Usage %#x not implemented.\n", usage); if (usage) FIXME("Usage %#x not implemented.\n", usage);
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_CreateVertexShader(device->WineD3DDevice, byte_code, hr = IWineD3DDevice_CreateVertexShader(device->WineD3DDevice, byte_code, NULL /* output signature */,
NULL /* output signature */, &shader->wineD3DVertexShader, shader, &d3d8_vertexshader_wined3d_parent_ops, &shader->wineD3DVertexShader);
(IUnknown *)shader, &d3d8_vertexshader_wined3d_parent_ops);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
if (FAILED(hr)) if (FAILED(hr))
{ {

View File

@ -264,7 +264,7 @@ HRESULT volume_init(IDirect3DVolume8Impl *volume, IDirect3DDevice8Impl *device,
volume->ref = 1; volume->ref = 1;
hr = IWineD3DDevice_CreateVolume(device->WineD3DDevice, width, height, depth, usage, hr = IWineD3DDevice_CreateVolume(device->WineD3DDevice, width, height, depth, usage,
format, pool, &volume->wineD3DVolume, (IUnknown *)volume, &d3d8_volume_wined3d_parent_ops); format, pool, volume, &d3d8_volume_wined3d_parent_ops, &volume->wineD3DVolume);
if (FAILED(hr)) if (FAILED(hr))
{ {
WARN("Failed to create wined3d volume, hr %#x.\n", hr); WARN("Failed to create wined3d volume, hr %#x.\n", hr);

View File

@ -251,22 +251,26 @@ static HRESULT WINAPI IDirect3DVolumeTexture8Impl_GetLevelDesc(LPDIRECT3DVOLUMET
return hr; return hr;
} }
static HRESULT WINAPI IDirect3DVolumeTexture8Impl_GetVolumeLevel(LPDIRECT3DVOLUMETEXTURE8 iface, UINT Level, IDirect3DVolume8 **ppVolumeLevel) { static HRESULT WINAPI IDirect3DVolumeTexture8Impl_GetVolumeLevel(IDirect3DVolumeTexture8 *iface,
UINT Level, IDirect3DVolume8 **ppVolumeLevel)
{
IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface; IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface;
HRESULT hrc = D3D_OK;
IWineD3DVolume *myVolume = NULL; IWineD3DVolume *myVolume = NULL;
HRESULT hr;
TRACE("iface %p, level %u, volume %p.\n", iface, Level, ppVolumeLevel); TRACE("iface %p, level %u, volume %p.\n", iface, Level, ppVolumeLevel);
wined3d_mutex_lock(); wined3d_mutex_lock();
hrc = IWineD3DVolumeTexture_GetVolumeLevel(This->wineD3DVolumeTexture, Level, &myVolume); hr = IWineD3DVolumeTexture_GetVolumeLevel(This->wineD3DVolumeTexture, Level, &myVolume);
if (hrc == D3D_OK && NULL != ppVolumeLevel) { if (SUCCEEDED(hr) && ppVolumeLevel)
IWineD3DVolumeTexture_GetParent(myVolume, (IUnknown **)ppVolumeLevel); {
IWineD3DVolumeTexture_Release(myVolume); *ppVolumeLevel = IWineD3DVolumeTexture_GetParent(myVolume);
IDirect3DVolume8_AddRef(*ppVolumeLevel);
IWineD3DVolumeTexture_Release(myVolume);
} }
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hrc; return hr;
} }
static HRESULT WINAPI IDirect3DVolumeTexture8Impl_LockBox(LPDIRECT3DVOLUMETEXTURE8 iface, UINT Level, D3DLOCKED_BOX *pLockedVolume, CONST D3DBOX *pBox, DWORD Flags) { static HRESULT WINAPI IDirect3DVolumeTexture8Impl_LockBox(LPDIRECT3DVOLUMETEXTURE8 iface, UINT Level, D3DLOCKED_BOX *pLockedVolume, CONST D3DBOX *pBox, DWORD Flags) {
@ -356,8 +360,8 @@ HRESULT volumetexture_init(IDirect3DVolumeTexture8Impl *texture, IDirect3DDevice
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_CreateVolumeTexture(device->WineD3DDevice, width, height, depth, levels, hr = IWineD3DDevice_CreateVolumeTexture(device->WineD3DDevice, width, height, depth, levels,
usage & WINED3DUSAGE_MASK, wined3dformat_from_d3dformat(format), pool, usage & WINED3DUSAGE_MASK, wined3dformat_from_d3dformat(format), pool, texture,
&texture->wineD3DVolumeTexture, (IUnknown *)texture, &d3d8_volumetexture_wined3d_parent_ops); &d3d8_volumetexture_wined3d_parent_ops, &texture->wineD3DVolumeTexture);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
if (FAILED(hr)) if (FAILED(hr))
{ {

View File

@ -292,22 +292,27 @@ static HRESULT WINAPI IDirect3DCubeTexture9Impl_GetLevelDesc(LPDIRECT3DCUBETEXTU
return hr; return hr;
} }
static HRESULT WINAPI IDirect3DCubeTexture9Impl_GetCubeMapSurface(LPDIRECT3DCUBETEXTURE9 iface, D3DCUBEMAP_FACES FaceType, UINT Level, IDirect3DSurface9** ppCubeMapSurface) { static HRESULT WINAPI IDirect3DCubeTexture9Impl_GetCubeMapSurface(IDirect3DCubeTexture9 *iface,
D3DCUBEMAP_FACES FaceType, UINT Level, IDirect3DSurface9 **ppCubeMapSurface)
{
IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
HRESULT hrc = D3D_OK;
IWineD3DSurface *mySurface = NULL; IWineD3DSurface *mySurface = NULL;
HRESULT hr;
TRACE("iface %p, face %#x, level %u, surface %p.\n", iface, FaceType, Level, ppCubeMapSurface); TRACE("iface %p, face %#x, level %u, surface %p.\n", iface, FaceType, Level, ppCubeMapSurface);
wined3d_mutex_lock(); wined3d_mutex_lock();
hrc = IWineD3DCubeTexture_GetCubeMapSurface(This->wineD3DCubeTexture, (WINED3DCUBEMAP_FACES) FaceType, Level, &mySurface); hr = IWineD3DCubeTexture_GetCubeMapSurface(This->wineD3DCubeTexture,
if (hrc == D3D_OK && NULL != ppCubeMapSurface) { (WINED3DCUBEMAP_FACES)FaceType, Level, &mySurface);
IWineD3DCubeTexture_GetParent(mySurface, (IUnknown **)ppCubeMapSurface); if (SUCCEEDED(hr) && ppCubeMapSurface)
IWineD3DCubeTexture_Release(mySurface); {
*ppCubeMapSurface = IWineD3DCubeTexture_GetParent(mySurface);
IDirect3DSurface9_AddRef(*ppCubeMapSurface);
IWineD3DCubeTexture_Release(mySurface);
} }
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hrc; return hr;
} }
static HRESULT WINAPI IDirect3DCubeTexture9Impl_LockRect(LPDIRECT3DCUBETEXTURE9 iface, D3DCUBEMAP_FACES FaceType, UINT Level, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) { static HRESULT WINAPI IDirect3DCubeTexture9Impl_LockRect(LPDIRECT3DCUBETEXTURE9 iface, D3DCUBEMAP_FACES FaceType, UINT Level, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) {
@ -399,9 +404,9 @@ HRESULT cubetexture_init(IDirect3DCubeTexture9Impl *texture, IDirect3DDevice9Imp
texture->ref = 1; texture->ref = 1;
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_CreateCubeTexture(device->WineD3DDevice, edge_length, levels, usage, hr = IWineD3DDevice_CreateCubeTexture(device->WineD3DDevice, edge_length,
wined3dformat_from_d3dformat(format), pool, &texture->wineD3DCubeTexture, levels, usage, wined3dformat_from_d3dformat(format), pool, texture,
(IUnknown *)texture, &d3d9_cubetexture_wined3d_parent_ops); &d3d9_cubetexture_wined3d_parent_ops, &texture->wineD3DCubeTexture);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
if (FAILED(hr)) if (FAILED(hr))
{ {

View File

@ -187,8 +187,9 @@ static ULONG WINAPI D3D9CB_DestroySwapChain(IWineD3DSwapChain *swapchain)
TRACE("swapchain %p.\n", swapchain); TRACE("swapchain %p.\n", swapchain);
IWineD3DSwapChain_GetParent(swapchain, (IUnknown **)&parent); parent = IWineD3DSwapChain_GetParent(swapchain);
parent->isImplicit = FALSE; parent->isImplicit = FALSE;
IDirect3DSwapChain9_AddRef((IDirect3DSwapChain9 *)parent);
return IDirect3DSwapChain9_Release((IDirect3DSwapChain9 *)parent); return IDirect3DSwapChain9_Release((IDirect3DSwapChain9 *)parent);
} }
@ -337,7 +338,8 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetDirect3D(LPDIRECT3DDEVICE9EX iface
hr = IWineD3DDevice_GetDirect3D(This->WineD3DDevice, &pWineD3D); hr = IWineD3DDevice_GetDirect3D(This->WineD3DDevice, &pWineD3D);
if (hr == D3D_OK && pWineD3D != NULL) if (hr == D3D_OK && pWineD3D != NULL)
{ {
IWineD3D_GetParent(pWineD3D,(IUnknown **)ppD3D9); *ppD3D9 = IWineD3D_GetParent(pWineD3D);
IDirect3D9_AddRef(*ppD3D9);
IWineD3D_Release(pWineD3D); IWineD3D_Release(pWineD3D);
} else { } else {
FIXME("Call to IWineD3DDevice_GetDirect3D failed\n"); FIXME("Call to IWineD3DDevice_GetDirect3D failed\n");
@ -495,7 +497,7 @@ static HRESULT WINAPI reset_enum_callback(IWineD3DResource *resource, void *data
WINED3DPOOL pool; WINED3DPOOL pool;
IDirect3DResource9 *parent; IDirect3DResource9 *parent;
IWineD3DResource_GetParent(resource, (IUnknown **) &parent); parent = IWineD3DResource_GetParent(resource);
type = IDirect3DResource9_GetType(parent); type = IDirect3DResource9_GetType(parent);
switch(type) { switch(type) {
case D3DRTYPE_SURFACE: case D3DRTYPE_SURFACE:
@ -526,16 +528,17 @@ static HRESULT WINAPI reset_enum_callback(IWineD3DResource *resource, void *data
break; break;
} }
if(pool == WINED3DPOOL_DEFAULT) { if (pool == WINED3DPOOL_DEFAULT)
if(IUnknown_Release(parent) == 0) { {
IDirect3DResource9_AddRef(parent);
if (IUnknown_Release(parent) == 0)
{
TRACE("Parent %p is an implicit resource with ref 0\n", parent); TRACE("Parent %p is an implicit resource with ref 0\n", parent);
} else { } else {
WARN("Resource %p(wineD3D %p) with pool D3DPOOL_DEFAULT blocks the Reset call\n", parent, resource); WARN("Resource %p(wineD3D %p) with pool D3DPOOL_DEFAULT blocks the Reset call\n", parent, resource);
ret = S_FALSE; ret = S_FALSE;
*resources_ok = FALSE; *resources_ok = FALSE;
} }
} else {
IUnknown_Release(parent);
} }
IWineD3DResource_Release(resource); IWineD3DResource_Release(resource);
@ -635,23 +638,28 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_Present(LPDIRECT3D
return hr; return hr;
} }
static HRESULT WINAPI IDirect3DDevice9Impl_GetBackBuffer(LPDIRECT3DDEVICE9EX iface, UINT iSwapChain, UINT BackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface9 ** ppBackBuffer) { static HRESULT WINAPI IDirect3DDevice9Impl_GetBackBuffer(IDirect3DDevice9Ex *iface,
UINT iSwapChain, UINT BackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface9 **ppBackBuffer)
{
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
IWineD3DSurface *retSurface = NULL; IWineD3DSurface *retSurface = NULL;
HRESULT rc = D3D_OK; HRESULT hr;
TRACE("iface %p, swapchain %u, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n", TRACE("iface %p, swapchain %u, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n",
iface, iSwapChain, BackBuffer, Type, ppBackBuffer); iface, iSwapChain, BackBuffer, Type, ppBackBuffer);
wined3d_mutex_lock(); wined3d_mutex_lock();
rc = IWineD3DDevice_GetBackBuffer(This->WineD3DDevice, iSwapChain, BackBuffer, (WINED3DBACKBUFFER_TYPE) Type, &retSurface); hr = IWineD3DDevice_GetBackBuffer(This->WineD3DDevice, iSwapChain,
if (rc == D3D_OK && NULL != retSurface && NULL != ppBackBuffer) { BackBuffer, (WINED3DBACKBUFFER_TYPE) Type, &retSurface);
IWineD3DSurface_GetParent(retSurface, (IUnknown **)ppBackBuffer); if (SUCCEEDED(hr) && retSurface && ppBackBuffer)
{
*ppBackBuffer = IWineD3DSurface_GetParent(retSurface);
IDirect3DSurface9_AddRef(*ppBackBuffer);
IWineD3DSurface_Release(retSurface); IWineD3DSurface_Release(retSurface);
} }
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return rc; return hr;
} }
static HRESULT WINAPI IDirect3DDevice9Impl_GetRasterStatus(LPDIRECT3DDEVICE9EX iface, UINT iSwapChain, D3DRASTER_STATUS* pRasterStatus) { static HRESULT WINAPI IDirect3DDevice9Impl_GetRasterStatus(LPDIRECT3DDEVICE9EX iface, UINT iSwapChain, D3DRASTER_STATUS* pRasterStatus) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
@ -1096,7 +1104,9 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetRenderTarget(LPDIRECT3DDEVICE9EX
return hr; return hr;
} }
static HRESULT WINAPI IDirect3DDevice9Impl_GetRenderTarget(LPDIRECT3DDEVICE9EX iface, DWORD RenderTargetIndex, IDirect3DSurface9 **ppRenderTarget) { static HRESULT WINAPI IDirect3DDevice9Impl_GetRenderTarget(IDirect3DDevice9Ex *iface,
DWORD RenderTargetIndex, IDirect3DSurface9 **ppRenderTarget)
{
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
IWineD3DSurface *pRenderTarget; IWineD3DSurface *pRenderTarget;
HRESULT hr; HRESULT hr;
@ -1127,7 +1137,8 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetRenderTarget(LPDIRECT3DDEVICE9EX
} }
else else
{ {
IWineD3DSurface_GetParent(pRenderTarget, (IUnknown **)ppRenderTarget); *ppRenderTarget = IWineD3DSurface_GetParent(pRenderTarget);
IDirect3DSurface9_AddRef(*ppRenderTarget);
IWineD3DSurface_Release(pRenderTarget); IWineD3DSurface_Release(pRenderTarget);
} }
@ -1152,10 +1163,12 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetDepthStencilSurface(LPDIRECT3DDE
return hr; return hr;
} }
static HRESULT WINAPI IDirect3DDevice9Impl_GetDepthStencilSurface(LPDIRECT3DDEVICE9EX iface, IDirect3DSurface9 **ppZStencilSurface) { static HRESULT WINAPI IDirect3DDevice9Impl_GetDepthStencilSurface(IDirect3DDevice9Ex *iface,
IDirect3DSurface9 **ppZStencilSurface)
{
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
HRESULT hr = D3D_OK;
IWineD3DSurface *pZStencilSurface; IWineD3DSurface *pZStencilSurface;
HRESULT hr;
TRACE("iface %p, depth_stencil %p.\n", iface, ppZStencilSurface); TRACE("iface %p, depth_stencil %p.\n", iface, ppZStencilSurface);
@ -1165,10 +1178,14 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetDepthStencilSurface(LPDIRECT3DDE
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_GetDepthStencilSurface(This->WineD3DDevice,&pZStencilSurface); hr = IWineD3DDevice_GetDepthStencilSurface(This->WineD3DDevice,&pZStencilSurface);
if (hr == WINED3D_OK) { if (SUCCEEDED(hr))
IWineD3DSurface_GetParent(pZStencilSurface,(IUnknown**)ppZStencilSurface); {
*ppZStencilSurface = IWineD3DSurface_GetParent(pZStencilSurface);
IDirect3DSurface9_AddRef(*ppZStencilSurface);
IWineD3DSurface_Release(pZStencilSurface); IWineD3DSurface_Release(pZStencilSurface);
} else { }
else
{
if (hr != WINED3DERR_NOTFOUND) if (hr != WINED3DERR_NOTFOUND)
WARN("Call to IWineD3DDevice_GetDepthStencilSurface failed with 0x%08x\n", hr); WARN("Call to IWineD3DDevice_GetDepthStencilSurface failed with 0x%08x\n", hr);
*ppZStencilSurface = NULL; *ppZStencilSurface = NULL;
@ -1540,10 +1557,12 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetClipStatus(LPDIRECT3DDEVICE9EX i
return hr; return hr;
} }
static HRESULT WINAPI IDirect3DDevice9Impl_GetTexture(LPDIRECT3DDEVICE9EX iface, DWORD Stage, IDirect3DBaseTexture9 **ppTexture) { static HRESULT WINAPI IDirect3DDevice9Impl_GetTexture(IDirect3DDevice9Ex *iface,
DWORD Stage, IDirect3DBaseTexture9 **ppTexture)
{
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
IWineD3DBaseTexture *retTexture = NULL; IWineD3DBaseTexture *retTexture = NULL;
HRESULT rc = D3D_OK; HRESULT hr;
TRACE("iface %p, stage %u, texture %p.\n", iface, Stage, ppTexture); TRACE("iface %p, stage %u, texture %p.\n", iface, Stage, ppTexture);
@ -1552,19 +1571,24 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetTexture(LPDIRECT3DDEVICE9EX ifac
} }
wined3d_mutex_lock(); wined3d_mutex_lock();
rc = IWineD3DDevice_GetTexture(This->WineD3DDevice, Stage, &retTexture); hr = IWineD3DDevice_GetTexture(This->WineD3DDevice, Stage, &retTexture);
if (SUCCEEDED(rc) && NULL != retTexture) { if (SUCCEEDED(hr) && retTexture)
IWineD3DBaseTexture_GetParent(retTexture, (IUnknown **)ppTexture); {
*ppTexture = IWineD3DBaseTexture_GetParent(retTexture);
IWineD3DBaseTexture_AddRef(*ppTexture);
IWineD3DBaseTexture_Release(retTexture); IWineD3DBaseTexture_Release(retTexture);
} else { }
if(FAILED(rc)) { else
{
if (FAILED(hr))
{
WARN("Call to get texture (%d) failed (%p)\n", Stage, retTexture); WARN("Call to get texture (%d) failed (%p)\n", Stage, retTexture);
} }
*ppTexture = NULL; *ppTexture = NULL;
} }
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return rc; return hr;
} }
static HRESULT WINAPI IDirect3DDevice9Impl_SetTexture(LPDIRECT3DDEVICE9EX iface, DWORD Stage, IDirect3DBaseTexture9* pTexture) { static HRESULT WINAPI IDirect3DDevice9Impl_SetTexture(LPDIRECT3DDEVICE9EX iface, DWORD Stage, IDirect3DBaseTexture9* pTexture) {
@ -2110,10 +2134,12 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetStreamSource(LPDIRECT3DDEVICE9EX i
return hr; return hr;
} }
static HRESULT WINAPI IDirect3DDevice9Impl_GetStreamSource(LPDIRECT3DDEVICE9EX iface, UINT StreamNumber, IDirect3DVertexBuffer9 **pStream, UINT* OffsetInBytes, UINT* pStride) { static HRESULT WINAPI IDirect3DDevice9Impl_GetStreamSource(IDirect3DDevice9Ex *iface,
UINT StreamNumber, IDirect3DVertexBuffer9 **pStream, UINT* OffsetInBytes, UINT* pStride)
{
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
IWineD3DBuffer *retStream = NULL; IWineD3DBuffer *retStream = NULL;
HRESULT rc = D3D_OK; HRESULT hr;
TRACE("iface %p, stream_idx %u, buffer %p, offset %p, stride %p.\n", TRACE("iface %p, stream_idx %u, buffer %p, offset %p, stride %p.\n",
iface, StreamNumber, pStream, OffsetInBytes, pStride); iface, StreamNumber, pStream, OffsetInBytes, pStride);
@ -2123,19 +2149,24 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetStreamSource(LPDIRECT3DDEVICE9EX i
} }
wined3d_mutex_lock(); wined3d_mutex_lock();
rc = IWineD3DDevice_GetStreamSource(This->WineD3DDevice, StreamNumber, &retStream, OffsetInBytes, pStride); hr = IWineD3DDevice_GetStreamSource(This->WineD3DDevice, StreamNumber, &retStream, OffsetInBytes, pStride);
if (rc == D3D_OK && NULL != retStream) { if (SUCCEEDED(hr) && retStream)
IWineD3DBuffer_GetParent(retStream, (IUnknown **)pStream); {
*pStream = IWineD3DBuffer_GetParent(retStream);
IDirect3DVertexBuffer9_AddRef(*pStream);
IWineD3DBuffer_Release(retStream); IWineD3DBuffer_Release(retStream);
}else{ }
if (rc != D3D_OK){ else
{
if (FAILED(hr))
{
FIXME("Call to GetStreamSource failed %p %p\n", OffsetInBytes, pStride); FIXME("Call to GetStreamSource failed %p %p\n", OffsetInBytes, pStride);
} }
*pStream = NULL; *pStream = NULL;
} }
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return rc; return hr;
} }
static HRESULT WINAPI IDirect3DDevice9Impl_SetStreamSourceFreq(IDirect3DDevice9Ex *iface, UINT StreamNumber, static HRESULT WINAPI IDirect3DDevice9Impl_SetStreamSourceFreq(IDirect3DDevice9Ex *iface, UINT StreamNumber,
@ -2182,10 +2213,11 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetIndices(LPDIRECT3DDEVICE9EX ifac
return hr; return hr;
} }
static HRESULT WINAPI IDirect3DDevice9Impl_GetIndices(LPDIRECT3DDEVICE9EX iface, IDirect3DIndexBuffer9 **ppIndexData) { static HRESULT WINAPI IDirect3DDevice9Impl_GetIndices(IDirect3DDevice9Ex *iface, IDirect3DIndexBuffer9 **ppIndexData)
{
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
IWineD3DBuffer *retIndexData = NULL; IWineD3DBuffer *retIndexData = NULL;
HRESULT rc = D3D_OK; HRESULT hr;
TRACE("iface %p, buffer %p.\n", iface, ppIndexData); TRACE("iface %p, buffer %p.\n", iface, ppIndexData);
@ -2194,17 +2226,21 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetIndices(LPDIRECT3DDEVICE9EX ifac
} }
wined3d_mutex_lock(); wined3d_mutex_lock();
rc = IWineD3DDevice_GetIndexBuffer(This->WineD3DDevice, &retIndexData); hr = IWineD3DDevice_GetIndexBuffer(This->WineD3DDevice, &retIndexData);
if (SUCCEEDED(rc) && retIndexData) { if (SUCCEEDED(hr) && retIndexData)
IWineD3DBuffer_GetParent(retIndexData, (IUnknown **)ppIndexData); {
*ppIndexData = IWineD3DBuffer_GetParent(retIndexData);
IDirect3DIndexBuffer9_AddRef(*ppIndexData);
IWineD3DBuffer_Release(retIndexData); IWineD3DBuffer_Release(retIndexData);
} else { }
if (FAILED(rc)) FIXME("Call to GetIndices failed\n"); else
{
if (FAILED(hr)) FIXME("Call to GetIndices failed\n");
*ppIndexData = NULL; *ppIndexData = NULL;
} }
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return rc; return hr;
} }
static HRESULT WINAPI IDirect3DDevice9Impl_CreatePixelShader(IDirect3DDevice9Ex *iface, static HRESULT WINAPI IDirect3DDevice9Impl_CreatePixelShader(IDirect3DDevice9Ex *iface,

View File

@ -270,9 +270,8 @@ HRESULT indexbuffer_init(IDirect3DIndexBuffer9Impl *buffer, IDirect3DDevice9Impl
buffer->format = wined3dformat_from_d3dformat(format); buffer->format = wined3dformat_from_d3dformat(format);
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_CreateIndexBuffer(device->WineD3DDevice, size, hr = IWineD3DDevice_CreateIndexBuffer(device->WineD3DDevice, size, usage & WINED3DUSAGE_MASK,
usage & WINED3DUSAGE_MASK, (WINED3DPOOL)pool, &buffer->wineD3DIndexBuffer, (WINED3DPOOL)pool, buffer, &d3d9_indexbuffer_wined3d_parent_ops, &buffer->wineD3DIndexBuffer);
(IUnknown *)buffer, &d3d9_indexbuffer_wined3d_parent_ops);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
if (FAILED(hr)) if (FAILED(hr))
{ {

View File

@ -136,9 +136,8 @@ HRESULT pixelshader_init(IDirect3DPixelShader9Impl *shader, IDirect3DDevice9Impl
shader->lpVtbl = &Direct3DPixelShader9_Vtbl; shader->lpVtbl = &Direct3DPixelShader9_Vtbl;
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_CreatePixelShader(device->WineD3DDevice, byte_code, hr = IWineD3DDevice_CreatePixelShader(device->WineD3DDevice, byte_code, NULL, shader,
NULL, &shader->wineD3DPixelShader, (IUnknown *)shader, &d3d9_pixelshader_wined3d_parent_ops, &shader->wineD3DPixelShader);
&d3d9_pixelshader_wined3d_parent_ops);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
if (FAILED(hr)) if (FAILED(hr))
{ {
@ -165,10 +164,11 @@ HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShader(LPDIRECT3DDEVICE9EX iface, ID
return D3D_OK; return D3D_OK;
} }
HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShader(LPDIRECT3DDEVICE9EX iface, IDirect3DPixelShader9** ppShader) { HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShader(IDirect3DDevice9Ex *iface, IDirect3DPixelShader9 **ppShader)
{
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
IWineD3DPixelShader *object; IWineD3DPixelShader *object;
HRESULT hrc; HRESULT hr;
TRACE("iface %p, shader %p.\n", iface, ppShader); TRACE("iface %p, shader %p.\n", iface, ppShader);
@ -178,12 +178,13 @@ HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShader(LPDIRECT3DDEVICE9EX iface, ID
} }
wined3d_mutex_lock(); wined3d_mutex_lock();
hrc = IWineD3DDevice_GetPixelShader(This->WineD3DDevice, &object); hr = IWineD3DDevice_GetPixelShader(This->WineD3DDevice, &object);
if (SUCCEEDED(hrc)) if (SUCCEEDED(hr))
{ {
if (object) if (object)
{ {
hrc = IWineD3DPixelShader_GetParent(object, (IUnknown **)ppShader); *ppShader = IWineD3DPixelShader_GetParent(object);
IDirect3DPixelShader9_AddRef(*ppShader);
IWineD3DPixelShader_Release(object); IWineD3DPixelShader_Release(object);
} }
else else
@ -193,12 +194,12 @@ HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShader(LPDIRECT3DDEVICE9EX iface, ID
} }
else else
{ {
WARN("(%p) : Call to IWineD3DDevice_GetPixelShader failed %u (device %p)\n", This, hrc, This->WineD3DDevice); WARN("Failed to get pixel shader, hr %#x.\n", hr);
} }
wined3d_mutex_unlock(); wined3d_mutex_unlock();
TRACE("(%p) : returning %p\n", This, *ppShader); TRACE("Returning %p.\n", *ppShader);
return hrc; return hr;
} }
HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantF(LPDIRECT3DDEVICE9EX iface, UINT Register, CONST float* pConstantData, UINT Vector4fCount) { HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantF(LPDIRECT3DDEVICE9EX iface, UINT Register, CONST float* pConstantData, UINT Vector4fCount) {

View File

@ -403,9 +403,8 @@ HRESULT surface_init(IDirect3DSurface9Impl *surface, IDirect3DDevice9Impl *devic
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_CreateSurface(device->WineD3DDevice, width, height, wined3dformat_from_d3dformat(format), hr = IWineD3DDevice_CreateSurface(device->WineD3DDevice, width, height, wined3dformat_from_d3dformat(format),
lockable, discard, level, &surface->wineD3DSurface, usage & WINED3DUSAGE_MASK, (WINED3DPOOL)pool, lockable, discard, level, usage & WINED3DUSAGE_MASK, (WINED3DPOOL)pool, multisample_type,
multisample_type, multisample_quality, SURFACE_OPENGL, (IUnknown *)surface, multisample_quality, SURFACE_OPENGL, surface, &d3d9_surface_wined3d_parent_ops, &surface->wineD3DSurface);
&d3d9_surface_wined3d_parent_ops);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
if (FAILED(hr)) if (FAILED(hr))
{ {

View File

@ -106,24 +106,29 @@ static HRESULT WINAPI IDirect3DSwapChain9Impl_GetFrontBufferData(LPDIRECT3DSWAPC
return hr; return hr;
} }
static HRESULT WINAPI IDirect3DSwapChain9Impl_GetBackBuffer(LPDIRECT3DSWAPCHAIN9 iface, UINT iBackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface9** ppBackBuffer) { static HRESULT WINAPI IDirect3DSwapChain9Impl_GetBackBuffer(IDirect3DSwapChain9 *iface,
UINT iBackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface9 **ppBackBuffer)
{
IDirect3DSwapChain9Impl *This = (IDirect3DSwapChain9Impl *)iface; IDirect3DSwapChain9Impl *This = (IDirect3DSwapChain9Impl *)iface;
HRESULT hrc = D3D_OK;
IWineD3DSurface *mySurface = NULL; IWineD3DSurface *mySurface = NULL;
HRESULT hr;
TRACE("iface %p, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n", TRACE("iface %p, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n",
iface, iBackBuffer, Type, ppBackBuffer); iface, iBackBuffer, Type, ppBackBuffer);
wined3d_mutex_lock(); wined3d_mutex_lock();
hrc = IWineD3DSwapChain_GetBackBuffer(This->wineD3DSwapChain, iBackBuffer, (WINED3DBACKBUFFER_TYPE) Type, &mySurface); hr = IWineD3DSwapChain_GetBackBuffer(This->wineD3DSwapChain, iBackBuffer,
if (hrc == D3D_OK && NULL != mySurface) { (WINED3DBACKBUFFER_TYPE)Type, &mySurface);
IWineD3DSurface_GetParent(mySurface, (IUnknown **)ppBackBuffer); if (SUCCEEDED(hr) && mySurface)
{
*ppBackBuffer = IWineD3DSurface_GetParent(mySurface);
IDirect3DSurface9_AddRef(*ppBackBuffer);
IWineD3DSurface_Release(mySurface); IWineD3DSurface_Release(mySurface);
} }
wined3d_mutex_unlock(); wined3d_mutex_unlock();
/* Do not touch the **ppBackBuffer pointer otherwise! (see device test) */ /* Do not touch the **ppBackBuffer pointer otherwise! (see device test) */
return hrc; return hr;
} }
static HRESULT WINAPI IDirect3DSwapChain9Impl_GetRasterStatus(LPDIRECT3DSWAPCHAIN9 iface, D3DRASTER_STATUS* pRasterStatus) { static HRESULT WINAPI IDirect3DSwapChain9Impl_GetRasterStatus(LPDIRECT3DSWAPCHAIN9 iface, D3DRASTER_STATUS* pRasterStatus) {
@ -239,7 +244,7 @@ HRESULT swapchain_init(IDirect3DSwapChain9Impl *swapchain, IDirect3DDevice9Impl
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_CreateSwapChain(device->WineD3DDevice, &wined3d_parameters, hr = IWineD3DDevice_CreateSwapChain(device->WineD3DDevice, &wined3d_parameters,
&swapchain->wineD3DSwapChain, (IUnknown *)swapchain, SURFACE_OPENGL); SURFACE_OPENGL, swapchain, &swapchain->wineD3DSwapChain);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
present_parameters->BackBufferWidth = wined3d_parameters.BackBufferWidth; present_parameters->BackBufferWidth = wined3d_parameters.BackBufferWidth;
@ -269,25 +274,31 @@ HRESULT swapchain_init(IDirect3DSwapChain9Impl *swapchain, IDirect3DDevice9Impl
return D3D_OK; return D3D_OK;
} }
HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_GetSwapChain(LPDIRECT3DDEVICE9EX iface, UINT iSwapChain, IDirect3DSwapChain9** pSwapChain) { HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_GetSwapChain(IDirect3DDevice9Ex *iface,
UINT iSwapChain, IDirect3DSwapChain9 **pSwapChain)
{
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
HRESULT hrc = D3D_OK;
IWineD3DSwapChain *swapchain = NULL; IWineD3DSwapChain *swapchain = NULL;
HRESULT hr;
TRACE("iface %p, swapchain_idx %u, swapchain %p.\n", TRACE("iface %p, swapchain_idx %u, swapchain %p.\n",
iface, iSwapChain, pSwapChain); iface, iSwapChain, pSwapChain);
wined3d_mutex_lock(); wined3d_mutex_lock();
hrc = IWineD3DDevice_GetSwapChain(This->WineD3DDevice, iSwapChain, &swapchain); hr = IWineD3DDevice_GetSwapChain(This->WineD3DDevice, iSwapChain, &swapchain);
if (hrc == D3D_OK && NULL != swapchain) { if (SUCCEEDED(hr) && swapchain)
IWineD3DSwapChain_GetParent(swapchain, (IUnknown **)pSwapChain); {
*pSwapChain = IWineD3DSwapChain_GetParent(swapchain);
IDirect3DSwapChain9_AddRef(*pSwapChain);
IWineD3DSwapChain_Release(swapchain); IWineD3DSwapChain_Release(swapchain);
} else { }
else
{
*pSwapChain = NULL; *pSwapChain = NULL;
} }
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hrc; return hr;
} }
UINT WINAPI IDirect3DDevice9Impl_GetNumberOfSwapChains(LPDIRECT3DDEVICE9EX iface) { UINT WINAPI IDirect3DDevice9Impl_GetNumberOfSwapChains(LPDIRECT3DDEVICE9EX iface) {

View File

@ -289,22 +289,26 @@ static HRESULT WINAPI IDirect3DTexture9Impl_GetLevelDesc(LPDIRECT3DTEXTURE9 ifac
return hr; return hr;
} }
static HRESULT WINAPI IDirect3DTexture9Impl_GetSurfaceLevel(LPDIRECT3DTEXTURE9 iface, UINT Level, IDirect3DSurface9** ppSurfaceLevel) { static HRESULT WINAPI IDirect3DTexture9Impl_GetSurfaceLevel(IDirect3DTexture9 *iface,
UINT Level, IDirect3DSurface9 **ppSurfaceLevel)
{
IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface;
HRESULT hrc = D3D_OK;
IWineD3DSurface *mySurface = NULL; IWineD3DSurface *mySurface = NULL;
HRESULT hr;
TRACE("iface %p, level %u, surface %p.\n", iface, Level, ppSurfaceLevel); TRACE("iface %p, level %u, surface %p.\n", iface, Level, ppSurfaceLevel);
wined3d_mutex_lock(); wined3d_mutex_lock();
hrc = IWineD3DTexture_GetSurfaceLevel(This->wineD3DTexture, Level, &mySurface); hr = IWineD3DTexture_GetSurfaceLevel(This->wineD3DTexture, Level, &mySurface);
if (hrc == D3D_OK && NULL != ppSurfaceLevel) { if (SUCCEEDED(hr) && ppSurfaceLevel)
IWineD3DSurface_GetParent(mySurface, (IUnknown **)ppSurfaceLevel); {
IWineD3DSurface_Release(mySurface); *ppSurfaceLevel = IWineD3DSurface_GetParent(mySurface);
IDirect3DSurface9_AddRef(*ppSurfaceLevel);
IWineD3DSurface_Release(mySurface);
} }
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hrc; return hr;
} }
static HRESULT WINAPI IDirect3DTexture9Impl_LockRect(LPDIRECT3DTEXTURE9 iface, UINT Level, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) { static HRESULT WINAPI IDirect3DTexture9Impl_LockRect(LPDIRECT3DTEXTURE9 iface, UINT Level, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) {
@ -398,7 +402,7 @@ HRESULT texture_init(IDirect3DTexture9Impl *texture, IDirect3DDevice9Impl *devic
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_CreateTexture(device->WineD3DDevice, width, height, levels, hr = IWineD3DDevice_CreateTexture(device->WineD3DDevice, width, height, levels,
usage & WINED3DUSAGE_MASK, wined3dformat_from_d3dformat(format), pool, usage & WINED3DUSAGE_MASK, wined3dformat_from_d3dformat(format), pool,
&texture->wineD3DTexture, (IUnknown *)texture, &d3d9_texture_wined3d_parent_ops); texture, &d3d9_texture_wined3d_parent_ops, &texture->wineD3DTexture);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
if (FAILED(hr)) if (FAILED(hr))
{ {

View File

@ -272,9 +272,8 @@ HRESULT vertexbuffer_init(IDirect3DVertexBuffer9Impl *buffer, IDirect3DDevice9Im
buffer->fvf = fvf; buffer->fvf = fvf;
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_CreateVertexBuffer(device->WineD3DDevice, size, hr = IWineD3DDevice_CreateVertexBuffer(device->WineD3DDevice, size, usage & WINED3DUSAGE_MASK,
usage & WINED3DUSAGE_MASK, (WINED3DPOOL)pool, &buffer->wineD3DVertexBuffer, (WINED3DPOOL)pool, buffer, &d3d9_vertexbuffer_wined3d_parent_ops, &buffer->wineD3DVertexBuffer);
(IUnknown *)buffer, &d3d9_vertexbuffer_wined3d_parent_ops);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
if (FAILED(hr)) if (FAILED(hr))
{ {

View File

@ -395,9 +395,8 @@ HRESULT vertexdeclaration_init(IDirect3DVertexDeclaration9Impl *declaration,
declaration->element_count = element_count; declaration->element_count = element_count;
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_CreateVertexDeclaration(device->WineD3DDevice, &declaration->wineD3DVertexDeclaration, hr = IWineD3DDevice_CreateVertexDeclaration(device->WineD3DDevice, wined3d_elements, wined3d_element_count,
(IUnknown *)declaration, &d3d9_vertexdeclaration_wined3d_parent_ops, declaration, &d3d9_vertexdeclaration_wined3d_parent_ops, &declaration->wineD3DVertexDeclaration);
wined3d_elements, wined3d_element_count);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
HeapFree(GetProcessHeap(), 0, wined3d_elements); HeapFree(GetProcessHeap(), 0, wined3d_elements);
if (FAILED(hr)) if (FAILED(hr))
@ -427,29 +426,31 @@ HRESULT WINAPI IDirect3DDevice9Impl_SetVertexDeclaration(LPDIRECT3DDEVICE9EX i
return hr; return hr;
} }
HRESULT WINAPI IDirect3DDevice9Impl_GetVertexDeclaration(LPDIRECT3DDEVICE9EX iface, IDirect3DVertexDeclaration9** ppDecl) { HRESULT WINAPI IDirect3DDevice9Impl_GetVertexDeclaration(IDirect3DDevice9Ex *iface,
IDirect3DDevice9Impl* This = (IDirect3DDevice9Impl*) iface; IDirect3DVertexDeclaration9 **declaration)
IWineD3DVertexDeclaration* pTest = NULL; {
HRESULT hr = D3D_OK; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
IWineD3DVertexDeclaration *wined3d_declaration = NULL;
HRESULT hr;
TRACE("iface %p, declaration %p.\n", iface, ppDecl); TRACE("iface %p, declaration %p.\n", iface, declaration);
if (NULL == ppDecl) { if (!declaration) return D3DERR_INVALIDCALL;
return D3DERR_INVALIDCALL;
}
*ppDecl = NULL;
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_GetVertexDeclaration(This->WineD3DDevice, &pTest); hr = IWineD3DDevice_GetVertexDeclaration(This->WineD3DDevice, &wined3d_declaration);
if (hr == D3D_OK && NULL != pTest) { if (SUCCEEDED(hr) && wined3d_declaration)
IWineD3DVertexDeclaration_GetParent(pTest, (IUnknown **)ppDecl); {
IWineD3DVertexDeclaration_Release(pTest); *declaration = IWineD3DVertexDeclaration_GetParent(wined3d_declaration);
} else { IDirect3DVertexDeclaration9_AddRef(*declaration);
*ppDecl = NULL; IWineD3DVertexDeclaration_Release(wined3d_declaration);
}
else
{
*declaration = NULL;
} }
wined3d_mutex_unlock(); wined3d_mutex_unlock();
TRACE("(%p) : returning %p\n", This, *ppDecl); TRACE("Returning %p.\n", *declaration);
return hr; return hr;
} }

View File

@ -136,9 +136,8 @@ HRESULT vertexshader_init(IDirect3DVertexShader9Impl *shader, IDirect3DDevice9Im
shader->lpVtbl = &Direct3DVertexShader9_Vtbl; shader->lpVtbl = &Direct3DVertexShader9_Vtbl;
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_CreateVertexShader(device->WineD3DDevice, byte_code, hr = IWineD3DDevice_CreateVertexShader(device->WineD3DDevice, byte_code, NULL,
NULL /* output signature */, &shader->wineD3DVertexShader, shader, &d3d9_vertexshader_wined3d_parent_ops, &shader->wineD3DVertexShader);
(IUnknown *)shader, &d3d9_vertexshader_wined3d_parent_ops);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
if (FAILED(hr)) if (FAILED(hr))
{ {
@ -166,20 +165,22 @@ HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShader(LPDIRECT3DDEVICE9EX iface, I
return hrc; return hrc;
} }
HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShader(LPDIRECT3DDEVICE9EX iface, IDirect3DVertexShader9** ppShader) { HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShader(LPDIRECT3DDEVICE9EX iface, IDirect3DVertexShader9 **ppShader)
{
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
IWineD3DVertexShader *pShader; IWineD3DVertexShader *pShader;
HRESULT hrc = D3D_OK; HRESULT hr;
TRACE("iface %p, shader %p.\n", iface, ppShader); TRACE("iface %p, shader %p.\n", iface, ppShader);
wined3d_mutex_lock(); wined3d_mutex_lock();
hrc = IWineD3DDevice_GetVertexShader(This->WineD3DDevice, &pShader); hr = IWineD3DDevice_GetVertexShader(This->WineD3DDevice, &pShader);
if (SUCCEEDED(hrc)) if (SUCCEEDED(hr))
{ {
if (pShader) if (pShader)
{ {
hrc = IWineD3DVertexShader_GetParent(pShader, (IUnknown **)ppShader); *ppShader = IWineD3DVertexShader_GetParent(pShader);
IDirect3DVertexShader9_AddRef(*ppShader);
IWineD3DVertexShader_Release(pShader); IWineD3DVertexShader_Release(pShader);
} }
else else
@ -189,12 +190,13 @@ HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShader(LPDIRECT3DDEVICE9EX iface, I
} }
else else
{ {
WARN("(%p) : Call to IWineD3DDevice_GetVertexShader failed %u (device %p)\n", This, hrc, This->WineD3DDevice); WARN("Failed to get vertex shader, hr %#x.\n", hr);
} }
wined3d_mutex_unlock(); wined3d_mutex_unlock();
TRACE("(%p) : returning %p\n", This, *ppShader); TRACE("Returning %p.\n", *ppShader);
return hrc;
return hr;
} }
HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantF(LPDIRECT3DDEVICE9EX iface, UINT Register, CONST float* pConstantData, UINT Vector4fCount) { HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantF(LPDIRECT3DDEVICE9EX iface, UINT Register, CONST float* pConstantData, UINT Vector4fCount) {

View File

@ -275,7 +275,7 @@ HRESULT volume_init(IDirect3DVolume9Impl *volume, IDirect3DDevice9Impl *device,
volume->ref = 1; volume->ref = 1;
hr = IWineD3DDevice_CreateVolume(device->WineD3DDevice, width, height, depth, usage & WINED3DUSAGE_MASK, hr = IWineD3DDevice_CreateVolume(device->WineD3DDevice, width, height, depth, usage & WINED3DUSAGE_MASK,
format, pool, &volume->wineD3DVolume, (IUnknown *)volume, &d3d9_volume_wined3d_parent_ops); format, pool, volume, &d3d9_volume_wined3d_parent_ops, &volume->wineD3DVolume);
if (FAILED(hr)) if (FAILED(hr))
{ {
WARN("Failed to create wined3d volume, hr %#x.\n", hr); WARN("Failed to create wined3d volume, hr %#x.\n", hr);

View File

@ -315,24 +315,28 @@ static HRESULT WINAPI IDirect3DVolumeTexture9Impl_GetLevelDesc(LPDIRECT3DVOLUMET
return hr; return hr;
} }
static HRESULT WINAPI IDirect3DVolumeTexture9Impl_GetVolumeLevel(LPDIRECT3DVOLUMETEXTURE9 iface, UINT Level, IDirect3DVolume9** ppVolumeLevel) { static HRESULT WINAPI IDirect3DVolumeTexture9Impl_GetVolumeLevel(IDirect3DVolumeTexture9 *iface,
UINT Level, IDirect3DVolume9 **ppVolumeLevel)
{
IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface;
HRESULT hrc = D3D_OK;
IWineD3DVolume *myVolume = NULL; IWineD3DVolume *myVolume = NULL;
HRESULT hr;
TRACE("iface %p, level %u, volume %p.\n", iface, Level, ppVolumeLevel); TRACE("iface %p, level %u, volume %p.\n", iface, Level, ppVolumeLevel);
wined3d_mutex_lock(); wined3d_mutex_lock();
hrc = IWineD3DVolumeTexture_GetVolumeLevel(This->wineD3DVolumeTexture, Level, &myVolume); hr = IWineD3DVolumeTexture_GetVolumeLevel(This->wineD3DVolumeTexture, Level, &myVolume);
if (hrc == D3D_OK && NULL != ppVolumeLevel) { if (SUCCEEDED(hr) && ppVolumeLevel)
IWineD3DVolumeTexture_GetParent(myVolume, (IUnknown **)ppVolumeLevel); {
*ppVolumeLevel = IWineD3DVolumeTexture_GetParent(myVolume);
IDirect3DVolumeTexture9_AddRef(*ppVolumeLevel);
IWineD3DVolumeTexture_Release(myVolume); IWineD3DVolumeTexture_Release(myVolume);
} }
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hrc; return hr;
} }
static HRESULT WINAPI IDirect3DVolumeTexture9Impl_LockBox(LPDIRECT3DVOLUMETEXTURE9 iface, UINT Level, D3DLOCKED_BOX* pLockedVolume, CONST D3DBOX* pBox, DWORD Flags) { static HRESULT WINAPI IDirect3DVolumeTexture9Impl_LockBox(LPDIRECT3DVOLUMETEXTURE9 iface, UINT Level, D3DLOCKED_BOX* pLockedVolume, CONST D3DBOX* pBox, DWORD Flags) {
@ -433,8 +437,8 @@ HRESULT volumetexture_init(IDirect3DVolumeTexture9Impl *texture, IDirect3DDevice
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_CreateVolumeTexture(device->WineD3DDevice, width, height, depth, levels, hr = IWineD3DDevice_CreateVolumeTexture(device->WineD3DDevice, width, height, depth, levels,
usage & WINED3DUSAGE_MASK, wined3dformat_from_d3dformat(format), pool, usage & WINED3DUSAGE_MASK, wined3dformat_from_d3dformat(format), pool, texture,
&texture->wineD3DVolumeTexture, (IUnknown *)texture, &d3d9_volumetexture_wined3d_parent_ops); &d3d9_volumetexture_wined3d_parent_ops, &texture->wineD3DVolumeTexture);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
if (FAILED(hr)) if (FAILED(hr))
{ {

View File

@ -1836,13 +1836,9 @@ static HRESULT WINAPI ddraw7_GetGDISurface(IDirectDraw7 *iface, IDirectDrawSurfa
return DDERR_NOTFOUND; return DDERR_NOTFOUND;
} }
/* GetBackBuffer AddRef()ed the surface, release it */ ddsurf = IWineD3DSurface_GetParent(Surf);
IWineD3DSurface_Release(Surf); IWineD3DSurface_Release(Surf);
IWineD3DSurface_GetParent(Surf,
(IUnknown **) &ddsurf);
IDirectDrawSurface7_Release(ddsurf); /* For the GetParent */
/* Find the front buffer */ /* Find the front buffer */
ddsCaps.dwCaps = DDSCAPS_FRONTBUFFER; ddsCaps.dwCaps = DDSCAPS_FRONTBUFFER;
hr = IDirectDrawSurface7_GetAttachedSurface(ddsurf, hr = IDirectDrawSurface7_GetAttachedSurface(ddsurf,
@ -2249,7 +2245,8 @@ static HRESULT WINAPI ddraw7_GetSurfaceFromDC(IDirectDraw7 *iface, HDC hdc, IDir
return DDERR_NOTFOUND; return DDERR_NOTFOUND;
} }
IWineD3DSurface_GetParent(wined3d_surface, (IUnknown **)Surface); *Surface = IWineD3DSurface_GetParent(wined3d_surface);
IDirectDrawSurface7_AddRef(*Surface);
TRACE("Returning surface %p.\n", Surface); TRACE("Returning surface %p.\n", Surface);
return DD_OK; return DD_OK;
} }
@ -2359,9 +2356,9 @@ HRESULT WINAPI ddraw_recreate_surfaces_cb(IDirectDrawSurface7 *surf, DDSURFACEDE
{ {
IDirectDrawSurfaceImpl *surfImpl = (IDirectDrawSurfaceImpl *)surf; IDirectDrawSurfaceImpl *surfImpl = (IDirectDrawSurfaceImpl *)surf;
IDirectDrawImpl *This = surfImpl->ddraw; IDirectDrawImpl *This = surfImpl->ddraw;
IUnknown *Parent;
IWineD3DSurface *wineD3DSurface; IWineD3DSurface *wineD3DSurface;
IWineD3DSwapChain *swapchain; IWineD3DSwapChain *swapchain;
void *parent;
HRESULT hr; HRESULT hr;
IWineD3DClipper *clipper = NULL; IWineD3DClipper *clipper = NULL;
@ -2403,13 +2400,10 @@ HRESULT WINAPI ddraw_recreate_surfaces_cb(IDirectDrawSurface7 *surf, DDSURFACEDE
Width = Desc.width; Width = Desc.width;
Height = Desc.height; Height = Desc.height;
IWineD3DSurface_GetParent(wineD3DSurface, &Parent); parent = IWineD3DSurface_GetParent(wineD3DSurface);
hr = IWineD3DDevice_CreateSurface(This->wineD3DDevice, Width, Height, Format, TRUE /* Lockable */,
/* Create the new surface */ FALSE /* Discard */, surfImpl->mipmap_level, Usage, Pool, MultiSampleType, MultiSampleQuality,
hr = IWineD3DDevice_CreateSurface(This->wineD3DDevice, Width, Height, Format, This->ImplType, parent, &ddraw_null_wined3d_parent_ops, &surfImpl->WineD3DSurface);
TRUE /* Lockable */, FALSE /* Discard */, surfImpl->mipmap_level, &surfImpl->WineD3DSurface, Usage, Pool,
MultiSampleType, MultiSampleQuality, This->ImplType, Parent, &ddraw_null_wined3d_parent_ops);
IUnknown_Release(Parent);
if (FAILED(hr)) if (FAILED(hr))
{ {
surfImpl->WineD3DSurface = wineD3DSurface; surfImpl->WineD3DSurface = wineD3DSurface;
@ -2475,13 +2469,13 @@ static HRESULT ddraw_recreate_surfaces(IDirectDrawImpl *This)
return IDirectDraw7_EnumSurfaces((IDirectDraw7 *)This, 0, &desc, This, ddraw_recreate_surfaces_cb); return IDirectDraw7_EnumSurfaces((IDirectDraw7 *)This, 0, &desc, This, ddraw_recreate_surfaces_cb);
} }
ULONG WINAPI D3D7CB_DestroySwapChain(IWineD3DSwapChain *pSwapChain) { ULONG WINAPI D3D7CB_DestroySwapChain(IWineD3DSwapChain *pSwapChain)
IUnknown* swapChainParent; {
IUnknown *swapChainParent;
TRACE("swapchain %p.\n", pSwapChain); TRACE("swapchain %p.\n", pSwapChain);
IWineD3DSwapChain_GetParent(pSwapChain, &swapChainParent); swapChainParent = IWineD3DSwapChain_GetParent(pSwapChain);
IUnknown_Release(swapChainParent);
return IUnknown_Release(swapChainParent); return IUnknown_Release(swapChainParent);
} }
@ -3295,15 +3289,15 @@ static HRESULT WINAPI ddraw7_CreateSurface(IDirectDraw7 *iface,
*/ */
if(desc2.ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP) if(desc2.ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP)
{ {
hr = IWineD3DDevice_CreateCubeTexture(This->wineD3DDevice, DDSD->dwWidth /* Edgelength */, hr = IWineD3DDevice_CreateCubeTexture(This->wineD3DDevice, DDSD->dwWidth /* Edgelength */, levels,
levels, 0 /* usage */, Format, Pool, (IWineD3DCubeTexture **)&object->wineD3DTexture, 0 /* usage */, Format, Pool, object, &ddraw_null_wined3d_parent_ops,
(IUnknown *)object, &ddraw_null_wined3d_parent_ops); (IWineD3DCubeTexture **)&object->wineD3DTexture);
} }
else else
{ {
hr = IWineD3DDevice_CreateTexture(This->wineD3DDevice, DDSD->dwWidth, DDSD->dwHeight, levels, hr = IWineD3DDevice_CreateTexture(This->wineD3DDevice, DDSD->dwWidth, DDSD->dwHeight, levels,
0 /* usage */, Format, Pool, (IWineD3DTexture **)&object->wineD3DTexture, 0 /* usage */, Format, Pool, object, &ddraw_null_wined3d_parent_ops,
(IUnknown *)object, &ddraw_null_wined3d_parent_ops); (IWineD3DTexture **)&object->wineD3DTexture);
} }
This->tex_root = NULL; This->tex_root = NULL;
} }
@ -5375,8 +5369,8 @@ IWineD3DVertexDeclaration *ddraw_find_decl(IDirectDrawImpl *This, DWORD fvf)
} }
TRACE("not found. Creating and inserting at position %d.\n", low); TRACE("not found. Creating and inserting at position %d.\n", low);
hr = IWineD3DDevice_CreateVertexDeclarationFromFVF(This->wineD3DDevice, &pDecl, hr = IWineD3DDevice_CreateVertexDeclarationFromFVF(This->wineD3DDevice,
(IUnknown *)This, &ddraw_null_wined3d_parent_ops, fvf); fvf, This, &ddraw_null_wined3d_parent_ops, &pDecl);
if (hr != S_OK) return NULL; if (hr != S_OK) return NULL;
if(This->declArraySize == This->numConvertedDecls) { if(This->declArraySize == This->numConvertedDecls) {
@ -5644,7 +5638,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDevicePar
ddraw_parent_init(object); ddraw_parent_init(object);
hr = IWineD3DDevice_CreateSwapChain(This->wineD3DDevice, present_parameters, hr = IWineD3DDevice_CreateSwapChain(This->wineD3DDevice, present_parameters,
swapchain, (IUnknown *)object, This->ImplType); This->ImplType, object, swapchain);
if (FAILED(hr)) if (FAILED(hr))
{ {
FIXME("(%p) CreateSwapChain failed, returning %#x\n", iface, hr); FIXME("(%p) CreateSwapChain failed, returning %#x\n", iface, hr);

View File

@ -300,10 +300,8 @@ IDirect3DDeviceImpl_7_Release(IDirect3DDevice7 *iface)
EnterCriticalSection(&ddraw_cs); EnterCriticalSection(&ddraw_cs);
/* Free the index buffer. */ /* Free the index buffer. */
IWineD3DDevice_SetIndexBuffer(This->wineD3DDevice, NULL, WINED3DFMT_UNKNOWN); IWineD3DDevice_SetIndexBuffer(This->wineD3DDevice, NULL, WINED3DFMT_UNKNOWN);
IWineD3DBuffer_GetParent(This->indexbuffer, IndexBufferParent = IWineD3DBuffer_GetParent(This->indexbuffer);
(IUnknown **) &IndexBufferParent); if (IParent_Release(IndexBufferParent))
IParent_Release(IndexBufferParent); /* Once for the getParent */
if( IParent_Release(IndexBufferParent) != 0) /* And now to destroy it */
{ {
ERR(" (%p) Something is still holding the index buffer parent %p\n", This, IndexBufferParent); ERR(" (%p) Something is still holding the index buffer parent %p\n", This, IndexBufferParent);
} }
@ -2556,24 +2554,13 @@ IDirect3DDeviceImpl_3_GetRenderState(IDirect3DDevice3 *iface,
EnterCriticalSection(&ddraw_cs); EnterCriticalSection(&ddraw_cs);
hr = IWineD3DDevice_GetTexture(This->wineD3DDevice, hr = IWineD3DDevice_GetTexture(This->wineD3DDevice, 0, &tex);
0, if (SUCCEEDED(hr) && tex)
&tex);
if(hr == WINED3D_OK && tex)
{ {
IDirectDrawSurface7 *parent = NULL; /* The parent of the texture is the IDirectDrawSurface7
hr = IWineD3DBaseTexture_GetParent(tex, * interface of the ddraw surface. */
(IUnknown **) &parent); IDirectDrawSurfaceImpl *parent = IWineD3DBaseTexture_GetParent(tex);
if(parent) if (parent) *lpdwRenderState = parent->Handle;
{
/* The parent of the texture is the IDirectDrawSurface7 interface
* of the ddraw surface
*/
IDirectDrawSurfaceImpl *texImpl = (IDirectDrawSurfaceImpl *)parent;
*lpdwRenderState = texImpl->Handle;
IDirectDrawSurface7_Release(parent);
}
IWineD3DBaseTexture_Release(tex); IWineD3DBaseTexture_Release(tex);
} }
@ -4353,18 +4340,16 @@ IDirect3DDeviceImpl_7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface,
{ {
UINT size = max(desc.Size * 2, IndexCount * sizeof(WORD)); UINT size = max(desc.Size * 2, IndexCount * sizeof(WORD));
IWineD3DBuffer *buffer; IWineD3DBuffer *buffer;
IUnknown *parent; IParentImpl *parent;
TRACE("Growing index buffer to %u bytes\n", size); TRACE("Growing index buffer to %u bytes\n", size);
IWineD3DBuffer_GetParent(This->indexbuffer, &parent); parent = IWineD3DBuffer_GetParent(This->indexbuffer);
hr = IWineD3DDevice_CreateIndexBuffer(This->wineD3DDevice, size, hr = IWineD3DDevice_CreateIndexBuffer(This->wineD3DDevice, size, WINED3DUSAGE_DYNAMIC /* Usage */,
WINED3DUSAGE_DYNAMIC /* Usage */, WINED3DPOOL_DEFAULT, &buffer, parent, WINED3DPOOL_DEFAULT, parent, &ddraw_null_wined3d_parent_ops, &buffer);
&ddraw_null_wined3d_parent_ops); if (FAILED(hr))
if(hr != D3D_OK)
{ {
ERR("(%p) IWineD3DDevice::CreateIndexBuffer failed with hr = %08x\n", This, hr); ERR("(%p) IWineD3DDevice::CreateIndexBuffer failed with hr = %08x\n", This, hr);
IParent_Release(parent);
LeaveCriticalSection(&ddraw_cs); LeaveCriticalSection(&ddraw_cs);
return hr; return hr;
} }
@ -4372,8 +4357,7 @@ IDirect3DDeviceImpl_7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface,
IWineD3DBuffer_Release(This->indexbuffer); IWineD3DBuffer_Release(This->indexbuffer);
This->indexbuffer = buffer; This->indexbuffer = buffer;
((IParentImpl *)parent)->child = (IUnknown *)buffer; parent->child = (IUnknown *)buffer;
IParent_Release(parent);
} }
/* copy the index stream into the index buffer. /* copy the index stream into the index buffer.
@ -4649,11 +4633,8 @@ IDirect3DDeviceImpl_7_GetTexture(IDirect3DDevice7 *iface,
return hr; return hr;
} }
/* GetParent AddRef()s, which is perfectly OK. *Texture = IWineD3DBaseTexture_GetParent(Surf);
* We have passed the IDirectDrawSurface7 interface to WineD3D, so that's OK too. IDirectDrawSurface7_AddRef(*Texture);
*/
hr = IWineD3DBaseTexture_GetParent(Surf,
(IUnknown **) Texture);
LeaveCriticalSection(&ddraw_cs); LeaveCriticalSection(&ddraw_cs);
return hr; return hr;
} }
@ -7014,8 +6995,8 @@ HRESULT d3d_device_init(IDirect3DDeviceImpl *device, IDirectDrawImpl *ddraw, IDi
ddraw_parent_init(index_buffer_parent); ddraw_parent_init(index_buffer_parent);
hr = IWineD3DDevice_CreateIndexBuffer(ddraw->wineD3DDevice, 0x40000 /* Length. Don't know how long it should be */, hr = IWineD3DDevice_CreateIndexBuffer(ddraw->wineD3DDevice, 0x40000 /* Length. Don't know how long it should be */,
WINED3DUSAGE_DYNAMIC /* Usage */, WINED3DPOOL_DEFAULT, &device->indexbuffer, WINED3DUSAGE_DYNAMIC /* Usage */, WINED3DPOOL_DEFAULT, index_buffer_parent,
(IUnknown *)index_buffer_parent, &ddraw_null_wined3d_parent_ops); &ddraw_null_wined3d_parent_ops, &device->indexbuffer);
if (FAILED(hr)) if (FAILED(hr))
{ {
ERR("Failed to create an index buffer, hr %#x.\n", hr); ERR("Failed to create an index buffer, hr %#x.\n", hr);

View File

@ -268,7 +268,7 @@ HRESULT ddraw_palette_init(IDirectDrawPaletteImpl *palette,
palette->ref = 1; palette->ref = 1;
hr = IWineD3DDevice_CreatePalette(ddraw->wineD3DDevice, flags, hr = IWineD3DDevice_CreatePalette(ddraw->wineD3DDevice, flags,
entries, &palette->wineD3DPalette, (IUnknown *)palette); entries, palette, &palette->wineD3DPalette);
if (FAILED(hr)) if (FAILED(hr))
{ {
WARN("Failed to create wined3d palette, hr %#x.\n", hr); WARN("Failed to create wined3d palette, hr %#x.\n", hr);

View File

@ -2742,7 +2742,8 @@ static HRESULT WINAPI ddraw_surface7_GetPalette(IDirectDrawSurface7 *iface, IDir
if(wPal) if(wPal)
{ {
hr = IWineD3DPalette_GetParent(wPal, (IUnknown **) Pal); *Pal = IWineD3DPalette_GetParent(wPal);
IDirectDrawPalette_AddRef(*Pal);
} }
else else
{ {
@ -3251,16 +3252,7 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu
LeaveCriticalSection(&ddraw_cs); LeaveCriticalSection(&ddraw_cs);
return D3DERR_TEXTURE_LOAD_FAILED; return D3DERR_TEXTURE_LOAD_FAILED;
} }
if (wined3d_dst_pal) if (wined3d_dst_pal) dst_pal = IWineD3DPalette_GetParent(wined3d_dst_pal);
{
hr = IWineD3DPalette_GetParent(wined3d_dst_pal, (IUnknown **)&dst_pal);
if (FAILED(hr))
{
ERR("Failed to get destination palette parent, hr %#x.\n", hr);
LeaveCriticalSection(&ddraw_cs);
return D3DERR_TEXTURE_LOAD_FAILED;
}
}
hr = IWineD3DSurface_GetPalette(src_surface->WineD3DSurface, &wined3d_src_pal); hr = IWineD3DSurface_GetPalette(src_surface->WineD3DSurface, &wined3d_src_pal);
if (FAILED(hr)) if (FAILED(hr))
@ -3269,17 +3261,7 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu
LeaveCriticalSection(&ddraw_cs); LeaveCriticalSection(&ddraw_cs);
return D3DERR_TEXTURE_LOAD_FAILED; return D3DERR_TEXTURE_LOAD_FAILED;
} }
if (wined3d_src_pal) if (wined3d_src_pal) src_pal = IWineD3DPalette_GetParent(wined3d_src_pal);
{
hr = IWineD3DPalette_GetParent(wined3d_src_pal, (IUnknown **)&src_pal);
if (FAILED(hr))
{
ERR("Failed to get source palette parent, hr %#x.\n", hr);
if (dst_pal) IDirectDrawPalette_Release(dst_pal);
LeaveCriticalSection(&ddraw_cs);
return D3DERR_TEXTURE_LOAD_FAILED;
}
}
if (src_pal) if (src_pal)
{ {
@ -3287,7 +3269,6 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu
if (!dst_pal) if (!dst_pal)
{ {
IDirectDrawPalette_Release(src_pal);
LeaveCriticalSection(&ddraw_cs); LeaveCriticalSection(&ddraw_cs);
return DDERR_NOPALETTEATTACHED; return DDERR_NOPALETTEATTACHED;
} }
@ -3295,9 +3276,6 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu
IDirectDrawPalette_SetEntries(dst_pal, 0, 0, 256, palent); IDirectDrawPalette_SetEntries(dst_pal, 0, 0, 256, palent);
} }
if (dst_pal) IDirectDrawPalette_Release(dst_pal);
if (src_pal) IDirectDrawPalette_Release(src_pal);
/* Copy one surface on the other */ /* Copy one surface on the other */
dst_desc = (DDSURFACEDESC *)&(dst_surface->surface_desc); dst_desc = (DDSURFACEDESC *)&(dst_surface->surface_desc);
src_desc = (DDSURFACEDESC *)&(src_surface->surface_desc); src_desc = (DDSURFACEDESC *)&(src_surface->surface_desc);
@ -3600,9 +3578,9 @@ HRESULT ddraw_surface_init(IDirectDrawSurfaceImpl *surface, IDirectDrawImpl *ddr
surface->ImplType = surface_type; surface->ImplType = surface_type;
hr = IWineD3DDevice_CreateSurface(ddraw->wineD3DDevice, desc->dwWidth, desc->dwHeight, format, hr = IWineD3DDevice_CreateSurface(ddraw->wineD3DDevice, desc->dwWidth, desc->dwHeight, format,
TRUE /* Lockable */, FALSE /* Discard */, mip_level, &surface->WineD3DSurface, TRUE /* Lockable */, FALSE /* Discard */, mip_level, usage, pool,
usage, pool, WINED3DMULTISAMPLE_NONE, 0 /* MultiSampleQuality */, surface_type, WINED3DMULTISAMPLE_NONE, 0 /* MultiSampleQuality */, surface_type, surface,
(IUnknown *)surface, &ddraw_null_wined3d_parent_ops); &ddraw_null_wined3d_parent_ops, &surface->WineD3DSurface);
if (FAILED(hr)) if (FAILED(hr))
{ {
WARN("Failed to create wined3d surface, hr %#x.\n", hr); WARN("Failed to create wined3d surface, hr %#x.\n", hr);

View File

@ -605,7 +605,7 @@ HRESULT d3d_vertex_buffer_init(IDirect3DVertexBufferImpl *buffer,
hr = IWineD3DDevice_CreateVertexBuffer(ddraw->wineD3DDevice, hr = IWineD3DDevice_CreateVertexBuffer(ddraw->wineD3DDevice,
get_flexible_vertex_size(desc->dwFVF) * desc->dwNumVertices, get_flexible_vertex_size(desc->dwFVF) * desc->dwNumVertices,
usage, desc->dwCaps & D3DVBCAPS_SYSTEMMEMORY ? WINED3DPOOL_SYSTEMMEM : WINED3DPOOL_DEFAULT, usage, desc->dwCaps & D3DVBCAPS_SYSTEMMEMORY ? WINED3DPOOL_SYSTEMMEM : WINED3DPOOL_DEFAULT,
&buffer->wineD3DVertexBuffer, (IUnknown *)buffer, &ddraw_null_wined3d_parent_ops); buffer, &ddraw_null_wined3d_parent_ops, &buffer->wineD3DVertexBuffer);
if (FAILED(hr)) if (FAILED(hr))
{ {
WARN("Failed to create wined3d vertex buffer, hr %#x.\n", hr); WARN("Failed to create wined3d vertex buffer, hr %#x.\n", hr);

View File

@ -190,16 +190,9 @@ static HRESULT STDMETHODCALLTYPE dxgi_device_CreateSurface(IWineDXGIDevice *ifac
goto fail; goto fail;
} }
hr = IWineD3DSurface_GetParent(wined3d_surface, &parent); parent = IWineD3DSurface_GetParent(wined3d_surface);
IWineD3DSurface_Release(wined3d_surface);
if (FAILED(hr))
{
ERR("GetParent failed, returning %#x\n", hr);
goto fail;
}
hr = IUnknown_QueryInterface(parent, &IID_IDXGISurface, (void **)&surface[i]); hr = IUnknown_QueryInterface(parent, &IID_IDXGISurface, (void **)&surface[i]);
IUnknown_Release(parent); IWineD3DSurface_Release(wined3d_surface);
if (FAILED(hr)) if (FAILED(hr))
{ {
ERR("Surface should implement IDXGISurface\n"); ERR("Surface should implement IDXGISurface\n");

View File

@ -235,17 +235,11 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSwapChain(IWineDXGIFactory *
return hr; return hr;
} }
hr = IWineD3DSwapChain_GetParent(wined3d_swapchain, (IUnknown **)swapchain); swapchain = IWineD3DSwapChain_GetParent(wined3d_swapchain);
IUnknown_Release(wined3d_swapchain); IUnknown_Release(wined3d_swapchain);
if (FAILED(hr))
{
WARN("Failed to get swapchain, returning %#x\n", hr);
return hr;
}
/* FIXME? The swapchain is created with refcount 1 by the wined3d device, /* FIXME? The swapchain is created with refcount 1 by the wined3d device,
* but the wined3d device can't hold a real reference. */ * but the wined3d device can't hold a real reference. */
IUnknown_Release(*swapchain);
TRACE("Created IDXGISwapChain %p\n", *swapchain); TRACE("Created IDXGISwapChain %p\n", *swapchain);

View File

@ -174,16 +174,10 @@ static HRESULT STDMETHODCALLTYPE dxgi_swapchain_GetBuffer(IDXGISwapChain *iface,
return hr; return hr;
} }
hr = IWineD3DSurface_GetParent(backbuffer, &parent); parent = IWineD3DSurface_GetParent(backbuffer);
hr = IUnknown_QueryInterface(parent, riid, surface);
IWineD3DSurface_Release(backbuffer); IWineD3DSurface_Release(backbuffer);
LeaveCriticalSection(&dxgi_cs); LeaveCriticalSection(&dxgi_cs);
if (FAILED(hr))
{
return hr;
}
hr = IUnknown_QueryInterface(parent, riid, surface);
IUnknown_Release(parent);
return hr; return hr;
} }
@ -284,7 +278,7 @@ HRESULT dxgi_swapchain_init(struct dxgi_swapchain *swapchain, struct dxgi_device
swapchain->refcount = 1; swapchain->refcount = 1;
hr = IWineD3DDevice_CreateSwapChain(device->wined3d_device, present_parameters, hr = IWineD3DDevice_CreateSwapChain(device->wined3d_device, present_parameters,
&swapchain->wined3d_swapchain, (IUnknown *)swapchain, SURFACE_OPENGL); SURFACE_OPENGL, swapchain, &swapchain->wined3d_swapchain);
if (FAILED(hr)) if (FAILED(hr))
{ {
WARN("Failed to create wined3d swapchain, hr %#x.\n", hr); WARN("Failed to create wined3d swapchain, hr %#x.\n", hr);

View File

@ -29,7 +29,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_texture);
HRESULT basetexture_init(IWineD3DBaseTextureImpl *texture, UINT layer_count, UINT level_count, HRESULT basetexture_init(IWineD3DBaseTextureImpl *texture, UINT layer_count, UINT level_count,
WINED3DRESOURCETYPE resource_type, IWineD3DDeviceImpl *device, UINT size, DWORD usage, WINED3DRESOURCETYPE resource_type, IWineD3DDeviceImpl *device, UINT size, DWORD usage,
const struct wined3d_format *format, WINED3DPOOL pool, IUnknown *parent, const struct wined3d_format *format, WINED3DPOOL pool, void *parent,
const struct wined3d_parent_ops *parent_ops) const struct wined3d_parent_ops *parent_ops)
{ {
HRESULT hr; HRESULT hr;

View File

@ -744,10 +744,11 @@ static ULONG STDMETHODCALLTYPE buffer_Release(IWineD3DBuffer *iface)
} }
/* IWineD3DBase methods */ /* IWineD3DBase methods */
static void * STDMETHODCALLTYPE buffer_GetParent(IWineD3DBuffer *iface)
static HRESULT STDMETHODCALLTYPE buffer_GetParent(IWineD3DBuffer *iface, IUnknown **parent)
{ {
return resource_get_parent((IWineD3DResource *)iface, parent); TRACE("iface %p.\n", iface);
return ((struct wined3d_buffer *)iface)->resource.parent;
} }
/* IWineD3DResource methods */ /* IWineD3DResource methods */
@ -1448,7 +1449,7 @@ static const struct IWineD3DBufferVtbl wined3d_buffer_vtbl =
HRESULT buffer_init(struct wined3d_buffer *buffer, IWineD3DDeviceImpl *device, HRESULT buffer_init(struct wined3d_buffer *buffer, IWineD3DDeviceImpl *device,
UINT size, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool, GLenum bind_hint, UINT size, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool, GLenum bind_hint,
const char *data, IUnknown *parent, const struct wined3d_parent_ops *parent_ops) const char *data, void *parent, const struct wined3d_parent_ops *parent_ops)
{ {
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
const struct wined3d_format *format = wined3d_get_format(gl_info, format_id); const struct wined3d_format *format = wined3d_get_format(gl_info, format_id);

View File

@ -230,8 +230,11 @@ static WINED3DRESOURCETYPE WINAPI IWineD3DCubeTextureImpl_GetType(IWineD3DCubeTe
return resource_get_type((IWineD3DResource *)iface); return resource_get_type((IWineD3DResource *)iface);
} }
static HRESULT WINAPI IWineD3DCubeTextureImpl_GetParent(IWineD3DCubeTexture *iface, IUnknown **pParent) { static void * WINAPI IWineD3DCubeTextureImpl_GetParent(IWineD3DCubeTexture *iface)
return resource_get_parent((IWineD3DResource *)iface, pParent); {
TRACE("iface %p.\n", iface);
return ((IWineD3DCubeTextureImpl *)iface)->resource.parent;
} }
/* ****************************************************** /* ******************************************************
@ -452,7 +455,7 @@ static const IWineD3DCubeTextureVtbl IWineD3DCubeTexture_Vtbl =
HRESULT cubetexture_init(IWineD3DCubeTextureImpl *texture, UINT edge_length, UINT levels, HRESULT cubetexture_init(IWineD3DCubeTextureImpl *texture, UINT edge_length, UINT levels,
IWineD3DDeviceImpl *device, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool, IWineD3DDeviceImpl *device, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool,
IUnknown *parent, const struct wined3d_parent_ops *parent_ops) void *parent, const struct wined3d_parent_ops *parent_ops)
{ {
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
const struct wined3d_format *format = wined3d_get_format(gl_info, format_id); const struct wined3d_format *format = wined3d_get_format(gl_info, format_id);

View File

@ -886,7 +886,7 @@ static ULONG WINAPI IWineD3DDeviceImpl_Release(IWineD3DDevice *iface) {
} }
static HRESULT WINAPI IWineD3DDeviceImpl_CreateBuffer(IWineD3DDevice *iface, struct wined3d_buffer_desc *desc, static HRESULT WINAPI IWineD3DDeviceImpl_CreateBuffer(IWineD3DDevice *iface, struct wined3d_buffer_desc *desc,
const void *data, IUnknown *parent, const struct wined3d_parent_ops *parent_ops, IWineD3DBuffer **buffer) const void *data, void *parent, const struct wined3d_parent_ops *parent_ops, IWineD3DBuffer **buffer)
{ {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
struct wined3d_buffer *object; struct wined3d_buffer *object;
@ -921,8 +921,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateBuffer(IWineD3DDevice *iface, str
} }
static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexBuffer(IWineD3DDevice *iface, static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexBuffer(IWineD3DDevice *iface,
UINT Size, DWORD Usage, WINED3DPOOL Pool, IWineD3DBuffer **ppVertexBuffer, UINT Size, DWORD Usage, WINED3DPOOL Pool, void *parent,
IUnknown *parent, const struct wined3d_parent_ops *parent_ops) const struct wined3d_parent_ops *parent_ops, IWineD3DBuffer **ppVertexBuffer)
{ {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
struct wined3d_buffer *object; struct wined3d_buffer *object;
@ -965,8 +965,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexBuffer(IWineD3DDevice *ifac
} }
static HRESULT WINAPI IWineD3DDeviceImpl_CreateIndexBuffer(IWineD3DDevice *iface, static HRESULT WINAPI IWineD3DDeviceImpl_CreateIndexBuffer(IWineD3DDevice *iface,
UINT Length, DWORD Usage, WINED3DPOOL Pool, IWineD3DBuffer **ppIndexBuffer, UINT Length, DWORD Usage, WINED3DPOOL Pool, void *parent,
IUnknown *parent, const struct wined3d_parent_ops *parent_ops) const struct wined3d_parent_ops *parent_ops, IWineD3DBuffer **ppIndexBuffer)
{ {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
struct wined3d_buffer *object; struct wined3d_buffer *object;
@ -1029,9 +1029,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateStateBlock(IWineD3DDevice *iface,
} }
static HRESULT WINAPI IWineD3DDeviceImpl_CreateSurface(IWineD3DDevice *iface, UINT Width, UINT Height, static HRESULT WINAPI IWineD3DDeviceImpl_CreateSurface(IWineD3DDevice *iface, UINT Width, UINT Height,
enum wined3d_format_id Format, BOOL Lockable, BOOL Discard, UINT Level, IWineD3DSurface **surface, enum wined3d_format_id Format, BOOL Lockable, BOOL Discard, UINT Level, DWORD Usage, WINED3DPOOL Pool,
DWORD Usage, WINED3DPOOL Pool, WINED3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, WINED3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, WINED3DSURFTYPE Impl,
WINED3DSURFTYPE Impl, IUnknown *parent, const struct wined3d_parent_ops *parent_ops) void *parent, const struct wined3d_parent_ops *parent_ops, IWineD3DSurface **surface)
{ {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DSurfaceImpl *object; IWineD3DSurfaceImpl *object;
@ -1073,7 +1073,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateSurface(IWineD3DDevice *iface, UI
} }
static HRESULT WINAPI IWineD3DDeviceImpl_CreateRendertargetView(IWineD3DDevice *iface, static HRESULT WINAPI IWineD3DDeviceImpl_CreateRendertargetView(IWineD3DDevice *iface,
IWineD3DResource *resource, IUnknown *parent, IWineD3DRendertargetView **rendertarget_view) IWineD3DResource *resource, void *parent, IWineD3DRendertargetView **rendertarget_view)
{ {
struct wined3d_rendertarget_view *object; struct wined3d_rendertarget_view *object;
@ -1097,7 +1097,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateRendertargetView(IWineD3DDevice *
static HRESULT WINAPI IWineD3DDeviceImpl_CreateTexture(IWineD3DDevice *iface, static HRESULT WINAPI IWineD3DDeviceImpl_CreateTexture(IWineD3DDevice *iface,
UINT Width, UINT Height, UINT Levels, DWORD Usage, enum wined3d_format_id Format, WINED3DPOOL Pool, UINT Width, UINT Height, UINT Levels, DWORD Usage, enum wined3d_format_id Format, WINED3DPOOL Pool,
IWineD3DTexture **ppTexture, IUnknown *parent, const struct wined3d_parent_ops *parent_ops) void *parent, const struct wined3d_parent_ops *parent_ops, IWineD3DTexture **ppTexture)
{ {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DTextureImpl *object; IWineD3DTextureImpl *object;
@ -1133,7 +1133,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateTexture(IWineD3DDevice *iface,
static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolumeTexture(IWineD3DDevice *iface, static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolumeTexture(IWineD3DDevice *iface,
UINT Width, UINT Height, UINT Depth, UINT Levels, DWORD Usage, enum wined3d_format_id Format, WINED3DPOOL Pool, UINT Width, UINT Height, UINT Depth, UINT Levels, DWORD Usage, enum wined3d_format_id Format, WINED3DPOOL Pool,
IWineD3DVolumeTexture **ppVolumeTexture, IUnknown *parent, const struct wined3d_parent_ops *parent_ops) void *parent, const struct wined3d_parent_ops *parent_ops, IWineD3DVolumeTexture **ppVolumeTexture)
{ {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DVolumeTextureImpl *object; IWineD3DVolumeTextureImpl *object;
@ -1166,8 +1166,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolumeTexture(IWineD3DDevice *ifa
} }
static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolume(IWineD3DDevice *iface, UINT Width, UINT Height, static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolume(IWineD3DDevice *iface, UINT Width, UINT Height,
UINT Depth, DWORD Usage, enum wined3d_format_id Format, WINED3DPOOL Pool, IWineD3DVolume **ppVolume, UINT Depth, DWORD Usage, enum wined3d_format_id Format, WINED3DPOOL Pool, void *parent,
IUnknown *parent, const struct wined3d_parent_ops *parent_ops) const struct wined3d_parent_ops *parent_ops, IWineD3DVolume **ppVolume)
{ {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DVolumeImpl *object; IWineD3DVolumeImpl *object;
@ -1199,8 +1199,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolume(IWineD3DDevice *iface, UIN
} }
static HRESULT WINAPI IWineD3DDeviceImpl_CreateCubeTexture(IWineD3DDevice *iface, UINT EdgeLength, UINT Levels, static HRESULT WINAPI IWineD3DDeviceImpl_CreateCubeTexture(IWineD3DDevice *iface, UINT EdgeLength, UINT Levels,
DWORD Usage, enum wined3d_format_id Format, WINED3DPOOL Pool, IWineD3DCubeTexture **ppCubeTexture, DWORD Usage, enum wined3d_format_id Format, WINED3DPOOL Pool, void *parent,
IUnknown *parent, const struct wined3d_parent_ops *parent_ops) const struct wined3d_parent_ops *parent_ops, IWineD3DCubeTexture **ppCubeTexture)
{ {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DCubeTextureImpl *object; /** NOTE: impl ref allowed since this is a create function **/ IWineD3DCubeTextureImpl *object; /** NOTE: impl ref allowed since this is a create function **/
@ -1260,8 +1260,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateQuery(IWineD3DDevice *iface,
} }
static HRESULT WINAPI IWineD3DDeviceImpl_CreateSwapChain(IWineD3DDevice *iface, static HRESULT WINAPI IWineD3DDeviceImpl_CreateSwapChain(IWineD3DDevice *iface,
WINED3DPRESENT_PARAMETERS *present_parameters, IWineD3DSwapChain **swapchain, WINED3DPRESENT_PARAMETERS *present_parameters, WINED3DSURFTYPE surface_type,
IUnknown *parent, WINED3DSURFTYPE surface_type) void *parent, IWineD3DSwapChain **swapchain)
{ {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DSwapChainImpl *object; IWineD3DSwapChainImpl *object;
@ -1316,8 +1316,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetSwapChain(IWineD3DDevice *iface, U
} }
static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexDeclaration(IWineD3DDevice *iface, static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexDeclaration(IWineD3DDevice *iface,
IWineD3DVertexDeclaration **declaration, IUnknown *parent, const struct wined3d_parent_ops *parent_ops, const WINED3DVERTEXELEMENT *elements, UINT element_count, void *parent,
const WINED3DVERTEXELEMENT *elements, UINT element_count) const struct wined3d_parent_ops *parent_ops, IWineD3DVertexDeclaration **declaration)
{ {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DVertexDeclarationImpl *object = NULL; IWineD3DVertexDeclarationImpl *object = NULL;
@ -1485,8 +1485,8 @@ static unsigned int ConvertFvfToDeclaration(IWineD3DDeviceImpl *This, /* For the
} }
static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexDeclarationFromFVF(IWineD3DDevice *iface, static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexDeclarationFromFVF(IWineD3DDevice *iface,
IWineD3DVertexDeclaration **declaration, IUnknown *parent, DWORD fvf, void *parent, const struct wined3d_parent_ops *parent_ops,
const struct wined3d_parent_ops *parent_ops, DWORD fvf) IWineD3DVertexDeclaration **declaration)
{ {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
WINED3DVERTEXELEMENT *elements; WINED3DVERTEXELEMENT *elements;
@ -1498,15 +1498,15 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexDeclarationFromFVF(IWineD3D
size = ConvertFvfToDeclaration(This, fvf, &elements); size = ConvertFvfToDeclaration(This, fvf, &elements);
if (size == ~0U) return E_OUTOFMEMORY; if (size == ~0U) return E_OUTOFMEMORY;
hr = IWineD3DDevice_CreateVertexDeclaration(iface, declaration, parent, parent_ops, elements, size); hr = IWineD3DDeviceImpl_CreateVertexDeclaration(iface, elements, size, parent, parent_ops, declaration);
HeapFree(GetProcessHeap(), 0, elements); HeapFree(GetProcessHeap(), 0, elements);
return hr; return hr;
} }
static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexShader(IWineD3DDevice *iface, static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexShader(IWineD3DDevice *iface,
const DWORD *pFunction, const struct wined3d_shader_signature *output_signature, const DWORD *pFunction, const struct wined3d_shader_signature *output_signature,
IWineD3DVertexShader **ppVertexShader, IUnknown *parent, void *parent, const struct wined3d_parent_ops *parent_ops,
const struct wined3d_parent_ops *parent_ops) IWineD3DVertexShader **ppVertexShader)
{ {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DVertexShaderImpl *object; IWineD3DVertexShaderImpl *object;
@ -1535,8 +1535,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexShader(IWineD3DDevice *ifac
static HRESULT WINAPI IWineD3DDeviceImpl_CreateGeometryShader(IWineD3DDevice *iface, static HRESULT WINAPI IWineD3DDeviceImpl_CreateGeometryShader(IWineD3DDevice *iface,
const DWORD *byte_code, const struct wined3d_shader_signature *output_signature, const DWORD *byte_code, const struct wined3d_shader_signature *output_signature,
IWineD3DGeometryShader **shader, IUnknown *parent, void *parent, const struct wined3d_parent_ops *parent_ops,
const struct wined3d_parent_ops *parent_ops) IWineD3DGeometryShader **shader)
{ {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
struct wined3d_geometryshader *object; struct wined3d_geometryshader *object;
@ -1565,8 +1565,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateGeometryShader(IWineD3DDevice *if
static HRESULT WINAPI IWineD3DDeviceImpl_CreatePixelShader(IWineD3DDevice *iface, static HRESULT WINAPI IWineD3DDeviceImpl_CreatePixelShader(IWineD3DDevice *iface,
const DWORD *pFunction, const struct wined3d_shader_signature *output_signature, const DWORD *pFunction, const struct wined3d_shader_signature *output_signature,
IWineD3DPixelShader **ppPixelShader, IUnknown *parent, void *parent, const struct wined3d_parent_ops *parent_ops,
const struct wined3d_parent_ops *parent_ops) IWineD3DPixelShader **ppPixelShader)
{ {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DPixelShaderImpl *object; IWineD3DPixelShaderImpl *object;
@ -1594,14 +1594,14 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreatePixelShader(IWineD3DDevice *iface
} }
static HRESULT WINAPI IWineD3DDeviceImpl_CreatePalette(IWineD3DDevice *iface, DWORD Flags, static HRESULT WINAPI IWineD3DDeviceImpl_CreatePalette(IWineD3DDevice *iface, DWORD Flags,
const PALETTEENTRY *PalEnt, IWineD3DPalette **Palette, IUnknown *Parent) const PALETTEENTRY *PalEnt, void *parent, IWineD3DPalette **Palette)
{ {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
IWineD3DPaletteImpl *object; IWineD3DPaletteImpl *object;
HRESULT hr; HRESULT hr;
TRACE("iface %p, flags %#x, entries %p, palette %p, parent %p.\n", TRACE("iface %p, flags %#x, entries %p, palette %p, parent %p.\n",
iface, Flags, PalEnt, Palette, Parent); iface, Flags, PalEnt, Palette, parent);
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object) if (!object)
@ -1610,7 +1610,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreatePalette(IWineD3DDevice *iface, DW
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
hr = wined3d_palette_init(object, This, Flags, PalEnt, Parent); hr = wined3d_palette_init(object, This, Flags, PalEnt, parent);
if (FAILED(hr)) if (FAILED(hr))
{ {
WARN("Failed to initialize palette, hr %#x.\n", hr); WARN("Failed to initialize palette, hr %#x.\n", hr);
@ -1650,10 +1650,11 @@ static void IWineD3DDeviceImpl_LoadLogo(IWineD3DDeviceImpl *This, const char *fi
} }
hr = IWineD3DDevice_CreateSurface((IWineD3DDevice *)This, bm.bmWidth, bm.bmHeight, WINED3DFMT_B5G6R5_UNORM, TRUE, hr = IWineD3DDevice_CreateSurface((IWineD3DDevice *)This, bm.bmWidth, bm.bmHeight, WINED3DFMT_B5G6R5_UNORM, TRUE,
FALSE, 0, &This->logo_surface, 0, WINED3DPOOL_DEFAULT, WINED3DMULTISAMPLE_NONE, 0, SURFACE_OPENGL, FALSE, 0, 0, WINED3DPOOL_DEFAULT, WINED3DMULTISAMPLE_NONE, 0, SURFACE_OPENGL, NULL,
NULL, &wined3d_null_parent_ops); &wined3d_null_parent_ops, &This->logo_surface);
if(FAILED(hr)) { if (FAILED(hr))
ERR("Wine logo requested, but failed to create surface\n"); {
ERR("Wine logo requested, but failed to create surface, hr %#x.\n", hr);
goto out; goto out;
} }

View File

@ -4871,11 +4871,11 @@ static HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT adapter_id
return WINED3D_OK; return WINED3D_OK;
} }
static HRESULT WINAPI IWineD3DImpl_GetParent(IWineD3D *iface, IUnknown **pParent) { static void * WINAPI IWineD3DImpl_GetParent(IWineD3D *iface)
IWineD3DImpl *This = (IWineD3DImpl *)iface; {
IUnknown_AddRef(This->parent); TRACE("iface %p.\n", iface);
*pParent = This->parent;
return WINED3D_OK; return ((IWineD3DImpl *)iface)->parent;
} }
static void WINE_GLAPI invalid_func(const void *data) static void WINE_GLAPI invalid_func(const void *data)
@ -5393,7 +5393,7 @@ const struct wined3d_parent_ops wined3d_null_parent_ops =
wined3d_null_wined3d_object_destroyed, wined3d_null_wined3d_object_destroyed,
}; };
HRESULT wined3d_init(IWineD3DImpl *wined3d, UINT version, IUnknown *parent) HRESULT wined3d_init(IWineD3DImpl *wined3d, UINT version, void *parent)
{ {
wined3d->lpVtbl = &IWineD3D_Vtbl; wined3d->lpVtbl = &IWineD3D_Vtbl;
wined3d->dxVersion = version; wined3d->dxVersion = version;

View File

@ -175,13 +175,11 @@ static HRESULT WINAPI IWineD3DPaletteImpl_GetCaps(IWineD3DPalette *iface, DWORD
return WINED3D_OK; return WINED3D_OK;
} }
static HRESULT WINAPI IWineD3DPaletteImpl_GetParent(IWineD3DPalette *iface, IUnknown **Parent) { static void * WINAPI IWineD3DPaletteImpl_GetParent(IWineD3DPalette *iface)
IWineD3DPaletteImpl *This = (IWineD3DPaletteImpl *)iface; {
TRACE("(%p)->(%p)\n", This, Parent); TRACE("iface %p.\n", iface);
*Parent = This->parent; return ((IWineD3DPaletteImpl *)iface)->parent;
IUnknown_AddRef(This->parent);
return WINED3D_OK;
} }
static const IWineD3DPaletteVtbl IWineD3DPalette_Vtbl = static const IWineD3DPaletteVtbl IWineD3DPalette_Vtbl =
@ -198,7 +196,7 @@ static const IWineD3DPaletteVtbl IWineD3DPalette_Vtbl =
}; };
HRESULT wined3d_palette_init(IWineD3DPaletteImpl *palette, IWineD3DDeviceImpl *device, HRESULT wined3d_palette_init(IWineD3DPaletteImpl *palette, IWineD3DDeviceImpl *device,
DWORD flags, const PALETTEENTRY *entries, IUnknown *parent) DWORD flags, const PALETTEENTRY *entries, void *parent)
{ {
HRESULT hr; HRESULT hr;

View File

@ -29,12 +29,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d);
HRESULT resource_init(IWineD3DResource *iface, WINED3DRESOURCETYPE resource_type, HRESULT resource_init(IWineD3DResource *iface, WINED3DRESOURCETYPE resource_type,
IWineD3DDeviceImpl *device, UINT size, DWORD usage, const struct wined3d_format *format, IWineD3DDeviceImpl *device, UINT size, DWORD usage, const struct wined3d_format *format,
WINED3DPOOL pool, IUnknown *parent, const struct wined3d_parent_ops *parent_ops) WINED3DPOOL pool, void *parent, const struct wined3d_parent_ops *parent_ops)
{ {
struct IWineD3DResourceClass *resource = &((IWineD3DResourceImpl *)iface)->resource; struct IWineD3DResourceClass *resource = &((IWineD3DResourceImpl *)iface)->resource;
resource->device = device; resource->device = device;
resource->parent = parent;
resource->resourceType = resource_type; resource->resourceType = resource_type;
resource->ref = 1; resource->ref = 1;
resource->pool = pool; resource->pool = pool;
@ -42,6 +41,7 @@ HRESULT resource_init(IWineD3DResource *iface, WINED3DRESOURCETYPE resource_type
resource->usage = usage; resource->usage = usage;
resource->size = size; resource->size = size;
resource->priority = 0; resource->priority = 0;
resource->parent = parent;
resource->parent_ops = parent_ops; resource->parent_ops = parent_ops;
list_init(&resource->privateData); list_init(&resource->privateData);
@ -245,11 +245,3 @@ WINED3DRESOURCETYPE resource_get_type(IWineD3DResource *iface)
TRACE("(%p) : returning %d\n", This, This->resource.resourceType); TRACE("(%p) : returning %d\n", This, This->resource.resourceType);
return This->resource.resourceType; return This->resource.resourceType;
} }
HRESULT resource_get_parent(IWineD3DResource *iface, IUnknown **pParent)
{
IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface;
IUnknown_AddRef(This->resource.parent);
*pParent = This->resource.parent;
return WINED3D_OK;
}

View File

@ -286,7 +286,7 @@ int shader_addline(struct wined3d_shader_buffer *buffer, const char *format, ...
} }
static void shader_init(struct IWineD3DBaseShaderClass *shader, IWineD3DDeviceImpl *device, static void shader_init(struct IWineD3DBaseShaderClass *shader, IWineD3DDeviceImpl *device,
IUnknown *parent, const struct wined3d_parent_ops *parent_ops) void *parent, const struct wined3d_parent_ops *parent_ops)
{ {
shader->ref = 1; shader->ref = 1;
shader->device = (IWineD3DDevice *)device; shader->device = (IWineD3DDevice *)device;
@ -1534,13 +1534,6 @@ const shader_backend_t none_shader_backend = {
shader_none_color_fixup_supported, shader_none_color_fixup_supported,
}; };
static void shader_get_parent(IWineD3DBaseShaderImpl *shader, IUnknown **parent)
{
*parent = shader->baseShader.parent;
IUnknown_AddRef(*parent);
TRACE("shader %p, returning %p.\n", shader, *parent);
}
static HRESULT shader_get_function(IWineD3DBaseShaderImpl *shader, void *data, UINT *data_size) static HRESULT shader_get_function(IWineD3DBaseShaderImpl *shader, void *data, UINT *data_size)
{ {
if (!data) if (!data)
@ -1654,13 +1647,11 @@ static ULONG STDMETHODCALLTYPE vertexshader_Release(IWineD3DVertexShader *iface)
return refcount; return refcount;
} }
static HRESULT STDMETHODCALLTYPE vertexshader_GetParent(IWineD3DVertexShader *iface, IUnknown **parent) static void * STDMETHODCALLTYPE vertexshader_GetParent(IWineD3DVertexShader *iface)
{ {
TRACE("iface %p, parent %p.\n", iface, parent); TRACE("iface %p.\n", iface);
shader_get_parent((IWineD3DBaseShaderImpl *)iface, parent); return ((IWineD3DBaseShaderImpl *)iface)->baseShader.parent;
return WINED3D_OK;
} }
static HRESULT STDMETHODCALLTYPE vertexshader_GetFunction(IWineD3DVertexShader *iface, void *data, UINT *data_size) static HRESULT STDMETHODCALLTYPE vertexshader_GetFunction(IWineD3DVertexShader *iface, void *data, UINT *data_size)
@ -1829,7 +1820,7 @@ static void vertexshader_set_limits(IWineD3DVertexShaderImpl *shader)
HRESULT vertexshader_init(IWineD3DVertexShaderImpl *shader, IWineD3DDeviceImpl *device, HRESULT vertexshader_init(IWineD3DVertexShaderImpl *shader, IWineD3DDeviceImpl *device,
const DWORD *byte_code, const struct wined3d_shader_signature *output_signature, const DWORD *byte_code, const struct wined3d_shader_signature *output_signature,
IUnknown *parent, const struct wined3d_parent_ops *parent_ops) void *parent, const struct wined3d_parent_ops *parent_ops)
{ {
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
struct shader_reg_maps *reg_maps = &shader->baseShader.reg_maps; struct shader_reg_maps *reg_maps = &shader->baseShader.reg_maps;
@ -1951,13 +1942,11 @@ static ULONG STDMETHODCALLTYPE geometryshader_Release(IWineD3DGeometryShader *if
return refcount; return refcount;
} }
static HRESULT STDMETHODCALLTYPE geometryshader_GetParent(IWineD3DGeometryShader *iface, IUnknown **parent) static void * STDMETHODCALLTYPE geometryshader_GetParent(IWineD3DGeometryShader *iface)
{ {
TRACE("iface %p, parent %p.\n", iface, parent); TRACE("iface %p.\n", iface);
shader_get_parent((IWineD3DBaseShaderImpl *)iface, parent); return ((IWineD3DBaseShaderImpl *)iface)->baseShader.parent;
return WINED3D_OK;
} }
static HRESULT STDMETHODCALLTYPE geometryshader_GetFunction(IWineD3DGeometryShader *iface, void *data, UINT *data_size) static HRESULT STDMETHODCALLTYPE geometryshader_GetFunction(IWineD3DGeometryShader *iface, void *data, UINT *data_size)
@ -1981,7 +1970,7 @@ static const IWineD3DGeometryShaderVtbl wined3d_geometryshader_vtbl =
HRESULT geometryshader_init(struct wined3d_geometryshader *shader, IWineD3DDeviceImpl *device, HRESULT geometryshader_init(struct wined3d_geometryshader *shader, IWineD3DDeviceImpl *device,
const DWORD *byte_code, const struct wined3d_shader_signature *output_signature, const DWORD *byte_code, const struct wined3d_shader_signature *output_signature,
IUnknown *parent, const struct wined3d_parent_ops *parent_ops) void *parent, const struct wined3d_parent_ops *parent_ops)
{ {
HRESULT hr; HRESULT hr;
@ -2048,13 +2037,11 @@ static ULONG STDMETHODCALLTYPE pixelshader_Release(IWineD3DPixelShader *iface)
return refcount; return refcount;
} }
static HRESULT STDMETHODCALLTYPE pixelshader_GetParent(IWineD3DPixelShader *iface, IUnknown **parent) static void * STDMETHODCALLTYPE pixelshader_GetParent(IWineD3DPixelShader *iface)
{ {
TRACE("iface %p, parent %p.\n", iface, parent); TRACE("iface %p.\n", iface);
shader_get_parent((IWineD3DBaseShaderImpl *)iface, parent); return ((IWineD3DBaseShaderImpl *)iface)->baseShader.parent;
return WINED3D_OK;
} }
static HRESULT STDMETHODCALLTYPE pixelshader_GetFunction(IWineD3DPixelShader *iface, void *data, UINT *data_size) static HRESULT STDMETHODCALLTYPE pixelshader_GetFunction(IWineD3DPixelShader *iface, void *data, UINT *data_size)
@ -2253,7 +2240,7 @@ static void pixelshader_set_limits(IWineD3DPixelShaderImpl *shader)
HRESULT pixelshader_init(IWineD3DPixelShaderImpl *shader, IWineD3DDeviceImpl *device, HRESULT pixelshader_init(IWineD3DPixelShaderImpl *shader, IWineD3DDeviceImpl *device,
const DWORD *byte_code, const struct wined3d_shader_signature *output_signature, const DWORD *byte_code, const struct wined3d_shader_signature *output_signature,
IUnknown *parent, const struct wined3d_parent_ops *parent_ops) void *parent, const struct wined3d_parent_ops *parent_ops)
{ {
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
unsigned int i, highest_reg_used = 0, num_regs_used = 0; unsigned int i, highest_reg_used = 0, num_regs_used = 0;

View File

@ -347,7 +347,7 @@ void draw_textured_quad(IWineD3DSurfaceImpl *src_surface, const RECT *src_rect,
HRESULT surface_init(IWineD3DSurfaceImpl *surface, WINED3DSURFTYPE surface_type, UINT alignment, HRESULT surface_init(IWineD3DSurfaceImpl *surface, WINED3DSURFTYPE surface_type, UINT alignment,
UINT width, UINT height, UINT level, BOOL lockable, BOOL discard, WINED3DMULTISAMPLE_TYPE multisample_type, UINT width, UINT height, UINT level, BOOL lockable, BOOL discard, WINED3DMULTISAMPLE_TYPE multisample_type,
UINT multisample_quality, IWineD3DDeviceImpl *device, DWORD usage, enum wined3d_format_id format_id, UINT multisample_quality, IWineD3DDeviceImpl *device, DWORD usage, enum wined3d_format_id format_id,
WINED3DPOOL pool, IUnknown *parent, const struct wined3d_parent_ops *parent_ops) WINED3DPOOL pool, void *parent, const struct wined3d_parent_ops *parent_ops)
{ {
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
const struct wined3d_format *format = wined3d_get_format(gl_info, format_id); const struct wined3d_format *format = wined3d_get_format(gl_info, format_id);

View File

@ -139,9 +139,11 @@ WINED3DRESOURCETYPE WINAPI IWineD3DBaseSurfaceImpl_GetType(IWineD3DSurface *ifac
return resource_get_type((IWineD3DResource *)iface); return resource_get_type((IWineD3DResource *)iface);
} }
HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetParent(IWineD3DSurface *iface, IUnknown **pParent) { void * WINAPI IWineD3DBaseSurfaceImpl_GetParent(IWineD3DSurface *iface)
TRACE("(%p) : calling resourceimpl_GetParent\n", iface); {
return resource_get_parent((IWineD3DResource *)iface, pParent); TRACE("iface %p.\n", iface);
return ((IWineD3DSurfaceImpl *)iface)->resource.parent;
} }
/* ****************************************************** /* ******************************************************
@ -811,10 +813,10 @@ static IWineD3DSurfaceImpl *surface_convert_format(IWineD3DSurfaceImpl *source,
} }
IWineD3DDevice_CreateSurface((IWineD3DDevice *)source->resource.device, source->currentDesc.Width, IWineD3DDevice_CreateSurface((IWineD3DDevice *)source->resource.device, source->currentDesc.Width,
source->currentDesc.Height, to_fmt, TRUE /* lockable */, TRUE /* discard */, 0 /* level */, &ret, source->currentDesc.Height, to_fmt, TRUE /* lockable */, TRUE /* discard */, 0 /* level */,
0 /* usage */, WINED3DPOOL_SCRATCH, WINED3DMULTISAMPLE_NONE /* TODO: Multisampled conversion */, 0 /* usage */, WINED3DPOOL_SCRATCH, WINED3DMULTISAMPLE_NONE /* TODO: Multisampled conversion */,
0 /* MultiSampleQuality */, IWineD3DSurface_GetImplType((IWineD3DSurface *) source), 0 /* MultiSampleQuality */, IWineD3DSurface_GetImplType((IWineD3DSurface *) source),
NULL /* parent */, &wined3d_null_parent_ops); NULL /* parent */, &wined3d_null_parent_ops, &ret);
if(!ret) { if(!ret) {
ERR("Failed to create a destination surface for conversion\n"); ERR("Failed to create a destination surface for conversion\n");
return NULL; return NULL;

View File

@ -622,7 +622,7 @@ void swapchain_restore_fullscreen_window(IWineD3DSwapChainImpl *swapchain)
HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface_type, HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface_type,
IWineD3DDeviceImpl *device, WINED3DPRESENT_PARAMETERS *present_parameters, IUnknown *parent) IWineD3DDeviceImpl *device, WINED3DPRESENT_PARAMETERS *present_parameters, void *parent)
{ {
const struct wined3d_adapter *adapter = device->adapter; const struct wined3d_adapter *adapter = device->adapter;
const struct wined3d_format *format; const struct wined3d_format *format;

View File

@ -64,12 +64,11 @@ ULONG WINAPI IWineD3DBaseSwapChainImpl_Release(IWineD3DSwapChain *iface) {
return refCount; return refCount;
} }
HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetParent(IWineD3DSwapChain *iface, IUnknown ** ppParent){ void * WINAPI IWineD3DBaseSwapChainImpl_GetParent(IWineD3DSwapChain *iface)
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface; {
*ppParent = This->parent; TRACE("iface %p.\n", iface);
IUnknown_AddRef(*ppParent);
TRACE("(%p) returning %p\n", This , *ppParent); return ((IWineD3DSwapChainImpl *)iface)->parent;
return WINED3D_OK;
} }
HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetFrontBufferData(IWineD3DSwapChain *iface, IWineD3DSurface *dst_surface) HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetFrontBufferData(IWineD3DSwapChain *iface, IWineD3DSurface *dst_surface)

View File

@ -221,8 +221,11 @@ static WINED3DRESOURCETYPE WINAPI IWineD3DTextureImpl_GetType(IWineD3DTexture *i
return resource_get_type((IWineD3DResource *)iface); return resource_get_type((IWineD3DResource *)iface);
} }
static HRESULT WINAPI IWineD3DTextureImpl_GetParent(IWineD3DTexture *iface, IUnknown **pParent) { static void * WINAPI IWineD3DTextureImpl_GetParent(IWineD3DTexture *iface)
return resource_get_parent((IWineD3DResource *)iface, pParent); {
TRACE("iface %p.\n", iface);
return ((IWineD3DTextureImpl *)iface)->resource.parent;
} }
/* ****************************************************** /* ******************************************************
@ -463,7 +466,7 @@ static const IWineD3DTextureVtbl IWineD3DTexture_Vtbl =
HRESULT texture_init(IWineD3DTextureImpl *texture, UINT width, UINT height, UINT levels, HRESULT texture_init(IWineD3DTextureImpl *texture, UINT width, UINT height, UINT levels,
IWineD3DDeviceImpl *device, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool, IWineD3DDeviceImpl *device, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool,
IUnknown *parent, const struct wined3d_parent_ops *parent_ops) void *parent, const struct wined3d_parent_ops *parent_ops)
{ {
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
const struct wined3d_format *format = wined3d_get_format(gl_info, format_id); const struct wined3d_format *format = wined3d_get_format(gl_info, format_id);

View File

@ -79,13 +79,11 @@ static ULONG WINAPI IWineD3DVertexDeclarationImpl_Release(IWineD3DVertexDeclarat
IWineD3DVertexDeclaration parts follow IWineD3DVertexDeclaration parts follow
******************************************* */ ******************************************* */
static HRESULT WINAPI IWineD3DVertexDeclarationImpl_GetParent(IWineD3DVertexDeclaration *iface, IUnknown** parent){ static void * WINAPI IWineD3DVertexDeclarationImpl_GetParent(IWineD3DVertexDeclaration *iface)
IWineD3DVertexDeclarationImpl *This = (IWineD3DVertexDeclarationImpl *)iface; {
TRACE("iface %p.\n", iface);
*parent= This->parent; return ((IWineD3DVertexDeclarationImpl *)iface)->parent;
IUnknown_AddRef(*parent);
TRACE("(%p) : returning %p\n", This, *parent);
return WINED3D_OK;
} }
static BOOL declaration_element_valid_ffp(const WINED3DVERTEXELEMENT *element) static BOOL declaration_element_valid_ffp(const WINED3DVERTEXELEMENT *element)
@ -188,7 +186,7 @@ static const IWineD3DVertexDeclarationVtbl IWineD3DVertexDeclaration_Vtbl =
HRESULT vertexdeclaration_init(IWineD3DVertexDeclarationImpl *declaration, IWineD3DDeviceImpl *device, HRESULT vertexdeclaration_init(IWineD3DVertexDeclarationImpl *declaration, IWineD3DDeviceImpl *device,
const WINED3DVERTEXELEMENT *elements, UINT element_count, const WINED3DVERTEXELEMENT *elements, UINT element_count,
IUnknown *parent, const struct wined3d_parent_ops *parent_ops) void *parent, const struct wined3d_parent_ops *parent_ops)
{ {
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
WORD preloaded = 0; /* MAX_STREAMS, 16 */ WORD preloaded = 0; /* MAX_STREAMS, 16 */

View File

@ -74,14 +74,11 @@ static ULONG STDMETHODCALLTYPE rendertarget_view_Release(IWineD3DRendertargetVie
/* IWineD3DBase methods */ /* IWineD3DBase methods */
static HRESULT STDMETHODCALLTYPE rendertarget_view_GetParent(IWineD3DRendertargetView *iface, IUnknown **parent) static void * STDMETHODCALLTYPE rendertarget_view_GetParent(IWineD3DRendertargetView *iface)
{ {
struct wined3d_rendertarget_view *This = (struct wined3d_rendertarget_view *)iface; TRACE("iface %p.\n", iface);
IUnknown_AddRef(This->parent); return ((struct wined3d_rendertarget_view *)iface)->parent;
*parent = This->parent;
return WINED3D_OK;
} }
/* IWineD3DRendertargetView methods */ /* IWineD3DRendertargetView methods */
@ -110,7 +107,7 @@ static const struct IWineD3DRendertargetViewVtbl wined3d_rendertarget_view_vtbl
}; };
void wined3d_rendertarget_view_init(struct wined3d_rendertarget_view *view, void wined3d_rendertarget_view_init(struct wined3d_rendertarget_view *view,
IWineD3DResource *resource, IUnknown *parent) IWineD3DResource *resource, void *parent)
{ {
view->vtbl = &wined3d_rendertarget_view_vtbl; view->vtbl = &wined3d_rendertarget_view_vtbl;
view->refcount = 1; view->refcount = 1;

View File

@ -139,8 +139,11 @@ static ULONG WINAPI IWineD3DVolumeImpl_Release(IWineD3DVolume *iface) {
/* **************************************************** /* ****************************************************
IWineD3DVolume IWineD3DResource parts follow IWineD3DVolume IWineD3DResource parts follow
**************************************************** */ **************************************************** */
static HRESULT WINAPI IWineD3DVolumeImpl_GetParent(IWineD3DVolume *iface, IUnknown **pParent) { static void * WINAPI IWineD3DVolumeImpl_GetParent(IWineD3DVolume *iface)
return resource_get_parent((IWineD3DResource *)iface, pParent); {
TRACE("iface %p.\n", iface);
return ((IWineD3DVolumeImpl *)iface)->resource.parent;
} }
static HRESULT WINAPI IWineD3DVolumeImpl_SetPrivateData(IWineD3DVolume *iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) { static HRESULT WINAPI IWineD3DVolumeImpl_SetPrivateData(IWineD3DVolume *iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
@ -325,7 +328,7 @@ static const IWineD3DVolumeVtbl IWineD3DVolume_Vtbl =
HRESULT volume_init(IWineD3DVolumeImpl *volume, IWineD3DDeviceImpl *device, UINT width, HRESULT volume_init(IWineD3DVolumeImpl *volume, IWineD3DDeviceImpl *device, UINT width,
UINT height, UINT depth, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool, UINT height, UINT depth, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool,
IUnknown *parent, const struct wined3d_parent_ops *parent_ops) void *parent, const struct wined3d_parent_ops *parent_ops)
{ {
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
const struct wined3d_format *format = wined3d_get_format(gl_info, format_id); const struct wined3d_format *format = wined3d_get_format(gl_info, format_id);

View File

@ -186,8 +186,11 @@ static WINED3DRESOURCETYPE WINAPI IWineD3DVolumeTextureImpl_GetType(IWineD3DVolu
return resource_get_type((IWineD3DResource *)iface); return resource_get_type((IWineD3DResource *)iface);
} }
static HRESULT WINAPI IWineD3DVolumeTextureImpl_GetParent(IWineD3DVolumeTexture *iface, IUnknown **pParent) { static void * WINAPI IWineD3DVolumeTextureImpl_GetParent(IWineD3DVolumeTexture *iface)
return resource_get_parent((IWineD3DResource *)iface, pParent); {
TRACE("iface %p\n", iface);
return ((IWineD3DVolumeTextureImpl *)iface)->resource.parent;
} }
/* ****************************************************** /* ******************************************************
@ -385,7 +388,7 @@ static const IWineD3DVolumeTextureVtbl IWineD3DVolumeTexture_Vtbl =
HRESULT volumetexture_init(IWineD3DVolumeTextureImpl *texture, UINT width, UINT height, HRESULT volumetexture_init(IWineD3DVolumeTextureImpl *texture, UINT width, UINT height,
UINT depth, UINT levels, IWineD3DDeviceImpl *device, DWORD usage, enum wined3d_format_id format_id, UINT depth, UINT levels, IWineD3DDeviceImpl *device, DWORD usage, enum wined3d_format_id format_id,
WINED3DPOOL pool, IUnknown *parent, const struct wined3d_parent_ops *parent_ops) WINED3DPOOL pool, void *parent, const struct wined3d_parent_ops *parent_ops)
{ {
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
const struct wined3d_format *format = wined3d_get_format(gl_info, format_id); const struct wined3d_format *format = wined3d_get_format(gl_info, format_id);

View File

@ -76,7 +76,7 @@ wined3d_settings_t wined3d_settings =
FALSE, /* No strict draw ordering. */ FALSE, /* No strict draw ordering. */
}; };
IWineD3D * WINAPI WineDirect3DCreate(UINT version, IUnknown *parent) IWineD3D * WINAPI WineDirect3DCreate(UINT version, void *parent)
{ {
IWineD3DImpl *object; IWineD3DImpl *object;
HRESULT hr; HRESULT hr;

View File

@ -1541,14 +1541,14 @@ typedef struct IWineD3DImpl
LONG ref; /* Note: Ref counting not required */ LONG ref; /* Note: Ref counting not required */
/* WineD3D Information */ /* WineD3D Information */
IUnknown *parent; void *parent;
UINT dxVersion; UINT dxVersion;
UINT adapter_count; UINT adapter_count;
struct wined3d_adapter adapters[1]; struct wined3d_adapter adapters[1];
} IWineD3DImpl; } IWineD3DImpl;
HRESULT wined3d_init(IWineD3DImpl *wined3d, UINT version, IUnknown *parent) DECLSPEC_HIDDEN; HRESULT wined3d_init(IWineD3DImpl *wined3d, UINT version, void *parent) DECLSPEC_HIDDEN;
BOOL wined3d_register_window(HWND window, struct IWineD3DDeviceImpl *device) DECLSPEC_HIDDEN; BOOL wined3d_register_window(HWND window, struct IWineD3DDeviceImpl *device) DECLSPEC_HIDDEN;
void wined3d_unregister_window(HWND window) DECLSPEC_HIDDEN; void wined3d_unregister_window(HWND window) DECLSPEC_HIDDEN;
@ -1748,7 +1748,6 @@ typedef struct IWineD3DResourceClass
LONG ref; /* Note: Ref counting not required */ LONG ref; /* Note: Ref counting not required */
/* WineD3DResource Information */ /* WineD3DResource Information */
IUnknown *parent;
WINED3DRESOURCETYPE resourceType; WINED3DRESOURCETYPE resourceType;
IWineD3DDeviceImpl *device; IWineD3DDeviceImpl *device;
WINED3DPOOL pool; WINED3DPOOL pool;
@ -1760,6 +1759,8 @@ typedef struct IWineD3DResourceClass
BYTE *heapMemory; /* Pointer to the HeapAlloced block of memory */ BYTE *heapMemory; /* Pointer to the HeapAlloced block of memory */
struct list privateData; struct list privateData;
struct list resource_list_entry; struct list resource_list_entry;
void *parent;
const struct wined3d_parent_ops *parent_ops; const struct wined3d_parent_ops *parent_ops;
} IWineD3DResourceClass; } IWineD3DResourceClass;
@ -1772,13 +1773,12 @@ typedef struct IWineD3DResourceImpl
void resource_cleanup(IWineD3DResource *iface) DECLSPEC_HIDDEN; void resource_cleanup(IWineD3DResource *iface) DECLSPEC_HIDDEN;
HRESULT resource_free_private_data(IWineD3DResource *iface, REFGUID guid) DECLSPEC_HIDDEN; HRESULT resource_free_private_data(IWineD3DResource *iface, REFGUID guid) DECLSPEC_HIDDEN;
HRESULT resource_get_parent(IWineD3DResource *iface, IUnknown **parent) DECLSPEC_HIDDEN;
DWORD resource_get_priority(IWineD3DResource *iface) DECLSPEC_HIDDEN; DWORD resource_get_priority(IWineD3DResource *iface) DECLSPEC_HIDDEN;
HRESULT resource_get_private_data(IWineD3DResource *iface, REFGUID guid, HRESULT resource_get_private_data(IWineD3DResource *iface, REFGUID guid,
void *data, DWORD *data_size) DECLSPEC_HIDDEN; void *data, DWORD *data_size) DECLSPEC_HIDDEN;
HRESULT resource_init(IWineD3DResource *iface, WINED3DRESOURCETYPE resource_type, HRESULT resource_init(IWineD3DResource *iface, WINED3DRESOURCETYPE resource_type,
IWineD3DDeviceImpl *device, UINT size, DWORD usage, const struct wined3d_format *format, IWineD3DDeviceImpl *device, UINT size, DWORD usage, const struct wined3d_format *format,
WINED3DPOOL pool, IUnknown *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN; WINED3DPOOL pool, void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
WINED3DRESOURCETYPE resource_get_type(IWineD3DResource *iface) DECLSPEC_HIDDEN; WINED3DRESOURCETYPE resource_get_type(IWineD3DResource *iface) DECLSPEC_HIDDEN;
DWORD resource_set_priority(IWineD3DResource *iface, DWORD new_priority) DECLSPEC_HIDDEN; DWORD resource_set_priority(IWineD3DResource *iface, DWORD new_priority) DECLSPEC_HIDDEN;
HRESULT resource_set_private_data(IWineD3DResource *iface, REFGUID guid, HRESULT resource_set_private_data(IWineD3DResource *iface, REFGUID guid,
@ -1867,7 +1867,7 @@ IWineD3DResourceImpl *basetexture_get_sub_resource(IWineD3DBaseTextureImpl *text
UINT layer, UINT level) DECLSPEC_HIDDEN; UINT layer, UINT level) DECLSPEC_HIDDEN;
HRESULT basetexture_init(IWineD3DBaseTextureImpl *texture, UINT layer_count, UINT level_count, HRESULT basetexture_init(IWineD3DBaseTextureImpl *texture, UINT layer_count, UINT level_count,
WINED3DRESOURCETYPE resource_type, IWineD3DDeviceImpl *device, UINT size, DWORD usage, WINED3DRESOURCETYPE resource_type, IWineD3DDeviceImpl *device, UINT size, DWORD usage,
const struct wined3d_format *format, WINED3DPOOL pool, IUnknown *parent, const struct wined3d_format *format, WINED3DPOOL pool, void *parent,
const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN; const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
HRESULT basetexture_set_autogen_filter_type(IWineD3DBaseTexture *iface, HRESULT basetexture_set_autogen_filter_type(IWineD3DBaseTexture *iface,
WINED3DTEXTUREFILTERTYPE filter_type) DECLSPEC_HIDDEN; WINED3DTEXTUREFILTERTYPE filter_type) DECLSPEC_HIDDEN;
@ -1893,7 +1893,7 @@ typedef struct IWineD3DTextureImpl
HRESULT texture_init(IWineD3DTextureImpl *texture, UINT width, UINT height, UINT levels, HRESULT texture_init(IWineD3DTextureImpl *texture, UINT width, UINT height, UINT levels,
IWineD3DDeviceImpl *device, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool, IWineD3DDeviceImpl *device, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool,
IUnknown *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN; void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
/***************************************************************************** /*****************************************************************************
* IWineD3DCubeTexture implementation structure (extends IWineD3DBaseTextureImpl) * IWineD3DCubeTexture implementation structure (extends IWineD3DBaseTextureImpl)
@ -1908,7 +1908,7 @@ typedef struct IWineD3DCubeTextureImpl
HRESULT cubetexture_init(IWineD3DCubeTextureImpl *texture, UINT edge_length, UINT levels, HRESULT cubetexture_init(IWineD3DCubeTextureImpl *texture, UINT edge_length, UINT levels,
IWineD3DDeviceImpl *device, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool, IWineD3DDeviceImpl *device, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool,
IUnknown *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN; void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
typedef struct _WINED3DVOLUMET_DESC typedef struct _WINED3DVOLUMET_DESC
{ {
@ -1939,7 +1939,7 @@ typedef struct IWineD3DVolumeImpl
void volume_add_dirty_box(IWineD3DVolume *iface, const WINED3DBOX *dirty_box) DECLSPEC_HIDDEN; void volume_add_dirty_box(IWineD3DVolume *iface, const WINED3DBOX *dirty_box) DECLSPEC_HIDDEN;
HRESULT volume_init(IWineD3DVolumeImpl *volume, IWineD3DDeviceImpl *device, UINT width, HRESULT volume_init(IWineD3DVolumeImpl *volume, IWineD3DDeviceImpl *device, UINT width,
UINT height, UINT depth, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool, UINT height, UINT depth, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool,
IUnknown *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN; void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
void volume_set_container(IWineD3DVolumeImpl *volume, struct IWineD3DVolumeTextureImpl *container) DECLSPEC_HIDDEN; void volume_set_container(IWineD3DVolumeImpl *volume, struct IWineD3DVolumeTextureImpl *container) DECLSPEC_HIDDEN;
/***************************************************************************** /*****************************************************************************
@ -1955,7 +1955,7 @@ typedef struct IWineD3DVolumeTextureImpl
HRESULT volumetexture_init(IWineD3DVolumeTextureImpl *texture, UINT width, UINT height, HRESULT volumetexture_init(IWineD3DVolumeTextureImpl *texture, UINT width, UINT height,
UINT depth, UINT levels, IWineD3DDeviceImpl *device, DWORD usage, enum wined3d_format_id format_id, UINT depth, UINT levels, IWineD3DDeviceImpl *device, DWORD usage, enum wined3d_format_id format_id,
WINED3DPOOL pool, IUnknown *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN; WINED3DPOOL pool, void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
typedef struct _WINED3DSURFACET_DESC typedef struct _WINED3DSURFACET_DESC
{ {
@ -2096,7 +2096,7 @@ GLenum surface_get_gl_buffer(IWineD3DSurfaceImpl *surface) DECLSPEC_HIDDEN;
HRESULT surface_init(IWineD3DSurfaceImpl *surface, WINED3DSURFTYPE surface_type, UINT alignment, HRESULT surface_init(IWineD3DSurfaceImpl *surface, WINED3DSURFTYPE surface_type, UINT alignment,
UINT width, UINT height, UINT level, BOOL lockable, BOOL discard, WINED3DMULTISAMPLE_TYPE multisample_type, UINT width, UINT height, UINT level, BOOL lockable, BOOL discard, WINED3DMULTISAMPLE_TYPE multisample_type,
UINT multisample_quality, IWineD3DDeviceImpl *device, DWORD usage, enum wined3d_format_id format_id, UINT multisample_quality, IWineD3DDeviceImpl *device, DWORD usage, enum wined3d_format_id format_id,
WINED3DPOOL pool, IUnknown *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN; WINED3DPOOL pool, void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
BOOL surface_init_sysmem(IWineD3DSurfaceImpl *surface) DECLSPEC_HIDDEN; BOOL surface_init_sysmem(IWineD3DSurfaceImpl *surface) DECLSPEC_HIDDEN;
void surface_internal_preload(IWineD3DSurfaceImpl *surface, enum WINED3DSRGB srgb) DECLSPEC_HIDDEN; void surface_internal_preload(IWineD3DSurfaceImpl *surface, enum WINED3DSRGB srgb) DECLSPEC_HIDDEN;
BOOL surface_is_offscreen(IWineD3DSurfaceImpl *iface) DECLSPEC_HIDDEN; BOOL surface_is_offscreen(IWineD3DSurfaceImpl *iface) DECLSPEC_HIDDEN;
@ -2119,7 +2119,7 @@ void surface_translate_frontbuffer_coords(IWineD3DSurfaceImpl *surface, HWND win
HRESULT WINAPI IWineD3DBaseSurfaceImpl_QueryInterface(IWineD3DSurface *iface, HRESULT WINAPI IWineD3DBaseSurfaceImpl_QueryInterface(IWineD3DSurface *iface,
REFIID riid, LPVOID *ppobj) DECLSPEC_HIDDEN; REFIID riid, LPVOID *ppobj) DECLSPEC_HIDDEN;
ULONG WINAPI IWineD3DBaseSurfaceImpl_AddRef(IWineD3DSurface *iface) DECLSPEC_HIDDEN; ULONG WINAPI IWineD3DBaseSurfaceImpl_AddRef(IWineD3DSurface *iface) DECLSPEC_HIDDEN;
HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetParent(IWineD3DSurface *iface, IUnknown **pParent) DECLSPEC_HIDDEN; void * WINAPI IWineD3DBaseSurfaceImpl_GetParent(IWineD3DSurface *iface) DECLSPEC_HIDDEN;
HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetPrivateData(IWineD3DSurface *iface, HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetPrivateData(IWineD3DSurface *iface,
REFGUID refguid, const void *pData, DWORD SizeOfData, DWORD Flags) DECLSPEC_HIDDEN; REFGUID refguid, const void *pData, DWORD SizeOfData, DWORD Flags) DECLSPEC_HIDDEN;
HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetPrivateData(IWineD3DSurface *iface, HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetPrivateData(IWineD3DSurface *iface,
@ -2252,7 +2252,7 @@ typedef struct IWineD3DVertexDeclarationImpl {
const IWineD3DVertexDeclarationVtbl *lpVtbl; const IWineD3DVertexDeclarationVtbl *lpVtbl;
LONG ref; LONG ref;
IUnknown *parent; void *parent;
const struct wined3d_parent_ops *parent_ops; const struct wined3d_parent_ops *parent_ops;
IWineD3DDeviceImpl *device; IWineD3DDeviceImpl *device;
@ -2267,7 +2267,7 @@ typedef struct IWineD3DVertexDeclarationImpl {
HRESULT vertexdeclaration_init(IWineD3DVertexDeclarationImpl *declaration, IWineD3DDeviceImpl *device, HRESULT vertexdeclaration_init(IWineD3DVertexDeclarationImpl *declaration, IWineD3DDeviceImpl *device,
const WINED3DVERTEXELEMENT *elements, UINT element_count, const WINED3DVERTEXELEMENT *elements, UINT element_count,
IUnknown *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN; void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
/***************************************************************************** /*****************************************************************************
* IWineD3DStateBlock implementation structure * IWineD3DStateBlock implementation structure
@ -2513,7 +2513,7 @@ const BYTE *buffer_get_memory(IWineD3DBuffer *iface, const struct wined3d_gl_inf
BYTE *buffer_get_sysmem(struct wined3d_buffer *This, const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN; BYTE *buffer_get_sysmem(struct wined3d_buffer *This, const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN;
HRESULT buffer_init(struct wined3d_buffer *buffer, IWineD3DDeviceImpl *device, HRESULT buffer_init(struct wined3d_buffer *buffer, IWineD3DDeviceImpl *device,
UINT size, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool, GLenum bind_hint, UINT size, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool, GLenum bind_hint,
const char *data, IUnknown *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN; const char *data, void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
/* IWineD3DRendertargetView */ /* IWineD3DRendertargetView */
struct wined3d_rendertarget_view struct wined3d_rendertarget_view
@ -2522,11 +2522,11 @@ struct wined3d_rendertarget_view
LONG refcount; LONG refcount;
IWineD3DResource *resource; IWineD3DResource *resource;
IUnknown *parent; void *parent;
}; };
void wined3d_rendertarget_view_init(struct wined3d_rendertarget_view *view, void wined3d_rendertarget_view_init(struct wined3d_rendertarget_view *view,
IWineD3DResource *resource, IUnknown *parent) DECLSPEC_HIDDEN; IWineD3DResource *resource, void *parent) DECLSPEC_HIDDEN;
/***************************************************************************** /*****************************************************************************
* IWineD3DSwapChainImpl implementation structure (extends IUnknown) * IWineD3DSwapChainImpl implementation structure (extends IUnknown)
@ -2538,7 +2538,7 @@ struct IWineD3DSwapChainImpl
const IWineD3DSwapChainVtbl *lpVtbl; const IWineD3DSwapChainVtbl *lpVtbl;
LONG ref; /* Note: Ref counting not required */ LONG ref; /* Note: Ref counting not required */
IUnknown *parent; void *parent;
IWineD3DDeviceImpl *device; IWineD3DDeviceImpl *device;
/* IWineD3DSwapChain fields */ /* IWineD3DSwapChain fields */
@ -2568,7 +2568,7 @@ HRESULT WINAPI IWineD3DBaseSwapChainImpl_QueryInterface(IWineD3DSwapChain *iface
REFIID riid, LPVOID *ppobj) DECLSPEC_HIDDEN; REFIID riid, LPVOID *ppobj) DECLSPEC_HIDDEN;
ULONG WINAPI IWineD3DBaseSwapChainImpl_AddRef(IWineD3DSwapChain *iface) DECLSPEC_HIDDEN; ULONG WINAPI IWineD3DBaseSwapChainImpl_AddRef(IWineD3DSwapChain *iface) DECLSPEC_HIDDEN;
ULONG WINAPI IWineD3DBaseSwapChainImpl_Release(IWineD3DSwapChain *iface) DECLSPEC_HIDDEN; ULONG WINAPI IWineD3DBaseSwapChainImpl_Release(IWineD3DSwapChain *iface) DECLSPEC_HIDDEN;
HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetParent(IWineD3DSwapChain *iface, IUnknown **ppParent) DECLSPEC_HIDDEN; void * WINAPI IWineD3DBaseSwapChainImpl_GetParent(IWineD3DSwapChain *iface) DECLSPEC_HIDDEN;
HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetFrontBufferData(IWineD3DSwapChain *iface, HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetFrontBufferData(IWineD3DSwapChain *iface,
IWineD3DSurface *dst_surface) DECLSPEC_HIDDEN; IWineD3DSurface *dst_surface) DECLSPEC_HIDDEN;
HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetBackBuffer(IWineD3DSwapChain *iface, UINT iBackBuffer, HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetBackBuffer(IWineD3DSwapChain *iface, UINT iBackBuffer,
@ -2588,7 +2588,7 @@ HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetGammaRamp(IWineD3DSwapChain *iface,
struct wined3d_context *swapchain_create_context_for_thread(IWineD3DSwapChain *iface) DECLSPEC_HIDDEN; struct wined3d_context *swapchain_create_context_for_thread(IWineD3DSwapChain *iface) DECLSPEC_HIDDEN;
HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface_type, HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface_type,
IWineD3DDeviceImpl *device, WINED3DPRESENT_PARAMETERS *present_parameters, IUnknown *parent) DECLSPEC_HIDDEN; IWineD3DDeviceImpl *device, WINED3DPRESENT_PARAMETERS *present_parameters, void *parent) DECLSPEC_HIDDEN;
void swapchain_restore_fullscreen_window(IWineD3DSwapChainImpl *swapchain) DECLSPEC_HIDDEN; void swapchain_restore_fullscreen_window(IWineD3DSwapChainImpl *swapchain) DECLSPEC_HIDDEN;
void swapchain_setup_fullscreen_window(IWineD3DSwapChainImpl *swapchain, UINT w, UINT h) DECLSPEC_HIDDEN; void swapchain_setup_fullscreen_window(IWineD3DSwapChainImpl *swapchain, UINT w, UINT h) DECLSPEC_HIDDEN;
@ -2717,7 +2717,7 @@ typedef struct IWineD3DBaseShaderClass
void *frontend_data; void *frontend_data;
void *backend_data; void *backend_data;
IUnknown *parent; void *parent;
const struct wined3d_parent_ops *parent_ops; const struct wined3d_parent_ops *parent_ops;
/* Programs this shader is linked with */ /* Programs this shader is linked with */
@ -2841,7 +2841,7 @@ void find_vs_compile_args(IWineD3DVertexShaderImpl *shader, IWineD3DStateBlockIm
struct vs_compile_args *args) DECLSPEC_HIDDEN; struct vs_compile_args *args) DECLSPEC_HIDDEN;
HRESULT vertexshader_init(IWineD3DVertexShaderImpl *shader, IWineD3DDeviceImpl *device, HRESULT vertexshader_init(IWineD3DVertexShaderImpl *shader, IWineD3DDeviceImpl *device,
const DWORD *byte_code, const struct wined3d_shader_signature *output_signature, const DWORD *byte_code, const struct wined3d_shader_signature *output_signature,
IUnknown *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN; void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
struct wined3d_geometryshader struct wined3d_geometryshader
{ {
@ -2851,7 +2851,7 @@ struct wined3d_geometryshader
HRESULT geometryshader_init(struct wined3d_geometryshader *shader, IWineD3DDeviceImpl *device, HRESULT geometryshader_init(struct wined3d_geometryshader *shader, IWineD3DDeviceImpl *device,
const DWORD *byte_code, const struct wined3d_shader_signature *output_signature, const DWORD *byte_code, const struct wined3d_shader_signature *output_signature,
IUnknown *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN; void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
/***************************************************************************** /*****************************************************************************
* IDirect3DPixelShader implementation structure * IDirect3DPixelShader implementation structure
@ -2896,7 +2896,7 @@ typedef struct IWineD3DPixelShaderImpl {
HRESULT pixelshader_init(IWineD3DPixelShaderImpl *shader, IWineD3DDeviceImpl *device, HRESULT pixelshader_init(IWineD3DPixelShaderImpl *shader, IWineD3DDeviceImpl *device,
const DWORD *byte_code, const struct wined3d_shader_signature *output_signature, const DWORD *byte_code, const struct wined3d_shader_signature *output_signature,
IUnknown *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN; void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
void pixelshader_update_samplers(struct shader_reg_maps *reg_maps, void pixelshader_update_samplers(struct shader_reg_maps *reg_maps,
IWineD3DBaseTexture * const *textures) DECLSPEC_HIDDEN; IWineD3DBaseTexture * const *textures) DECLSPEC_HIDDEN;
void find_ps_compile_args(IWineD3DPixelShaderImpl *shader, IWineD3DStateBlockImpl *stateblock, void find_ps_compile_args(IWineD3DPixelShaderImpl *shader, IWineD3DStateBlockImpl *stateblock,
@ -2917,7 +2917,7 @@ struct IWineD3DPaletteImpl {
const IWineD3DPaletteVtbl *lpVtbl; const IWineD3DPaletteVtbl *lpVtbl;
LONG ref; LONG ref;
IUnknown *parent; void *parent;
IWineD3DDeviceImpl *device; IWineD3DDeviceImpl *device;
/* IWineD3DPalette */ /* IWineD3DPalette */
@ -2931,7 +2931,7 @@ struct IWineD3DPaletteImpl {
}; };
HRESULT wined3d_palette_init(IWineD3DPaletteImpl *palette, IWineD3DDeviceImpl *device, HRESULT wined3d_palette_init(IWineD3DPaletteImpl *palette, IWineD3DDeviceImpl *device,
DWORD flags, const PALETTEENTRY *entries, IUnknown *parent) DECLSPEC_HIDDEN; DWORD flags, const PALETTEENTRY *entries, void *parent) DECLSPEC_HIDDEN;
/* DirectDraw utility functions */ /* DirectDraw utility functions */
extern enum wined3d_format_id pixelformat_for_depth(DWORD depth) DECLSPEC_HIDDEN; extern enum wined3d_format_id pixelformat_for_depth(DWORD depth) DECLSPEC_HIDDEN;

View File

@ -2178,8 +2178,7 @@ typedef HRESULT (__stdcall *D3DCB_ENUMRESOURCES)(IWineD3DResource *resource, voi
] ]
interface IWineD3DBase : IUnknown interface IWineD3DBase : IUnknown
{ {
HRESULT GetParent( void *GetParent(
[out] IUnknown **parent
); );
} }
@ -2797,7 +2796,7 @@ interface IWineD3DDevice : IUnknown
HRESULT CreateBuffer( HRESULT CreateBuffer(
[in] struct wined3d_buffer_desc *desc, [in] struct wined3d_buffer_desc *desc,
[in] const void *data, [in] const void *data,
[in] IUnknown *parent, [in] void *parent,
[in] const struct wined3d_parent_ops *parent_ops, [in] const struct wined3d_parent_ops *parent_ops,
[out] IWineD3DBuffer **buffer [out] IWineD3DBuffer **buffer
); );
@ -2805,17 +2804,17 @@ interface IWineD3DDevice : IUnknown
[in] UINT length, [in] UINT length,
[in] DWORD usage, [in] DWORD usage,
[in] WINED3DPOOL pool, [in] WINED3DPOOL pool,
[out] IWineD3DBuffer **vertex_buffer, [in] void *parent,
[in] IUnknown *parent, [in] const struct wined3d_parent_ops *parent_ops,
[in] const struct wined3d_parent_ops *parent_ops [out] IWineD3DBuffer **vertex_buffer
); );
HRESULT CreateIndexBuffer( HRESULT CreateIndexBuffer(
[in] UINT length, [in] UINT length,
[in] DWORD usage, [in] DWORD usage,
[in] WINED3DPOOL pool, [in] WINED3DPOOL pool,
[out] IWineD3DBuffer **index_buffer, [in] void *parent,
[in] IUnknown *parent, [in] const struct wined3d_parent_ops *parent_ops,
[in] const struct wined3d_parent_ops *parent_ops [out] IWineD3DBuffer **index_buffer
); );
HRESULT CreateStateBlock( HRESULT CreateStateBlock(
[in] WINED3DSTATEBLOCKTYPE type, [in] WINED3DSTATEBLOCKTYPE type,
@ -2828,18 +2827,18 @@ interface IWineD3DDevice : IUnknown
[in] BOOL lockable, [in] BOOL lockable,
[in] BOOL discard, [in] BOOL discard,
[in] UINT level, [in] UINT level,
[out] IWineD3DSurface **surface,
[in] DWORD usage, [in] DWORD usage,
[in] WINED3DPOOL pool, [in] WINED3DPOOL pool,
[in] WINED3DMULTISAMPLE_TYPE multisample_type, [in] WINED3DMULTISAMPLE_TYPE multisample_type,
[in] DWORD multisample_quality, [in] DWORD multisample_quality,
[in] WINED3DSURFTYPE surface_type, [in] WINED3DSURFTYPE surface_type,
[in] IUnknown *parent, [in] void *parent,
[in] const struct wined3d_parent_ops *parent_ops [in] const struct wined3d_parent_ops *parent_ops,
[out] IWineD3DSurface **surface
); );
HRESULT CreateRendertargetView( HRESULT CreateRendertargetView(
[in] IWineD3DResource *resource, [in] IWineD3DResource *resource,
[in] IUnknown *parent, [in] void *parent,
[out] IWineD3DRendertargetView **rendertarget_view [out] IWineD3DRendertargetView **rendertarget_view
); );
HRESULT CreateTexture( HRESULT CreateTexture(
@ -2849,9 +2848,9 @@ interface IWineD3DDevice : IUnknown
[in] DWORD usage, [in] DWORD usage,
[in] enum wined3d_format_id format_id, [in] enum wined3d_format_id format_id,
[in] WINED3DPOOL pool, [in] WINED3DPOOL pool,
[out] IWineD3DTexture **texture, [in] void *parent,
[in] IUnknown *parent, [in] const struct wined3d_parent_ops *parent_ops,
[in] const struct wined3d_parent_ops *parent_ops [out] IWineD3DTexture **texture
); );
HRESULT CreateVolumeTexture( HRESULT CreateVolumeTexture(
[in] UINT width, [in] UINT width,
@ -2861,9 +2860,9 @@ interface IWineD3DDevice : IUnknown
[in] DWORD usage, [in] DWORD usage,
[in] enum wined3d_format_id format_id, [in] enum wined3d_format_id format_id,
[in] WINED3DPOOL pool, [in] WINED3DPOOL pool,
[out] IWineD3DVolumeTexture **texture, [in] void *parent,
[in] IUnknown *parent, [in] const struct wined3d_parent_ops *parent_ops,
[in] const struct wined3d_parent_ops *parent_ops [out] IWineD3DVolumeTexture **texture
); );
HRESULT CreateVolume( HRESULT CreateVolume(
[in] UINT width, [in] UINT width,
@ -2872,9 +2871,9 @@ interface IWineD3DDevice : IUnknown
[in] DWORD usage, [in] DWORD usage,
[in] enum wined3d_format_id format_id, [in] enum wined3d_format_id format_id,
[in] WINED3DPOOL pool, [in] WINED3DPOOL pool,
[out] IWineD3DVolume **volume, [in] void *parent,
[in] IUnknown *parent, [in] const struct wined3d_parent_ops *parent_ops,
[in] const struct wined3d_parent_ops *parent_ops [out] IWineD3DVolume **volume
); );
HRESULT CreateCubeTexture( HRESULT CreateCubeTexture(
[in] UINT edge_length, [in] UINT edge_length,
@ -2882,9 +2881,9 @@ interface IWineD3DDevice : IUnknown
[in] DWORD usage, [in] DWORD usage,
[in] enum wined3d_format_id format_id, [in] enum wined3d_format_id format_id,
[in] WINED3DPOOL pool, [in] WINED3DPOOL pool,
[out] IWineD3DCubeTexture **texture, [in] void *parent,
[in] IUnknown *parent, [in] const struct wined3d_parent_ops *parent_ops,
[in] const struct wined3d_parent_ops *parent_ops [out] IWineD3DCubeTexture **texture
); );
HRESULT CreateQuery( HRESULT CreateQuery(
[in] WINED3DQUERYTYPE type, [in] WINED3DQUERYTYPE type,
@ -2892,49 +2891,49 @@ interface IWineD3DDevice : IUnknown
); );
HRESULT CreateSwapChain( HRESULT CreateSwapChain(
[in] WINED3DPRESENT_PARAMETERS *present_parameters, [in] WINED3DPRESENT_PARAMETERS *present_parameters,
[out] IWineD3DSwapChain **swapchain, [in] WINED3DSURFTYPE surface_type,
[in] IUnknown *parent, [in] void *parent,
[in] WINED3DSURFTYPE surface_type [out] IWineD3DSwapChain **swapchain
); );
HRESULT CreateVertexDeclaration( HRESULT CreateVertexDeclaration(
[out] IWineD3DVertexDeclaration **declaration,
[in] IUnknown *parent,
[in] const struct wined3d_parent_ops *parent_ops,
[in] const WINED3DVERTEXELEMENT *elements, [in] const WINED3DVERTEXELEMENT *elements,
[in] UINT element_count [in] UINT element_count,
[in] void *parent,
[in] const struct wined3d_parent_ops *parent_ops,
[out] IWineD3DVertexDeclaration **declaration
); );
HRESULT CreateVertexDeclarationFromFVF( HRESULT CreateVertexDeclarationFromFVF(
[out] IWineD3DVertexDeclaration **declaration, [in] DWORD fvf,
[in] IUnknown *parent, [in] void *parent,
[in] const struct wined3d_parent_ops *parent_ops, [in] const struct wined3d_parent_ops *parent_ops,
[in] DWORD fvf [out] IWineD3DVertexDeclaration **declaration
); );
HRESULT CreateVertexShader( HRESULT CreateVertexShader(
[in] const DWORD *function, [in] const DWORD *function,
[in] const struct wined3d_shader_signature *output_signature, [in] const struct wined3d_shader_signature *output_signature,
[out] IWineD3DVertexShader **shader, [in] void *parent,
[in] IUnknown *parent, [in] const struct wined3d_parent_ops *parent_ops,
[in] const struct wined3d_parent_ops *parent_ops [out] IWineD3DVertexShader **shader
); );
HRESULT CreateGeometryShader( HRESULT CreateGeometryShader(
[in] const DWORD *byte_code, [in] const DWORD *byte_code,
[in] const struct wined3d_shader_signature *output_signature, [in] const struct wined3d_shader_signature *output_signature,
[out] IWineD3DGeometryShader **shader, [in] void *parent,
[in] IUnknown *parent, [in] const struct wined3d_parent_ops *parent_ops,
[in] const struct wined3d_parent_ops *parent_ops [out] IWineD3DGeometryShader **shader
); );
HRESULT CreatePixelShader( HRESULT CreatePixelShader(
[in] const DWORD *function, [in] const DWORD *function,
[in] const struct wined3d_shader_signature *output_signature, [in] const struct wined3d_shader_signature *output_signature,
[out] IWineD3DPixelShader **shader, [in] void *parent,
[in] IUnknown *parent, [in] const struct wined3d_parent_ops *parent_ops,
[in] const struct wined3d_parent_ops *parent_ops [out] IWineD3DPixelShader **shader
); );
HRESULT CreatePalette( HRESULT CreatePalette(
[in] DWORD flags, [in] DWORD flags,
[in] const PALETTEENTRY *palette_entry, [in] const PALETTEENTRY *palette_entry,
[out] IWineD3DPalette **palette, [in] void *parent,
[in] IUnknown *parent [out] IWineD3DPalette **palette
); );
HRESULT Init3D( HRESULT Init3D(
[in] WINED3DPRESENT_PARAMETERS *present_parameters [in] WINED3DPRESENT_PARAMETERS *present_parameters
@ -3388,7 +3387,7 @@ interface IWineD3DDevice : IUnknown
); );
} }
IWineD3D * __stdcall WineDirect3DCreate(UINT dxVersion, IUnknown *parent); IWineD3D * __stdcall WineDirect3DCreate(UINT dxVersion, void *parent);
IWineD3DClipper * __stdcall WineDirect3DCreateClipper(void); IWineD3DClipper * __stdcall WineDirect3DCreateClipper(void);
void __stdcall wined3d_mutex_lock(void); void __stdcall wined3d_mutex_lock(void);
void __stdcall wined3d_mutex_unlock(void); void __stdcall wined3d_mutex_unlock(void);