[PATCH 4/5] wined3d: Don't require wined3d object parents to be COM objects.
Henri Verbeet
hverbeet at codeweavers.com
Tue Aug 31 11:41:40 CDT 2010
---
dlls/d3d10core/inputlayout.c | 4 +-
dlls/d3d10core/shader.c | 15 ++--
dlls/d3d10core/texture2d.c | 7 +-
dlls/d3d10core/view.c | 12 +---
dlls/d3d8/cubetexture.c | 23 +++--
dlls/d3d8/device.c | 162 ++++++++++++++++++++++---------------
dlls/d3d8/indexbuffer.c | 5 +-
dlls/d3d8/pixelshader.c | 5 +-
dlls/d3d8/surface.c | 5 +-
dlls/d3d8/swapchain.c | 21 +++--
dlls/d3d8/texture.c | 18 +++--
dlls/d3d8/vertexbuffer.c | 5 +-
dlls/d3d8/vertexdeclaration.c | 10 +--
dlls/d3d8/vertexshader.c | 5 +-
dlls/d3d8/volume.c | 2 +-
dlls/d3d8/volumetexture.c | 22 +++--
dlls/d3d9/cubetexture.c | 25 ++++---
dlls/d3d9/device.c | 124 +++++++++++++++++++----------
dlls/d3d9/indexbuffer.c | 5 +-
dlls/d3d9/pixelshader.c | 23 +++---
dlls/d3d9/surface.c | 5 +-
dlls/d3d9/swapchain.c | 39 ++++++---
dlls/d3d9/texture.c | 20 +++--
dlls/d3d9/vertexbuffer.c | 5 +-
dlls/d3d9/vertexdeclaration.c | 41 +++++-----
dlls/d3d9/vertexshader.c | 24 +++---
dlls/d3d9/volume.c | 2 +-
dlls/d3d9/volumetexture.c | 20 +++--
dlls/ddraw/ddraw.c | 46 +++++------
dlls/ddraw/device.c | 55 ++++---------
dlls/ddraw/palette.c | 2 +-
dlls/ddraw/surface.c | 36 ++-------
dlls/ddraw/vertexbuffer.c | 2 +-
dlls/dxgi/device.c | 11 +--
dlls/dxgi/factory.c | 8 +--
dlls/dxgi/swapchain.c | 12 +--
dlls/wined3d/basetexture.c | 2 +-
dlls/wined3d/buffer.c | 9 +-
dlls/wined3d/cubetexture.c | 9 ++-
dlls/wined3d/device.c | 71 +++++++++--------
dlls/wined3d/directx.c | 12 ++--
dlls/wined3d/palette.c | 12 +--
dlls/wined3d/resource.c | 12 +---
dlls/wined3d/shader.c | 39 +++------
dlls/wined3d/surface.c | 2 +-
dlls/wined3d/surface_base.c | 12 ++-
dlls/wined3d/swapchain.c | 2 +-
dlls/wined3d/swapchain_base.c | 11 +--
dlls/wined3d/texture.c | 9 ++-
dlls/wined3d/vertexdeclaration.c | 12 +--
dlls/wined3d/view.c | 11 +--
dlls/wined3d/volume.c | 9 ++-
dlls/wined3d/volumetexture.c | 9 ++-
dlls/wined3d/wined3d_main.c | 2 +-
dlls/wined3d/wined3d_private.h | 52 ++++++------
include/wine/wined3d.idl | 93 +++++++++++-----------
56 files changed, 613 insertions(+), 603 deletions(-)
diff --git a/dlls/d3d10core/inputlayout.c b/dlls/d3d10core/inputlayout.c
index bdbff3a..2b8b716 100644
--- a/dlls/d3d10core/inputlayout.c
+++ b/dlls/d3d10core/inputlayout.c
@@ -227,8 +227,8 @@ HRESULT d3d10_input_layout_init(struct d3d10_input_layout *layout, struct d3d10_
return hr;
}
- hr = IWineD3DDevice_CreateVertexDeclaration(device->wined3d_device, &layout->wined3d_decl,
- (IUnknown *)layout, &d3d10_input_layout_wined3d_parent_ops, wined3d_elements, wined3d_element_count);
+ hr = IWineD3DDevice_CreateVertexDeclaration(device->wined3d_device, wined3d_elements, wined3d_element_count,
+ layout, &d3d10_input_layout_wined3d_parent_ops, &layout->wined3d_decl);
HeapFree(GetProcessHeap(), 0, wined3d_elements);
if (FAILED(hr))
{
diff --git a/dlls/d3d10core/shader.c b/dlls/d3d10core/shader.c
index 256f281..a072cb9 100644
--- a/dlls/d3d10core/shader.c
+++ b/dlls/d3d10core/shader.c
@@ -259,9 +259,8 @@ HRESULT d3d10_vertex_shader_init(struct d3d10_vertex_shader *shader, struct d3d1
return hr;
}
- hr = IWineD3DDevice_CreateVertexShader(device->wined3d_device,
- shader_info.shader_code, &shader->output_signature, &shader->wined3d_shader,
- (IUnknown *)shader, &d3d10_vertex_shader_wined3d_parent_ops);
+ hr = IWineD3DDevice_CreateVertexShader(device->wined3d_device, shader_info.shader_code,
+ &shader->output_signature, shader, &d3d10_vertex_shader_wined3d_parent_ops, &shader->wined3d_shader);
if (FAILED(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;
}
- hr = IWineD3DDevice_CreateGeometryShader(device->wined3d_device,
- shader_info.shader_code, &shader->output_signature, &shader->wined3d_shader,
- (IUnknown *)shader, &d3d10_geometry_shader_wined3d_parent_ops);
+ hr = IWineD3DDevice_CreateGeometryShader(device->wined3d_device, shader_info.shader_code,
+ &shader->output_signature, shader, &d3d10_geometry_shader_wined3d_parent_ops, &shader->wined3d_shader);
if (FAILED(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;
}
- hr = IWineD3DDevice_CreatePixelShader(device->wined3d_device,
- shader_info.shader_code, &shader->output_signature, &shader->wined3d_shader,
- (IUnknown *)shader, &d3d10_pixel_shader_wined3d_parent_ops);
+ hr = IWineD3DDevice_CreatePixelShader(device->wined3d_device, shader_info.shader_code,
+ &shader->output_signature, shader, &d3d10_pixel_shader_wined3d_parent_ops, &shader->wined3d_shader);
if (FAILED(hr))
{
WARN("Failed to create wined3d pixel shader, hr %#x.\n", hr);
diff --git a/dlls/d3d10core/texture2d.c b/dlls/d3d10core/texture2d.c
index 3d5eea1..4ade9ab 100644
--- a/dlls/d3d10core/texture2d.c
+++ b/dlls/d3d10core/texture2d.c
@@ -228,11 +228,10 @@ HRESULT d3d10_texture2d_init(struct d3d10_texture2d *texture, struct d3d10_devic
FIXME("Implement DXGI<->wined3d usage conversion\n");
hr = IWineD3DDevice_CreateSurface(device->wined3d_device, desc->Width, desc->Height,
- wined3dformat_from_dxgi_format(desc->Format), FALSE, FALSE, 0,
- &texture->wined3d_surface, desc->Usage, WINED3DPOOL_DEFAULT,
+ wined3dformat_from_dxgi_format(desc->Format), FALSE, FALSE, 0, desc->Usage, WINED3DPOOL_DEFAULT,
desc->SampleDesc.Count > 1 ? desc->SampleDesc.Count : WINED3DMULTISAMPLE_NONE,
- desc->SampleDesc.Quality, SURFACE_OPENGL, (IUnknown *)texture,
- &d3d10_texture2d_wined3d_parent_ops);
+ desc->SampleDesc.Quality, SURFACE_OPENGL, texture, &d3d10_texture2d_wined3d_parent_ops,
+ &texture->wined3d_surface);
if (FAILED(hr))
{
ERR("CreateSurface failed, returning %#x\n", hr);
diff --git a/dlls/d3d10core/view.c b/dlls/d3d10core/view.c
index 63bc01e..72b7f4e 100644
--- a/dlls/d3d10core/view.c
+++ b/dlls/d3d10core/view.c
@@ -388,17 +388,9 @@ static void STDMETHODCALLTYPE d3d10_rendertarget_view_GetResource(ID3D10RenderTa
return;
}
- hr = IWineD3DResource_GetParent(wined3d_resource, &parent);
- IWineD3DResource_Release(wined3d_resource);
- if (FAILED(hr))
- {
- ERR("Failed to get wined3d resource parent, hr %#x\n", hr);
- *resource = NULL;
- return;
- }
-
+ parent = IWineD3DResource_GetParent(wined3d_resource);
hr = IUnknown_QueryInterface(parent, &IID_ID3D10Resource, (void **)&resource);
- IUnknown_Release(parent);
+ IWineD3DResource_Release(wined3d_resource);
if (FAILED(hr))
{
ERR("Resource parent isn't a d3d10 resource, hr %#x\n", hr);
diff --git a/dlls/d3d8/cubetexture.c b/dlls/d3d8/cubetexture.c
index 7e48dab..b9b411a 100644
--- a/dlls/d3d8/cubetexture.c
+++ b/dlls/d3d8/cubetexture.c
@@ -253,22 +253,27 @@ static HRESULT WINAPI IDirect3DCubeTexture8Impl_GetLevelDesc(LPDIRECT3DCUBETEXTU
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;
- HRESULT hrc = D3D_OK;
IWineD3DSurface *mySurface = NULL;
+ HRESULT hr;
TRACE("iface %p, face %#x, level %u, surface %p.\n", iface, FaceType, Level, ppCubeMapSurface);
wined3d_mutex_lock();
- hrc = IWineD3DCubeTexture_GetCubeMapSurface(This->wineD3DCubeTexture, (WINED3DCUBEMAP_FACES) FaceType, Level, &mySurface);
- if (hrc == D3D_OK && NULL != ppCubeMapSurface) {
- IWineD3DCubeTexture_GetParent(mySurface, (IUnknown **)ppCubeMapSurface);
+ hr = IWineD3DCubeTexture_GetCubeMapSurface(This->wineD3DCubeTexture,
+ (WINED3DCUBEMAP_FACES) FaceType, Level, &mySurface);
+ if (SUCCEEDED(hr) && ppCubeMapSurface)
+ {
+ *ppCubeMapSurface = IWineD3DCubeTexture_GetParent(mySurface);
+ IDirect3DSurface8_AddRef(*ppCubeMapSurface);
IWineD3DCubeTexture_Release(mySurface);
}
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) {
@@ -357,9 +362,9 @@ HRESULT cubetexture_init(IDirect3DCubeTexture8Impl *texture, IDirect3DDevice8Imp
texture->ref = 1;
wined3d_mutex_lock();
- hr = IWineD3DDevice_CreateCubeTexture(device->WineD3DDevice, edge_length, levels, usage & WINED3DUSAGE_MASK,
- wined3dformat_from_d3dformat(format), pool, &texture->wineD3DCubeTexture,
- (IUnknown *)texture, &d3d8_cubetexture_wined3d_parent_ops);
+ hr = IWineD3DDevice_CreateCubeTexture(device->WineD3DDevice, edge_length, levels,
+ usage & WINED3DUSAGE_MASK, wined3dformat_from_d3dformat(format), pool, texture,
+ &d3d8_cubetexture_wined3d_parent_ops, &texture->wineD3DCubeTexture);
wined3d_mutex_unlock();
if (FAILED(hr))
{
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index 9572199..59e318c 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -260,8 +260,7 @@ static ULONG WINAPI D3D8CB_DestroySwapChain(IWineD3DSwapChain *swapchain)
TRACE("swapchain %p.\n", swapchain);
- IWineD3DSwapChain_GetParent(swapchain, &parent);
- IUnknown_Release(parent);
+ parent = IWineD3DSwapChain_GetParent(swapchain);
return IUnknown_Release(parent);
}
@@ -370,10 +369,11 @@ static HRESULT WINAPI IDirect3DDevice8Impl_ResourceManagerDiscardBytes(LPDIRECT3
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_GetDirect3D(LPDIRECT3DDEVICE8 iface, IDirect3D8** ppD3D8) {
+static HRESULT WINAPI IDirect3DDevice8Impl_GetDirect3D(IDirect3DDevice8 *iface, IDirect3D8 **ppD3D8)
+{
IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
- HRESULT hr = D3D_OK;
- IWineD3D* pWineD3D;
+ IWineD3D *pWineD3D;
+ HRESULT hr;
TRACE("iface %p, d3d8 %p.\n", iface, ppD3D8);
@@ -383,11 +383,14 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetDirect3D(LPDIRECT3DDEVICE8 iface,
wined3d_mutex_lock();
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);
- } else {
+ }
+ else
+ {
FIXME("Call to IWineD3DDevice_GetDirect3D failed\n");
*ppD3D8 = NULL;
}
@@ -589,23 +592,27 @@ static HRESULT WINAPI IDirect3DDevice8Impl_Present(LPDIRECT3DDEVICE8 iface, CONS
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;
IWineD3DSurface *retSurface = NULL;
- HRESULT rc = D3D_OK;
+ HRESULT hr;
TRACE("iface %p, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n",
iface, BackBuffer, Type, ppBackBuffer);
wined3d_mutex_lock();
- rc = IWineD3DDevice_GetBackBuffer(This->WineD3DDevice, 0, BackBuffer, (WINED3DBACKBUFFER_TYPE) Type, &retSurface);
- if (rc == D3D_OK && NULL != retSurface && NULL != ppBackBuffer) {
- IWineD3DSurface_GetParent(retSurface, (IUnknown **)ppBackBuffer);
+ hr = IWineD3DDevice_GetBackBuffer(This->WineD3DDevice, 0, BackBuffer, (WINED3DBACKBUFFER_TYPE)Type, &retSurface);
+ if (SUCCEEDED(hr) && retSurface && ppBackBuffer)
+ {
+ *ppBackBuffer = IWineD3DSurface_GetParent(retSurface);
+ IDirect3DSurface8_AddRef(*ppBackBuffer);
IWineD3DSurface_Release(retSurface);
}
wined3d_mutex_unlock();
- return rc;
+ return hr;
}
static HRESULT WINAPI IDirect3DDevice8Impl_GetRasterStatus(LPDIRECT3DDEVICE8 iface, D3DRASTER_STATUS* pRasterStatus) {
@@ -984,10 +991,12 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetRenderTarget(LPDIRECT3DDEVICE8 ifa
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_GetRenderTarget(LPDIRECT3DDEVICE8 iface, IDirect3DSurface8** ppRenderTarget) {
+static HRESULT WINAPI IDirect3DDevice8Impl_GetRenderTarget(IDirect3DDevice8 *iface,
+ IDirect3DSurface8 **ppRenderTarget)
+{
IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
- HRESULT hr = D3D_OK;
IWineD3DSurface *pRenderTarget;
+ HRESULT hr;
TRACE("iface %p, render_target %p.\n", iface, ppRenderTarget);
@@ -997,11 +1006,14 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetRenderTarget(LPDIRECT3DDEVICE8 i
wined3d_mutex_lock();
hr = IWineD3DDevice_GetRenderTarget(This->WineD3DDevice, 0, &pRenderTarget);
-
- if (hr == D3D_OK && pRenderTarget != NULL) {
- IWineD3DSurface_GetParent(pRenderTarget,(IUnknown**)ppRenderTarget);
+ if (SUCCEEDED(hr) && pRenderTarget)
+ {
+ *ppRenderTarget = IWineD3DSurface_GetParent(pRenderTarget);
+ IDirect3DSurface8_AddRef(*ppRenderTarget);
IWineD3DSurface_Release(pRenderTarget);
- } else {
+ }
+ else
+ {
FIXME("Call to IWineD3DDevice_GetRenderTarget failed\n");
*ppRenderTarget = NULL;
}
@@ -1010,10 +1022,12 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetRenderTarget(LPDIRECT3DDEVICE8 i
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_GetDepthStencilSurface(LPDIRECT3DDEVICE8 iface, IDirect3DSurface8** ppZStencilSurface) {
+static HRESULT WINAPI IDirect3DDevice8Impl_GetDepthStencilSurface(IDirect3DDevice8 *iface,
+ IDirect3DSurface8 **ppZStencilSurface)
+{
IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
- HRESULT hr = D3D_OK;
IWineD3DSurface *pZStencilSurface;
+ HRESULT hr;
TRACE("iface %p, depth_stencil %p.\n", iface, ppZStencilSurface);
@@ -1022,11 +1036,15 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetDepthStencilSurface(LPDIRECT3DDE
}
wined3d_mutex_lock();
- hr=IWineD3DDevice_GetDepthStencilSurface(This->WineD3DDevice,&pZStencilSurface);
- if (hr == WINED3D_OK) {
- IWineD3DSurface_GetParent(pZStencilSurface,(IUnknown**)ppZStencilSurface);
+ hr = IWineD3DDevice_GetDepthStencilSurface(This->WineD3DDevice, &pZStencilSurface);
+ if (SUCCEEDED(hr))
+ {
+ *ppZStencilSurface = IWineD3DSurface_GetParent(pZStencilSurface);
+ IDirect3DSurface8_AddRef(*ppZStencilSurface);
IWineD3DSurface_Release(pZStencilSurface);
- }else{
+ }
+ else
+ {
if (hr != WINED3DERR_NOTFOUND)
FIXME("Call to IWineD3DDevice_GetDepthStencilSurface failed with 0x%08x\n", hr);
*ppZStencilSurface = NULL;
@@ -1467,7 +1485,9 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetClipStatus(LPDIRECT3DDEVICE8 iface
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;
IWineD3DBaseTexture *retTexture;
HRESULT hr;
@@ -1490,7 +1510,8 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetTexture(LPDIRECT3DDEVICE8 iface, D
if (retTexture)
{
- IWineD3DBaseTexture_GetParent(retTexture, (IUnknown **)ppTexture);
+ *ppTexture = IWineD3DBaseTexture_GetParent(retTexture);
+ IDirect3DBaseTexture8_AddRef(*ppTexture);
IWineD3DBaseTexture_Release(retTexture);
}
else
@@ -1900,22 +1921,23 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetVertexShader(LPDIRECT3DDEVICE8 ifa
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_GetVertexShader(LPDIRECT3DDEVICE8 iface, DWORD* ppShader) {
+static HRESULT WINAPI IDirect3DDevice8Impl_GetVertexShader(IDirect3DDevice8 *iface, DWORD *ppShader)
+{
IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
IWineD3DVertexDeclaration *wined3d_declaration;
IDirect3DVertexDeclaration8 *d3d8_declaration;
- HRESULT hrc;
+ HRESULT hr;
TRACE("iface %p, shader %p.\n", iface, ppShader);
wined3d_mutex_lock();
- hrc = IWineD3DDevice_GetVertexDeclaration(This->WineD3DDevice, &wined3d_declaration);
- if (FAILED(hrc))
+ hr = IWineD3DDevice_GetVertexDeclaration(This->WineD3DDevice, &wined3d_declaration);
+ if (FAILED(hr))
{
wined3d_mutex_unlock();
WARN("(%p) : Call to IWineD3DDevice_GetVertexDeclaration failed %#x (device %p)\n",
- This, hrc, This->WineD3DDevice);
- return hrc;
+ This, hr, This->WineD3DDevice);
+ return hr;
}
if (!wined3d_declaration)
@@ -1925,18 +1947,14 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetVertexShader(LPDIRECT3DDEVICE8 ifa
return D3D_OK;
}
- hrc = IWineD3DVertexDeclaration_GetParent(wined3d_declaration, (IUnknown **)&d3d8_declaration);
+ d3d8_declaration = IWineD3DVertexDeclaration_GetParent(wined3d_declaration);
IWineD3DVertexDeclaration_Release(wined3d_declaration);
wined3d_mutex_unlock();
- if (SUCCEEDED(hrc))
- {
- *ppShader = ((IDirect3DVertexDeclaration8Impl *)d3d8_declaration)->shader_handle;
- IDirect3DVertexDeclaration8_Release(d3d8_declaration);
- }
+ *ppShader = ((IDirect3DVertexDeclaration8Impl *)d3d8_declaration)->shader_handle;
TRACE("(%p) : returning %#x\n", This, *ppShader);
- return hrc;
+ return hr;
}
static HRESULT WINAPI IDirect3DDevice8Impl_DeleteVertexShader(LPDIRECT3DDEVICE8 iface, DWORD pShader) {
@@ -2105,10 +2123,12 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetIndices(LPDIRECT3DDEVICE8 iface, I
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;
IWineD3DBuffer *retIndexData = NULL;
- HRESULT rc = D3D_OK;
+ HRESULT hr;
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 */
wined3d_mutex_lock();
IWineD3DDevice_GetBaseVertexIndex(This->WineD3DDevice, (INT *) pBaseVertexIndex);
- rc = IWineD3DDevice_GetIndexBuffer(This->WineD3DDevice, &retIndexData);
- if (SUCCEEDED(rc) && retIndexData) {
- IWineD3DBuffer_GetParent(retIndexData, (IUnknown **)ppIndexData);
+ hr = IWineD3DDevice_GetIndexBuffer(This->WineD3DDevice, &retIndexData);
+ if (SUCCEEDED(hr) && retIndexData)
+ {
+ *ppIndexData = IWineD3DBuffer_GetParent(retIndexData);
+ IDirect3DIndexBuffer8_AddRef(*ppIndexData);
IWineD3DBuffer_Release(retIndexData);
} else {
- if (FAILED(rc)) FIXME("Call to GetIndices failed\n");
+ if (FAILED(hr)) FIXME("Call to GetIndices failed\n");
*ppIndexData = NULL;
}
wined3d_mutex_unlock();
- return rc;
+ return hr;
}
static HRESULT WINAPI IDirect3DDevice8Impl_CreatePixelShader(IDirect3DDevice8 *iface,
@@ -2217,10 +2239,11 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetPixelShader(LPDIRECT3DDEVICE8 ifac
return hr;
}
-static HRESULT WINAPI IDirect3DDevice8Impl_GetPixelShader(LPDIRECT3DDEVICE8 iface, DWORD* ppShader) {
+static HRESULT WINAPI IDirect3DDevice8Impl_GetPixelShader(IDirect3DDevice8 *iface, DWORD *ppShader)
+{
IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
IWineD3DPixelShader *object;
- HRESULT hrc = D3D_OK;
+ HRESULT hr;
TRACE("iface %p, shader %p.\n", iface, ppShader);
@@ -2230,21 +2253,23 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetPixelShader(LPDIRECT3DDEVICE8 ifac
}
wined3d_mutex_lock();
- hrc = IWineD3DDevice_GetPixelShader(This->WineD3DDevice, &object);
- if (D3D_OK == hrc && NULL != object) {
+ hr = IWineD3DDevice_GetPixelShader(This->WineD3DDevice, &object);
+ if (SUCCEEDED(hr) && object)
+ {
IDirect3DPixelShader8Impl *d3d8_shader;
- hrc = IWineD3DPixelShader_GetParent(object, (IUnknown **)&d3d8_shader);
+ d3d8_shader = IWineD3DPixelShader_GetParent(object);
IWineD3DPixelShader_Release(object);
*ppShader = d3d8_shader->handle;
- IDirect3DPixelShader8_Release((IDirect3DPixelShader8 *)d3d8_shader);
- } else {
+ }
+ else
+ {
*ppShader = 0;
}
wined3d_mutex_unlock();
TRACE("(%p) : returning %#x\n", This, *ppShader);
- return hrc;
+ return hr;
}
static HRESULT WINAPI IDirect3DDevice8Impl_DeletePixelShader(LPDIRECT3DDEVICE8 iface, DWORD pShader) {
@@ -2391,10 +2416,12 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetStreamSource(LPDIRECT3DDEVICE8 ifa
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;
IWineD3DBuffer *retStream = NULL;
- HRESULT rc = D3D_OK;
+ HRESULT hr;
TRACE("iface %p, stream_idx %u, buffer %p, stride %p.\n",
iface, StreamNumber, pStream, pStride);
@@ -2404,19 +2431,22 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetStreamSource(LPDIRECT3DDEVICE8 ifa
}
wined3d_mutex_lock();
- rc = IWineD3DDevice_GetStreamSource(This->WineD3DDevice, StreamNumber, &retStream, 0 /* Offset in bytes */, pStride);
- if (rc == D3D_OK && NULL != retStream) {
- IWineD3DBuffer_GetParent(retStream, (IUnknown **)pStream);
+ hr = IWineD3DDevice_GetStreamSource(This->WineD3DDevice, StreamNumber,
+ &retStream, 0 /* Offset in bytes */, pStride);
+ if (SUCCEEDED(hr) && retStream)
+ {
+ *pStream = IWineD3DBuffer_GetParent(retStream);
+ IDirect3DVertexBuffer8_AddRef(*pStream);
IWineD3DBuffer_Release(retStream);
- }else{
- if (rc != D3D_OK){
- FIXME("Call to GetStreamSource failed %p\n", pStride);
- }
+ }
+ else
+ {
+ if (FAILED(hr)) FIXME("Call to GetStreamSource failed, hr %#x.\n", hr);
*pStream = NULL;
}
wined3d_mutex_unlock();
- return rc;
+ return hr;
}
static const IDirect3DDevice8Vtbl Direct3DDevice8_Vtbl =
diff --git a/dlls/d3d8/indexbuffer.c b/dlls/d3d8/indexbuffer.c
index b98c2d3..0e0b42d 100644
--- a/dlls/d3d8/indexbuffer.c
+++ b/dlls/d3d8/indexbuffer.c
@@ -268,9 +268,8 @@ HRESULT indexbuffer_init(IDirect3DIndexBuffer8Impl *buffer, IDirect3DDevice8Impl
buffer->format = wined3dformat_from_d3dformat(format);
wined3d_mutex_lock();
- hr = IWineD3DDevice_CreateIndexBuffer(device->WineD3DDevice, size,
- usage & WINED3DUSAGE_MASK, (WINED3DPOOL)pool, &buffer->wineD3DIndexBuffer,
- (IUnknown *)buffer, &d3d8_indexbuffer_wined3d_parent_ops);
+ hr = IWineD3DDevice_CreateIndexBuffer(device->WineD3DDevice, size, usage & WINED3DUSAGE_MASK,
+ (WINED3DPOOL)pool, buffer, &d3d8_indexbuffer_wined3d_parent_ops, &buffer->wineD3DIndexBuffer);
wined3d_mutex_unlock();
if (FAILED(hr))
{
diff --git a/dlls/d3d8/pixelshader.c b/dlls/d3d8/pixelshader.c
index 7b6d4e5..6a3e031 100644
--- a/dlls/d3d8/pixelshader.c
+++ b/dlls/d3d8/pixelshader.c
@@ -100,9 +100,8 @@ HRESULT pixelshader_init(IDirect3DPixelShader8Impl *shader, IDirect3DDevice8Impl
shader->handle = shader_handle;
wined3d_mutex_lock();
- hr = IWineD3DDevice_CreatePixelShader(device->WineD3DDevice, byte_code,
- NULL, &shader->wineD3DPixelShader, (IUnknown *)shader,
- &d3d8_pixelshader_wined3d_parent_ops);
+ hr = IWineD3DDevice_CreatePixelShader(device->WineD3DDevice, byte_code, NULL, shader,
+ &d3d8_pixelshader_wined3d_parent_ops, &shader->wineD3DPixelShader);
wined3d_mutex_unlock();
if (FAILED(hr))
{
diff --git a/dlls/d3d8/surface.c b/dlls/d3d8/surface.c
index cf72e3e..a71ab12 100644
--- a/dlls/d3d8/surface.c
+++ b/dlls/d3d8/surface.c
@@ -306,9 +306,8 @@ HRESULT surface_init(IDirect3DSurface8Impl *surface, IDirect3DDevice8Impl *devic
wined3d_mutex_lock();
hr = IWineD3DDevice_CreateSurface(device->WineD3DDevice, width, height, wined3dformat_from_d3dformat(format),
- lockable, discard, level, &surface->wineD3DSurface, usage & WINED3DUSAGE_MASK, (WINED3DPOOL)pool,
- multisample_type, multisample_quality, SURFACE_OPENGL, (IUnknown *)surface,
- &d3d8_surface_wined3d_parent_ops);
+ lockable, discard, level, usage & WINED3DUSAGE_MASK, (WINED3DPOOL)pool, multisample_type,
+ multisample_quality, SURFACE_OPENGL, surface, &d3d8_surface_wined3d_parent_ops, &surface->wineD3DSurface);
wined3d_mutex_unlock();
if (FAILED(hr))
{
diff --git a/dlls/d3d8/swapchain.c b/dlls/d3d8/swapchain.c
index 1b807fb..1c2a535 100644
--- a/dlls/d3d8/swapchain.c
+++ b/dlls/d3d8/swapchain.c
@@ -83,23 +83,28 @@ static HRESULT WINAPI IDirect3DSwapChain8Impl_Present(LPDIRECT3DSWAPCHAIN8 iface
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;
- HRESULT hrc = D3D_OK;
IWineD3DSurface *mySurface = NULL;
+ HRESULT hr;
TRACE("iface %p, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n",
iface, iBackBuffer, Type, ppBackBuffer);
wined3d_mutex_lock();
- hrc = IWineD3DSwapChain_GetBackBuffer(This->wineD3DSwapChain, iBackBuffer, (WINED3DBACKBUFFER_TYPE )Type, &mySurface);
- if (hrc == D3D_OK && NULL != mySurface) {
- IWineD3DSurface_GetParent(mySurface, (IUnknown **)ppBackBuffer);
- IWineD3DSurface_Release(mySurface);
+ hr = IWineD3DSwapChain_GetBackBuffer(This->wineD3DSwapChain, iBackBuffer,
+ (WINED3DBACKBUFFER_TYPE)Type, &mySurface);
+ if (SUCCEEDED(hr) && mySurface)
+ {
+ *ppBackBuffer = IWineD3DSurface_GetParent(mySurface);
+ IDirect3DSurface8_AddRef(*ppBackBuffer);
+ IWineD3DSurface_Release(mySurface);
}
wined3d_mutex_unlock();
- return hrc;
+ return hr;
}
static const IDirect3DSwapChain8Vtbl Direct3DSwapChain8_Vtbl =
@@ -138,7 +143,7 @@ HRESULT swapchain_init(IDirect3DSwapChain8Impl *swapchain, IDirect3DDevice8Impl
wined3d_mutex_lock();
hr = IWineD3DDevice_CreateSwapChain(device->WineD3DDevice, &wined3d_parameters,
- &swapchain->wineD3DSwapChain, (IUnknown *)swapchain, SURFACE_OPENGL);
+ SURFACE_OPENGL, swapchain, &swapchain->wineD3DSwapChain);
wined3d_mutex_unlock();
present_parameters->BackBufferWidth = wined3d_parameters.BackBufferWidth;
diff --git a/dlls/d3d8/texture.c b/dlls/d3d8/texture.c
index 67a60b4..a842160 100644
--- a/dlls/d3d8/texture.c
+++ b/dlls/d3d8/texture.c
@@ -251,22 +251,26 @@ static HRESULT WINAPI IDirect3DTexture8Impl_GetLevelDesc(LPDIRECT3DTEXTURE8 ifac
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;
- HRESULT hrc = D3D_OK;
IWineD3DSurface *mySurface = NULL;
+ HRESULT hr;
TRACE("iface %p, level %u, surface %p.\n", iface, Level, ppSurfaceLevel);
wined3d_mutex_lock();
- hrc = IWineD3DTexture_GetSurfaceLevel(This->wineD3DTexture, Level, &mySurface);
- if (hrc == D3D_OK && NULL != ppSurfaceLevel) {
- IWineD3DSurface_GetParent(mySurface, (IUnknown **)ppSurfaceLevel);
+ hr = IWineD3DTexture_GetSurfaceLevel(This->wineD3DTexture, Level, &mySurface);
+ if (SUCCEEDED(hr) && ppSurfaceLevel)
+ {
+ *ppSurfaceLevel = IWineD3DSurface_GetParent(mySurface);
+ IDirect3DSurface8_AddRef(*ppSurfaceLevel);
IWineD3DSurface_Release(mySurface);
}
wined3d_mutex_unlock();
- return hrc;
+ return hr;
}
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();
hr = IWineD3DDevice_CreateTexture(device->WineD3DDevice, width, height, levels,
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();
if (FAILED(hr))
{
diff --git a/dlls/d3d8/vertexbuffer.c b/dlls/d3d8/vertexbuffer.c
index 476fcc4..eec89f7 100644
--- a/dlls/d3d8/vertexbuffer.c
+++ b/dlls/d3d8/vertexbuffer.c
@@ -271,9 +271,8 @@ HRESULT vertexbuffer_init(IDirect3DVertexBuffer8Impl *buffer, IDirect3DDevice8Im
buffer->fvf = fvf;
wined3d_mutex_lock();
- hr = IWineD3DDevice_CreateVertexBuffer(device->WineD3DDevice, size,
- usage & WINED3DUSAGE_MASK, (WINED3DPOOL)pool, &buffer->wineD3DVertexBuffer,
- (IUnknown *)buffer, &d3d8_vertexbuffer_wined3d_parent_ops);
+ hr = IWineD3DDevice_CreateVertexBuffer(device->WineD3DDevice, size, usage & WINED3DUSAGE_MASK,
+ (WINED3DPOOL)pool, buffer, &d3d8_vertexbuffer_wined3d_parent_ops, &buffer->wineD3DVertexBuffer);
wined3d_mutex_unlock();
if (FAILED(hr))
{
diff --git a/dlls/d3d8/vertexdeclaration.c b/dlls/d3d8/vertexdeclaration.c
index 0d54eba..58573a5 100644
--- a/dlls/d3d8/vertexdeclaration.c
+++ b/dlls/d3d8/vertexdeclaration.c
@@ -399,9 +399,8 @@ HRESULT vertexdeclaration_init(IDirect3DVertexDeclaration8Impl *declaration,
memcpy(declaration->elements, elements, declaration->elements_size);
wined3d_mutex_lock();
- hr = IWineD3DDevice_CreateVertexDeclaration(device->WineD3DDevice, &declaration->wined3d_vertex_declaration,
- (IUnknown *)declaration, &d3d8_vertexdeclaration_wined3d_parent_ops,
- wined3d_elements, wined3d_element_count);
+ hr = IWineD3DDevice_CreateVertexDeclaration(device->WineD3DDevice, wined3d_elements, wined3d_element_count,
+ declaration, &d3d8_vertexdeclaration_wined3d_parent_ops, &declaration->wined3d_vertex_declaration);
wined3d_mutex_unlock();
HeapFree(GetProcessHeap(), 0, wined3d_elements);
if (FAILED(hr))
@@ -425,9 +424,8 @@ HRESULT vertexdeclaration_init_fvf(IDirect3DVertexDeclaration8Impl *declaration,
declaration->elements_size = 0;
declaration->shader_handle = fvf;
- hr = IWineD3DDevice_CreateVertexDeclarationFromFVF(device->WineD3DDevice,
- &declaration->wined3d_vertex_declaration, (IUnknown *)declaration,
- &d3d8_vertexdeclaration_wined3d_parent_ops, fvf);
+ hr = IWineD3DDevice_CreateVertexDeclarationFromFVF(device->WineD3DDevice, fvf, declaration,
+ &d3d8_vertexdeclaration_wined3d_parent_ops, &declaration->wined3d_vertex_declaration);
if (FAILED(hr))
{
WARN("Failed to create wined3d vertex declaration, hr %#x.\n", hr);
diff --git a/dlls/d3d8/vertexshader.c b/dlls/d3d8/vertexshader.c
index 1f00aa0..06142b4 100644
--- a/dlls/d3d8/vertexshader.c
+++ b/dlls/d3d8/vertexshader.c
@@ -169,9 +169,8 @@ HRESULT vertexshader_init(IDirect3DVertexShader8Impl *shader, IDirect3DDevice8Im
if (usage) FIXME("Usage %#x not implemented.\n", usage);
wined3d_mutex_lock();
- hr = IWineD3DDevice_CreateVertexShader(device->WineD3DDevice, byte_code,
- NULL /* output signature */, &shader->wineD3DVertexShader,
- (IUnknown *)shader, &d3d8_vertexshader_wined3d_parent_ops);
+ hr = IWineD3DDevice_CreateVertexShader(device->WineD3DDevice, byte_code, NULL /* output signature */,
+ shader, &d3d8_vertexshader_wined3d_parent_ops, &shader->wineD3DVertexShader);
wined3d_mutex_unlock();
if (FAILED(hr))
{
diff --git a/dlls/d3d8/volume.c b/dlls/d3d8/volume.c
index b7413bb..c2b7417 100644
--- a/dlls/d3d8/volume.c
+++ b/dlls/d3d8/volume.c
@@ -264,7 +264,7 @@ HRESULT volume_init(IDirect3DVolume8Impl *volume, IDirect3DDevice8Impl *device,
volume->ref = 1;
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))
{
WARN("Failed to create wined3d volume, hr %#x.\n", hr);
diff --git a/dlls/d3d8/volumetexture.c b/dlls/d3d8/volumetexture.c
index bc5c5b8..bd72d68 100644
--- a/dlls/d3d8/volumetexture.c
+++ b/dlls/d3d8/volumetexture.c
@@ -251,22 +251,26 @@ static HRESULT WINAPI IDirect3DVolumeTexture8Impl_GetLevelDesc(LPDIRECT3DVOLUMET
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;
- HRESULT hrc = D3D_OK;
IWineD3DVolume *myVolume = NULL;
+ HRESULT hr;
TRACE("iface %p, level %u, volume %p.\n", iface, Level, ppVolumeLevel);
wined3d_mutex_lock();
- hrc = IWineD3DVolumeTexture_GetVolumeLevel(This->wineD3DVolumeTexture, Level, &myVolume);
- if (hrc == D3D_OK && NULL != ppVolumeLevel) {
- IWineD3DVolumeTexture_GetParent(myVolume, (IUnknown **)ppVolumeLevel);
- IWineD3DVolumeTexture_Release(myVolume);
+ hr = IWineD3DVolumeTexture_GetVolumeLevel(This->wineD3DVolumeTexture, Level, &myVolume);
+ if (SUCCEEDED(hr) && ppVolumeLevel)
+ {
+ *ppVolumeLevel = IWineD3DVolumeTexture_GetParent(myVolume);
+ IDirect3DVolume8_AddRef(*ppVolumeLevel);
+ IWineD3DVolumeTexture_Release(myVolume);
}
wined3d_mutex_unlock();
- return hrc;
+ return hr;
}
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();
hr = IWineD3DDevice_CreateVolumeTexture(device->WineD3DDevice, width, height, depth, levels,
- usage & WINED3DUSAGE_MASK, wined3dformat_from_d3dformat(format), pool,
- &texture->wineD3DVolumeTexture, (IUnknown *)texture, &d3d8_volumetexture_wined3d_parent_ops);
+ usage & WINED3DUSAGE_MASK, wined3dformat_from_d3dformat(format), pool, texture,
+ &d3d8_volumetexture_wined3d_parent_ops, &texture->wineD3DVolumeTexture);
wined3d_mutex_unlock();
if (FAILED(hr))
{
diff --git a/dlls/d3d9/cubetexture.c b/dlls/d3d9/cubetexture.c
index c0d0e3c..508784f 100644
--- a/dlls/d3d9/cubetexture.c
+++ b/dlls/d3d9/cubetexture.c
@@ -292,22 +292,27 @@ static HRESULT WINAPI IDirect3DCubeTexture9Impl_GetLevelDesc(LPDIRECT3DCUBETEXTU
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;
- HRESULT hrc = D3D_OK;
IWineD3DSurface *mySurface = NULL;
+ HRESULT hr;
TRACE("iface %p, face %#x, level %u, surface %p.\n", iface, FaceType, Level, ppCubeMapSurface);
wined3d_mutex_lock();
- hrc = IWineD3DCubeTexture_GetCubeMapSurface(This->wineD3DCubeTexture, (WINED3DCUBEMAP_FACES) FaceType, Level, &mySurface);
- if (hrc == D3D_OK && NULL != ppCubeMapSurface) {
- IWineD3DCubeTexture_GetParent(mySurface, (IUnknown **)ppCubeMapSurface);
- IWineD3DCubeTexture_Release(mySurface);
+ hr = IWineD3DCubeTexture_GetCubeMapSurface(This->wineD3DCubeTexture,
+ (WINED3DCUBEMAP_FACES)FaceType, Level, &mySurface);
+ if (SUCCEEDED(hr) && ppCubeMapSurface)
+ {
+ *ppCubeMapSurface = IWineD3DCubeTexture_GetParent(mySurface);
+ IDirect3DSurface9_AddRef(*ppCubeMapSurface);
+ IWineD3DCubeTexture_Release(mySurface);
}
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) {
@@ -399,9 +404,9 @@ HRESULT cubetexture_init(IDirect3DCubeTexture9Impl *texture, IDirect3DDevice9Imp
texture->ref = 1;
wined3d_mutex_lock();
- hr = IWineD3DDevice_CreateCubeTexture(device->WineD3DDevice, edge_length, levels, usage,
- wined3dformat_from_d3dformat(format), pool, &texture->wineD3DCubeTexture,
- (IUnknown *)texture, &d3d9_cubetexture_wined3d_parent_ops);
+ hr = IWineD3DDevice_CreateCubeTexture(device->WineD3DDevice, edge_length,
+ levels, usage, wined3dformat_from_d3dformat(format), pool, texture,
+ &d3d9_cubetexture_wined3d_parent_ops, &texture->wineD3DCubeTexture);
wined3d_mutex_unlock();
if (FAILED(hr))
{
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 87cc65c..0162439 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -187,8 +187,9 @@ static ULONG WINAPI D3D9CB_DestroySwapChain(IWineD3DSwapChain *swapchain)
TRACE("swapchain %p.\n", swapchain);
- IWineD3DSwapChain_GetParent(swapchain, (IUnknown **)&parent);
+ parent = IWineD3DSwapChain_GetParent(swapchain);
parent->isImplicit = FALSE;
+ IDirect3DSwapChain9_AddRef((IDirect3DSwapChain9 *)parent);
return IDirect3DSwapChain9_Release((IDirect3DSwapChain9 *)parent);
}
@@ -337,7 +338,8 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetDirect3D(LPDIRECT3DDEVICE9EX iface
hr = IWineD3DDevice_GetDirect3D(This->WineD3DDevice, &pWineD3D);
if (hr == D3D_OK && pWineD3D != NULL)
{
- IWineD3D_GetParent(pWineD3D,(IUnknown **)ppD3D9);
+ *ppD3D9 = IWineD3D_GetParent(pWineD3D);
+ IDirect3D9_AddRef(*ppD3D9);
IWineD3D_Release(pWineD3D);
} else {
FIXME("Call to IWineD3DDevice_GetDirect3D failed\n");
@@ -495,7 +497,7 @@ static HRESULT WINAPI reset_enum_callback(IWineD3DResource *resource, void *data
WINED3DPOOL pool;
IDirect3DResource9 *parent;
- IWineD3DResource_GetParent(resource, (IUnknown **) &parent);
+ parent = IWineD3DResource_GetParent(resource);
type = IDirect3DResource9_GetType(parent);
switch(type) {
case D3DRTYPE_SURFACE:
@@ -526,16 +528,17 @@ static HRESULT WINAPI reset_enum_callback(IWineD3DResource *resource, void *data
break;
}
- if(pool == WINED3DPOOL_DEFAULT) {
- if(IUnknown_Release(parent) == 0) {
+ if (pool == WINED3DPOOL_DEFAULT)
+ {
+ IDirect3DResource9_AddRef(parent);
+ if (IUnknown_Release(parent) == 0)
+ {
TRACE("Parent %p is an implicit resource with ref 0\n", parent);
} else {
WARN("Resource %p(wineD3D %p) with pool D3DPOOL_DEFAULT blocks the Reset call\n", parent, resource);
ret = S_FALSE;
*resources_ok = FALSE;
}
- } else {
- IUnknown_Release(parent);
}
IWineD3DResource_Release(resource);
@@ -635,23 +638,28 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_Present(LPDIRECT3D
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;
IWineD3DSurface *retSurface = NULL;
- HRESULT rc = D3D_OK;
+ HRESULT hr;
TRACE("iface %p, swapchain %u, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n",
iface, iSwapChain, BackBuffer, Type, ppBackBuffer);
wined3d_mutex_lock();
- rc = IWineD3DDevice_GetBackBuffer(This->WineD3DDevice, iSwapChain, BackBuffer, (WINED3DBACKBUFFER_TYPE) Type, &retSurface);
- if (rc == D3D_OK && NULL != retSurface && NULL != ppBackBuffer) {
- IWineD3DSurface_GetParent(retSurface, (IUnknown **)ppBackBuffer);
+ hr = IWineD3DDevice_GetBackBuffer(This->WineD3DDevice, iSwapChain,
+ BackBuffer, (WINED3DBACKBUFFER_TYPE) Type, &retSurface);
+ if (SUCCEEDED(hr) && retSurface && ppBackBuffer)
+ {
+ *ppBackBuffer = IWineD3DSurface_GetParent(retSurface);
+ IDirect3DSurface9_AddRef(*ppBackBuffer);
IWineD3DSurface_Release(retSurface);
}
wined3d_mutex_unlock();
- return rc;
+ return hr;
}
static HRESULT WINAPI IDirect3DDevice9Impl_GetRasterStatus(LPDIRECT3DDEVICE9EX iface, UINT iSwapChain, D3DRASTER_STATUS* pRasterStatus) {
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
@@ -1096,7 +1104,9 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetRenderTarget(LPDIRECT3DDEVICE9EX
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;
IWineD3DSurface *pRenderTarget;
HRESULT hr;
@@ -1127,7 +1137,8 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetRenderTarget(LPDIRECT3DDEVICE9EX
}
else
{
- IWineD3DSurface_GetParent(pRenderTarget, (IUnknown **)ppRenderTarget);
+ *ppRenderTarget = IWineD3DSurface_GetParent(pRenderTarget);
+ IDirect3DSurface9_AddRef(*ppRenderTarget);
IWineD3DSurface_Release(pRenderTarget);
}
@@ -1152,10 +1163,12 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetDepthStencilSurface(LPDIRECT3DDE
return hr;
}
-static HRESULT WINAPI IDirect3DDevice9Impl_GetDepthStencilSurface(LPDIRECT3DDEVICE9EX iface, IDirect3DSurface9 **ppZStencilSurface) {
+static HRESULT WINAPI IDirect3DDevice9Impl_GetDepthStencilSurface(IDirect3DDevice9Ex *iface,
+ IDirect3DSurface9 **ppZStencilSurface)
+{
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
- HRESULT hr = D3D_OK;
IWineD3DSurface *pZStencilSurface;
+ HRESULT hr;
TRACE("iface %p, depth_stencil %p.\n", iface, ppZStencilSurface);
@@ -1165,10 +1178,14 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetDepthStencilSurface(LPDIRECT3DDE
wined3d_mutex_lock();
hr = IWineD3DDevice_GetDepthStencilSurface(This->WineD3DDevice,&pZStencilSurface);
- if (hr == WINED3D_OK) {
- IWineD3DSurface_GetParent(pZStencilSurface,(IUnknown**)ppZStencilSurface);
+ if (SUCCEEDED(hr))
+ {
+ *ppZStencilSurface = IWineD3DSurface_GetParent(pZStencilSurface);
+ IDirect3DSurface9_AddRef(*ppZStencilSurface);
IWineD3DSurface_Release(pZStencilSurface);
- } else {
+ }
+ else
+ {
if (hr != WINED3DERR_NOTFOUND)
WARN("Call to IWineD3DDevice_GetDepthStencilSurface failed with 0x%08x\n", hr);
*ppZStencilSurface = NULL;
@@ -1540,10 +1557,12 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetClipStatus(LPDIRECT3DDEVICE9EX i
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;
IWineD3DBaseTexture *retTexture = NULL;
- HRESULT rc = D3D_OK;
+ HRESULT hr;
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();
- rc = IWineD3DDevice_GetTexture(This->WineD3DDevice, Stage, &retTexture);
- if (SUCCEEDED(rc) && NULL != retTexture) {
- IWineD3DBaseTexture_GetParent(retTexture, (IUnknown **)ppTexture);
+ hr = IWineD3DDevice_GetTexture(This->WineD3DDevice, Stage, &retTexture);
+ if (SUCCEEDED(hr) && retTexture)
+ {
+ *ppTexture = IWineD3DBaseTexture_GetParent(retTexture);
+ IWineD3DBaseTexture_AddRef(*ppTexture);
IWineD3DBaseTexture_Release(retTexture);
- } else {
- if(FAILED(rc)) {
+ }
+ else
+ {
+ if (FAILED(hr))
+ {
WARN("Call to get texture (%d) failed (%p)\n", Stage, retTexture);
}
*ppTexture = NULL;
}
wined3d_mutex_unlock();
- return rc;
+ return hr;
}
static HRESULT WINAPI IDirect3DDevice9Impl_SetTexture(LPDIRECT3DDEVICE9EX iface, DWORD Stage, IDirect3DBaseTexture9* pTexture) {
@@ -2110,10 +2134,12 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetStreamSource(LPDIRECT3DDEVICE9EX i
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;
IWineD3DBuffer *retStream = NULL;
- HRESULT rc = D3D_OK;
+ HRESULT hr;
TRACE("iface %p, stream_idx %u, buffer %p, offset %p, stride %p.\n",
iface, StreamNumber, pStream, OffsetInBytes, pStride);
@@ -2123,19 +2149,24 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetStreamSource(LPDIRECT3DDEVICE9EX i
}
wined3d_mutex_lock();
- rc = IWineD3DDevice_GetStreamSource(This->WineD3DDevice, StreamNumber, &retStream, OffsetInBytes, pStride);
- if (rc == D3D_OK && NULL != retStream) {
- IWineD3DBuffer_GetParent(retStream, (IUnknown **)pStream);
+ hr = IWineD3DDevice_GetStreamSource(This->WineD3DDevice, StreamNumber, &retStream, OffsetInBytes, pStride);
+ if (SUCCEEDED(hr) && retStream)
+ {
+ *pStream = IWineD3DBuffer_GetParent(retStream);
+ IDirect3DVertexBuffer9_AddRef(*pStream);
IWineD3DBuffer_Release(retStream);
- }else{
- if (rc != D3D_OK){
+ }
+ else
+ {
+ if (FAILED(hr))
+ {
FIXME("Call to GetStreamSource failed %p %p\n", OffsetInBytes, pStride);
}
*pStream = NULL;
}
wined3d_mutex_unlock();
- return rc;
+ return hr;
}
static HRESULT WINAPI IDirect3DDevice9Impl_SetStreamSourceFreq(IDirect3DDevice9Ex *iface, UINT StreamNumber,
@@ -2182,10 +2213,11 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetIndices(LPDIRECT3DDEVICE9EX ifac
return hr;
}
-static HRESULT WINAPI IDirect3DDevice9Impl_GetIndices(LPDIRECT3DDEVICE9EX iface, IDirect3DIndexBuffer9 **ppIndexData) {
+static HRESULT WINAPI IDirect3DDevice9Impl_GetIndices(IDirect3DDevice9Ex *iface, IDirect3DIndexBuffer9 **ppIndexData)
+{
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
IWineD3DBuffer *retIndexData = NULL;
- HRESULT rc = D3D_OK;
+ HRESULT hr;
TRACE("iface %p, buffer %p.\n", iface, ppIndexData);
@@ -2194,17 +2226,21 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetIndices(LPDIRECT3DDEVICE9EX ifac
}
wined3d_mutex_lock();
- rc = IWineD3DDevice_GetIndexBuffer(This->WineD3DDevice, &retIndexData);
- if (SUCCEEDED(rc) && retIndexData) {
- IWineD3DBuffer_GetParent(retIndexData, (IUnknown **)ppIndexData);
+ hr = IWineD3DDevice_GetIndexBuffer(This->WineD3DDevice, &retIndexData);
+ if (SUCCEEDED(hr) && retIndexData)
+ {
+ *ppIndexData = IWineD3DBuffer_GetParent(retIndexData);
+ IDirect3DIndexBuffer9_AddRef(*ppIndexData);
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;
}
wined3d_mutex_unlock();
- return rc;
+ return hr;
}
static HRESULT WINAPI IDirect3DDevice9Impl_CreatePixelShader(IDirect3DDevice9Ex *iface,
diff --git a/dlls/d3d9/indexbuffer.c b/dlls/d3d9/indexbuffer.c
index 1b7e8e4..001bb2a 100644
--- a/dlls/d3d9/indexbuffer.c
+++ b/dlls/d3d9/indexbuffer.c
@@ -270,9 +270,8 @@ HRESULT indexbuffer_init(IDirect3DIndexBuffer9Impl *buffer, IDirect3DDevice9Impl
buffer->format = wined3dformat_from_d3dformat(format);
wined3d_mutex_lock();
- hr = IWineD3DDevice_CreateIndexBuffer(device->WineD3DDevice, size,
- usage & WINED3DUSAGE_MASK, (WINED3DPOOL)pool, &buffer->wineD3DIndexBuffer,
- (IUnknown *)buffer, &d3d9_indexbuffer_wined3d_parent_ops);
+ hr = IWineD3DDevice_CreateIndexBuffer(device->WineD3DDevice, size, usage & WINED3DUSAGE_MASK,
+ (WINED3DPOOL)pool, buffer, &d3d9_indexbuffer_wined3d_parent_ops, &buffer->wineD3DIndexBuffer);
wined3d_mutex_unlock();
if (FAILED(hr))
{
diff --git a/dlls/d3d9/pixelshader.c b/dlls/d3d9/pixelshader.c
index 7cb803a..840322b 100644
--- a/dlls/d3d9/pixelshader.c
+++ b/dlls/d3d9/pixelshader.c
@@ -136,9 +136,8 @@ HRESULT pixelshader_init(IDirect3DPixelShader9Impl *shader, IDirect3DDevice9Impl
shader->lpVtbl = &Direct3DPixelShader9_Vtbl;
wined3d_mutex_lock();
- hr = IWineD3DDevice_CreatePixelShader(device->WineD3DDevice, byte_code,
- NULL, &shader->wineD3DPixelShader, (IUnknown *)shader,
- &d3d9_pixelshader_wined3d_parent_ops);
+ hr = IWineD3DDevice_CreatePixelShader(device->WineD3DDevice, byte_code, NULL, shader,
+ &d3d9_pixelshader_wined3d_parent_ops, &shader->wineD3DPixelShader);
wined3d_mutex_unlock();
if (FAILED(hr))
{
@@ -165,10 +164,11 @@ HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShader(LPDIRECT3DDEVICE9EX iface, ID
return D3D_OK;
}
-HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShader(LPDIRECT3DDEVICE9EX iface, IDirect3DPixelShader9** ppShader) {
+HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShader(IDirect3DDevice9Ex *iface, IDirect3DPixelShader9 **ppShader)
+{
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
IWineD3DPixelShader *object;
- HRESULT hrc;
+ HRESULT hr;
TRACE("iface %p, shader %p.\n", iface, ppShader);
@@ -178,12 +178,13 @@ HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShader(LPDIRECT3DDEVICE9EX iface, ID
}
wined3d_mutex_lock();
- hrc = IWineD3DDevice_GetPixelShader(This->WineD3DDevice, &object);
- if (SUCCEEDED(hrc))
+ hr = IWineD3DDevice_GetPixelShader(This->WineD3DDevice, &object);
+ if (SUCCEEDED(hr))
{
if (object)
{
- hrc = IWineD3DPixelShader_GetParent(object, (IUnknown **)ppShader);
+ *ppShader = IWineD3DPixelShader_GetParent(object);
+ IDirect3DPixelShader9_AddRef(*ppShader);
IWineD3DPixelShader_Release(object);
}
else
@@ -193,12 +194,12 @@ HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShader(LPDIRECT3DDEVICE9EX iface, ID
}
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();
- TRACE("(%p) : returning %p\n", This, *ppShader);
- return hrc;
+ TRACE("Returning %p.\n", *ppShader);
+ return hr;
}
HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantF(LPDIRECT3DDEVICE9EX iface, UINT Register, CONST float* pConstantData, UINT Vector4fCount) {
diff --git a/dlls/d3d9/surface.c b/dlls/d3d9/surface.c
index 210a0ee..c7dc895 100644
--- a/dlls/d3d9/surface.c
+++ b/dlls/d3d9/surface.c
@@ -403,9 +403,8 @@ HRESULT surface_init(IDirect3DSurface9Impl *surface, IDirect3DDevice9Impl *devic
wined3d_mutex_lock();
hr = IWineD3DDevice_CreateSurface(device->WineD3DDevice, width, height, wined3dformat_from_d3dformat(format),
- lockable, discard, level, &surface->wineD3DSurface, usage & WINED3DUSAGE_MASK, (WINED3DPOOL)pool,
- multisample_type, multisample_quality, SURFACE_OPENGL, (IUnknown *)surface,
- &d3d9_surface_wined3d_parent_ops);
+ lockable, discard, level, usage & WINED3DUSAGE_MASK, (WINED3DPOOL)pool, multisample_type,
+ multisample_quality, SURFACE_OPENGL, surface, &d3d9_surface_wined3d_parent_ops, &surface->wineD3DSurface);
wined3d_mutex_unlock();
if (FAILED(hr))
{
diff --git a/dlls/d3d9/swapchain.c b/dlls/d3d9/swapchain.c
index c692371..18c7dcd 100644
--- a/dlls/d3d9/swapchain.c
+++ b/dlls/d3d9/swapchain.c
@@ -106,24 +106,29 @@ static HRESULT WINAPI IDirect3DSwapChain9Impl_GetFrontBufferData(LPDIRECT3DSWAPC
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;
- HRESULT hrc = D3D_OK;
IWineD3DSurface *mySurface = NULL;
+ HRESULT hr;
TRACE("iface %p, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n",
iface, iBackBuffer, Type, ppBackBuffer);
wined3d_mutex_lock();
- hrc = IWineD3DSwapChain_GetBackBuffer(This->wineD3DSwapChain, iBackBuffer, (WINED3DBACKBUFFER_TYPE) Type, &mySurface);
- if (hrc == D3D_OK && NULL != mySurface) {
- IWineD3DSurface_GetParent(mySurface, (IUnknown **)ppBackBuffer);
+ hr = IWineD3DSwapChain_GetBackBuffer(This->wineD3DSwapChain, iBackBuffer,
+ (WINED3DBACKBUFFER_TYPE)Type, &mySurface);
+ if (SUCCEEDED(hr) && mySurface)
+ {
+ *ppBackBuffer = IWineD3DSurface_GetParent(mySurface);
+ IDirect3DSurface9_AddRef(*ppBackBuffer);
IWineD3DSurface_Release(mySurface);
}
wined3d_mutex_unlock();
/* Do not touch the **ppBackBuffer pointer otherwise! (see device test) */
- return hrc;
+ return hr;
}
static HRESULT WINAPI IDirect3DSwapChain9Impl_GetRasterStatus(LPDIRECT3DSWAPCHAIN9 iface, D3DRASTER_STATUS* pRasterStatus) {
@@ -239,7 +244,7 @@ HRESULT swapchain_init(IDirect3DSwapChain9Impl *swapchain, IDirect3DDevice9Impl
wined3d_mutex_lock();
hr = IWineD3DDevice_CreateSwapChain(device->WineD3DDevice, &wined3d_parameters,
- &swapchain->wineD3DSwapChain, (IUnknown *)swapchain, SURFACE_OPENGL);
+ SURFACE_OPENGL, swapchain, &swapchain->wineD3DSwapChain);
wined3d_mutex_unlock();
present_parameters->BackBufferWidth = wined3d_parameters.BackBufferWidth;
@@ -269,25 +274,31 @@ HRESULT swapchain_init(IDirect3DSwapChain9Impl *swapchain, IDirect3DDevice9Impl
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;
- HRESULT hrc = D3D_OK;
IWineD3DSwapChain *swapchain = NULL;
+ HRESULT hr;
TRACE("iface %p, swapchain_idx %u, swapchain %p.\n",
iface, iSwapChain, pSwapChain);
wined3d_mutex_lock();
- hrc = IWineD3DDevice_GetSwapChain(This->WineD3DDevice, iSwapChain, &swapchain);
- if (hrc == D3D_OK && NULL != swapchain) {
- IWineD3DSwapChain_GetParent(swapchain, (IUnknown **)pSwapChain);
+ hr = IWineD3DDevice_GetSwapChain(This->WineD3DDevice, iSwapChain, &swapchain);
+ if (SUCCEEDED(hr) && swapchain)
+ {
+ *pSwapChain = IWineD3DSwapChain_GetParent(swapchain);
+ IDirect3DSwapChain9_AddRef(*pSwapChain);
IWineD3DSwapChain_Release(swapchain);
- } else {
+ }
+ else
+ {
*pSwapChain = NULL;
}
wined3d_mutex_unlock();
- return hrc;
+ return hr;
}
UINT WINAPI IDirect3DDevice9Impl_GetNumberOfSwapChains(LPDIRECT3DDEVICE9EX iface) {
diff --git a/dlls/d3d9/texture.c b/dlls/d3d9/texture.c
index 564057f..dbe9798 100644
--- a/dlls/d3d9/texture.c
+++ b/dlls/d3d9/texture.c
@@ -289,22 +289,26 @@ static HRESULT WINAPI IDirect3DTexture9Impl_GetLevelDesc(LPDIRECT3DTEXTURE9 ifac
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;
- HRESULT hrc = D3D_OK;
IWineD3DSurface *mySurface = NULL;
+ HRESULT hr;
TRACE("iface %p, level %u, surface %p.\n", iface, Level, ppSurfaceLevel);
wined3d_mutex_lock();
- hrc = IWineD3DTexture_GetSurfaceLevel(This->wineD3DTexture, Level, &mySurface);
- if (hrc == D3D_OK && NULL != ppSurfaceLevel) {
- IWineD3DSurface_GetParent(mySurface, (IUnknown **)ppSurfaceLevel);
- IWineD3DSurface_Release(mySurface);
+ hr = IWineD3DTexture_GetSurfaceLevel(This->wineD3DTexture, Level, &mySurface);
+ if (SUCCEEDED(hr) && ppSurfaceLevel)
+ {
+ *ppSurfaceLevel = IWineD3DSurface_GetParent(mySurface);
+ IDirect3DSurface9_AddRef(*ppSurfaceLevel);
+ IWineD3DSurface_Release(mySurface);
}
wined3d_mutex_unlock();
- return hrc;
+ return hr;
}
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();
hr = IWineD3DDevice_CreateTexture(device->WineD3DDevice, width, height, levels,
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();
if (FAILED(hr))
{
diff --git a/dlls/d3d9/vertexbuffer.c b/dlls/d3d9/vertexbuffer.c
index 1841bec..f06d5a2 100644
--- a/dlls/d3d9/vertexbuffer.c
+++ b/dlls/d3d9/vertexbuffer.c
@@ -272,9 +272,8 @@ HRESULT vertexbuffer_init(IDirect3DVertexBuffer9Impl *buffer, IDirect3DDevice9Im
buffer->fvf = fvf;
wined3d_mutex_lock();
- hr = IWineD3DDevice_CreateVertexBuffer(device->WineD3DDevice, size,
- usage & WINED3DUSAGE_MASK, (WINED3DPOOL)pool, &buffer->wineD3DVertexBuffer,
- (IUnknown *)buffer, &d3d9_vertexbuffer_wined3d_parent_ops);
+ hr = IWineD3DDevice_CreateVertexBuffer(device->WineD3DDevice, size, usage & WINED3DUSAGE_MASK,
+ (WINED3DPOOL)pool, buffer, &d3d9_vertexbuffer_wined3d_parent_ops, &buffer->wineD3DVertexBuffer);
wined3d_mutex_unlock();
if (FAILED(hr))
{
diff --git a/dlls/d3d9/vertexdeclaration.c b/dlls/d3d9/vertexdeclaration.c
index 5bdf0ec..3e91389 100644
--- a/dlls/d3d9/vertexdeclaration.c
+++ b/dlls/d3d9/vertexdeclaration.c
@@ -395,9 +395,8 @@ HRESULT vertexdeclaration_init(IDirect3DVertexDeclaration9Impl *declaration,
declaration->element_count = element_count;
wined3d_mutex_lock();
- hr = IWineD3DDevice_CreateVertexDeclaration(device->WineD3DDevice, &declaration->wineD3DVertexDeclaration,
- (IUnknown *)declaration, &d3d9_vertexdeclaration_wined3d_parent_ops,
- wined3d_elements, wined3d_element_count);
+ hr = IWineD3DDevice_CreateVertexDeclaration(device->WineD3DDevice, wined3d_elements, wined3d_element_count,
+ declaration, &d3d9_vertexdeclaration_wined3d_parent_ops, &declaration->wineD3DVertexDeclaration);
wined3d_mutex_unlock();
HeapFree(GetProcessHeap(), 0, wined3d_elements);
if (FAILED(hr))
@@ -427,29 +426,31 @@ HRESULT WINAPI IDirect3DDevice9Impl_SetVertexDeclaration(LPDIRECT3DDEVICE9EX i
return hr;
}
-HRESULT WINAPI IDirect3DDevice9Impl_GetVertexDeclaration(LPDIRECT3DDEVICE9EX iface, IDirect3DVertexDeclaration9** ppDecl) {
- IDirect3DDevice9Impl* This = (IDirect3DDevice9Impl*) iface;
- IWineD3DVertexDeclaration* pTest = NULL;
- HRESULT hr = D3D_OK;
+HRESULT WINAPI IDirect3DDevice9Impl_GetVertexDeclaration(IDirect3DDevice9Ex *iface,
+ IDirect3DVertexDeclaration9 **declaration)
+{
+ 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) {
- return D3DERR_INVALIDCALL;
- }
-
- *ppDecl = NULL;
+ if (!declaration) return D3DERR_INVALIDCALL;
wined3d_mutex_lock();
- hr = IWineD3DDevice_GetVertexDeclaration(This->WineD3DDevice, &pTest);
- if (hr == D3D_OK && NULL != pTest) {
- IWineD3DVertexDeclaration_GetParent(pTest, (IUnknown **)ppDecl);
- IWineD3DVertexDeclaration_Release(pTest);
- } else {
- *ppDecl = NULL;
+ hr = IWineD3DDevice_GetVertexDeclaration(This->WineD3DDevice, &wined3d_declaration);
+ if (SUCCEEDED(hr) && wined3d_declaration)
+ {
+ *declaration = IWineD3DVertexDeclaration_GetParent(wined3d_declaration);
+ IDirect3DVertexDeclaration9_AddRef(*declaration);
+ IWineD3DVertexDeclaration_Release(wined3d_declaration);
+ }
+ else
+ {
+ *declaration = NULL;
}
wined3d_mutex_unlock();
- TRACE("(%p) : returning %p\n", This, *ppDecl);
+ TRACE("Returning %p.\n", *declaration);
return hr;
}
diff --git a/dlls/d3d9/vertexshader.c b/dlls/d3d9/vertexshader.c
index 21a4e87..9faef72 100644
--- a/dlls/d3d9/vertexshader.c
+++ b/dlls/d3d9/vertexshader.c
@@ -136,9 +136,8 @@ HRESULT vertexshader_init(IDirect3DVertexShader9Impl *shader, IDirect3DDevice9Im
shader->lpVtbl = &Direct3DVertexShader9_Vtbl;
wined3d_mutex_lock();
- hr = IWineD3DDevice_CreateVertexShader(device->WineD3DDevice, byte_code,
- NULL /* output signature */, &shader->wineD3DVertexShader,
- (IUnknown *)shader, &d3d9_vertexshader_wined3d_parent_ops);
+ hr = IWineD3DDevice_CreateVertexShader(device->WineD3DDevice, byte_code, NULL,
+ shader, &d3d9_vertexshader_wined3d_parent_ops, &shader->wineD3DVertexShader);
wined3d_mutex_unlock();
if (FAILED(hr))
{
@@ -166,20 +165,22 @@ HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShader(LPDIRECT3DDEVICE9EX iface, I
return hrc;
}
-HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShader(LPDIRECT3DDEVICE9EX iface, IDirect3DVertexShader9** ppShader) {
+HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShader(LPDIRECT3DDEVICE9EX iface, IDirect3DVertexShader9 **ppShader)
+{
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
IWineD3DVertexShader *pShader;
- HRESULT hrc = D3D_OK;
+ HRESULT hr;
TRACE("iface %p, shader %p.\n", iface, ppShader);
wined3d_mutex_lock();
- hrc = IWineD3DDevice_GetVertexShader(This->WineD3DDevice, &pShader);
- if (SUCCEEDED(hrc))
+ hr = IWineD3DDevice_GetVertexShader(This->WineD3DDevice, &pShader);
+ if (SUCCEEDED(hr))
{
if (pShader)
{
- hrc = IWineD3DVertexShader_GetParent(pShader, (IUnknown **)ppShader);
+ *ppShader = IWineD3DVertexShader_GetParent(pShader);
+ IDirect3DVertexShader9_AddRef(*ppShader);
IWineD3DVertexShader_Release(pShader);
}
else
@@ -189,12 +190,13 @@ HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShader(LPDIRECT3DDEVICE9EX iface, I
}
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();
- TRACE("(%p) : returning %p\n", This, *ppShader);
- return hrc;
+ TRACE("Returning %p.\n", *ppShader);
+
+ return hr;
}
HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantF(LPDIRECT3DDEVICE9EX iface, UINT Register, CONST float* pConstantData, UINT Vector4fCount) {
diff --git a/dlls/d3d9/volume.c b/dlls/d3d9/volume.c
index ceb88bd..0d87b86 100644
--- a/dlls/d3d9/volume.c
+++ b/dlls/d3d9/volume.c
@@ -275,7 +275,7 @@ HRESULT volume_init(IDirect3DVolume9Impl *volume, IDirect3DDevice9Impl *device,
volume->ref = 1;
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))
{
WARN("Failed to create wined3d volume, hr %#x.\n", hr);
diff --git a/dlls/d3d9/volumetexture.c b/dlls/d3d9/volumetexture.c
index ca9ca9c..7ce4623 100644
--- a/dlls/d3d9/volumetexture.c
+++ b/dlls/d3d9/volumetexture.c
@@ -315,24 +315,28 @@ static HRESULT WINAPI IDirect3DVolumeTexture9Impl_GetLevelDesc(LPDIRECT3DVOLUMET
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;
- HRESULT hrc = D3D_OK;
IWineD3DVolume *myVolume = NULL;
+ HRESULT hr;
TRACE("iface %p, level %u, volume %p.\n", iface, Level, ppVolumeLevel);
wined3d_mutex_lock();
- hrc = IWineD3DVolumeTexture_GetVolumeLevel(This->wineD3DVolumeTexture, Level, &myVolume);
- if (hrc == D3D_OK && NULL != ppVolumeLevel) {
- IWineD3DVolumeTexture_GetParent(myVolume, (IUnknown **)ppVolumeLevel);
+ hr = IWineD3DVolumeTexture_GetVolumeLevel(This->wineD3DVolumeTexture, Level, &myVolume);
+ if (SUCCEEDED(hr) && ppVolumeLevel)
+ {
+ *ppVolumeLevel = IWineD3DVolumeTexture_GetParent(myVolume);
+ IDirect3DVolumeTexture9_AddRef(*ppVolumeLevel);
IWineD3DVolumeTexture_Release(myVolume);
}
wined3d_mutex_unlock();
- return hrc;
+ return hr;
}
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();
hr = IWineD3DDevice_CreateVolumeTexture(device->WineD3DDevice, width, height, depth, levels,
- usage & WINED3DUSAGE_MASK, wined3dformat_from_d3dformat(format), pool,
- &texture->wineD3DVolumeTexture, (IUnknown *)texture, &d3d9_volumetexture_wined3d_parent_ops);
+ usage & WINED3DUSAGE_MASK, wined3dformat_from_d3dformat(format), pool, texture,
+ &d3d9_volumetexture_wined3d_parent_ops, &texture->wineD3DVolumeTexture);
wined3d_mutex_unlock();
if (FAILED(hr))
{
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index 451298c..865d5d0 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -1836,13 +1836,9 @@ static HRESULT WINAPI ddraw7_GetGDISurface(IDirectDraw7 *iface, IDirectDrawSurfa
return DDERR_NOTFOUND;
}
- /* GetBackBuffer AddRef()ed the surface, release it */
+ ddsurf = IWineD3DSurface_GetParent(Surf);
IWineD3DSurface_Release(Surf);
- IWineD3DSurface_GetParent(Surf,
- (IUnknown **) &ddsurf);
- IDirectDrawSurface7_Release(ddsurf); /* For the GetParent */
-
/* Find the front buffer */
ddsCaps.dwCaps = DDSCAPS_FRONTBUFFER;
hr = IDirectDrawSurface7_GetAttachedSurface(ddsurf,
@@ -2249,7 +2245,8 @@ static HRESULT WINAPI ddraw7_GetSurfaceFromDC(IDirectDraw7 *iface, HDC hdc, IDir
return DDERR_NOTFOUND;
}
- IWineD3DSurface_GetParent(wined3d_surface, (IUnknown **)Surface);
+ *Surface = IWineD3DSurface_GetParent(wined3d_surface);
+ IDirectDrawSurface7_AddRef(*Surface);
TRACE("Returning surface %p.\n", Surface);
return DD_OK;
}
@@ -2359,9 +2356,9 @@ HRESULT WINAPI ddraw_recreate_surfaces_cb(IDirectDrawSurface7 *surf, DDSURFACEDE
{
IDirectDrawSurfaceImpl *surfImpl = (IDirectDrawSurfaceImpl *)surf;
IDirectDrawImpl *This = surfImpl->ddraw;
- IUnknown *Parent;
IWineD3DSurface *wineD3DSurface;
IWineD3DSwapChain *swapchain;
+ void *parent;
HRESULT hr;
IWineD3DClipper *clipper = NULL;
@@ -2403,13 +2400,10 @@ HRESULT WINAPI ddraw_recreate_surfaces_cb(IDirectDrawSurface7 *surf, DDSURFACEDE
Width = Desc.width;
Height = Desc.height;
- IWineD3DSurface_GetParent(wineD3DSurface, &Parent);
-
- /* Create the new surface */
- hr = IWineD3DDevice_CreateSurface(This->wineD3DDevice, Width, Height, Format,
- TRUE /* Lockable */, FALSE /* Discard */, surfImpl->mipmap_level, &surfImpl->WineD3DSurface, Usage, Pool,
- MultiSampleType, MultiSampleQuality, This->ImplType, Parent, &ddraw_null_wined3d_parent_ops);
- IUnknown_Release(Parent);
+ parent = IWineD3DSurface_GetParent(wineD3DSurface);
+ hr = IWineD3DDevice_CreateSurface(This->wineD3DDevice, Width, Height, Format, TRUE /* Lockable */,
+ FALSE /* Discard */, surfImpl->mipmap_level, Usage, Pool, MultiSampleType, MultiSampleQuality,
+ This->ImplType, parent, &ddraw_null_wined3d_parent_ops, &surfImpl->WineD3DSurface);
if (FAILED(hr))
{
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);
}
-ULONG WINAPI D3D7CB_DestroySwapChain(IWineD3DSwapChain *pSwapChain) {
- IUnknown* swapChainParent;
+ULONG WINAPI D3D7CB_DestroySwapChain(IWineD3DSwapChain *pSwapChain)
+{
+ IUnknown *swapChainParent;
TRACE("swapchain %p.\n", pSwapChain);
- IWineD3DSwapChain_GetParent(pSwapChain, &swapChainParent);
- IUnknown_Release(swapChainParent);
+ swapChainParent = IWineD3DSwapChain_GetParent(pSwapChain);
return IUnknown_Release(swapChainParent);
}
@@ -3295,15 +3289,15 @@ static HRESULT WINAPI ddraw7_CreateSurface(IDirectDraw7 *iface,
*/
if(desc2.ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP)
{
- hr = IWineD3DDevice_CreateCubeTexture(This->wineD3DDevice, DDSD->dwWidth /* Edgelength */,
- levels, 0 /* usage */, Format, Pool, (IWineD3DCubeTexture **)&object->wineD3DTexture,
- (IUnknown *)object, &ddraw_null_wined3d_parent_ops);
+ hr = IWineD3DDevice_CreateCubeTexture(This->wineD3DDevice, DDSD->dwWidth /* Edgelength */, levels,
+ 0 /* usage */, Format, Pool, object, &ddraw_null_wined3d_parent_ops,
+ (IWineD3DCubeTexture **)&object->wineD3DTexture);
}
else
{
hr = IWineD3DDevice_CreateTexture(This->wineD3DDevice, DDSD->dwWidth, DDSD->dwHeight, levels,
- 0 /* usage */, Format, Pool, (IWineD3DTexture **)&object->wineD3DTexture,
- (IUnknown *)object, &ddraw_null_wined3d_parent_ops);
+ 0 /* usage */, Format, Pool, object, &ddraw_null_wined3d_parent_ops,
+ (IWineD3DTexture **)&object->wineD3DTexture);
}
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);
- hr = IWineD3DDevice_CreateVertexDeclarationFromFVF(This->wineD3DDevice, &pDecl,
- (IUnknown *)This, &ddraw_null_wined3d_parent_ops, fvf);
+ hr = IWineD3DDevice_CreateVertexDeclarationFromFVF(This->wineD3DDevice,
+ fvf, This, &ddraw_null_wined3d_parent_ops, &pDecl);
if (hr != S_OK) return NULL;
if(This->declArraySize == This->numConvertedDecls) {
@@ -5644,7 +5638,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDevicePar
ddraw_parent_init(object);
hr = IWineD3DDevice_CreateSwapChain(This->wineD3DDevice, present_parameters,
- swapchain, (IUnknown *)object, This->ImplType);
+ This->ImplType, object, swapchain);
if (FAILED(hr))
{
FIXME("(%p) CreateSwapChain failed, returning %#x\n", iface, hr);
diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c
index 7837dcd..e632151 100644
--- a/dlls/ddraw/device.c
+++ b/dlls/ddraw/device.c
@@ -300,10 +300,8 @@ IDirect3DDeviceImpl_7_Release(IDirect3DDevice7 *iface)
EnterCriticalSection(&ddraw_cs);
/* Free the index buffer. */
IWineD3DDevice_SetIndexBuffer(This->wineD3DDevice, NULL, WINED3DFMT_UNKNOWN);
- IWineD3DBuffer_GetParent(This->indexbuffer,
- (IUnknown **) &IndexBufferParent);
- IParent_Release(IndexBufferParent); /* Once for the getParent */
- if( IParent_Release(IndexBufferParent) != 0) /* And now to destroy it */
+ IndexBufferParent = IWineD3DBuffer_GetParent(This->indexbuffer);
+ if (IParent_Release(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);
- hr = IWineD3DDevice_GetTexture(This->wineD3DDevice,
- 0,
- &tex);
-
- if(hr == WINED3D_OK && tex)
+ hr = IWineD3DDevice_GetTexture(This->wineD3DDevice, 0, &tex);
+ if (SUCCEEDED(hr) && tex)
{
- IDirectDrawSurface7 *parent = NULL;
- hr = IWineD3DBaseTexture_GetParent(tex,
- (IUnknown **) &parent);
- if(parent)
- {
- /* The parent of the texture is the IDirectDrawSurface7 interface
- * of the ddraw surface
- */
- IDirectDrawSurfaceImpl *texImpl = (IDirectDrawSurfaceImpl *)parent;
- *lpdwRenderState = texImpl->Handle;
- IDirectDrawSurface7_Release(parent);
- }
+ /* The parent of the texture is the IDirectDrawSurface7
+ * interface of the ddraw surface. */
+ IDirectDrawSurfaceImpl *parent = IWineD3DBaseTexture_GetParent(tex);
+ if (parent) *lpdwRenderState = parent->Handle;
IWineD3DBaseTexture_Release(tex);
}
@@ -4353,18 +4340,16 @@ IDirect3DDeviceImpl_7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface,
{
UINT size = max(desc.Size * 2, IndexCount * sizeof(WORD));
IWineD3DBuffer *buffer;
- IUnknown *parent;
+ IParentImpl *parent;
TRACE("Growing index buffer to %u bytes\n", size);
- IWineD3DBuffer_GetParent(This->indexbuffer, &parent);
- hr = IWineD3DDevice_CreateIndexBuffer(This->wineD3DDevice, size,
- WINED3DUSAGE_DYNAMIC /* Usage */, WINED3DPOOL_DEFAULT, &buffer, parent,
- &ddraw_null_wined3d_parent_ops);
- if(hr != D3D_OK)
+ parent = IWineD3DBuffer_GetParent(This->indexbuffer);
+ hr = IWineD3DDevice_CreateIndexBuffer(This->wineD3DDevice, size, WINED3DUSAGE_DYNAMIC /* Usage */,
+ WINED3DPOOL_DEFAULT, parent, &ddraw_null_wined3d_parent_ops, &buffer);
+ if (FAILED(hr))
{
ERR("(%p) IWineD3DDevice::CreateIndexBuffer failed with hr = %08x\n", This, hr);
- IParent_Release(parent);
LeaveCriticalSection(&ddraw_cs);
return hr;
}
@@ -4372,8 +4357,7 @@ IDirect3DDeviceImpl_7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface,
IWineD3DBuffer_Release(This->indexbuffer);
This->indexbuffer = buffer;
- ((IParentImpl *)parent)->child = (IUnknown *)buffer;
- IParent_Release(parent);
+ parent->child = (IUnknown *)buffer;
}
/* copy the index stream into the index buffer.
@@ -4649,11 +4633,8 @@ IDirect3DDeviceImpl_7_GetTexture(IDirect3DDevice7 *iface,
return hr;
}
- /* GetParent AddRef()s, which is perfectly OK.
- * We have passed the IDirectDrawSurface7 interface to WineD3D, so that's OK too.
- */
- hr = IWineD3DBaseTexture_GetParent(Surf,
- (IUnknown **) Texture);
+ *Texture = IWineD3DBaseTexture_GetParent(Surf);
+ IDirectDrawSurface7_AddRef(*Texture);
LeaveCriticalSection(&ddraw_cs);
return hr;
}
@@ -7014,8 +6995,8 @@ HRESULT d3d_device_init(IDirect3DDeviceImpl *device, IDirectDrawImpl *ddraw, IDi
ddraw_parent_init(index_buffer_parent);
hr = IWineD3DDevice_CreateIndexBuffer(ddraw->wineD3DDevice, 0x40000 /* Length. Don't know how long it should be */,
- WINED3DUSAGE_DYNAMIC /* Usage */, WINED3DPOOL_DEFAULT, &device->indexbuffer,
- (IUnknown *)index_buffer_parent, &ddraw_null_wined3d_parent_ops);
+ WINED3DUSAGE_DYNAMIC /* Usage */, WINED3DPOOL_DEFAULT, index_buffer_parent,
+ &ddraw_null_wined3d_parent_ops, &device->indexbuffer);
if (FAILED(hr))
{
ERR("Failed to create an index buffer, hr %#x.\n", hr);
diff --git a/dlls/ddraw/palette.c b/dlls/ddraw/palette.c
index f922774..a389480 100644
--- a/dlls/ddraw/palette.c
+++ b/dlls/ddraw/palette.c
@@ -268,7 +268,7 @@ HRESULT ddraw_palette_init(IDirectDrawPaletteImpl *palette,
palette->ref = 1;
hr = IWineD3DDevice_CreatePalette(ddraw->wineD3DDevice, flags,
- entries, &palette->wineD3DPalette, (IUnknown *)palette);
+ entries, palette, &palette->wineD3DPalette);
if (FAILED(hr))
{
WARN("Failed to create wined3d palette, hr %#x.\n", hr);
diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c
index 2785f35..a433913 100644
--- a/dlls/ddraw/surface.c
+++ b/dlls/ddraw/surface.c
@@ -2742,7 +2742,8 @@ static HRESULT WINAPI ddraw_surface7_GetPalette(IDirectDrawSurface7 *iface, IDir
if(wPal)
{
- hr = IWineD3DPalette_GetParent(wPal, (IUnknown **) Pal);
+ *Pal = IWineD3DPalette_GetParent(wPal);
+ IDirectDrawPalette_AddRef(*Pal);
}
else
{
@@ -3251,16 +3252,7 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu
LeaveCriticalSection(&ddraw_cs);
return D3DERR_TEXTURE_LOAD_FAILED;
}
- if (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;
- }
- }
+ if (wined3d_dst_pal) dst_pal = IWineD3DPalette_GetParent(wined3d_dst_pal);
hr = IWineD3DSurface_GetPalette(src_surface->WineD3DSurface, &wined3d_src_pal);
if (FAILED(hr))
@@ -3269,17 +3261,7 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu
LeaveCriticalSection(&ddraw_cs);
return D3DERR_TEXTURE_LOAD_FAILED;
}
- if (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 (wined3d_src_pal) src_pal = IWineD3DPalette_GetParent(wined3d_src_pal);
if (src_pal)
{
@@ -3287,7 +3269,6 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu
if (!dst_pal)
{
- IDirectDrawPalette_Release(src_pal);
LeaveCriticalSection(&ddraw_cs);
return DDERR_NOPALETTEATTACHED;
}
@@ -3295,9 +3276,6 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu
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 */
dst_desc = (DDSURFACEDESC *)&(dst_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;
hr = IWineD3DDevice_CreateSurface(ddraw->wineD3DDevice, desc->dwWidth, desc->dwHeight, format,
- TRUE /* Lockable */, FALSE /* Discard */, mip_level, &surface->WineD3DSurface,
- usage, pool, WINED3DMULTISAMPLE_NONE, 0 /* MultiSampleQuality */, surface_type,
- (IUnknown *)surface, &ddraw_null_wined3d_parent_ops);
+ TRUE /* Lockable */, FALSE /* Discard */, mip_level, usage, pool,
+ WINED3DMULTISAMPLE_NONE, 0 /* MultiSampleQuality */, surface_type, surface,
+ &ddraw_null_wined3d_parent_ops, &surface->WineD3DSurface);
if (FAILED(hr))
{
WARN("Failed to create wined3d surface, hr %#x.\n", hr);
diff --git a/dlls/ddraw/vertexbuffer.c b/dlls/ddraw/vertexbuffer.c
index 48e9ae7..b40faa2 100644
--- a/dlls/ddraw/vertexbuffer.c
+++ b/dlls/ddraw/vertexbuffer.c
@@ -605,7 +605,7 @@ HRESULT d3d_vertex_buffer_init(IDirect3DVertexBufferImpl *buffer,
hr = IWineD3DDevice_CreateVertexBuffer(ddraw->wineD3DDevice,
get_flexible_vertex_size(desc->dwFVF) * desc->dwNumVertices,
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))
{
WARN("Failed to create wined3d vertex buffer, hr %#x.\n", hr);
diff --git a/dlls/dxgi/device.c b/dlls/dxgi/device.c
index 2478063..64c874a 100644
--- a/dlls/dxgi/device.c
+++ b/dlls/dxgi/device.c
@@ -190,16 +190,9 @@ static HRESULT STDMETHODCALLTYPE dxgi_device_CreateSurface(IWineDXGIDevice *ifac
goto fail;
}
- hr = IWineD3DSurface_GetParent(wined3d_surface, &parent);
- IWineD3DSurface_Release(wined3d_surface);
- if (FAILED(hr))
- {
- ERR("GetParent failed, returning %#x\n", hr);
- goto fail;
- }
-
+ parent = IWineD3DSurface_GetParent(wined3d_surface);
hr = IUnknown_QueryInterface(parent, &IID_IDXGISurface, (void **)&surface[i]);
- IUnknown_Release(parent);
+ IWineD3DSurface_Release(wined3d_surface);
if (FAILED(hr))
{
ERR("Surface should implement IDXGISurface\n");
diff --git a/dlls/dxgi/factory.c b/dlls/dxgi/factory.c
index 9af9b40..fb47364 100644
--- a/dlls/dxgi/factory.c
+++ b/dlls/dxgi/factory.c
@@ -235,17 +235,11 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSwapChain(IWineDXGIFactory *
return hr;
}
- hr = IWineD3DSwapChain_GetParent(wined3d_swapchain, (IUnknown **)swapchain);
+ swapchain = IWineD3DSwapChain_GetParent(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,
* but the wined3d device can't hold a real reference. */
- IUnknown_Release(*swapchain);
TRACE("Created IDXGISwapChain %p\n", *swapchain);
diff --git a/dlls/dxgi/swapchain.c b/dlls/dxgi/swapchain.c
index 891c4ec..de9412b 100644
--- a/dlls/dxgi/swapchain.c
+++ b/dlls/dxgi/swapchain.c
@@ -174,16 +174,10 @@ static HRESULT STDMETHODCALLTYPE dxgi_swapchain_GetBuffer(IDXGISwapChain *iface,
return hr;
}
- hr = IWineD3DSurface_GetParent(backbuffer, &parent);
+ parent = IWineD3DSurface_GetParent(backbuffer);
+ hr = IUnknown_QueryInterface(parent, riid, surface);
IWineD3DSurface_Release(backbuffer);
LeaveCriticalSection(&dxgi_cs);
- if (FAILED(hr))
- {
- return hr;
- }
-
- hr = IUnknown_QueryInterface(parent, riid, surface);
- IUnknown_Release(parent);
return hr;
}
@@ -284,7 +278,7 @@ HRESULT dxgi_swapchain_init(struct dxgi_swapchain *swapchain, struct dxgi_device
swapchain->refcount = 1;
hr = IWineD3DDevice_CreateSwapChain(device->wined3d_device, present_parameters,
- &swapchain->wined3d_swapchain, (IUnknown *)swapchain, SURFACE_OPENGL);
+ SURFACE_OPENGL, swapchain, &swapchain->wined3d_swapchain);
if (FAILED(hr))
{
WARN("Failed to create wined3d swapchain, hr %#x.\n", hr);
diff --git a/dlls/wined3d/basetexture.c b/dlls/wined3d/basetexture.c
index 584dabd..e3e5404 100644
--- a/dlls/wined3d/basetexture.c
+++ b/dlls/wined3d/basetexture.c
@@ -29,7 +29,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_texture);
HRESULT basetexture_init(IWineD3DBaseTextureImpl *texture, UINT layer_count, UINT level_count,
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)
{
HRESULT hr;
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index d97aac1..477ac14 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -744,10 +744,11 @@ static ULONG STDMETHODCALLTYPE buffer_Release(IWineD3DBuffer *iface)
}
/* IWineD3DBase methods */
-
-static HRESULT STDMETHODCALLTYPE buffer_GetParent(IWineD3DBuffer *iface, IUnknown **parent)
+static void * STDMETHODCALLTYPE buffer_GetParent(IWineD3DBuffer *iface)
{
- return resource_get_parent((IWineD3DResource *)iface, parent);
+ TRACE("iface %p.\n", iface);
+
+ return ((struct wined3d_buffer *)iface)->resource.parent;
}
/* IWineD3DResource methods */
@@ -1448,7 +1449,7 @@ static const struct IWineD3DBufferVtbl wined3d_buffer_vtbl =
HRESULT buffer_init(struct wined3d_buffer *buffer, IWineD3DDeviceImpl *device,
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_format *format = wined3d_get_format(gl_info, format_id);
diff --git a/dlls/wined3d/cubetexture.c b/dlls/wined3d/cubetexture.c
index fd690a6..728548f 100644
--- a/dlls/wined3d/cubetexture.c
+++ b/dlls/wined3d/cubetexture.c
@@ -230,8 +230,11 @@ static WINED3DRESOURCETYPE WINAPI IWineD3DCubeTextureImpl_GetType(IWineD3DCubeTe
return resource_get_type((IWineD3DResource *)iface);
}
-static HRESULT WINAPI IWineD3DCubeTextureImpl_GetParent(IWineD3DCubeTexture *iface, IUnknown **pParent) {
- return resource_get_parent((IWineD3DResource *)iface, pParent);
+static void * WINAPI IWineD3DCubeTextureImpl_GetParent(IWineD3DCubeTexture *iface)
+{
+ 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,
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_format *format = wined3d_get_format(gl_info, format_id);
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index ce1910f..68a6d16 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -886,7 +886,7 @@ static ULONG WINAPI IWineD3DDeviceImpl_Release(IWineD3DDevice *iface) {
}
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;
struct wined3d_buffer *object;
@@ -921,8 +921,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateBuffer(IWineD3DDevice *iface, str
}
static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexBuffer(IWineD3DDevice *iface,
- UINT Size, DWORD Usage, WINED3DPOOL Pool, IWineD3DBuffer **ppVertexBuffer,
- IUnknown *parent, const struct wined3d_parent_ops *parent_ops)
+ UINT Size, DWORD Usage, WINED3DPOOL Pool, void *parent,
+ const struct wined3d_parent_ops *parent_ops, IWineD3DBuffer **ppVertexBuffer)
{
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
struct wined3d_buffer *object;
@@ -965,8 +965,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexBuffer(IWineD3DDevice *ifac
}
static HRESULT WINAPI IWineD3DDeviceImpl_CreateIndexBuffer(IWineD3DDevice *iface,
- UINT Length, DWORD Usage, WINED3DPOOL Pool, IWineD3DBuffer **ppIndexBuffer,
- IUnknown *parent, const struct wined3d_parent_ops *parent_ops)
+ UINT Length, DWORD Usage, WINED3DPOOL Pool, void *parent,
+ const struct wined3d_parent_ops *parent_ops, IWineD3DBuffer **ppIndexBuffer)
{
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
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,
- enum wined3d_format_id Format, BOOL Lockable, BOOL Discard, UINT Level, IWineD3DSurface **surface,
- DWORD Usage, WINED3DPOOL Pool, WINED3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality,
- WINED3DSURFTYPE Impl, IUnknown *parent, const struct wined3d_parent_ops *parent_ops)
+ enum wined3d_format_id Format, BOOL Lockable, BOOL Discard, UINT Level, DWORD Usage, WINED3DPOOL Pool,
+ WINED3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, WINED3DSURFTYPE Impl,
+ void *parent, const struct wined3d_parent_ops *parent_ops, IWineD3DSurface **surface)
{
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DSurfaceImpl *object;
@@ -1073,7 +1073,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateSurface(IWineD3DDevice *iface, UI
}
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;
@@ -1097,7 +1097,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateRendertargetView(IWineD3DDevice *
static HRESULT WINAPI IWineD3DDeviceImpl_CreateTexture(IWineD3DDevice *iface,
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;
IWineD3DTextureImpl *object;
@@ -1133,7 +1133,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateTexture(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,
- 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;
IWineD3DVolumeTextureImpl *object;
@@ -1166,8 +1166,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolumeTexture(IWineD3DDevice *ifa
}
static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolume(IWineD3DDevice *iface, UINT Width, UINT Height,
- UINT Depth, DWORD Usage, enum wined3d_format_id Format, WINED3DPOOL Pool, IWineD3DVolume **ppVolume,
- IUnknown *parent, const struct wined3d_parent_ops *parent_ops)
+ UINT Depth, DWORD Usage, enum wined3d_format_id Format, WINED3DPOOL Pool, void *parent,
+ const struct wined3d_parent_ops *parent_ops, IWineD3DVolume **ppVolume)
{
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
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,
- DWORD Usage, enum wined3d_format_id Format, WINED3DPOOL Pool, IWineD3DCubeTexture **ppCubeTexture,
- IUnknown *parent, const struct wined3d_parent_ops *parent_ops)
+ DWORD Usage, enum wined3d_format_id Format, WINED3DPOOL Pool, void *parent,
+ const struct wined3d_parent_ops *parent_ops, IWineD3DCubeTexture **ppCubeTexture)
{
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
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,
- WINED3DPRESENT_PARAMETERS *present_parameters, IWineD3DSwapChain **swapchain,
- IUnknown *parent, WINED3DSURFTYPE surface_type)
+ WINED3DPRESENT_PARAMETERS *present_parameters, WINED3DSURFTYPE surface_type,
+ void *parent, IWineD3DSwapChain **swapchain)
{
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DSwapChainImpl *object;
@@ -1316,8 +1316,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetSwapChain(IWineD3DDevice *iface, U
}
static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexDeclaration(IWineD3DDevice *iface,
- IWineD3DVertexDeclaration **declaration, IUnknown *parent, const struct wined3d_parent_ops *parent_ops,
- const WINED3DVERTEXELEMENT *elements, UINT element_count)
+ const WINED3DVERTEXELEMENT *elements, UINT element_count, void *parent,
+ const struct wined3d_parent_ops *parent_ops, IWineD3DVertexDeclaration **declaration)
{
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DVertexDeclarationImpl *object = NULL;
@@ -1485,8 +1485,8 @@ static unsigned int ConvertFvfToDeclaration(IWineD3DDeviceImpl *This, /* For the
}
static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexDeclarationFromFVF(IWineD3DDevice *iface,
- IWineD3DVertexDeclaration **declaration, IUnknown *parent,
- const struct wined3d_parent_ops *parent_ops, DWORD fvf)
+ DWORD fvf, void *parent, const struct wined3d_parent_ops *parent_ops,
+ IWineD3DVertexDeclaration **declaration)
{
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
WINED3DVERTEXELEMENT *elements;
@@ -1498,15 +1498,15 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexDeclarationFromFVF(IWineD3D
size = ConvertFvfToDeclaration(This, fvf, &elements);
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);
return hr;
}
static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexShader(IWineD3DDevice *iface,
const DWORD *pFunction, const struct wined3d_shader_signature *output_signature,
- IWineD3DVertexShader **ppVertexShader, IUnknown *parent,
- const struct wined3d_parent_ops *parent_ops)
+ void *parent, const struct wined3d_parent_ops *parent_ops,
+ IWineD3DVertexShader **ppVertexShader)
{
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DVertexShaderImpl *object;
@@ -1535,8 +1535,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexShader(IWineD3DDevice *ifac
static HRESULT WINAPI IWineD3DDeviceImpl_CreateGeometryShader(IWineD3DDevice *iface,
const DWORD *byte_code, const struct wined3d_shader_signature *output_signature,
- IWineD3DGeometryShader **shader, IUnknown *parent,
- const struct wined3d_parent_ops *parent_ops)
+ void *parent, const struct wined3d_parent_ops *parent_ops,
+ IWineD3DGeometryShader **shader)
{
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
struct wined3d_geometryshader *object;
@@ -1565,8 +1565,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateGeometryShader(IWineD3DDevice *if
static HRESULT WINAPI IWineD3DDeviceImpl_CreatePixelShader(IWineD3DDevice *iface,
const DWORD *pFunction, const struct wined3d_shader_signature *output_signature,
- IWineD3DPixelShader **ppPixelShader, IUnknown *parent,
- const struct wined3d_parent_ops *parent_ops)
+ void *parent, const struct wined3d_parent_ops *parent_ops,
+ IWineD3DPixelShader **ppPixelShader)
{
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DPixelShaderImpl *object;
@@ -1594,14 +1594,14 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreatePixelShader(IWineD3DDevice *iface
}
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;
IWineD3DPaletteImpl *object;
HRESULT hr;
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));
if (!object)
@@ -1610,7 +1610,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreatePalette(IWineD3DDevice *iface, DW
return E_OUTOFMEMORY;
}
- hr = wined3d_palette_init(object, This, Flags, PalEnt, Parent);
+ hr = wined3d_palette_init(object, This, Flags, PalEnt, parent);
if (FAILED(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,
- FALSE, 0, &This->logo_surface, 0, WINED3DPOOL_DEFAULT, WINED3DMULTISAMPLE_NONE, 0, SURFACE_OPENGL,
- NULL, &wined3d_null_parent_ops);
- if(FAILED(hr)) {
- ERR("Wine logo requested, but failed to create surface\n");
+ FALSE, 0, 0, WINED3DPOOL_DEFAULT, WINED3DMULTISAMPLE_NONE, 0, SURFACE_OPENGL, NULL,
+ &wined3d_null_parent_ops, &This->logo_surface);
+ if (FAILED(hr))
+ {
+ ERR("Wine logo requested, but failed to create surface, hr %#x.\n", hr);
goto out;
}
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 2960c2a..3beb024 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -4871,11 +4871,11 @@ static HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT adapter_id
return WINED3D_OK;
}
-static HRESULT WINAPI IWineD3DImpl_GetParent(IWineD3D *iface, IUnknown **pParent) {
- IWineD3DImpl *This = (IWineD3DImpl *)iface;
- IUnknown_AddRef(This->parent);
- *pParent = This->parent;
- return WINED3D_OK;
+static void * WINAPI IWineD3DImpl_GetParent(IWineD3D *iface)
+{
+ TRACE("iface %p.\n", iface);
+
+ return ((IWineD3DImpl *)iface)->parent;
}
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,
};
-HRESULT wined3d_init(IWineD3DImpl *wined3d, UINT version, IUnknown *parent)
+HRESULT wined3d_init(IWineD3DImpl *wined3d, UINT version, void *parent)
{
wined3d->lpVtbl = &IWineD3D_Vtbl;
wined3d->dxVersion = version;
diff --git a/dlls/wined3d/palette.c b/dlls/wined3d/palette.c
index 1366ef1..7b83d6b 100644
--- a/dlls/wined3d/palette.c
+++ b/dlls/wined3d/palette.c
@@ -175,13 +175,11 @@ static HRESULT WINAPI IWineD3DPaletteImpl_GetCaps(IWineD3DPalette *iface, DWORD
return WINED3D_OK;
}
-static HRESULT WINAPI IWineD3DPaletteImpl_GetParent(IWineD3DPalette *iface, IUnknown **Parent) {
- IWineD3DPaletteImpl *This = (IWineD3DPaletteImpl *)iface;
- TRACE("(%p)->(%p)\n", This, Parent);
+static void * WINAPI IWineD3DPaletteImpl_GetParent(IWineD3DPalette *iface)
+{
+ TRACE("iface %p.\n", iface);
- *Parent = This->parent;
- IUnknown_AddRef(This->parent);
- return WINED3D_OK;
+ return ((IWineD3DPaletteImpl *)iface)->parent;
}
static const IWineD3DPaletteVtbl IWineD3DPalette_Vtbl =
@@ -198,7 +196,7 @@ static const IWineD3DPaletteVtbl IWineD3DPalette_Vtbl =
};
HRESULT wined3d_palette_init(IWineD3DPaletteImpl *palette, IWineD3DDeviceImpl *device,
- DWORD flags, const PALETTEENTRY *entries, IUnknown *parent)
+ DWORD flags, const PALETTEENTRY *entries, void *parent)
{
HRESULT hr;
diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c
index 4bdd415..3aee3f9 100644
--- a/dlls/wined3d/resource.c
+++ b/dlls/wined3d/resource.c
@@ -29,12 +29,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d);
HRESULT resource_init(IWineD3DResource *iface, WINED3DRESOURCETYPE resource_type,
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;
resource->device = device;
- resource->parent = parent;
resource->resourceType = resource_type;
resource->ref = 1;
resource->pool = pool;
@@ -42,6 +41,7 @@ HRESULT resource_init(IWineD3DResource *iface, WINED3DRESOURCETYPE resource_type
resource->usage = usage;
resource->size = size;
resource->priority = 0;
+ resource->parent = parent;
resource->parent_ops = parent_ops;
list_init(&resource->privateData);
@@ -245,11 +245,3 @@ WINED3DRESOURCETYPE resource_get_type(IWineD3DResource *iface)
TRACE("(%p) : returning %d\n", This, 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;
-}
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index e2d7f6b..87c664f 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -286,7 +286,7 @@ int shader_addline(struct wined3d_shader_buffer *buffer, const char *format, ...
}
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->device = (IWineD3DDevice *)device;
@@ -1534,13 +1534,6 @@ const shader_backend_t none_shader_backend = {
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)
{
if (!data)
@@ -1654,13 +1647,11 @@ static ULONG STDMETHODCALLTYPE vertexshader_Release(IWineD3DVertexShader *iface)
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 WINED3D_OK;
+ return ((IWineD3DBaseShaderImpl *)iface)->baseShader.parent;
}
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,
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;
struct shader_reg_maps *reg_maps = &shader->baseShader.reg_maps;
@@ -1951,13 +1942,11 @@ static ULONG STDMETHODCALLTYPE geometryshader_Release(IWineD3DGeometryShader *if
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 WINED3D_OK;
+ return ((IWineD3DBaseShaderImpl *)iface)->baseShader.parent;
}
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,
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;
@@ -2048,13 +2037,11 @@ static ULONG STDMETHODCALLTYPE pixelshader_Release(IWineD3DPixelShader *iface)
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 WINED3D_OK;
+ return ((IWineD3DBaseShaderImpl *)iface)->baseShader.parent;
}
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,
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;
unsigned int i, highest_reg_used = 0, num_regs_used = 0;
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index f7cca8f..0c72c91 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -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,
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,
- 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_format *format = wined3d_get_format(gl_info, format_id);
diff --git a/dlls/wined3d/surface_base.c b/dlls/wined3d/surface_base.c
index a5d040d..f35d6be 100644
--- a/dlls/wined3d/surface_base.c
+++ b/dlls/wined3d/surface_base.c
@@ -139,9 +139,11 @@ WINED3DRESOURCETYPE WINAPI IWineD3DBaseSurfaceImpl_GetType(IWineD3DSurface *ifac
return resource_get_type((IWineD3DResource *)iface);
}
-HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetParent(IWineD3DSurface *iface, IUnknown **pParent) {
- TRACE("(%p) : calling resourceimpl_GetParent\n", iface);
- return resource_get_parent((IWineD3DResource *)iface, pParent);
+void * WINAPI IWineD3DBaseSurfaceImpl_GetParent(IWineD3DSurface *iface)
+{
+ 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,
- 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 /* MultiSampleQuality */, IWineD3DSurface_GetImplType((IWineD3DSurface *) source),
- NULL /* parent */, &wined3d_null_parent_ops);
+ NULL /* parent */, &wined3d_null_parent_ops, &ret);
if(!ret) {
ERR("Failed to create a destination surface for conversion\n");
return NULL;
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index 3fb803f..a4e18be 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -622,7 +622,7 @@ void swapchain_restore_fullscreen_window(IWineD3DSwapChainImpl *swapchain)
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_format *format;
diff --git a/dlls/wined3d/swapchain_base.c b/dlls/wined3d/swapchain_base.c
index 917a8b6..5b5739c 100644
--- a/dlls/wined3d/swapchain_base.c
+++ b/dlls/wined3d/swapchain_base.c
@@ -64,12 +64,11 @@ ULONG WINAPI IWineD3DBaseSwapChainImpl_Release(IWineD3DSwapChain *iface) {
return refCount;
}
-HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetParent(IWineD3DSwapChain *iface, IUnknown ** ppParent){
- IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
- *ppParent = This->parent;
- IUnknown_AddRef(*ppParent);
- TRACE("(%p) returning %p\n", This , *ppParent);
- return WINED3D_OK;
+void * WINAPI IWineD3DBaseSwapChainImpl_GetParent(IWineD3DSwapChain *iface)
+{
+ TRACE("iface %p.\n", iface);
+
+ return ((IWineD3DSwapChainImpl *)iface)->parent;
}
HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetFrontBufferData(IWineD3DSwapChain *iface, IWineD3DSurface *dst_surface)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 4d8aabc..3fc616d 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -221,8 +221,11 @@ static WINED3DRESOURCETYPE WINAPI IWineD3DTextureImpl_GetType(IWineD3DTexture *i
return resource_get_type((IWineD3DResource *)iface);
}
-static HRESULT WINAPI IWineD3DTextureImpl_GetParent(IWineD3DTexture *iface, IUnknown **pParent) {
- return resource_get_parent((IWineD3DResource *)iface, pParent);
+static void * WINAPI IWineD3DTextureImpl_GetParent(IWineD3DTexture *iface)
+{
+ 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,
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_format *format = wined3d_get_format(gl_info, format_id);
diff --git a/dlls/wined3d/vertexdeclaration.c b/dlls/wined3d/vertexdeclaration.c
index 056fbb0..59219f0 100644
--- a/dlls/wined3d/vertexdeclaration.c
+++ b/dlls/wined3d/vertexdeclaration.c
@@ -79,13 +79,11 @@ static ULONG WINAPI IWineD3DVertexDeclarationImpl_Release(IWineD3DVertexDeclarat
IWineD3DVertexDeclaration parts follow
******************************************* */
-static HRESULT WINAPI IWineD3DVertexDeclarationImpl_GetParent(IWineD3DVertexDeclaration *iface, IUnknown** parent){
- IWineD3DVertexDeclarationImpl *This = (IWineD3DVertexDeclarationImpl *)iface;
+static void * WINAPI IWineD3DVertexDeclarationImpl_GetParent(IWineD3DVertexDeclaration *iface)
+{
+ TRACE("iface %p.\n", iface);
- *parent= This->parent;
- IUnknown_AddRef(*parent);
- TRACE("(%p) : returning %p\n", This, *parent);
- return WINED3D_OK;
+ return ((IWineD3DVertexDeclarationImpl *)iface)->parent;
}
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,
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;
WORD preloaded = 0; /* MAX_STREAMS, 16 */
diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c
index 0c9919d..e4e40fc 100644
--- a/dlls/wined3d/view.c
+++ b/dlls/wined3d/view.c
@@ -74,14 +74,11 @@ static ULONG STDMETHODCALLTYPE rendertarget_view_Release(IWineD3DRendertargetVie
/* 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;
-
- IUnknown_AddRef(This->parent);
- *parent = This->parent;
+ TRACE("iface %p.\n", iface);
- return WINED3D_OK;
+ return ((struct wined3d_rendertarget_view *)iface)->parent;
}
/* IWineD3DRendertargetView methods */
@@ -110,7 +107,7 @@ static const struct IWineD3DRendertargetViewVtbl wined3d_rendertarget_view_vtbl
};
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->refcount = 1;
diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c
index 18c8d46..ea49e56 100644
--- a/dlls/wined3d/volume.c
+++ b/dlls/wined3d/volume.c
@@ -139,8 +139,11 @@ static ULONG WINAPI IWineD3DVolumeImpl_Release(IWineD3DVolume *iface) {
/* ****************************************************
IWineD3DVolume IWineD3DResource parts follow
**************************************************** */
-static HRESULT WINAPI IWineD3DVolumeImpl_GetParent(IWineD3DVolume *iface, IUnknown **pParent) {
- return resource_get_parent((IWineD3DResource *)iface, pParent);
+static void * WINAPI IWineD3DVolumeImpl_GetParent(IWineD3DVolume *iface)
+{
+ 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) {
@@ -325,7 +328,7 @@ static const IWineD3DVolumeVtbl IWineD3DVolume_Vtbl =
HRESULT volume_init(IWineD3DVolumeImpl *volume, IWineD3DDeviceImpl *device, UINT width,
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_format *format = wined3d_get_format(gl_info, format_id);
diff --git a/dlls/wined3d/volumetexture.c b/dlls/wined3d/volumetexture.c
index a64b05d..a2b706e 100644
--- a/dlls/wined3d/volumetexture.c
+++ b/dlls/wined3d/volumetexture.c
@@ -186,8 +186,11 @@ static WINED3DRESOURCETYPE WINAPI IWineD3DVolumeTextureImpl_GetType(IWineD3DVolu
return resource_get_type((IWineD3DResource *)iface);
}
-static HRESULT WINAPI IWineD3DVolumeTextureImpl_GetParent(IWineD3DVolumeTexture *iface, IUnknown **pParent) {
- return resource_get_parent((IWineD3DResource *)iface, pParent);
+static void * WINAPI IWineD3DVolumeTextureImpl_GetParent(IWineD3DVolumeTexture *iface)
+{
+ 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,
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_format *format = wined3d_get_format(gl_info, format_id);
diff --git a/dlls/wined3d/wined3d_main.c b/dlls/wined3d/wined3d_main.c
index 991ea80..56e78ad 100644
--- a/dlls/wined3d/wined3d_main.c
+++ b/dlls/wined3d/wined3d_main.c
@@ -76,7 +76,7 @@ wined3d_settings_t wined3d_settings =
FALSE, /* No strict draw ordering. */
};
-IWineD3D * WINAPI WineDirect3DCreate(UINT version, IUnknown *parent)
+IWineD3D * WINAPI WineDirect3DCreate(UINT version, void *parent)
{
IWineD3DImpl *object;
HRESULT hr;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 66f2182..691b8cc 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1541,14 +1541,14 @@ typedef struct IWineD3DImpl
LONG ref; /* Note: Ref counting not required */
/* WineD3D Information */
- IUnknown *parent;
+ void *parent;
UINT dxVersion;
UINT adapter_count;
struct wined3d_adapter adapters[1];
} 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;
void wined3d_unregister_window(HWND window) DECLSPEC_HIDDEN;
@@ -1748,7 +1748,6 @@ typedef struct IWineD3DResourceClass
LONG ref; /* Note: Ref counting not required */
/* WineD3DResource Information */
- IUnknown *parent;
WINED3DRESOURCETYPE resourceType;
IWineD3DDeviceImpl *device;
WINED3DPOOL pool;
@@ -1760,6 +1759,8 @@ typedef struct IWineD3DResourceClass
BYTE *heapMemory; /* Pointer to the HeapAlloced block of memory */
struct list privateData;
struct list resource_list_entry;
+
+ void *parent;
const struct wined3d_parent_ops *parent_ops;
} IWineD3DResourceClass;
@@ -1772,13 +1773,12 @@ typedef struct IWineD3DResourceImpl
void resource_cleanup(IWineD3DResource *iface) 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;
HRESULT resource_get_private_data(IWineD3DResource *iface, REFGUID guid,
void *data, DWORD *data_size) DECLSPEC_HIDDEN;
HRESULT resource_init(IWineD3DResource *iface, WINED3DRESOURCETYPE resource_type,
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;
DWORD resource_set_priority(IWineD3DResource *iface, DWORD new_priority) DECLSPEC_HIDDEN;
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;
HRESULT basetexture_init(IWineD3DBaseTextureImpl *texture, UINT layer_count, UINT level_count,
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;
HRESULT basetexture_set_autogen_filter_type(IWineD3DBaseTexture *iface,
WINED3DTEXTUREFILTERTYPE filter_type) DECLSPEC_HIDDEN;
@@ -1893,7 +1893,7 @@ typedef struct IWineD3DTextureImpl
HRESULT texture_init(IWineD3DTextureImpl *texture, UINT width, UINT height, 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;
+ void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
/*****************************************************************************
* IWineD3DCubeTexture implementation structure (extends IWineD3DBaseTextureImpl)
@@ -1908,7 +1908,7 @@ typedef struct IWineD3DCubeTextureImpl
HRESULT cubetexture_init(IWineD3DCubeTextureImpl *texture, UINT edge_length, 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;
+ void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
typedef struct _WINED3DVOLUMET_DESC
{
@@ -1939,7 +1939,7 @@ typedef struct IWineD3DVolumeImpl
void volume_add_dirty_box(IWineD3DVolume *iface, const WINED3DBOX *dirty_box) DECLSPEC_HIDDEN;
HRESULT volume_init(IWineD3DVolumeImpl *volume, IWineD3DDeviceImpl *device, UINT width,
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;
/*****************************************************************************
@@ -1955,7 +1955,7 @@ typedef struct IWineD3DVolumeTextureImpl
HRESULT volumetexture_init(IWineD3DVolumeTextureImpl *texture, UINT width, UINT height,
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
{
@@ -2096,7 +2096,7 @@ GLenum surface_get_gl_buffer(IWineD3DSurfaceImpl *surface) DECLSPEC_HIDDEN;
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 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;
void surface_internal_preload(IWineD3DSurfaceImpl *surface, enum WINED3DSRGB srgb) 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,
REFIID riid, LPVOID *ppobj) 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,
REFGUID refguid, const void *pData, DWORD SizeOfData, DWORD Flags) DECLSPEC_HIDDEN;
HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetPrivateData(IWineD3DSurface *iface,
@@ -2252,7 +2252,7 @@ typedef struct IWineD3DVertexDeclarationImpl {
const IWineD3DVertexDeclarationVtbl *lpVtbl;
LONG ref;
- IUnknown *parent;
+ void *parent;
const struct wined3d_parent_ops *parent_ops;
IWineD3DDeviceImpl *device;
@@ -2267,7 +2267,7 @@ typedef struct IWineD3DVertexDeclarationImpl {
HRESULT vertexdeclaration_init(IWineD3DVertexDeclarationImpl *declaration, IWineD3DDeviceImpl *device,
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
@@ -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;
HRESULT buffer_init(struct wined3d_buffer *buffer, IWineD3DDeviceImpl *device,
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 */
struct wined3d_rendertarget_view
@@ -2522,11 +2522,11 @@ struct wined3d_rendertarget_view
LONG refcount;
IWineD3DResource *resource;
- IUnknown *parent;
+ void *parent;
};
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)
@@ -2538,7 +2538,7 @@ struct IWineD3DSwapChainImpl
const IWineD3DSwapChainVtbl *lpVtbl;
LONG ref; /* Note: Ref counting not required */
- IUnknown *parent;
+ void *parent;
IWineD3DDeviceImpl *device;
/* IWineD3DSwapChain fields */
@@ -2568,7 +2568,7 @@ HRESULT WINAPI IWineD3DBaseSwapChainImpl_QueryInterface(IWineD3DSwapChain *iface
REFIID riid, LPVOID *ppobj) DECLSPEC_HIDDEN;
ULONG WINAPI IWineD3DBaseSwapChainImpl_AddRef(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,
IWineD3DSurface *dst_surface) DECLSPEC_HIDDEN;
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;
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_setup_fullscreen_window(IWineD3DSwapChainImpl *swapchain, UINT w, UINT h) DECLSPEC_HIDDEN;
@@ -2717,7 +2717,7 @@ typedef struct IWineD3DBaseShaderClass
void *frontend_data;
void *backend_data;
- IUnknown *parent;
+ void *parent;
const struct wined3d_parent_ops *parent_ops;
/* 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;
HRESULT vertexshader_init(IWineD3DVertexShaderImpl *shader, IWineD3DDeviceImpl *device,
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
{
@@ -2851,7 +2851,7 @@ struct wined3d_geometryshader
HRESULT geometryshader_init(struct wined3d_geometryshader *shader, IWineD3DDeviceImpl *device,
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
@@ -2896,7 +2896,7 @@ typedef struct IWineD3DPixelShaderImpl {
HRESULT pixelshader_init(IWineD3DPixelShaderImpl *shader, IWineD3DDeviceImpl *device,
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,
IWineD3DBaseTexture * const *textures) DECLSPEC_HIDDEN;
void find_ps_compile_args(IWineD3DPixelShaderImpl *shader, IWineD3DStateBlockImpl *stateblock,
@@ -2917,7 +2917,7 @@ struct IWineD3DPaletteImpl {
const IWineD3DPaletteVtbl *lpVtbl;
LONG ref;
- IUnknown *parent;
+ void *parent;
IWineD3DDeviceImpl *device;
/* IWineD3DPalette */
@@ -2931,7 +2931,7 @@ struct IWineD3DPaletteImpl {
};
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 */
extern enum wined3d_format_id pixelformat_for_depth(DWORD depth) DECLSPEC_HIDDEN;
diff --git a/include/wine/wined3d.idl b/include/wine/wined3d.idl
index c46b04f..230d012 100644
--- a/include/wine/wined3d.idl
+++ b/include/wine/wined3d.idl
@@ -2178,8 +2178,7 @@ typedef HRESULT (__stdcall *D3DCB_ENUMRESOURCES)(IWineD3DResource *resource, voi
]
interface IWineD3DBase : IUnknown
{
- HRESULT GetParent(
- [out] IUnknown **parent
+ void *GetParent(
);
}
@@ -2797,7 +2796,7 @@ interface IWineD3DDevice : IUnknown
HRESULT CreateBuffer(
[in] struct wined3d_buffer_desc *desc,
[in] const void *data,
- [in] IUnknown *parent,
+ [in] void *parent,
[in] const struct wined3d_parent_ops *parent_ops,
[out] IWineD3DBuffer **buffer
);
@@ -2805,17 +2804,17 @@ interface IWineD3DDevice : IUnknown
[in] UINT length,
[in] DWORD usage,
[in] WINED3DPOOL pool,
- [out] IWineD3DBuffer **vertex_buffer,
- [in] IUnknown *parent,
- [in] const struct wined3d_parent_ops *parent_ops
+ [in] void *parent,
+ [in] const struct wined3d_parent_ops *parent_ops,
+ [out] IWineD3DBuffer **vertex_buffer
);
HRESULT CreateIndexBuffer(
[in] UINT length,
[in] DWORD usage,
[in] WINED3DPOOL pool,
- [out] IWineD3DBuffer **index_buffer,
- [in] IUnknown *parent,
- [in] const struct wined3d_parent_ops *parent_ops
+ [in] void *parent,
+ [in] const struct wined3d_parent_ops *parent_ops,
+ [out] IWineD3DBuffer **index_buffer
);
HRESULT CreateStateBlock(
[in] WINED3DSTATEBLOCKTYPE type,
@@ -2828,18 +2827,18 @@ interface IWineD3DDevice : IUnknown
[in] BOOL lockable,
[in] BOOL discard,
[in] UINT level,
- [out] IWineD3DSurface **surface,
[in] DWORD usage,
[in] WINED3DPOOL pool,
[in] WINED3DMULTISAMPLE_TYPE multisample_type,
[in] DWORD multisample_quality,
[in] WINED3DSURFTYPE surface_type,
- [in] IUnknown *parent,
- [in] const struct wined3d_parent_ops *parent_ops
+ [in] void *parent,
+ [in] const struct wined3d_parent_ops *parent_ops,
+ [out] IWineD3DSurface **surface
);
HRESULT CreateRendertargetView(
[in] IWineD3DResource *resource,
- [in] IUnknown *parent,
+ [in] void *parent,
[out] IWineD3DRendertargetView **rendertarget_view
);
HRESULT CreateTexture(
@@ -2849,9 +2848,9 @@ interface IWineD3DDevice : IUnknown
[in] DWORD usage,
[in] enum wined3d_format_id format_id,
[in] WINED3DPOOL pool,
- [out] IWineD3DTexture **texture,
- [in] IUnknown *parent,
- [in] const struct wined3d_parent_ops *parent_ops
+ [in] void *parent,
+ [in] const struct wined3d_parent_ops *parent_ops,
+ [out] IWineD3DTexture **texture
);
HRESULT CreateVolumeTexture(
[in] UINT width,
@@ -2861,9 +2860,9 @@ interface IWineD3DDevice : IUnknown
[in] DWORD usage,
[in] enum wined3d_format_id format_id,
[in] WINED3DPOOL pool,
- [out] IWineD3DVolumeTexture **texture,
- [in] IUnknown *parent,
- [in] const struct wined3d_parent_ops *parent_ops
+ [in] void *parent,
+ [in] const struct wined3d_parent_ops *parent_ops,
+ [out] IWineD3DVolumeTexture **texture
);
HRESULT CreateVolume(
[in] UINT width,
@@ -2872,9 +2871,9 @@ interface IWineD3DDevice : IUnknown
[in] DWORD usage,
[in] enum wined3d_format_id format_id,
[in] WINED3DPOOL pool,
- [out] IWineD3DVolume **volume,
- [in] IUnknown *parent,
- [in] const struct wined3d_parent_ops *parent_ops
+ [in] void *parent,
+ [in] const struct wined3d_parent_ops *parent_ops,
+ [out] IWineD3DVolume **volume
);
HRESULT CreateCubeTexture(
[in] UINT edge_length,
@@ -2882,9 +2881,9 @@ interface IWineD3DDevice : IUnknown
[in] DWORD usage,
[in] enum wined3d_format_id format_id,
[in] WINED3DPOOL pool,
- [out] IWineD3DCubeTexture **texture,
- [in] IUnknown *parent,
- [in] const struct wined3d_parent_ops *parent_ops
+ [in] void *parent,
+ [in] const struct wined3d_parent_ops *parent_ops,
+ [out] IWineD3DCubeTexture **texture
);
HRESULT CreateQuery(
[in] WINED3DQUERYTYPE type,
@@ -2892,49 +2891,49 @@ interface IWineD3DDevice : IUnknown
);
HRESULT CreateSwapChain(
[in] WINED3DPRESENT_PARAMETERS *present_parameters,
- [out] IWineD3DSwapChain **swapchain,
- [in] IUnknown *parent,
- [in] WINED3DSURFTYPE surface_type
+ [in] WINED3DSURFTYPE surface_type,
+ [in] void *parent,
+ [out] IWineD3DSwapChain **swapchain
);
HRESULT CreateVertexDeclaration(
- [out] IWineD3DVertexDeclaration **declaration,
- [in] IUnknown *parent,
- [in] const struct wined3d_parent_ops *parent_ops,
[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(
- [out] IWineD3DVertexDeclaration **declaration,
- [in] IUnknown *parent,
+ [in] DWORD fvf,
+ [in] void *parent,
[in] const struct wined3d_parent_ops *parent_ops,
- [in] DWORD fvf
+ [out] IWineD3DVertexDeclaration **declaration
);
HRESULT CreateVertexShader(
[in] const DWORD *function,
[in] const struct wined3d_shader_signature *output_signature,
- [out] IWineD3DVertexShader **shader,
- [in] IUnknown *parent,
- [in] const struct wined3d_parent_ops *parent_ops
+ [in] void *parent,
+ [in] const struct wined3d_parent_ops *parent_ops,
+ [out] IWineD3DVertexShader **shader
);
HRESULT CreateGeometryShader(
[in] const DWORD *byte_code,
[in] const struct wined3d_shader_signature *output_signature,
- [out] IWineD3DGeometryShader **shader,
- [in] IUnknown *parent,
- [in] const struct wined3d_parent_ops *parent_ops
+ [in] void *parent,
+ [in] const struct wined3d_parent_ops *parent_ops,
+ [out] IWineD3DGeometryShader **shader
);
HRESULT CreatePixelShader(
[in] const DWORD *function,
[in] const struct wined3d_shader_signature *output_signature,
- [out] IWineD3DPixelShader **shader,
- [in] IUnknown *parent,
- [in] const struct wined3d_parent_ops *parent_ops
+ [in] void *parent,
+ [in] const struct wined3d_parent_ops *parent_ops,
+ [out] IWineD3DPixelShader **shader
);
HRESULT CreatePalette(
[in] DWORD flags,
[in] const PALETTEENTRY *palette_entry,
- [out] IWineD3DPalette **palette,
- [in] IUnknown *parent
+ [in] void *parent,
+ [out] IWineD3DPalette **palette
);
HRESULT Init3D(
[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);
void __stdcall wined3d_mutex_lock(void);
void __stdcall wined3d_mutex_unlock(void);
--
1.7.1
More information about the wine-patches
mailing list