Commit 6c4c3517 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

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

parent b84d1ce5
...@@ -227,8 +227,8 @@ HRESULT d3d10_input_layout_init(struct d3d10_input_layout *layout, struct d3d10_ ...@@ -227,8 +227,8 @@ HRESULT d3d10_input_layout_init(struct d3d10_input_layout *layout, struct d3d10_
return hr; return hr;
} }
hr = IWineD3DDevice_CreateVertexDeclaration(device->wined3d_device, &layout->wined3d_decl, hr = IWineD3DDevice_CreateVertexDeclaration(device->wined3d_device, wined3d_elements, wined3d_element_count,
(IUnknown *)layout, &d3d10_input_layout_wined3d_parent_ops, wined3d_elements, wined3d_element_count); layout, &d3d10_input_layout_wined3d_parent_ops, &layout->wined3d_decl);
HeapFree(GetProcessHeap(), 0, wined3d_elements); HeapFree(GetProcessHeap(), 0, wined3d_elements);
if (FAILED(hr)) if (FAILED(hr))
{ {
......
...@@ -259,9 +259,8 @@ HRESULT d3d10_vertex_shader_init(struct d3d10_vertex_shader *shader, struct d3d1 ...@@ -259,9 +259,8 @@ HRESULT d3d10_vertex_shader_init(struct d3d10_vertex_shader *shader, struct d3d1
return hr; return hr;
} }
hr = IWineD3DDevice_CreateVertexShader(device->wined3d_device, hr = IWineD3DDevice_CreateVertexShader(device->wined3d_device, shader_info.shader_code,
shader_info.shader_code, &shader->output_signature, &shader->wined3d_shader, &shader->output_signature, shader, &d3d10_vertex_shader_wined3d_parent_ops, &shader->wined3d_shader);
(IUnknown *)shader, &d3d10_vertex_shader_wined3d_parent_ops);
if (FAILED(hr)) if (FAILED(hr))
{ {
WARN("Failed to create wined3d vertex shader, hr %#x.\n", hr); WARN("Failed to create wined3d vertex shader, hr %#x.\n", hr);
...@@ -394,9 +393,8 @@ HRESULT d3d10_geometry_shader_init(struct d3d10_geometry_shader *shader, struct ...@@ -394,9 +393,8 @@ HRESULT d3d10_geometry_shader_init(struct d3d10_geometry_shader *shader, struct
return hr; return hr;
} }
hr = IWineD3DDevice_CreateGeometryShader(device->wined3d_device, hr = IWineD3DDevice_CreateGeometryShader(device->wined3d_device, shader_info.shader_code,
shader_info.shader_code, &shader->output_signature, &shader->wined3d_shader, &shader->output_signature, shader, &d3d10_geometry_shader_wined3d_parent_ops, &shader->wined3d_shader);
(IUnknown *)shader, &d3d10_geometry_shader_wined3d_parent_ops);
if (FAILED(hr)) if (FAILED(hr))
{ {
WARN("Failed to create wined3d vertex shader, hr %#x.\n", hr); WARN("Failed to create wined3d vertex shader, hr %#x.\n", hr);
...@@ -534,9 +532,8 @@ HRESULT d3d10_pixel_shader_init(struct d3d10_pixel_shader *shader, struct d3d10_ ...@@ -534,9 +532,8 @@ HRESULT d3d10_pixel_shader_init(struct d3d10_pixel_shader *shader, struct d3d10_
return hr; return hr;
} }
hr = IWineD3DDevice_CreatePixelShader(device->wined3d_device, hr = IWineD3DDevice_CreatePixelShader(device->wined3d_device, shader_info.shader_code,
shader_info.shader_code, &shader->output_signature, &shader->wined3d_shader, &shader->output_signature, shader, &d3d10_pixel_shader_wined3d_parent_ops, &shader->wined3d_shader);
(IUnknown *)shader, &d3d10_pixel_shader_wined3d_parent_ops);
if (FAILED(hr)) if (FAILED(hr))
{ {
WARN("Failed to create wined3d pixel shader, hr %#x.\n", hr); WARN("Failed to create wined3d pixel shader, hr %#x.\n", hr);
......
...@@ -228,11 +228,10 @@ HRESULT d3d10_texture2d_init(struct d3d10_texture2d *texture, struct d3d10_devic ...@@ -228,11 +228,10 @@ HRESULT d3d10_texture2d_init(struct d3d10_texture2d *texture, struct d3d10_devic
FIXME("Implement DXGI<->wined3d usage conversion\n"); FIXME("Implement DXGI<->wined3d usage conversion\n");
hr = IWineD3DDevice_CreateSurface(device->wined3d_device, desc->Width, desc->Height, hr = IWineD3DDevice_CreateSurface(device->wined3d_device, desc->Width, desc->Height,
wined3dformat_from_dxgi_format(desc->Format), FALSE, FALSE, 0, wined3dformat_from_dxgi_format(desc->Format), FALSE, FALSE, 0, desc->Usage, WINED3DPOOL_DEFAULT,
&texture->wined3d_surface, desc->Usage, WINED3DPOOL_DEFAULT,
desc->SampleDesc.Count > 1 ? desc->SampleDesc.Count : WINED3DMULTISAMPLE_NONE, desc->SampleDesc.Count > 1 ? desc->SampleDesc.Count : WINED3DMULTISAMPLE_NONE,
desc->SampleDesc.Quality, SURFACE_OPENGL, (IUnknown *)texture, desc->SampleDesc.Quality, SURFACE_OPENGL, texture, &d3d10_texture2d_wined3d_parent_ops,
&d3d10_texture2d_wined3d_parent_ops); &texture->wined3d_surface);
if (FAILED(hr)) if (FAILED(hr))
{ {
ERR("CreateSurface failed, returning %#x\n", hr); ERR("CreateSurface failed, returning %#x\n", hr);
......
...@@ -388,17 +388,9 @@ static void STDMETHODCALLTYPE d3d10_rendertarget_view_GetResource(ID3D10RenderTa ...@@ -388,17 +388,9 @@ static void STDMETHODCALLTYPE d3d10_rendertarget_view_GetResource(ID3D10RenderTa
return; return;
} }
hr = IWineD3DResource_GetParent(wined3d_resource, &parent); parent = IWineD3DResource_GetParent(wined3d_resource);
IWineD3DResource_Release(wined3d_resource);
if (FAILED(hr))
{
ERR("Failed to get wined3d resource parent, hr %#x\n", hr);
*resource = NULL;
return;
}
hr = IUnknown_QueryInterface(parent, &IID_ID3D10Resource, (void **)&resource); hr = IUnknown_QueryInterface(parent, &IID_ID3D10Resource, (void **)&resource);
IUnknown_Release(parent); IWineD3DResource_Release(wined3d_resource);
if (FAILED(hr)) if (FAILED(hr))
{ {
ERR("Resource parent isn't a d3d10 resource, hr %#x\n", hr); ERR("Resource parent isn't a d3d10 resource, hr %#x\n", hr);
......
...@@ -253,22 +253,27 @@ static HRESULT WINAPI IDirect3DCubeTexture8Impl_GetLevelDesc(LPDIRECT3DCUBETEXTU ...@@ -253,22 +253,27 @@ static HRESULT WINAPI IDirect3DCubeTexture8Impl_GetLevelDesc(LPDIRECT3DCUBETEXTU
return hr; return hr;
} }
static HRESULT WINAPI IDirect3DCubeTexture8Impl_GetCubeMapSurface(LPDIRECT3DCUBETEXTURE8 iface, D3DCUBEMAP_FACES FaceType, UINT Level, IDirect3DSurface8 **ppCubeMapSurface) { static HRESULT WINAPI IDirect3DCubeTexture8Impl_GetCubeMapSurface(IDirect3DCubeTexture8 *iface,
D3DCUBEMAP_FACES FaceType, UINT Level, IDirect3DSurface8 **ppCubeMapSurface)
{
IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface; IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface;
HRESULT hrc = D3D_OK;
IWineD3DSurface *mySurface = NULL; IWineD3DSurface *mySurface = NULL;
HRESULT hr;
TRACE("iface %p, face %#x, level %u, surface %p.\n", iface, FaceType, Level, ppCubeMapSurface); TRACE("iface %p, face %#x, level %u, surface %p.\n", iface, FaceType, Level, ppCubeMapSurface);
wined3d_mutex_lock(); wined3d_mutex_lock();
hrc = IWineD3DCubeTexture_GetCubeMapSurface(This->wineD3DCubeTexture, (WINED3DCUBEMAP_FACES) FaceType, Level, &mySurface); hr = IWineD3DCubeTexture_GetCubeMapSurface(This->wineD3DCubeTexture,
if (hrc == D3D_OK && NULL != ppCubeMapSurface) { (WINED3DCUBEMAP_FACES) FaceType, Level, &mySurface);
IWineD3DCubeTexture_GetParent(mySurface, (IUnknown **)ppCubeMapSurface); if (SUCCEEDED(hr) && ppCubeMapSurface)
{
*ppCubeMapSurface = IWineD3DCubeTexture_GetParent(mySurface);
IDirect3DSurface8_AddRef(*ppCubeMapSurface);
IWineD3DCubeTexture_Release(mySurface); IWineD3DCubeTexture_Release(mySurface);
} }
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hrc; return hr;
} }
static HRESULT WINAPI IDirect3DCubeTexture8Impl_LockRect(LPDIRECT3DCUBETEXTURE8 iface, D3DCUBEMAP_FACES FaceType, UINT Level, D3DLOCKED_RECT* pLockedRect, CONST RECT *pRect, DWORD Flags) { static HRESULT WINAPI IDirect3DCubeTexture8Impl_LockRect(LPDIRECT3DCUBETEXTURE8 iface, D3DCUBEMAP_FACES FaceType, UINT Level, D3DLOCKED_RECT* pLockedRect, CONST RECT *pRect, DWORD Flags) {
...@@ -357,9 +362,9 @@ HRESULT cubetexture_init(IDirect3DCubeTexture8Impl *texture, IDirect3DDevice8Imp ...@@ -357,9 +362,9 @@ HRESULT cubetexture_init(IDirect3DCubeTexture8Impl *texture, IDirect3DDevice8Imp
texture->ref = 1; texture->ref = 1;
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_CreateCubeTexture(device->WineD3DDevice, edge_length, levels, usage & WINED3DUSAGE_MASK, hr = IWineD3DDevice_CreateCubeTexture(device->WineD3DDevice, edge_length, levels,
wined3dformat_from_d3dformat(format), pool, &texture->wineD3DCubeTexture, usage & WINED3DUSAGE_MASK, wined3dformat_from_d3dformat(format), pool, texture,
(IUnknown *)texture, &d3d8_cubetexture_wined3d_parent_ops); &d3d8_cubetexture_wined3d_parent_ops, &texture->wineD3DCubeTexture);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
if (FAILED(hr)) if (FAILED(hr))
{ {
......
...@@ -268,9 +268,8 @@ HRESULT indexbuffer_init(IDirect3DIndexBuffer8Impl *buffer, IDirect3DDevice8Impl ...@@ -268,9 +268,8 @@ HRESULT indexbuffer_init(IDirect3DIndexBuffer8Impl *buffer, IDirect3DDevice8Impl
buffer->format = wined3dformat_from_d3dformat(format); buffer->format = wined3dformat_from_d3dformat(format);
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_CreateIndexBuffer(device->WineD3DDevice, size, hr = IWineD3DDevice_CreateIndexBuffer(device->WineD3DDevice, size, usage & WINED3DUSAGE_MASK,
usage & WINED3DUSAGE_MASK, (WINED3DPOOL)pool, &buffer->wineD3DIndexBuffer, (WINED3DPOOL)pool, buffer, &d3d8_indexbuffer_wined3d_parent_ops, &buffer->wineD3DIndexBuffer);
(IUnknown *)buffer, &d3d8_indexbuffer_wined3d_parent_ops);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
if (FAILED(hr)) if (FAILED(hr))
{ {
......
...@@ -100,9 +100,8 @@ HRESULT pixelshader_init(IDirect3DPixelShader8Impl *shader, IDirect3DDevice8Impl ...@@ -100,9 +100,8 @@ HRESULT pixelshader_init(IDirect3DPixelShader8Impl *shader, IDirect3DDevice8Impl
shader->handle = shader_handle; shader->handle = shader_handle;
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_CreatePixelShader(device->WineD3DDevice, byte_code, hr = IWineD3DDevice_CreatePixelShader(device->WineD3DDevice, byte_code, NULL, shader,
NULL, &shader->wineD3DPixelShader, (IUnknown *)shader, &d3d8_pixelshader_wined3d_parent_ops, &shader->wineD3DPixelShader);
&d3d8_pixelshader_wined3d_parent_ops);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
if (FAILED(hr)) if (FAILED(hr))
{ {
......
...@@ -306,9 +306,8 @@ HRESULT surface_init(IDirect3DSurface8Impl *surface, IDirect3DDevice8Impl *devic ...@@ -306,9 +306,8 @@ HRESULT surface_init(IDirect3DSurface8Impl *surface, IDirect3DDevice8Impl *devic
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_CreateSurface(device->WineD3DDevice, width, height, wined3dformat_from_d3dformat(format), hr = IWineD3DDevice_CreateSurface(device->WineD3DDevice, width, height, wined3dformat_from_d3dformat(format),
lockable, discard, level, &surface->wineD3DSurface, usage & WINED3DUSAGE_MASK, (WINED3DPOOL)pool, lockable, discard, level, usage & WINED3DUSAGE_MASK, (WINED3DPOOL)pool, multisample_type,
multisample_type, multisample_quality, SURFACE_OPENGL, (IUnknown *)surface, multisample_quality, SURFACE_OPENGL, surface, &d3d8_surface_wined3d_parent_ops, &surface->wineD3DSurface);
&d3d8_surface_wined3d_parent_ops);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
if (FAILED(hr)) if (FAILED(hr))
{ {
......
...@@ -83,23 +83,28 @@ static HRESULT WINAPI IDirect3DSwapChain8Impl_Present(LPDIRECT3DSWAPCHAIN8 iface ...@@ -83,23 +83,28 @@ static HRESULT WINAPI IDirect3DSwapChain8Impl_Present(LPDIRECT3DSWAPCHAIN8 iface
return hr; return hr;
} }
static HRESULT WINAPI IDirect3DSwapChain8Impl_GetBackBuffer(LPDIRECT3DSWAPCHAIN8 iface, UINT iBackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface8** ppBackBuffer) { static HRESULT WINAPI IDirect3DSwapChain8Impl_GetBackBuffer(IDirect3DSwapChain8 *iface,
UINT iBackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface8 **ppBackBuffer)
{
IDirect3DSwapChain8Impl *This = (IDirect3DSwapChain8Impl *)iface; IDirect3DSwapChain8Impl *This = (IDirect3DSwapChain8Impl *)iface;
HRESULT hrc = D3D_OK;
IWineD3DSurface *mySurface = NULL; IWineD3DSurface *mySurface = NULL;
HRESULT hr;
TRACE("iface %p, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n", TRACE("iface %p, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n",
iface, iBackBuffer, Type, ppBackBuffer); iface, iBackBuffer, Type, ppBackBuffer);
wined3d_mutex_lock(); wined3d_mutex_lock();
hrc = IWineD3DSwapChain_GetBackBuffer(This->wineD3DSwapChain, iBackBuffer, (WINED3DBACKBUFFER_TYPE )Type, &mySurface); hr = IWineD3DSwapChain_GetBackBuffer(This->wineD3DSwapChain, iBackBuffer,
if (hrc == D3D_OK && NULL != mySurface) { (WINED3DBACKBUFFER_TYPE)Type, &mySurface);
IWineD3DSurface_GetParent(mySurface, (IUnknown **)ppBackBuffer); if (SUCCEEDED(hr) && mySurface)
IWineD3DSurface_Release(mySurface); {
*ppBackBuffer = IWineD3DSurface_GetParent(mySurface);
IDirect3DSurface8_AddRef(*ppBackBuffer);
IWineD3DSurface_Release(mySurface);
} }
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hrc; return hr;
} }
static const IDirect3DSwapChain8Vtbl Direct3DSwapChain8_Vtbl = static const IDirect3DSwapChain8Vtbl Direct3DSwapChain8_Vtbl =
...@@ -138,7 +143,7 @@ HRESULT swapchain_init(IDirect3DSwapChain8Impl *swapchain, IDirect3DDevice8Impl ...@@ -138,7 +143,7 @@ HRESULT swapchain_init(IDirect3DSwapChain8Impl *swapchain, IDirect3DDevice8Impl
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_CreateSwapChain(device->WineD3DDevice, &wined3d_parameters, hr = IWineD3DDevice_CreateSwapChain(device->WineD3DDevice, &wined3d_parameters,
&swapchain->wineD3DSwapChain, (IUnknown *)swapchain, SURFACE_OPENGL); SURFACE_OPENGL, swapchain, &swapchain->wineD3DSwapChain);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
present_parameters->BackBufferWidth = wined3d_parameters.BackBufferWidth; present_parameters->BackBufferWidth = wined3d_parameters.BackBufferWidth;
......
...@@ -251,22 +251,26 @@ static HRESULT WINAPI IDirect3DTexture8Impl_GetLevelDesc(LPDIRECT3DTEXTURE8 ifac ...@@ -251,22 +251,26 @@ static HRESULT WINAPI IDirect3DTexture8Impl_GetLevelDesc(LPDIRECT3DTEXTURE8 ifac
return hr; return hr;
} }
static HRESULT WINAPI IDirect3DTexture8Impl_GetSurfaceLevel(LPDIRECT3DTEXTURE8 iface, UINT Level, IDirect3DSurface8 **ppSurfaceLevel) { static HRESULT WINAPI IDirect3DTexture8Impl_GetSurfaceLevel(IDirect3DTexture8 *iface,
UINT Level, IDirect3DSurface8 **ppSurfaceLevel)
{
IDirect3DTexture8Impl *This = (IDirect3DTexture8Impl *)iface; IDirect3DTexture8Impl *This = (IDirect3DTexture8Impl *)iface;
HRESULT hrc = D3D_OK;
IWineD3DSurface *mySurface = NULL; IWineD3DSurface *mySurface = NULL;
HRESULT hr;
TRACE("iface %p, level %u, surface %p.\n", iface, Level, ppSurfaceLevel); TRACE("iface %p, level %u, surface %p.\n", iface, Level, ppSurfaceLevel);
wined3d_mutex_lock(); wined3d_mutex_lock();
hrc = IWineD3DTexture_GetSurfaceLevel(This->wineD3DTexture, Level, &mySurface); hr = IWineD3DTexture_GetSurfaceLevel(This->wineD3DTexture, Level, &mySurface);
if (hrc == D3D_OK && NULL != ppSurfaceLevel) { if (SUCCEEDED(hr) && ppSurfaceLevel)
IWineD3DSurface_GetParent(mySurface, (IUnknown **)ppSurfaceLevel); {
*ppSurfaceLevel = IWineD3DSurface_GetParent(mySurface);
IDirect3DSurface8_AddRef(*ppSurfaceLevel);
IWineD3DSurface_Release(mySurface); IWineD3DSurface_Release(mySurface);
} }
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hrc; return hr;
} }
static HRESULT WINAPI IDirect3DTexture8Impl_LockRect(LPDIRECT3DTEXTURE8 iface, UINT Level, D3DLOCKED_RECT *pLockedRect, CONST RECT *pRect, DWORD Flags) { static HRESULT WINAPI IDirect3DTexture8Impl_LockRect(LPDIRECT3DTEXTURE8 iface, UINT Level, D3DLOCKED_RECT *pLockedRect, CONST RECT *pRect, DWORD Flags) {
...@@ -357,7 +361,7 @@ HRESULT texture_init(IDirect3DTexture8Impl *texture, IDirect3DDevice8Impl *devic ...@@ -357,7 +361,7 @@ HRESULT texture_init(IDirect3DTexture8Impl *texture, IDirect3DDevice8Impl *devic
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_CreateTexture(device->WineD3DDevice, width, height, levels, hr = IWineD3DDevice_CreateTexture(device->WineD3DDevice, width, height, levels,
usage & WINED3DUSAGE_MASK, wined3dformat_from_d3dformat(format), pool, usage & WINED3DUSAGE_MASK, wined3dformat_from_d3dformat(format), pool,
&texture->wineD3DTexture, (IUnknown *)texture, &d3d8_texture_wined3d_parent_ops); texture, &d3d8_texture_wined3d_parent_ops, &texture->wineD3DTexture);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
if (FAILED(hr)) if (FAILED(hr))
{ {
......
...@@ -271,9 +271,8 @@ HRESULT vertexbuffer_init(IDirect3DVertexBuffer8Impl *buffer, IDirect3DDevice8Im ...@@ -271,9 +271,8 @@ HRESULT vertexbuffer_init(IDirect3DVertexBuffer8Impl *buffer, IDirect3DDevice8Im
buffer->fvf = fvf; buffer->fvf = fvf;
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_CreateVertexBuffer(device->WineD3DDevice, size, hr = IWineD3DDevice_CreateVertexBuffer(device->WineD3DDevice, size, usage & WINED3DUSAGE_MASK,
usage & WINED3DUSAGE_MASK, (WINED3DPOOL)pool, &buffer->wineD3DVertexBuffer, (WINED3DPOOL)pool, buffer, &d3d8_vertexbuffer_wined3d_parent_ops, &buffer->wineD3DVertexBuffer);
(IUnknown *)buffer, &d3d8_vertexbuffer_wined3d_parent_ops);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
if (FAILED(hr)) if (FAILED(hr))
{ {
......
...@@ -399,9 +399,8 @@ HRESULT vertexdeclaration_init(IDirect3DVertexDeclaration8Impl *declaration, ...@@ -399,9 +399,8 @@ HRESULT vertexdeclaration_init(IDirect3DVertexDeclaration8Impl *declaration,
memcpy(declaration->elements, elements, declaration->elements_size); memcpy(declaration->elements, elements, declaration->elements_size);
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_CreateVertexDeclaration(device->WineD3DDevice, &declaration->wined3d_vertex_declaration, hr = IWineD3DDevice_CreateVertexDeclaration(device->WineD3DDevice, wined3d_elements, wined3d_element_count,
(IUnknown *)declaration, &d3d8_vertexdeclaration_wined3d_parent_ops, declaration, &d3d8_vertexdeclaration_wined3d_parent_ops, &declaration->wined3d_vertex_declaration);
wined3d_elements, wined3d_element_count);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
HeapFree(GetProcessHeap(), 0, wined3d_elements); HeapFree(GetProcessHeap(), 0, wined3d_elements);
if (FAILED(hr)) if (FAILED(hr))
...@@ -425,9 +424,8 @@ HRESULT vertexdeclaration_init_fvf(IDirect3DVertexDeclaration8Impl *declaration, ...@@ -425,9 +424,8 @@ HRESULT vertexdeclaration_init_fvf(IDirect3DVertexDeclaration8Impl *declaration,
declaration->elements_size = 0; declaration->elements_size = 0;
declaration->shader_handle = fvf; declaration->shader_handle = fvf;
hr = IWineD3DDevice_CreateVertexDeclarationFromFVF(device->WineD3DDevice, hr = IWineD3DDevice_CreateVertexDeclarationFromFVF(device->WineD3DDevice, fvf, declaration,
&declaration->wined3d_vertex_declaration, (IUnknown *)declaration, &d3d8_vertexdeclaration_wined3d_parent_ops, &declaration->wined3d_vertex_declaration);
&d3d8_vertexdeclaration_wined3d_parent_ops, fvf);
if (FAILED(hr)) if (FAILED(hr))
{ {
WARN("Failed to create wined3d vertex declaration, hr %#x.\n", hr); WARN("Failed to create wined3d vertex declaration, hr %#x.\n", hr);
......
...@@ -169,9 +169,8 @@ HRESULT vertexshader_init(IDirect3DVertexShader8Impl *shader, IDirect3DDevice8Im ...@@ -169,9 +169,8 @@ HRESULT vertexshader_init(IDirect3DVertexShader8Impl *shader, IDirect3DDevice8Im
if (usage) FIXME("Usage %#x not implemented.\n", usage); if (usage) FIXME("Usage %#x not implemented.\n", usage);
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_CreateVertexShader(device->WineD3DDevice, byte_code, hr = IWineD3DDevice_CreateVertexShader(device->WineD3DDevice, byte_code, NULL /* output signature */,
NULL /* output signature */, &shader->wineD3DVertexShader, shader, &d3d8_vertexshader_wined3d_parent_ops, &shader->wineD3DVertexShader);
(IUnknown *)shader, &d3d8_vertexshader_wined3d_parent_ops);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
if (FAILED(hr)) if (FAILED(hr))
{ {
......
...@@ -264,7 +264,7 @@ HRESULT volume_init(IDirect3DVolume8Impl *volume, IDirect3DDevice8Impl *device, ...@@ -264,7 +264,7 @@ HRESULT volume_init(IDirect3DVolume8Impl *volume, IDirect3DDevice8Impl *device,
volume->ref = 1; volume->ref = 1;
hr = IWineD3DDevice_CreateVolume(device->WineD3DDevice, width, height, depth, usage, hr = IWineD3DDevice_CreateVolume(device->WineD3DDevice, width, height, depth, usage,
format, pool, &volume->wineD3DVolume, (IUnknown *)volume, &d3d8_volume_wined3d_parent_ops); format, pool, volume, &d3d8_volume_wined3d_parent_ops, &volume->wineD3DVolume);
if (FAILED(hr)) if (FAILED(hr))
{ {
WARN("Failed to create wined3d volume, hr %#x.\n", hr); WARN("Failed to create wined3d volume, hr %#x.\n", hr);
......
...@@ -251,22 +251,26 @@ static HRESULT WINAPI IDirect3DVolumeTexture8Impl_GetLevelDesc(LPDIRECT3DVOLUMET ...@@ -251,22 +251,26 @@ static HRESULT WINAPI IDirect3DVolumeTexture8Impl_GetLevelDesc(LPDIRECT3DVOLUMET
return hr; return hr;
} }
static HRESULT WINAPI IDirect3DVolumeTexture8Impl_GetVolumeLevel(LPDIRECT3DVOLUMETEXTURE8 iface, UINT Level, IDirect3DVolume8 **ppVolumeLevel) { static HRESULT WINAPI IDirect3DVolumeTexture8Impl_GetVolumeLevel(IDirect3DVolumeTexture8 *iface,
UINT Level, IDirect3DVolume8 **ppVolumeLevel)
{
IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface; IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface;
HRESULT hrc = D3D_OK;
IWineD3DVolume *myVolume = NULL; IWineD3DVolume *myVolume = NULL;
HRESULT hr;
TRACE("iface %p, level %u, volume %p.\n", iface, Level, ppVolumeLevel); TRACE("iface %p, level %u, volume %p.\n", iface, Level, ppVolumeLevel);
wined3d_mutex_lock(); wined3d_mutex_lock();
hrc = IWineD3DVolumeTexture_GetVolumeLevel(This->wineD3DVolumeTexture, Level, &myVolume); hr = IWineD3DVolumeTexture_GetVolumeLevel(This->wineD3DVolumeTexture, Level, &myVolume);
if (hrc == D3D_OK && NULL != ppVolumeLevel) { if (SUCCEEDED(hr) && ppVolumeLevel)
IWineD3DVolumeTexture_GetParent(myVolume, (IUnknown **)ppVolumeLevel); {
IWineD3DVolumeTexture_Release(myVolume); *ppVolumeLevel = IWineD3DVolumeTexture_GetParent(myVolume);
IDirect3DVolume8_AddRef(*ppVolumeLevel);
IWineD3DVolumeTexture_Release(myVolume);
} }
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hrc; return hr;
} }
static HRESULT WINAPI IDirect3DVolumeTexture8Impl_LockBox(LPDIRECT3DVOLUMETEXTURE8 iface, UINT Level, D3DLOCKED_BOX *pLockedVolume, CONST D3DBOX *pBox, DWORD Flags) { static HRESULT WINAPI IDirect3DVolumeTexture8Impl_LockBox(LPDIRECT3DVOLUMETEXTURE8 iface, UINT Level, D3DLOCKED_BOX *pLockedVolume, CONST D3DBOX *pBox, DWORD Flags) {
...@@ -356,8 +360,8 @@ HRESULT volumetexture_init(IDirect3DVolumeTexture8Impl *texture, IDirect3DDevice ...@@ -356,8 +360,8 @@ HRESULT volumetexture_init(IDirect3DVolumeTexture8Impl *texture, IDirect3DDevice
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_CreateVolumeTexture(device->WineD3DDevice, width, height, depth, levels, hr = IWineD3DDevice_CreateVolumeTexture(device->WineD3DDevice, width, height, depth, levels,
usage & WINED3DUSAGE_MASK, wined3dformat_from_d3dformat(format), pool, usage & WINED3DUSAGE_MASK, wined3dformat_from_d3dformat(format), pool, texture,
&texture->wineD3DVolumeTexture, (IUnknown *)texture, &d3d8_volumetexture_wined3d_parent_ops); &d3d8_volumetexture_wined3d_parent_ops, &texture->wineD3DVolumeTexture);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
if (FAILED(hr)) if (FAILED(hr))
{ {
......
...@@ -292,22 +292,27 @@ static HRESULT WINAPI IDirect3DCubeTexture9Impl_GetLevelDesc(LPDIRECT3DCUBETEXTU ...@@ -292,22 +292,27 @@ static HRESULT WINAPI IDirect3DCubeTexture9Impl_GetLevelDesc(LPDIRECT3DCUBETEXTU
return hr; return hr;
} }
static HRESULT WINAPI IDirect3DCubeTexture9Impl_GetCubeMapSurface(LPDIRECT3DCUBETEXTURE9 iface, D3DCUBEMAP_FACES FaceType, UINT Level, IDirect3DSurface9** ppCubeMapSurface) { static HRESULT WINAPI IDirect3DCubeTexture9Impl_GetCubeMapSurface(IDirect3DCubeTexture9 *iface,
D3DCUBEMAP_FACES FaceType, UINT Level, IDirect3DSurface9 **ppCubeMapSurface)
{
IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
HRESULT hrc = D3D_OK;
IWineD3DSurface *mySurface = NULL; IWineD3DSurface *mySurface = NULL;
HRESULT hr;
TRACE("iface %p, face %#x, level %u, surface %p.\n", iface, FaceType, Level, ppCubeMapSurface); TRACE("iface %p, face %#x, level %u, surface %p.\n", iface, FaceType, Level, ppCubeMapSurface);
wined3d_mutex_lock(); wined3d_mutex_lock();
hrc = IWineD3DCubeTexture_GetCubeMapSurface(This->wineD3DCubeTexture, (WINED3DCUBEMAP_FACES) FaceType, Level, &mySurface); hr = IWineD3DCubeTexture_GetCubeMapSurface(This->wineD3DCubeTexture,
if (hrc == D3D_OK && NULL != ppCubeMapSurface) { (WINED3DCUBEMAP_FACES)FaceType, Level, &mySurface);
IWineD3DCubeTexture_GetParent(mySurface, (IUnknown **)ppCubeMapSurface); if (SUCCEEDED(hr) && ppCubeMapSurface)
IWineD3DCubeTexture_Release(mySurface); {
*ppCubeMapSurface = IWineD3DCubeTexture_GetParent(mySurface);
IDirect3DSurface9_AddRef(*ppCubeMapSurface);
IWineD3DCubeTexture_Release(mySurface);
} }
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hrc; return hr;
} }
static HRESULT WINAPI IDirect3DCubeTexture9Impl_LockRect(LPDIRECT3DCUBETEXTURE9 iface, D3DCUBEMAP_FACES FaceType, UINT Level, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) { static HRESULT WINAPI IDirect3DCubeTexture9Impl_LockRect(LPDIRECT3DCUBETEXTURE9 iface, D3DCUBEMAP_FACES FaceType, UINT Level, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) {
...@@ -399,9 +404,9 @@ HRESULT cubetexture_init(IDirect3DCubeTexture9Impl *texture, IDirect3DDevice9Imp ...@@ -399,9 +404,9 @@ HRESULT cubetexture_init(IDirect3DCubeTexture9Impl *texture, IDirect3DDevice9Imp
texture->ref = 1; texture->ref = 1;
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_CreateCubeTexture(device->WineD3DDevice, edge_length, levels, usage, hr = IWineD3DDevice_CreateCubeTexture(device->WineD3DDevice, edge_length,
wined3dformat_from_d3dformat(format), pool, &texture->wineD3DCubeTexture, levels, usage, wined3dformat_from_d3dformat(format), pool, texture,
(IUnknown *)texture, &d3d9_cubetexture_wined3d_parent_ops); &d3d9_cubetexture_wined3d_parent_ops, &texture->wineD3DCubeTexture);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
if (FAILED(hr)) if (FAILED(hr))
{ {
......
...@@ -270,9 +270,8 @@ HRESULT indexbuffer_init(IDirect3DIndexBuffer9Impl *buffer, IDirect3DDevice9Impl ...@@ -270,9 +270,8 @@ HRESULT indexbuffer_init(IDirect3DIndexBuffer9Impl *buffer, IDirect3DDevice9Impl
buffer->format = wined3dformat_from_d3dformat(format); buffer->format = wined3dformat_from_d3dformat(format);
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_CreateIndexBuffer(device->WineD3DDevice, size, hr = IWineD3DDevice_CreateIndexBuffer(device->WineD3DDevice, size, usage & WINED3DUSAGE_MASK,
usage & WINED3DUSAGE_MASK, (WINED3DPOOL)pool, &buffer->wineD3DIndexBuffer, (WINED3DPOOL)pool, buffer, &d3d9_indexbuffer_wined3d_parent_ops, &buffer->wineD3DIndexBuffer);
(IUnknown *)buffer, &d3d9_indexbuffer_wined3d_parent_ops);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
if (FAILED(hr)) if (FAILED(hr))
{ {
......
...@@ -136,9 +136,8 @@ HRESULT pixelshader_init(IDirect3DPixelShader9Impl *shader, IDirect3DDevice9Impl ...@@ -136,9 +136,8 @@ HRESULT pixelshader_init(IDirect3DPixelShader9Impl *shader, IDirect3DDevice9Impl
shader->lpVtbl = &Direct3DPixelShader9_Vtbl; shader->lpVtbl = &Direct3DPixelShader9_Vtbl;
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_CreatePixelShader(device->WineD3DDevice, byte_code, hr = IWineD3DDevice_CreatePixelShader(device->WineD3DDevice, byte_code, NULL, shader,
NULL, &shader->wineD3DPixelShader, (IUnknown *)shader, &d3d9_pixelshader_wined3d_parent_ops, &shader->wineD3DPixelShader);
&d3d9_pixelshader_wined3d_parent_ops);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
if (FAILED(hr)) if (FAILED(hr))
{ {
...@@ -165,10 +164,11 @@ HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShader(LPDIRECT3DDEVICE9EX iface, ID ...@@ -165,10 +164,11 @@ HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShader(LPDIRECT3DDEVICE9EX iface, ID
return D3D_OK; return D3D_OK;
} }
HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShader(LPDIRECT3DDEVICE9EX iface, IDirect3DPixelShader9** ppShader) { HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShader(IDirect3DDevice9Ex *iface, IDirect3DPixelShader9 **ppShader)
{
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
IWineD3DPixelShader *object; IWineD3DPixelShader *object;
HRESULT hrc; HRESULT hr;
TRACE("iface %p, shader %p.\n", iface, ppShader); TRACE("iface %p, shader %p.\n", iface, ppShader);
...@@ -178,12 +178,13 @@ HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShader(LPDIRECT3DDEVICE9EX iface, ID ...@@ -178,12 +178,13 @@ HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShader(LPDIRECT3DDEVICE9EX iface, ID
} }
wined3d_mutex_lock(); wined3d_mutex_lock();
hrc = IWineD3DDevice_GetPixelShader(This->WineD3DDevice, &object); hr = IWineD3DDevice_GetPixelShader(This->WineD3DDevice, &object);
if (SUCCEEDED(hrc)) if (SUCCEEDED(hr))
{ {
if (object) if (object)
{ {
hrc = IWineD3DPixelShader_GetParent(object, (IUnknown **)ppShader); *ppShader = IWineD3DPixelShader_GetParent(object);
IDirect3DPixelShader9_AddRef(*ppShader);
IWineD3DPixelShader_Release(object); IWineD3DPixelShader_Release(object);
} }
else else
...@@ -193,12 +194,12 @@ HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShader(LPDIRECT3DDEVICE9EX iface, ID ...@@ -193,12 +194,12 @@ HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShader(LPDIRECT3DDEVICE9EX iface, ID
} }
else else
{ {
WARN("(%p) : Call to IWineD3DDevice_GetPixelShader failed %u (device %p)\n", This, hrc, This->WineD3DDevice); WARN("Failed to get pixel shader, hr %#x.\n", hr);
} }
wined3d_mutex_unlock(); wined3d_mutex_unlock();
TRACE("(%p) : returning %p\n", This, *ppShader); TRACE("Returning %p.\n", *ppShader);
return hrc; return hr;
} }
HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantF(LPDIRECT3DDEVICE9EX iface, UINT Register, CONST float* pConstantData, UINT Vector4fCount) { HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantF(LPDIRECT3DDEVICE9EX iface, UINT Register, CONST float* pConstantData, UINT Vector4fCount) {
......
...@@ -403,9 +403,8 @@ HRESULT surface_init(IDirect3DSurface9Impl *surface, IDirect3DDevice9Impl *devic ...@@ -403,9 +403,8 @@ HRESULT surface_init(IDirect3DSurface9Impl *surface, IDirect3DDevice9Impl *devic
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_CreateSurface(device->WineD3DDevice, width, height, wined3dformat_from_d3dformat(format), hr = IWineD3DDevice_CreateSurface(device->WineD3DDevice, width, height, wined3dformat_from_d3dformat(format),
lockable, discard, level, &surface->wineD3DSurface, usage & WINED3DUSAGE_MASK, (WINED3DPOOL)pool, lockable, discard, level, usage & WINED3DUSAGE_MASK, (WINED3DPOOL)pool, multisample_type,
multisample_type, multisample_quality, SURFACE_OPENGL, (IUnknown *)surface, multisample_quality, SURFACE_OPENGL, surface, &d3d9_surface_wined3d_parent_ops, &surface->wineD3DSurface);
&d3d9_surface_wined3d_parent_ops);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
if (FAILED(hr)) if (FAILED(hr))
{ {
......
...@@ -106,24 +106,29 @@ static HRESULT WINAPI IDirect3DSwapChain9Impl_GetFrontBufferData(LPDIRECT3DSWAPC ...@@ -106,24 +106,29 @@ static HRESULT WINAPI IDirect3DSwapChain9Impl_GetFrontBufferData(LPDIRECT3DSWAPC
return hr; return hr;
} }
static HRESULT WINAPI IDirect3DSwapChain9Impl_GetBackBuffer(LPDIRECT3DSWAPCHAIN9 iface, UINT iBackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface9** ppBackBuffer) { static HRESULT WINAPI IDirect3DSwapChain9Impl_GetBackBuffer(IDirect3DSwapChain9 *iface,
UINT iBackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface9 **ppBackBuffer)
{
IDirect3DSwapChain9Impl *This = (IDirect3DSwapChain9Impl *)iface; IDirect3DSwapChain9Impl *This = (IDirect3DSwapChain9Impl *)iface;
HRESULT hrc = D3D_OK;
IWineD3DSurface *mySurface = NULL; IWineD3DSurface *mySurface = NULL;
HRESULT hr;
TRACE("iface %p, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n", TRACE("iface %p, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n",
iface, iBackBuffer, Type, ppBackBuffer); iface, iBackBuffer, Type, ppBackBuffer);
wined3d_mutex_lock(); wined3d_mutex_lock();
hrc = IWineD3DSwapChain_GetBackBuffer(This->wineD3DSwapChain, iBackBuffer, (WINED3DBACKBUFFER_TYPE) Type, &mySurface); hr = IWineD3DSwapChain_GetBackBuffer(This->wineD3DSwapChain, iBackBuffer,
if (hrc == D3D_OK && NULL != mySurface) { (WINED3DBACKBUFFER_TYPE)Type, &mySurface);
IWineD3DSurface_GetParent(mySurface, (IUnknown **)ppBackBuffer); if (SUCCEEDED(hr) && mySurface)
{
*ppBackBuffer = IWineD3DSurface_GetParent(mySurface);
IDirect3DSurface9_AddRef(*ppBackBuffer);
IWineD3DSurface_Release(mySurface); IWineD3DSurface_Release(mySurface);
} }
wined3d_mutex_unlock(); wined3d_mutex_unlock();
/* Do not touch the **ppBackBuffer pointer otherwise! (see device test) */ /* Do not touch the **ppBackBuffer pointer otherwise! (see device test) */
return hrc; return hr;
} }
static HRESULT WINAPI IDirect3DSwapChain9Impl_GetRasterStatus(LPDIRECT3DSWAPCHAIN9 iface, D3DRASTER_STATUS* pRasterStatus) { static HRESULT WINAPI IDirect3DSwapChain9Impl_GetRasterStatus(LPDIRECT3DSWAPCHAIN9 iface, D3DRASTER_STATUS* pRasterStatus) {
...@@ -239,7 +244,7 @@ HRESULT swapchain_init(IDirect3DSwapChain9Impl *swapchain, IDirect3DDevice9Impl ...@@ -239,7 +244,7 @@ HRESULT swapchain_init(IDirect3DSwapChain9Impl *swapchain, IDirect3DDevice9Impl
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_CreateSwapChain(device->WineD3DDevice, &wined3d_parameters, hr = IWineD3DDevice_CreateSwapChain(device->WineD3DDevice, &wined3d_parameters,
&swapchain->wineD3DSwapChain, (IUnknown *)swapchain, SURFACE_OPENGL); SURFACE_OPENGL, swapchain, &swapchain->wineD3DSwapChain);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
present_parameters->BackBufferWidth = wined3d_parameters.BackBufferWidth; present_parameters->BackBufferWidth = wined3d_parameters.BackBufferWidth;
...@@ -269,25 +274,31 @@ HRESULT swapchain_init(IDirect3DSwapChain9Impl *swapchain, IDirect3DDevice9Impl ...@@ -269,25 +274,31 @@ HRESULT swapchain_init(IDirect3DSwapChain9Impl *swapchain, IDirect3DDevice9Impl
return D3D_OK; return D3D_OK;
} }
HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_GetSwapChain(LPDIRECT3DDEVICE9EX iface, UINT iSwapChain, IDirect3DSwapChain9** pSwapChain) { HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_GetSwapChain(IDirect3DDevice9Ex *iface,
UINT iSwapChain, IDirect3DSwapChain9 **pSwapChain)
{
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
HRESULT hrc = D3D_OK;
IWineD3DSwapChain *swapchain = NULL; IWineD3DSwapChain *swapchain = NULL;
HRESULT hr;
TRACE("iface %p, swapchain_idx %u, swapchain %p.\n", TRACE("iface %p, swapchain_idx %u, swapchain %p.\n",
iface, iSwapChain, pSwapChain); iface, iSwapChain, pSwapChain);
wined3d_mutex_lock(); wined3d_mutex_lock();
hrc = IWineD3DDevice_GetSwapChain(This->WineD3DDevice, iSwapChain, &swapchain); hr = IWineD3DDevice_GetSwapChain(This->WineD3DDevice, iSwapChain, &swapchain);
if (hrc == D3D_OK && NULL != swapchain) { if (SUCCEEDED(hr) && swapchain)
IWineD3DSwapChain_GetParent(swapchain, (IUnknown **)pSwapChain); {
*pSwapChain = IWineD3DSwapChain_GetParent(swapchain);
IDirect3DSwapChain9_AddRef(*pSwapChain);
IWineD3DSwapChain_Release(swapchain); IWineD3DSwapChain_Release(swapchain);
} else { }
else
{
*pSwapChain = NULL; *pSwapChain = NULL;
} }
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hrc; return hr;
} }
UINT WINAPI IDirect3DDevice9Impl_GetNumberOfSwapChains(LPDIRECT3DDEVICE9EX iface) { UINT WINAPI IDirect3DDevice9Impl_GetNumberOfSwapChains(LPDIRECT3DDEVICE9EX iface) {
......
...@@ -289,22 +289,26 @@ static HRESULT WINAPI IDirect3DTexture9Impl_GetLevelDesc(LPDIRECT3DTEXTURE9 ifac ...@@ -289,22 +289,26 @@ static HRESULT WINAPI IDirect3DTexture9Impl_GetLevelDesc(LPDIRECT3DTEXTURE9 ifac
return hr; return hr;
} }
static HRESULT WINAPI IDirect3DTexture9Impl_GetSurfaceLevel(LPDIRECT3DTEXTURE9 iface, UINT Level, IDirect3DSurface9** ppSurfaceLevel) { static HRESULT WINAPI IDirect3DTexture9Impl_GetSurfaceLevel(IDirect3DTexture9 *iface,
UINT Level, IDirect3DSurface9 **ppSurfaceLevel)
{
IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface;
HRESULT hrc = D3D_OK;
IWineD3DSurface *mySurface = NULL; IWineD3DSurface *mySurface = NULL;
HRESULT hr;
TRACE("iface %p, level %u, surface %p.\n", iface, Level, ppSurfaceLevel); TRACE("iface %p, level %u, surface %p.\n", iface, Level, ppSurfaceLevel);
wined3d_mutex_lock(); wined3d_mutex_lock();
hrc = IWineD3DTexture_GetSurfaceLevel(This->wineD3DTexture, Level, &mySurface); hr = IWineD3DTexture_GetSurfaceLevel(This->wineD3DTexture, Level, &mySurface);
if (hrc == D3D_OK && NULL != ppSurfaceLevel) { if (SUCCEEDED(hr) && ppSurfaceLevel)
IWineD3DSurface_GetParent(mySurface, (IUnknown **)ppSurfaceLevel); {
IWineD3DSurface_Release(mySurface); *ppSurfaceLevel = IWineD3DSurface_GetParent(mySurface);
IDirect3DSurface9_AddRef(*ppSurfaceLevel);
IWineD3DSurface_Release(mySurface);
} }
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hrc; return hr;
} }
static HRESULT WINAPI IDirect3DTexture9Impl_LockRect(LPDIRECT3DTEXTURE9 iface, UINT Level, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) { static HRESULT WINAPI IDirect3DTexture9Impl_LockRect(LPDIRECT3DTEXTURE9 iface, UINT Level, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) {
...@@ -398,7 +402,7 @@ HRESULT texture_init(IDirect3DTexture9Impl *texture, IDirect3DDevice9Impl *devic ...@@ -398,7 +402,7 @@ HRESULT texture_init(IDirect3DTexture9Impl *texture, IDirect3DDevice9Impl *devic
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_CreateTexture(device->WineD3DDevice, width, height, levels, hr = IWineD3DDevice_CreateTexture(device->WineD3DDevice, width, height, levels,
usage & WINED3DUSAGE_MASK, wined3dformat_from_d3dformat(format), pool, usage & WINED3DUSAGE_MASK, wined3dformat_from_d3dformat(format), pool,
&texture->wineD3DTexture, (IUnknown *)texture, &d3d9_texture_wined3d_parent_ops); texture, &d3d9_texture_wined3d_parent_ops, &texture->wineD3DTexture);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
if (FAILED(hr)) if (FAILED(hr))
{ {
......
...@@ -272,9 +272,8 @@ HRESULT vertexbuffer_init(IDirect3DVertexBuffer9Impl *buffer, IDirect3DDevice9Im ...@@ -272,9 +272,8 @@ HRESULT vertexbuffer_init(IDirect3DVertexBuffer9Impl *buffer, IDirect3DDevice9Im
buffer->fvf = fvf; buffer->fvf = fvf;
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_CreateVertexBuffer(device->WineD3DDevice, size, hr = IWineD3DDevice_CreateVertexBuffer(device->WineD3DDevice, size, usage & WINED3DUSAGE_MASK,
usage & WINED3DUSAGE_MASK, (WINED3DPOOL)pool, &buffer->wineD3DVertexBuffer, (WINED3DPOOL)pool, buffer, &d3d9_vertexbuffer_wined3d_parent_ops, &buffer->wineD3DVertexBuffer);
(IUnknown *)buffer, &d3d9_vertexbuffer_wined3d_parent_ops);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
if (FAILED(hr)) if (FAILED(hr))
{ {
......
...@@ -395,9 +395,8 @@ HRESULT vertexdeclaration_init(IDirect3DVertexDeclaration9Impl *declaration, ...@@ -395,9 +395,8 @@ HRESULT vertexdeclaration_init(IDirect3DVertexDeclaration9Impl *declaration,
declaration->element_count = element_count; declaration->element_count = element_count;
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_CreateVertexDeclaration(device->WineD3DDevice, &declaration->wineD3DVertexDeclaration, hr = IWineD3DDevice_CreateVertexDeclaration(device->WineD3DDevice, wined3d_elements, wined3d_element_count,
(IUnknown *)declaration, &d3d9_vertexdeclaration_wined3d_parent_ops, declaration, &d3d9_vertexdeclaration_wined3d_parent_ops, &declaration->wineD3DVertexDeclaration);
wined3d_elements, wined3d_element_count);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
HeapFree(GetProcessHeap(), 0, wined3d_elements); HeapFree(GetProcessHeap(), 0, wined3d_elements);
if (FAILED(hr)) if (FAILED(hr))
...@@ -427,29 +426,31 @@ HRESULT WINAPI IDirect3DDevice9Impl_SetVertexDeclaration(LPDIRECT3DDEVICE9EX i ...@@ -427,29 +426,31 @@ HRESULT WINAPI IDirect3DDevice9Impl_SetVertexDeclaration(LPDIRECT3DDEVICE9EX i
return hr; return hr;
} }
HRESULT WINAPI IDirect3DDevice9Impl_GetVertexDeclaration(LPDIRECT3DDEVICE9EX iface, IDirect3DVertexDeclaration9** ppDecl) { HRESULT WINAPI IDirect3DDevice9Impl_GetVertexDeclaration(IDirect3DDevice9Ex *iface,
IDirect3DDevice9Impl* This = (IDirect3DDevice9Impl*) iface; IDirect3DVertexDeclaration9 **declaration)
IWineD3DVertexDeclaration* pTest = NULL; {
HRESULT hr = D3D_OK; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
IWineD3DVertexDeclaration *wined3d_declaration = NULL;
HRESULT hr;
TRACE("iface %p, declaration %p.\n", iface, ppDecl); TRACE("iface %p, declaration %p.\n", iface, declaration);
if (NULL == ppDecl) { if (!declaration) return D3DERR_INVALIDCALL;
return D3DERR_INVALIDCALL;
}
*ppDecl = NULL;
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_GetVertexDeclaration(This->WineD3DDevice, &pTest); hr = IWineD3DDevice_GetVertexDeclaration(This->WineD3DDevice, &wined3d_declaration);
if (hr == D3D_OK && NULL != pTest) { if (SUCCEEDED(hr) && wined3d_declaration)
IWineD3DVertexDeclaration_GetParent(pTest, (IUnknown **)ppDecl); {
IWineD3DVertexDeclaration_Release(pTest); *declaration = IWineD3DVertexDeclaration_GetParent(wined3d_declaration);
} else { IDirect3DVertexDeclaration9_AddRef(*declaration);
*ppDecl = NULL; IWineD3DVertexDeclaration_Release(wined3d_declaration);
}
else
{
*declaration = NULL;
} }
wined3d_mutex_unlock(); wined3d_mutex_unlock();
TRACE("(%p) : returning %p\n", This, *ppDecl); TRACE("Returning %p.\n", *declaration);
return hr; return hr;
} }
...@@ -136,9 +136,8 @@ HRESULT vertexshader_init(IDirect3DVertexShader9Impl *shader, IDirect3DDevice9Im ...@@ -136,9 +136,8 @@ HRESULT vertexshader_init(IDirect3DVertexShader9Impl *shader, IDirect3DDevice9Im
shader->lpVtbl = &Direct3DVertexShader9_Vtbl; shader->lpVtbl = &Direct3DVertexShader9_Vtbl;
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_CreateVertexShader(device->WineD3DDevice, byte_code, hr = IWineD3DDevice_CreateVertexShader(device->WineD3DDevice, byte_code, NULL,
NULL /* output signature */, &shader->wineD3DVertexShader, shader, &d3d9_vertexshader_wined3d_parent_ops, &shader->wineD3DVertexShader);
(IUnknown *)shader, &d3d9_vertexshader_wined3d_parent_ops);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
if (FAILED(hr)) if (FAILED(hr))
{ {
...@@ -166,20 +165,22 @@ HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShader(LPDIRECT3DDEVICE9EX iface, I ...@@ -166,20 +165,22 @@ HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShader(LPDIRECT3DDEVICE9EX iface, I
return hrc; return hrc;
} }
HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShader(LPDIRECT3DDEVICE9EX iface, IDirect3DVertexShader9** ppShader) { HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShader(LPDIRECT3DDEVICE9EX iface, IDirect3DVertexShader9 **ppShader)
{
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
IWineD3DVertexShader *pShader; IWineD3DVertexShader *pShader;
HRESULT hrc = D3D_OK; HRESULT hr;
TRACE("iface %p, shader %p.\n", iface, ppShader); TRACE("iface %p, shader %p.\n", iface, ppShader);
wined3d_mutex_lock(); wined3d_mutex_lock();
hrc = IWineD3DDevice_GetVertexShader(This->WineD3DDevice, &pShader); hr = IWineD3DDevice_GetVertexShader(This->WineD3DDevice, &pShader);
if (SUCCEEDED(hrc)) if (SUCCEEDED(hr))
{ {
if (pShader) if (pShader)
{ {
hrc = IWineD3DVertexShader_GetParent(pShader, (IUnknown **)ppShader); *ppShader = IWineD3DVertexShader_GetParent(pShader);
IDirect3DVertexShader9_AddRef(*ppShader);
IWineD3DVertexShader_Release(pShader); IWineD3DVertexShader_Release(pShader);
} }
else else
...@@ -189,12 +190,13 @@ HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShader(LPDIRECT3DDEVICE9EX iface, I ...@@ -189,12 +190,13 @@ HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShader(LPDIRECT3DDEVICE9EX iface, I
} }
else else
{ {
WARN("(%p) : Call to IWineD3DDevice_GetVertexShader failed %u (device %p)\n", This, hrc, This->WineD3DDevice); WARN("Failed to get vertex shader, hr %#x.\n", hr);
} }
wined3d_mutex_unlock(); wined3d_mutex_unlock();
TRACE("(%p) : returning %p\n", This, *ppShader); TRACE("Returning %p.\n", *ppShader);
return hrc;
return hr;
} }
HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantF(LPDIRECT3DDEVICE9EX iface, UINT Register, CONST float* pConstantData, UINT Vector4fCount) { HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantF(LPDIRECT3DDEVICE9EX iface, UINT Register, CONST float* pConstantData, UINT Vector4fCount) {
......
...@@ -275,7 +275,7 @@ HRESULT volume_init(IDirect3DVolume9Impl *volume, IDirect3DDevice9Impl *device, ...@@ -275,7 +275,7 @@ HRESULT volume_init(IDirect3DVolume9Impl *volume, IDirect3DDevice9Impl *device,
volume->ref = 1; volume->ref = 1;
hr = IWineD3DDevice_CreateVolume(device->WineD3DDevice, width, height, depth, usage & WINED3DUSAGE_MASK, hr = IWineD3DDevice_CreateVolume(device->WineD3DDevice, width, height, depth, usage & WINED3DUSAGE_MASK,
format, pool, &volume->wineD3DVolume, (IUnknown *)volume, &d3d9_volume_wined3d_parent_ops); format, pool, volume, &d3d9_volume_wined3d_parent_ops, &volume->wineD3DVolume);
if (FAILED(hr)) if (FAILED(hr))
{ {
WARN("Failed to create wined3d volume, hr %#x.\n", hr); WARN("Failed to create wined3d volume, hr %#x.\n", hr);
......
...@@ -315,24 +315,28 @@ static HRESULT WINAPI IDirect3DVolumeTexture9Impl_GetLevelDesc(LPDIRECT3DVOLUMET ...@@ -315,24 +315,28 @@ static HRESULT WINAPI IDirect3DVolumeTexture9Impl_GetLevelDesc(LPDIRECT3DVOLUMET
return hr; return hr;
} }
static HRESULT WINAPI IDirect3DVolumeTexture9Impl_GetVolumeLevel(LPDIRECT3DVOLUMETEXTURE9 iface, UINT Level, IDirect3DVolume9** ppVolumeLevel) { static HRESULT WINAPI IDirect3DVolumeTexture9Impl_GetVolumeLevel(IDirect3DVolumeTexture9 *iface,
UINT Level, IDirect3DVolume9 **ppVolumeLevel)
{
IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface;
HRESULT hrc = D3D_OK;
IWineD3DVolume *myVolume = NULL; IWineD3DVolume *myVolume = NULL;
HRESULT hr;
TRACE("iface %p, level %u, volume %p.\n", iface, Level, ppVolumeLevel); TRACE("iface %p, level %u, volume %p.\n", iface, Level, ppVolumeLevel);
wined3d_mutex_lock(); wined3d_mutex_lock();
hrc = IWineD3DVolumeTexture_GetVolumeLevel(This->wineD3DVolumeTexture, Level, &myVolume); hr = IWineD3DVolumeTexture_GetVolumeLevel(This->wineD3DVolumeTexture, Level, &myVolume);
if (hrc == D3D_OK && NULL != ppVolumeLevel) { if (SUCCEEDED(hr) && ppVolumeLevel)
IWineD3DVolumeTexture_GetParent(myVolume, (IUnknown **)ppVolumeLevel); {
*ppVolumeLevel = IWineD3DVolumeTexture_GetParent(myVolume);
IDirect3DVolumeTexture9_AddRef(*ppVolumeLevel);
IWineD3DVolumeTexture_Release(myVolume); IWineD3DVolumeTexture_Release(myVolume);
} }
wined3d_mutex_unlock(); wined3d_mutex_unlock();
return hrc; return hr;
} }
static HRESULT WINAPI IDirect3DVolumeTexture9Impl_LockBox(LPDIRECT3DVOLUMETEXTURE9 iface, UINT Level, D3DLOCKED_BOX* pLockedVolume, CONST D3DBOX* pBox, DWORD Flags) { static HRESULT WINAPI IDirect3DVolumeTexture9Impl_LockBox(LPDIRECT3DVOLUMETEXTURE9 iface, UINT Level, D3DLOCKED_BOX* pLockedVolume, CONST D3DBOX* pBox, DWORD Flags) {
...@@ -433,8 +437,8 @@ HRESULT volumetexture_init(IDirect3DVolumeTexture9Impl *texture, IDirect3DDevice ...@@ -433,8 +437,8 @@ HRESULT volumetexture_init(IDirect3DVolumeTexture9Impl *texture, IDirect3DDevice
wined3d_mutex_lock(); wined3d_mutex_lock();
hr = IWineD3DDevice_CreateVolumeTexture(device->WineD3DDevice, width, height, depth, levels, hr = IWineD3DDevice_CreateVolumeTexture(device->WineD3DDevice, width, height, depth, levels,
usage & WINED3DUSAGE_MASK, wined3dformat_from_d3dformat(format), pool, usage & WINED3DUSAGE_MASK, wined3dformat_from_d3dformat(format), pool, texture,
&texture->wineD3DVolumeTexture, (IUnknown *)texture, &d3d9_volumetexture_wined3d_parent_ops); &d3d9_volumetexture_wined3d_parent_ops, &texture->wineD3DVolumeTexture);
wined3d_mutex_unlock(); wined3d_mutex_unlock();
if (FAILED(hr)) if (FAILED(hr))
{ {
......
...@@ -1836,13 +1836,9 @@ static HRESULT WINAPI ddraw7_GetGDISurface(IDirectDraw7 *iface, IDirectDrawSurfa ...@@ -1836,13 +1836,9 @@ static HRESULT WINAPI ddraw7_GetGDISurface(IDirectDraw7 *iface, IDirectDrawSurfa
return DDERR_NOTFOUND; return DDERR_NOTFOUND;
} }
/* GetBackBuffer AddRef()ed the surface, release it */ ddsurf = IWineD3DSurface_GetParent(Surf);
IWineD3DSurface_Release(Surf); IWineD3DSurface_Release(Surf);
IWineD3DSurface_GetParent(Surf,
(IUnknown **) &ddsurf);
IDirectDrawSurface7_Release(ddsurf); /* For the GetParent */
/* Find the front buffer */ /* Find the front buffer */
ddsCaps.dwCaps = DDSCAPS_FRONTBUFFER; ddsCaps.dwCaps = DDSCAPS_FRONTBUFFER;
hr = IDirectDrawSurface7_GetAttachedSurface(ddsurf, hr = IDirectDrawSurface7_GetAttachedSurface(ddsurf,
...@@ -2249,7 +2245,8 @@ static HRESULT WINAPI ddraw7_GetSurfaceFromDC(IDirectDraw7 *iface, HDC hdc, IDir ...@@ -2249,7 +2245,8 @@ static HRESULT WINAPI ddraw7_GetSurfaceFromDC(IDirectDraw7 *iface, HDC hdc, IDir
return DDERR_NOTFOUND; return DDERR_NOTFOUND;
} }
IWineD3DSurface_GetParent(wined3d_surface, (IUnknown **)Surface); *Surface = IWineD3DSurface_GetParent(wined3d_surface);
IDirectDrawSurface7_AddRef(*Surface);
TRACE("Returning surface %p.\n", Surface); TRACE("Returning surface %p.\n", Surface);
return DD_OK; return DD_OK;
} }
...@@ -2359,9 +2356,9 @@ HRESULT WINAPI ddraw_recreate_surfaces_cb(IDirectDrawSurface7 *surf, DDSURFACEDE ...@@ -2359,9 +2356,9 @@ HRESULT WINAPI ddraw_recreate_surfaces_cb(IDirectDrawSurface7 *surf, DDSURFACEDE
{ {
IDirectDrawSurfaceImpl *surfImpl = (IDirectDrawSurfaceImpl *)surf; IDirectDrawSurfaceImpl *surfImpl = (IDirectDrawSurfaceImpl *)surf;
IDirectDrawImpl *This = surfImpl->ddraw; IDirectDrawImpl *This = surfImpl->ddraw;
IUnknown *Parent;
IWineD3DSurface *wineD3DSurface; IWineD3DSurface *wineD3DSurface;
IWineD3DSwapChain *swapchain; IWineD3DSwapChain *swapchain;
void *parent;
HRESULT hr; HRESULT hr;
IWineD3DClipper *clipper = NULL; IWineD3DClipper *clipper = NULL;
...@@ -2403,13 +2400,10 @@ HRESULT WINAPI ddraw_recreate_surfaces_cb(IDirectDrawSurface7 *surf, DDSURFACEDE ...@@ -2403,13 +2400,10 @@ HRESULT WINAPI ddraw_recreate_surfaces_cb(IDirectDrawSurface7 *surf, DDSURFACEDE
Width = Desc.width; Width = Desc.width;
Height = Desc.height; Height = Desc.height;
IWineD3DSurface_GetParent(wineD3DSurface, &Parent); parent = IWineD3DSurface_GetParent(wineD3DSurface);
hr = IWineD3DDevice_CreateSurface(This->wineD3DDevice, Width, Height, Format, TRUE /* Lockable */,
/* Create the new surface */ FALSE /* Discard */, surfImpl->mipmap_level, Usage, Pool, MultiSampleType, MultiSampleQuality,
hr = IWineD3DDevice_CreateSurface(This->wineD3DDevice, Width, Height, Format, This->ImplType, parent, &ddraw_null_wined3d_parent_ops, &surfImpl->WineD3DSurface);
TRUE /* Lockable */, FALSE /* Discard */, surfImpl->mipmap_level, &surfImpl->WineD3DSurface, Usage, Pool,
MultiSampleType, MultiSampleQuality, This->ImplType, Parent, &ddraw_null_wined3d_parent_ops);
IUnknown_Release(Parent);
if (FAILED(hr)) if (FAILED(hr))
{ {
surfImpl->WineD3DSurface = wineD3DSurface; surfImpl->WineD3DSurface = wineD3DSurface;
...@@ -2475,13 +2469,13 @@ static HRESULT ddraw_recreate_surfaces(IDirectDrawImpl *This) ...@@ -2475,13 +2469,13 @@ static HRESULT ddraw_recreate_surfaces(IDirectDrawImpl *This)
return IDirectDraw7_EnumSurfaces((IDirectDraw7 *)This, 0, &desc, This, ddraw_recreate_surfaces_cb); return IDirectDraw7_EnumSurfaces((IDirectDraw7 *)This, 0, &desc, This, ddraw_recreate_surfaces_cb);
} }
ULONG WINAPI D3D7CB_DestroySwapChain(IWineD3DSwapChain *pSwapChain) { ULONG WINAPI D3D7CB_DestroySwapChain(IWineD3DSwapChain *pSwapChain)
IUnknown* swapChainParent; {
IUnknown *swapChainParent;
TRACE("swapchain %p.\n", pSwapChain); TRACE("swapchain %p.\n", pSwapChain);
IWineD3DSwapChain_GetParent(pSwapChain, &swapChainParent); swapChainParent = IWineD3DSwapChain_GetParent(pSwapChain);
IUnknown_Release(swapChainParent);
return IUnknown_Release(swapChainParent); return IUnknown_Release(swapChainParent);
} }
...@@ -3295,15 +3289,15 @@ static HRESULT WINAPI ddraw7_CreateSurface(IDirectDraw7 *iface, ...@@ -3295,15 +3289,15 @@ static HRESULT WINAPI ddraw7_CreateSurface(IDirectDraw7 *iface,
*/ */
if(desc2.ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP) if(desc2.ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP)
{ {
hr = IWineD3DDevice_CreateCubeTexture(This->wineD3DDevice, DDSD->dwWidth /* Edgelength */, hr = IWineD3DDevice_CreateCubeTexture(This->wineD3DDevice, DDSD->dwWidth /* Edgelength */, levels,
levels, 0 /* usage */, Format, Pool, (IWineD3DCubeTexture **)&object->wineD3DTexture, 0 /* usage */, Format, Pool, object, &ddraw_null_wined3d_parent_ops,
(IUnknown *)object, &ddraw_null_wined3d_parent_ops); (IWineD3DCubeTexture **)&object->wineD3DTexture);
} }
else else
{ {
hr = IWineD3DDevice_CreateTexture(This->wineD3DDevice, DDSD->dwWidth, DDSD->dwHeight, levels, hr = IWineD3DDevice_CreateTexture(This->wineD3DDevice, DDSD->dwWidth, DDSD->dwHeight, levels,
0 /* usage */, Format, Pool, (IWineD3DTexture **)&object->wineD3DTexture, 0 /* usage */, Format, Pool, object, &ddraw_null_wined3d_parent_ops,
(IUnknown *)object, &ddraw_null_wined3d_parent_ops); (IWineD3DTexture **)&object->wineD3DTexture);
} }
This->tex_root = NULL; This->tex_root = NULL;
} }
...@@ -5375,8 +5369,8 @@ IWineD3DVertexDeclaration *ddraw_find_decl(IDirectDrawImpl *This, DWORD fvf) ...@@ -5375,8 +5369,8 @@ IWineD3DVertexDeclaration *ddraw_find_decl(IDirectDrawImpl *This, DWORD fvf)
} }
TRACE("not found. Creating and inserting at position %d.\n", low); TRACE("not found. Creating and inserting at position %d.\n", low);
hr = IWineD3DDevice_CreateVertexDeclarationFromFVF(This->wineD3DDevice, &pDecl, hr = IWineD3DDevice_CreateVertexDeclarationFromFVF(This->wineD3DDevice,
(IUnknown *)This, &ddraw_null_wined3d_parent_ops, fvf); fvf, This, &ddraw_null_wined3d_parent_ops, &pDecl);
if (hr != S_OK) return NULL; if (hr != S_OK) return NULL;
if(This->declArraySize == This->numConvertedDecls) { if(This->declArraySize == This->numConvertedDecls) {
...@@ -5644,7 +5638,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDevicePar ...@@ -5644,7 +5638,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDevicePar
ddraw_parent_init(object); ddraw_parent_init(object);
hr = IWineD3DDevice_CreateSwapChain(This->wineD3DDevice, present_parameters, hr = IWineD3DDevice_CreateSwapChain(This->wineD3DDevice, present_parameters,
swapchain, (IUnknown *)object, This->ImplType); This->ImplType, object, swapchain);
if (FAILED(hr)) if (FAILED(hr))
{ {
FIXME("(%p) CreateSwapChain failed, returning %#x\n", iface, hr); FIXME("(%p) CreateSwapChain failed, returning %#x\n", iface, hr);
......
...@@ -300,10 +300,8 @@ IDirect3DDeviceImpl_7_Release(IDirect3DDevice7 *iface) ...@@ -300,10 +300,8 @@ IDirect3DDeviceImpl_7_Release(IDirect3DDevice7 *iface)
EnterCriticalSection(&ddraw_cs); EnterCriticalSection(&ddraw_cs);
/* Free the index buffer. */ /* Free the index buffer. */
IWineD3DDevice_SetIndexBuffer(This->wineD3DDevice, NULL, WINED3DFMT_UNKNOWN); IWineD3DDevice_SetIndexBuffer(This->wineD3DDevice, NULL, WINED3DFMT_UNKNOWN);
IWineD3DBuffer_GetParent(This->indexbuffer, IndexBufferParent = IWineD3DBuffer_GetParent(This->indexbuffer);
(IUnknown **) &IndexBufferParent); if (IParent_Release(IndexBufferParent))
IParent_Release(IndexBufferParent); /* Once for the getParent */
if( IParent_Release(IndexBufferParent) != 0) /* And now to destroy it */
{ {
ERR(" (%p) Something is still holding the index buffer parent %p\n", This, IndexBufferParent); ERR(" (%p) Something is still holding the index buffer parent %p\n", This, IndexBufferParent);
} }
...@@ -2556,24 +2554,13 @@ IDirect3DDeviceImpl_3_GetRenderState(IDirect3DDevice3 *iface, ...@@ -2556,24 +2554,13 @@ IDirect3DDeviceImpl_3_GetRenderState(IDirect3DDevice3 *iface,
EnterCriticalSection(&ddraw_cs); EnterCriticalSection(&ddraw_cs);
hr = IWineD3DDevice_GetTexture(This->wineD3DDevice, hr = IWineD3DDevice_GetTexture(This->wineD3DDevice, 0, &tex);
0, if (SUCCEEDED(hr) && tex)
&tex);
if(hr == WINED3D_OK && tex)
{ {
IDirectDrawSurface7 *parent = NULL; /* The parent of the texture is the IDirectDrawSurface7
hr = IWineD3DBaseTexture_GetParent(tex, * interface of the ddraw surface. */
(IUnknown **) &parent); IDirectDrawSurfaceImpl *parent = IWineD3DBaseTexture_GetParent(tex);
if(parent) if (parent) *lpdwRenderState = parent->Handle;
{
/* The parent of the texture is the IDirectDrawSurface7 interface
* of the ddraw surface
*/
IDirectDrawSurfaceImpl *texImpl = (IDirectDrawSurfaceImpl *)parent;
*lpdwRenderState = texImpl->Handle;
IDirectDrawSurface7_Release(parent);
}
IWineD3DBaseTexture_Release(tex); IWineD3DBaseTexture_Release(tex);
} }
...@@ -4353,18 +4340,16 @@ IDirect3DDeviceImpl_7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface, ...@@ -4353,18 +4340,16 @@ IDirect3DDeviceImpl_7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface,
{ {
UINT size = max(desc.Size * 2, IndexCount * sizeof(WORD)); UINT size = max(desc.Size * 2, IndexCount * sizeof(WORD));
IWineD3DBuffer *buffer; IWineD3DBuffer *buffer;
IUnknown *parent; IParentImpl *parent;
TRACE("Growing index buffer to %u bytes\n", size); TRACE("Growing index buffer to %u bytes\n", size);
IWineD3DBuffer_GetParent(This->indexbuffer, &parent); parent = IWineD3DBuffer_GetParent(This->indexbuffer);
hr = IWineD3DDevice_CreateIndexBuffer(This->wineD3DDevice, size, hr = IWineD3DDevice_CreateIndexBuffer(This->wineD3DDevice, size, WINED3DUSAGE_DYNAMIC /* Usage */,
WINED3DUSAGE_DYNAMIC /* Usage */, WINED3DPOOL_DEFAULT, &buffer, parent, WINED3DPOOL_DEFAULT, parent, &ddraw_null_wined3d_parent_ops, &buffer);
&ddraw_null_wined3d_parent_ops); if (FAILED(hr))
if(hr != D3D_OK)
{ {
ERR("(%p) IWineD3DDevice::CreateIndexBuffer failed with hr = %08x\n", This, hr); ERR("(%p) IWineD3DDevice::CreateIndexBuffer failed with hr = %08x\n", This, hr);
IParent_Release(parent);
LeaveCriticalSection(&ddraw_cs); LeaveCriticalSection(&ddraw_cs);
return hr; return hr;
} }
...@@ -4372,8 +4357,7 @@ IDirect3DDeviceImpl_7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface, ...@@ -4372,8 +4357,7 @@ IDirect3DDeviceImpl_7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface,
IWineD3DBuffer_Release(This->indexbuffer); IWineD3DBuffer_Release(This->indexbuffer);
This->indexbuffer = buffer; This->indexbuffer = buffer;
((IParentImpl *)parent)->child = (IUnknown *)buffer; parent->child = (IUnknown *)buffer;
IParent_Release(parent);
} }
/* copy the index stream into the index buffer. /* copy the index stream into the index buffer.
...@@ -4649,11 +4633,8 @@ IDirect3DDeviceImpl_7_GetTexture(IDirect3DDevice7 *iface, ...@@ -4649,11 +4633,8 @@ IDirect3DDeviceImpl_7_GetTexture(IDirect3DDevice7 *iface,
return hr; return hr;
} }
/* GetParent AddRef()s, which is perfectly OK. *Texture = IWineD3DBaseTexture_GetParent(Surf);
* We have passed the IDirectDrawSurface7 interface to WineD3D, so that's OK too. IDirectDrawSurface7_AddRef(*Texture);
*/
hr = IWineD3DBaseTexture_GetParent(Surf,
(IUnknown **) Texture);
LeaveCriticalSection(&ddraw_cs); LeaveCriticalSection(&ddraw_cs);
return hr; return hr;
} }
...@@ -7014,8 +6995,8 @@ HRESULT d3d_device_init(IDirect3DDeviceImpl *device, IDirectDrawImpl *ddraw, IDi ...@@ -7014,8 +6995,8 @@ HRESULT d3d_device_init(IDirect3DDeviceImpl *device, IDirectDrawImpl *ddraw, IDi
ddraw_parent_init(index_buffer_parent); ddraw_parent_init(index_buffer_parent);
hr = IWineD3DDevice_CreateIndexBuffer(ddraw->wineD3DDevice, 0x40000 /* Length. Don't know how long it should be */, hr = IWineD3DDevice_CreateIndexBuffer(ddraw->wineD3DDevice, 0x40000 /* Length. Don't know how long it should be */,
WINED3DUSAGE_DYNAMIC /* Usage */, WINED3DPOOL_DEFAULT, &device->indexbuffer, WINED3DUSAGE_DYNAMIC /* Usage */, WINED3DPOOL_DEFAULT, index_buffer_parent,
(IUnknown *)index_buffer_parent, &ddraw_null_wined3d_parent_ops); &ddraw_null_wined3d_parent_ops, &device->indexbuffer);
if (FAILED(hr)) if (FAILED(hr))
{ {
ERR("Failed to create an index buffer, hr %#x.\n", hr); ERR("Failed to create an index buffer, hr %#x.\n", hr);
......
...@@ -268,7 +268,7 @@ HRESULT ddraw_palette_init(IDirectDrawPaletteImpl *palette, ...@@ -268,7 +268,7 @@ HRESULT ddraw_palette_init(IDirectDrawPaletteImpl *palette,
palette->ref = 1; palette->ref = 1;
hr = IWineD3DDevice_CreatePalette(ddraw->wineD3DDevice, flags, hr = IWineD3DDevice_CreatePalette(ddraw->wineD3DDevice, flags,
entries, &palette->wineD3DPalette, (IUnknown *)palette); entries, palette, &palette->wineD3DPalette);
if (FAILED(hr)) if (FAILED(hr))
{ {
WARN("Failed to create wined3d palette, hr %#x.\n", hr); WARN("Failed to create wined3d palette, hr %#x.\n", hr);
......
...@@ -2742,7 +2742,8 @@ static HRESULT WINAPI ddraw_surface7_GetPalette(IDirectDrawSurface7 *iface, IDir ...@@ -2742,7 +2742,8 @@ static HRESULT WINAPI ddraw_surface7_GetPalette(IDirectDrawSurface7 *iface, IDir
if(wPal) if(wPal)
{ {
hr = IWineD3DPalette_GetParent(wPal, (IUnknown **) Pal); *Pal = IWineD3DPalette_GetParent(wPal);
IDirectDrawPalette_AddRef(*Pal);
} }
else else
{ {
...@@ -3251,16 +3252,7 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu ...@@ -3251,16 +3252,7 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu
LeaveCriticalSection(&ddraw_cs); LeaveCriticalSection(&ddraw_cs);
return D3DERR_TEXTURE_LOAD_FAILED; return D3DERR_TEXTURE_LOAD_FAILED;
} }
if (wined3d_dst_pal) if (wined3d_dst_pal) dst_pal = IWineD3DPalette_GetParent(wined3d_dst_pal);
{
hr = IWineD3DPalette_GetParent(wined3d_dst_pal, (IUnknown **)&dst_pal);
if (FAILED(hr))
{
ERR("Failed to get destination palette parent, hr %#x.\n", hr);
LeaveCriticalSection(&ddraw_cs);
return D3DERR_TEXTURE_LOAD_FAILED;
}
}
hr = IWineD3DSurface_GetPalette(src_surface->WineD3DSurface, &wined3d_src_pal); hr = IWineD3DSurface_GetPalette(src_surface->WineD3DSurface, &wined3d_src_pal);
if (FAILED(hr)) if (FAILED(hr))
...@@ -3269,17 +3261,7 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu ...@@ -3269,17 +3261,7 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu
LeaveCriticalSection(&ddraw_cs); LeaveCriticalSection(&ddraw_cs);
return D3DERR_TEXTURE_LOAD_FAILED; return D3DERR_TEXTURE_LOAD_FAILED;
} }
if (wined3d_src_pal) if (wined3d_src_pal) src_pal = IWineD3DPalette_GetParent(wined3d_src_pal);
{
hr = IWineD3DPalette_GetParent(wined3d_src_pal, (IUnknown **)&src_pal);
if (FAILED(hr))
{
ERR("Failed to get source palette parent, hr %#x.\n", hr);
if (dst_pal) IDirectDrawPalette_Release(dst_pal);
LeaveCriticalSection(&ddraw_cs);
return D3DERR_TEXTURE_LOAD_FAILED;
}
}
if (src_pal) if (src_pal)
{ {
...@@ -3287,7 +3269,6 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu ...@@ -3287,7 +3269,6 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu
if (!dst_pal) if (!dst_pal)
{ {
IDirectDrawPalette_Release(src_pal);
LeaveCriticalSection(&ddraw_cs); LeaveCriticalSection(&ddraw_cs);
return DDERR_NOPALETTEATTACHED; return DDERR_NOPALETTEATTACHED;
} }
...@@ -3295,9 +3276,6 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu ...@@ -3295,9 +3276,6 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu
IDirectDrawPalette_SetEntries(dst_pal, 0, 0, 256, palent); IDirectDrawPalette_SetEntries(dst_pal, 0, 0, 256, palent);
} }
if (dst_pal) IDirectDrawPalette_Release(dst_pal);
if (src_pal) IDirectDrawPalette_Release(src_pal);
/* Copy one surface on the other */ /* Copy one surface on the other */
dst_desc = (DDSURFACEDESC *)&(dst_surface->surface_desc); dst_desc = (DDSURFACEDESC *)&(dst_surface->surface_desc);
src_desc = (DDSURFACEDESC *)&(src_surface->surface_desc); src_desc = (DDSURFACEDESC *)&(src_surface->surface_desc);
...@@ -3600,9 +3578,9 @@ HRESULT ddraw_surface_init(IDirectDrawSurfaceImpl *surface, IDirectDrawImpl *ddr ...@@ -3600,9 +3578,9 @@ HRESULT ddraw_surface_init(IDirectDrawSurfaceImpl *surface, IDirectDrawImpl *ddr
surface->ImplType = surface_type; surface->ImplType = surface_type;
hr = IWineD3DDevice_CreateSurface(ddraw->wineD3DDevice, desc->dwWidth, desc->dwHeight, format, hr = IWineD3DDevice_CreateSurface(ddraw->wineD3DDevice, desc->dwWidth, desc->dwHeight, format,
TRUE /* Lockable */, FALSE /* Discard */, mip_level, &surface->WineD3DSurface, TRUE /* Lockable */, FALSE /* Discard */, mip_level, usage, pool,
usage, pool, WINED3DMULTISAMPLE_NONE, 0 /* MultiSampleQuality */, surface_type, WINED3DMULTISAMPLE_NONE, 0 /* MultiSampleQuality */, surface_type, surface,
(IUnknown *)surface, &ddraw_null_wined3d_parent_ops); &ddraw_null_wined3d_parent_ops, &surface->WineD3DSurface);
if (FAILED(hr)) if (FAILED(hr))
{ {
WARN("Failed to create wined3d surface, hr %#x.\n", hr); WARN("Failed to create wined3d surface, hr %#x.\n", hr);
......
...@@ -605,7 +605,7 @@ HRESULT d3d_vertex_buffer_init(IDirect3DVertexBufferImpl *buffer, ...@@ -605,7 +605,7 @@ HRESULT d3d_vertex_buffer_init(IDirect3DVertexBufferImpl *buffer,
hr = IWineD3DDevice_CreateVertexBuffer(ddraw->wineD3DDevice, hr = IWineD3DDevice_CreateVertexBuffer(ddraw->wineD3DDevice,
get_flexible_vertex_size(desc->dwFVF) * desc->dwNumVertices, get_flexible_vertex_size(desc->dwFVF) * desc->dwNumVertices,
usage, desc->dwCaps & D3DVBCAPS_SYSTEMMEMORY ? WINED3DPOOL_SYSTEMMEM : WINED3DPOOL_DEFAULT, usage, desc->dwCaps & D3DVBCAPS_SYSTEMMEMORY ? WINED3DPOOL_SYSTEMMEM : WINED3DPOOL_DEFAULT,
&buffer->wineD3DVertexBuffer, (IUnknown *)buffer, &ddraw_null_wined3d_parent_ops); buffer, &ddraw_null_wined3d_parent_ops, &buffer->wineD3DVertexBuffer);
if (FAILED(hr)) if (FAILED(hr))
{ {
WARN("Failed to create wined3d vertex buffer, hr %#x.\n", hr); WARN("Failed to create wined3d vertex buffer, hr %#x.\n", hr);
......
...@@ -190,16 +190,9 @@ static HRESULT STDMETHODCALLTYPE dxgi_device_CreateSurface(IWineDXGIDevice *ifac ...@@ -190,16 +190,9 @@ static HRESULT STDMETHODCALLTYPE dxgi_device_CreateSurface(IWineDXGIDevice *ifac
goto fail; goto fail;
} }
hr = IWineD3DSurface_GetParent(wined3d_surface, &parent); parent = IWineD3DSurface_GetParent(wined3d_surface);
IWineD3DSurface_Release(wined3d_surface);
if (FAILED(hr))
{
ERR("GetParent failed, returning %#x\n", hr);
goto fail;
}
hr = IUnknown_QueryInterface(parent, &IID_IDXGISurface, (void **)&surface[i]); hr = IUnknown_QueryInterface(parent, &IID_IDXGISurface, (void **)&surface[i]);
IUnknown_Release(parent); IWineD3DSurface_Release(wined3d_surface);
if (FAILED(hr)) if (FAILED(hr))
{ {
ERR("Surface should implement IDXGISurface\n"); ERR("Surface should implement IDXGISurface\n");
......
...@@ -235,17 +235,11 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSwapChain(IWineDXGIFactory * ...@@ -235,17 +235,11 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSwapChain(IWineDXGIFactory *
return hr; return hr;
} }
hr = IWineD3DSwapChain_GetParent(wined3d_swapchain, (IUnknown **)swapchain); swapchain = IWineD3DSwapChain_GetParent(wined3d_swapchain);
IUnknown_Release(wined3d_swapchain); IUnknown_Release(wined3d_swapchain);
if (FAILED(hr))
{
WARN("Failed to get swapchain, returning %#x\n", hr);
return hr;
}
/* FIXME? The swapchain is created with refcount 1 by the wined3d device, /* FIXME? The swapchain is created with refcount 1 by the wined3d device,
* but the wined3d device can't hold a real reference. */ * but the wined3d device can't hold a real reference. */
IUnknown_Release(*swapchain);
TRACE("Created IDXGISwapChain %p\n", *swapchain); TRACE("Created IDXGISwapChain %p\n", *swapchain);
......
...@@ -174,16 +174,10 @@ static HRESULT STDMETHODCALLTYPE dxgi_swapchain_GetBuffer(IDXGISwapChain *iface, ...@@ -174,16 +174,10 @@ static HRESULT STDMETHODCALLTYPE dxgi_swapchain_GetBuffer(IDXGISwapChain *iface,
return hr; return hr;
} }
hr = IWineD3DSurface_GetParent(backbuffer, &parent); parent = IWineD3DSurface_GetParent(backbuffer);
hr = IUnknown_QueryInterface(parent, riid, surface);
IWineD3DSurface_Release(backbuffer); IWineD3DSurface_Release(backbuffer);
LeaveCriticalSection(&dxgi_cs); LeaveCriticalSection(&dxgi_cs);
if (FAILED(hr))
{
return hr;
}
hr = IUnknown_QueryInterface(parent, riid, surface);
IUnknown_Release(parent);
return hr; return hr;
} }
...@@ -284,7 +278,7 @@ HRESULT dxgi_swapchain_init(struct dxgi_swapchain *swapchain, struct dxgi_device ...@@ -284,7 +278,7 @@ HRESULT dxgi_swapchain_init(struct dxgi_swapchain *swapchain, struct dxgi_device
swapchain->refcount = 1; swapchain->refcount = 1;
hr = IWineD3DDevice_CreateSwapChain(device->wined3d_device, present_parameters, hr = IWineD3DDevice_CreateSwapChain(device->wined3d_device, present_parameters,
&swapchain->wined3d_swapchain, (IUnknown *)swapchain, SURFACE_OPENGL); SURFACE_OPENGL, swapchain, &swapchain->wined3d_swapchain);
if (FAILED(hr)) if (FAILED(hr))
{ {
WARN("Failed to create wined3d swapchain, hr %#x.\n", hr); WARN("Failed to create wined3d swapchain, hr %#x.\n", hr);
......
...@@ -29,7 +29,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_texture); ...@@ -29,7 +29,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_texture);
HRESULT basetexture_init(IWineD3DBaseTextureImpl *texture, UINT layer_count, UINT level_count, HRESULT basetexture_init(IWineD3DBaseTextureImpl *texture, UINT layer_count, UINT level_count,
WINED3DRESOURCETYPE resource_type, IWineD3DDeviceImpl *device, UINT size, DWORD usage, WINED3DRESOURCETYPE resource_type, IWineD3DDeviceImpl *device, UINT size, DWORD usage,
const struct wined3d_format *format, WINED3DPOOL pool, IUnknown *parent, const struct wined3d_format *format, WINED3DPOOL pool, void *parent,
const struct wined3d_parent_ops *parent_ops) const struct wined3d_parent_ops *parent_ops)
{ {
HRESULT hr; HRESULT hr;
......
...@@ -744,10 +744,11 @@ static ULONG STDMETHODCALLTYPE buffer_Release(IWineD3DBuffer *iface) ...@@ -744,10 +744,11 @@ static ULONG STDMETHODCALLTYPE buffer_Release(IWineD3DBuffer *iface)
} }
/* IWineD3DBase methods */ /* IWineD3DBase methods */
static void * STDMETHODCALLTYPE buffer_GetParent(IWineD3DBuffer *iface)
static HRESULT STDMETHODCALLTYPE buffer_GetParent(IWineD3DBuffer *iface, IUnknown **parent)
{ {
return resource_get_parent((IWineD3DResource *)iface, parent); TRACE("iface %p.\n", iface);
return ((struct wined3d_buffer *)iface)->resource.parent;
} }
/* IWineD3DResource methods */ /* IWineD3DResource methods */
...@@ -1448,7 +1449,7 @@ static const struct IWineD3DBufferVtbl wined3d_buffer_vtbl = ...@@ -1448,7 +1449,7 @@ static const struct IWineD3DBufferVtbl wined3d_buffer_vtbl =
HRESULT buffer_init(struct wined3d_buffer *buffer, IWineD3DDeviceImpl *device, HRESULT buffer_init(struct wined3d_buffer *buffer, IWineD3DDeviceImpl *device,
UINT size, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool, GLenum bind_hint, UINT size, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool, GLenum bind_hint,
const char *data, IUnknown *parent, const struct wined3d_parent_ops *parent_ops) const char *data, void *parent, const struct wined3d_parent_ops *parent_ops)
{ {
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
const struct wined3d_format *format = wined3d_get_format(gl_info, format_id); const struct wined3d_format *format = wined3d_get_format(gl_info, format_id);
......
...@@ -230,8 +230,11 @@ static WINED3DRESOURCETYPE WINAPI IWineD3DCubeTextureImpl_GetType(IWineD3DCubeTe ...@@ -230,8 +230,11 @@ static WINED3DRESOURCETYPE WINAPI IWineD3DCubeTextureImpl_GetType(IWineD3DCubeTe
return resource_get_type((IWineD3DResource *)iface); return resource_get_type((IWineD3DResource *)iface);
} }
static HRESULT WINAPI IWineD3DCubeTextureImpl_GetParent(IWineD3DCubeTexture *iface, IUnknown **pParent) { static void * WINAPI IWineD3DCubeTextureImpl_GetParent(IWineD3DCubeTexture *iface)
return resource_get_parent((IWineD3DResource *)iface, pParent); {
TRACE("iface %p.\n", iface);
return ((IWineD3DCubeTextureImpl *)iface)->resource.parent;
} }
/* ****************************************************** /* ******************************************************
...@@ -452,7 +455,7 @@ static const IWineD3DCubeTextureVtbl IWineD3DCubeTexture_Vtbl = ...@@ -452,7 +455,7 @@ static const IWineD3DCubeTextureVtbl IWineD3DCubeTexture_Vtbl =
HRESULT cubetexture_init(IWineD3DCubeTextureImpl *texture, UINT edge_length, UINT levels, HRESULT cubetexture_init(IWineD3DCubeTextureImpl *texture, UINT edge_length, UINT levels,
IWineD3DDeviceImpl *device, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool, IWineD3DDeviceImpl *device, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool,
IUnknown *parent, const struct wined3d_parent_ops *parent_ops) void *parent, const struct wined3d_parent_ops *parent_ops)
{ {
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
const struct wined3d_format *format = wined3d_get_format(gl_info, format_id); const struct wined3d_format *format = wined3d_get_format(gl_info, format_id);
......
...@@ -4871,11 +4871,11 @@ static HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT adapter_id ...@@ -4871,11 +4871,11 @@ static HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT adapter_id
return WINED3D_OK; return WINED3D_OK;
} }
static HRESULT WINAPI IWineD3DImpl_GetParent(IWineD3D *iface, IUnknown **pParent) { static void * WINAPI IWineD3DImpl_GetParent(IWineD3D *iface)
IWineD3DImpl *This = (IWineD3DImpl *)iface; {
IUnknown_AddRef(This->parent); TRACE("iface %p.\n", iface);
*pParent = This->parent;
return WINED3D_OK; return ((IWineD3DImpl *)iface)->parent;
} }
static void WINE_GLAPI invalid_func(const void *data) static void WINE_GLAPI invalid_func(const void *data)
...@@ -5393,7 +5393,7 @@ const struct wined3d_parent_ops wined3d_null_parent_ops = ...@@ -5393,7 +5393,7 @@ const struct wined3d_parent_ops wined3d_null_parent_ops =
wined3d_null_wined3d_object_destroyed, wined3d_null_wined3d_object_destroyed,
}; };
HRESULT wined3d_init(IWineD3DImpl *wined3d, UINT version, IUnknown *parent) HRESULT wined3d_init(IWineD3DImpl *wined3d, UINT version, void *parent)
{ {
wined3d->lpVtbl = &IWineD3D_Vtbl; wined3d->lpVtbl = &IWineD3D_Vtbl;
wined3d->dxVersion = version; wined3d->dxVersion = version;
......
...@@ -175,13 +175,11 @@ static HRESULT WINAPI IWineD3DPaletteImpl_GetCaps(IWineD3DPalette *iface, DWORD ...@@ -175,13 +175,11 @@ static HRESULT WINAPI IWineD3DPaletteImpl_GetCaps(IWineD3DPalette *iface, DWORD
return WINED3D_OK; return WINED3D_OK;
} }
static HRESULT WINAPI IWineD3DPaletteImpl_GetParent(IWineD3DPalette *iface, IUnknown **Parent) { static void * WINAPI IWineD3DPaletteImpl_GetParent(IWineD3DPalette *iface)
IWineD3DPaletteImpl *This = (IWineD3DPaletteImpl *)iface; {
TRACE("(%p)->(%p)\n", This, Parent); TRACE("iface %p.\n", iface);
*Parent = This->parent; return ((IWineD3DPaletteImpl *)iface)->parent;
IUnknown_AddRef(This->parent);
return WINED3D_OK;
} }
static const IWineD3DPaletteVtbl IWineD3DPalette_Vtbl = static const IWineD3DPaletteVtbl IWineD3DPalette_Vtbl =
...@@ -198,7 +196,7 @@ static const IWineD3DPaletteVtbl IWineD3DPalette_Vtbl = ...@@ -198,7 +196,7 @@ static const IWineD3DPaletteVtbl IWineD3DPalette_Vtbl =
}; };
HRESULT wined3d_palette_init(IWineD3DPaletteImpl *palette, IWineD3DDeviceImpl *device, HRESULT wined3d_palette_init(IWineD3DPaletteImpl *palette, IWineD3DDeviceImpl *device,
DWORD flags, const PALETTEENTRY *entries, IUnknown *parent) DWORD flags, const PALETTEENTRY *entries, void *parent)
{ {
HRESULT hr; HRESULT hr;
......
...@@ -29,12 +29,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d); ...@@ -29,12 +29,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d);
HRESULT resource_init(IWineD3DResource *iface, WINED3DRESOURCETYPE resource_type, HRESULT resource_init(IWineD3DResource *iface, WINED3DRESOURCETYPE resource_type,
IWineD3DDeviceImpl *device, UINT size, DWORD usage, const struct wined3d_format *format, IWineD3DDeviceImpl *device, UINT size, DWORD usage, const struct wined3d_format *format,
WINED3DPOOL pool, IUnknown *parent, const struct wined3d_parent_ops *parent_ops) WINED3DPOOL pool, void *parent, const struct wined3d_parent_ops *parent_ops)
{ {
struct IWineD3DResourceClass *resource = &((IWineD3DResourceImpl *)iface)->resource; struct IWineD3DResourceClass *resource = &((IWineD3DResourceImpl *)iface)->resource;
resource->device = device; resource->device = device;
resource->parent = parent;
resource->resourceType = resource_type; resource->resourceType = resource_type;
resource->ref = 1; resource->ref = 1;
resource->pool = pool; resource->pool = pool;
...@@ -42,6 +41,7 @@ HRESULT resource_init(IWineD3DResource *iface, WINED3DRESOURCETYPE resource_type ...@@ -42,6 +41,7 @@ HRESULT resource_init(IWineD3DResource *iface, WINED3DRESOURCETYPE resource_type
resource->usage = usage; resource->usage = usage;
resource->size = size; resource->size = size;
resource->priority = 0; resource->priority = 0;
resource->parent = parent;
resource->parent_ops = parent_ops; resource->parent_ops = parent_ops;
list_init(&resource->privateData); list_init(&resource->privateData);
...@@ -245,11 +245,3 @@ WINED3DRESOURCETYPE resource_get_type(IWineD3DResource *iface) ...@@ -245,11 +245,3 @@ WINED3DRESOURCETYPE resource_get_type(IWineD3DResource *iface)
TRACE("(%p) : returning %d\n", This, This->resource.resourceType); TRACE("(%p) : returning %d\n", This, This->resource.resourceType);
return This->resource.resourceType; return This->resource.resourceType;
} }
HRESULT resource_get_parent(IWineD3DResource *iface, IUnknown **pParent)
{
IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface;
IUnknown_AddRef(This->resource.parent);
*pParent = This->resource.parent;
return WINED3D_OK;
}
...@@ -286,7 +286,7 @@ int shader_addline(struct wined3d_shader_buffer *buffer, const char *format, ... ...@@ -286,7 +286,7 @@ int shader_addline(struct wined3d_shader_buffer *buffer, const char *format, ...
} }
static void shader_init(struct IWineD3DBaseShaderClass *shader, IWineD3DDeviceImpl *device, static void shader_init(struct IWineD3DBaseShaderClass *shader, IWineD3DDeviceImpl *device,
IUnknown *parent, const struct wined3d_parent_ops *parent_ops) void *parent, const struct wined3d_parent_ops *parent_ops)
{ {
shader->ref = 1; shader->ref = 1;
shader->device = (IWineD3DDevice *)device; shader->device = (IWineD3DDevice *)device;
...@@ -1534,13 +1534,6 @@ const shader_backend_t none_shader_backend = { ...@@ -1534,13 +1534,6 @@ const shader_backend_t none_shader_backend = {
shader_none_color_fixup_supported, shader_none_color_fixup_supported,
}; };
static void shader_get_parent(IWineD3DBaseShaderImpl *shader, IUnknown **parent)
{
*parent = shader->baseShader.parent;
IUnknown_AddRef(*parent);
TRACE("shader %p, returning %p.\n", shader, *parent);
}
static HRESULT shader_get_function(IWineD3DBaseShaderImpl *shader, void *data, UINT *data_size) static HRESULT shader_get_function(IWineD3DBaseShaderImpl *shader, void *data, UINT *data_size)
{ {
if (!data) if (!data)
...@@ -1654,13 +1647,11 @@ static ULONG STDMETHODCALLTYPE vertexshader_Release(IWineD3DVertexShader *iface) ...@@ -1654,13 +1647,11 @@ static ULONG STDMETHODCALLTYPE vertexshader_Release(IWineD3DVertexShader *iface)
return refcount; return refcount;
} }
static HRESULT STDMETHODCALLTYPE vertexshader_GetParent(IWineD3DVertexShader *iface, IUnknown **parent) static void * STDMETHODCALLTYPE vertexshader_GetParent(IWineD3DVertexShader *iface)
{ {
TRACE("iface %p, parent %p.\n", iface, parent); TRACE("iface %p.\n", iface);
shader_get_parent((IWineD3DBaseShaderImpl *)iface, parent); return ((IWineD3DBaseShaderImpl *)iface)->baseShader.parent;
return WINED3D_OK;
} }
static HRESULT STDMETHODCALLTYPE vertexshader_GetFunction(IWineD3DVertexShader *iface, void *data, UINT *data_size) static HRESULT STDMETHODCALLTYPE vertexshader_GetFunction(IWineD3DVertexShader *iface, void *data, UINT *data_size)
...@@ -1829,7 +1820,7 @@ static void vertexshader_set_limits(IWineD3DVertexShaderImpl *shader) ...@@ -1829,7 +1820,7 @@ static void vertexshader_set_limits(IWineD3DVertexShaderImpl *shader)
HRESULT vertexshader_init(IWineD3DVertexShaderImpl *shader, IWineD3DDeviceImpl *device, HRESULT vertexshader_init(IWineD3DVertexShaderImpl *shader, IWineD3DDeviceImpl *device,
const DWORD *byte_code, const struct wined3d_shader_signature *output_signature, const DWORD *byte_code, const struct wined3d_shader_signature *output_signature,
IUnknown *parent, const struct wined3d_parent_ops *parent_ops) void *parent, const struct wined3d_parent_ops *parent_ops)
{ {
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
struct shader_reg_maps *reg_maps = &shader->baseShader.reg_maps; struct shader_reg_maps *reg_maps = &shader->baseShader.reg_maps;
...@@ -1951,13 +1942,11 @@ static ULONG STDMETHODCALLTYPE geometryshader_Release(IWineD3DGeometryShader *if ...@@ -1951,13 +1942,11 @@ static ULONG STDMETHODCALLTYPE geometryshader_Release(IWineD3DGeometryShader *if
return refcount; return refcount;
} }
static HRESULT STDMETHODCALLTYPE geometryshader_GetParent(IWineD3DGeometryShader *iface, IUnknown **parent) static void * STDMETHODCALLTYPE geometryshader_GetParent(IWineD3DGeometryShader *iface)
{ {
TRACE("iface %p, parent %p.\n", iface, parent); TRACE("iface %p.\n", iface);
shader_get_parent((IWineD3DBaseShaderImpl *)iface, parent); return ((IWineD3DBaseShaderImpl *)iface)->baseShader.parent;
return WINED3D_OK;
} }
static HRESULT STDMETHODCALLTYPE geometryshader_GetFunction(IWineD3DGeometryShader *iface, void *data, UINT *data_size) static HRESULT STDMETHODCALLTYPE geometryshader_GetFunction(IWineD3DGeometryShader *iface, void *data, UINT *data_size)
...@@ -1981,7 +1970,7 @@ static const IWineD3DGeometryShaderVtbl wined3d_geometryshader_vtbl = ...@@ -1981,7 +1970,7 @@ static const IWineD3DGeometryShaderVtbl wined3d_geometryshader_vtbl =
HRESULT geometryshader_init(struct wined3d_geometryshader *shader, IWineD3DDeviceImpl *device, HRESULT geometryshader_init(struct wined3d_geometryshader *shader, IWineD3DDeviceImpl *device,
const DWORD *byte_code, const struct wined3d_shader_signature *output_signature, const DWORD *byte_code, const struct wined3d_shader_signature *output_signature,
IUnknown *parent, const struct wined3d_parent_ops *parent_ops) void *parent, const struct wined3d_parent_ops *parent_ops)
{ {
HRESULT hr; HRESULT hr;
...@@ -2048,13 +2037,11 @@ static ULONG STDMETHODCALLTYPE pixelshader_Release(IWineD3DPixelShader *iface) ...@@ -2048,13 +2037,11 @@ static ULONG STDMETHODCALLTYPE pixelshader_Release(IWineD3DPixelShader *iface)
return refcount; return refcount;
} }
static HRESULT STDMETHODCALLTYPE pixelshader_GetParent(IWineD3DPixelShader *iface, IUnknown **parent) static void * STDMETHODCALLTYPE pixelshader_GetParent(IWineD3DPixelShader *iface)
{ {
TRACE("iface %p, parent %p.\n", iface, parent); TRACE("iface %p.\n", iface);
shader_get_parent((IWineD3DBaseShaderImpl *)iface, parent); return ((IWineD3DBaseShaderImpl *)iface)->baseShader.parent;
return WINED3D_OK;
} }
static HRESULT STDMETHODCALLTYPE pixelshader_GetFunction(IWineD3DPixelShader *iface, void *data, UINT *data_size) static HRESULT STDMETHODCALLTYPE pixelshader_GetFunction(IWineD3DPixelShader *iface, void *data, UINT *data_size)
...@@ -2253,7 +2240,7 @@ static void pixelshader_set_limits(IWineD3DPixelShaderImpl *shader) ...@@ -2253,7 +2240,7 @@ static void pixelshader_set_limits(IWineD3DPixelShaderImpl *shader)
HRESULT pixelshader_init(IWineD3DPixelShaderImpl *shader, IWineD3DDeviceImpl *device, HRESULT pixelshader_init(IWineD3DPixelShaderImpl *shader, IWineD3DDeviceImpl *device,
const DWORD *byte_code, const struct wined3d_shader_signature *output_signature, const DWORD *byte_code, const struct wined3d_shader_signature *output_signature,
IUnknown *parent, const struct wined3d_parent_ops *parent_ops) void *parent, const struct wined3d_parent_ops *parent_ops)
{ {
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
unsigned int i, highest_reg_used = 0, num_regs_used = 0; unsigned int i, highest_reg_used = 0, num_regs_used = 0;
......
...@@ -347,7 +347,7 @@ void draw_textured_quad(IWineD3DSurfaceImpl *src_surface, const RECT *src_rect, ...@@ -347,7 +347,7 @@ void draw_textured_quad(IWineD3DSurfaceImpl *src_surface, const RECT *src_rect,
HRESULT surface_init(IWineD3DSurfaceImpl *surface, WINED3DSURFTYPE surface_type, UINT alignment, HRESULT surface_init(IWineD3DSurfaceImpl *surface, WINED3DSURFTYPE surface_type, UINT alignment,
UINT width, UINT height, UINT level, BOOL lockable, BOOL discard, WINED3DMULTISAMPLE_TYPE multisample_type, UINT width, UINT height, UINT level, BOOL lockable, BOOL discard, WINED3DMULTISAMPLE_TYPE multisample_type,
UINT multisample_quality, IWineD3DDeviceImpl *device, DWORD usage, enum wined3d_format_id format_id, UINT multisample_quality, IWineD3DDeviceImpl *device, DWORD usage, enum wined3d_format_id format_id,
WINED3DPOOL pool, IUnknown *parent, const struct wined3d_parent_ops *parent_ops) WINED3DPOOL pool, void *parent, const struct wined3d_parent_ops *parent_ops)
{ {
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
const struct wined3d_format *format = wined3d_get_format(gl_info, format_id); const struct wined3d_format *format = wined3d_get_format(gl_info, format_id);
......
...@@ -139,9 +139,11 @@ WINED3DRESOURCETYPE WINAPI IWineD3DBaseSurfaceImpl_GetType(IWineD3DSurface *ifac ...@@ -139,9 +139,11 @@ WINED3DRESOURCETYPE WINAPI IWineD3DBaseSurfaceImpl_GetType(IWineD3DSurface *ifac
return resource_get_type((IWineD3DResource *)iface); return resource_get_type((IWineD3DResource *)iface);
} }
HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetParent(IWineD3DSurface *iface, IUnknown **pParent) { void * WINAPI IWineD3DBaseSurfaceImpl_GetParent(IWineD3DSurface *iface)
TRACE("(%p) : calling resourceimpl_GetParent\n", iface); {
return resource_get_parent((IWineD3DResource *)iface, pParent); TRACE("iface %p.\n", iface);
return ((IWineD3DSurfaceImpl *)iface)->resource.parent;
} }
/* ****************************************************** /* ******************************************************
...@@ -811,10 +813,10 @@ static IWineD3DSurfaceImpl *surface_convert_format(IWineD3DSurfaceImpl *source, ...@@ -811,10 +813,10 @@ static IWineD3DSurfaceImpl *surface_convert_format(IWineD3DSurfaceImpl *source,
} }
IWineD3DDevice_CreateSurface((IWineD3DDevice *)source->resource.device, source->currentDesc.Width, IWineD3DDevice_CreateSurface((IWineD3DDevice *)source->resource.device, source->currentDesc.Width,
source->currentDesc.Height, to_fmt, TRUE /* lockable */, TRUE /* discard */, 0 /* level */, &ret, source->currentDesc.Height, to_fmt, TRUE /* lockable */, TRUE /* discard */, 0 /* level */,
0 /* usage */, WINED3DPOOL_SCRATCH, WINED3DMULTISAMPLE_NONE /* TODO: Multisampled conversion */, 0 /* usage */, WINED3DPOOL_SCRATCH, WINED3DMULTISAMPLE_NONE /* TODO: Multisampled conversion */,
0 /* MultiSampleQuality */, IWineD3DSurface_GetImplType((IWineD3DSurface *) source), 0 /* MultiSampleQuality */, IWineD3DSurface_GetImplType((IWineD3DSurface *) source),
NULL /* parent */, &wined3d_null_parent_ops); NULL /* parent */, &wined3d_null_parent_ops, &ret);
if(!ret) { if(!ret) {
ERR("Failed to create a destination surface for conversion\n"); ERR("Failed to create a destination surface for conversion\n");
return NULL; return NULL;
......
...@@ -622,7 +622,7 @@ void swapchain_restore_fullscreen_window(IWineD3DSwapChainImpl *swapchain) ...@@ -622,7 +622,7 @@ void swapchain_restore_fullscreen_window(IWineD3DSwapChainImpl *swapchain)
HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface_type, HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface_type,
IWineD3DDeviceImpl *device, WINED3DPRESENT_PARAMETERS *present_parameters, IUnknown *parent) IWineD3DDeviceImpl *device, WINED3DPRESENT_PARAMETERS *present_parameters, void *parent)
{ {
const struct wined3d_adapter *adapter = device->adapter; const struct wined3d_adapter *adapter = device->adapter;
const struct wined3d_format *format; const struct wined3d_format *format;
......
...@@ -64,12 +64,11 @@ ULONG WINAPI IWineD3DBaseSwapChainImpl_Release(IWineD3DSwapChain *iface) { ...@@ -64,12 +64,11 @@ ULONG WINAPI IWineD3DBaseSwapChainImpl_Release(IWineD3DSwapChain *iface) {
return refCount; return refCount;
} }
HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetParent(IWineD3DSwapChain *iface, IUnknown ** ppParent){ void * WINAPI IWineD3DBaseSwapChainImpl_GetParent(IWineD3DSwapChain *iface)
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface; {
*ppParent = This->parent; TRACE("iface %p.\n", iface);
IUnknown_AddRef(*ppParent);
TRACE("(%p) returning %p\n", This , *ppParent); return ((IWineD3DSwapChainImpl *)iface)->parent;
return WINED3D_OK;
} }
HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetFrontBufferData(IWineD3DSwapChain *iface, IWineD3DSurface *dst_surface) HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetFrontBufferData(IWineD3DSwapChain *iface, IWineD3DSurface *dst_surface)
......
...@@ -221,8 +221,11 @@ static WINED3DRESOURCETYPE WINAPI IWineD3DTextureImpl_GetType(IWineD3DTexture *i ...@@ -221,8 +221,11 @@ static WINED3DRESOURCETYPE WINAPI IWineD3DTextureImpl_GetType(IWineD3DTexture *i
return resource_get_type((IWineD3DResource *)iface); return resource_get_type((IWineD3DResource *)iface);
} }
static HRESULT WINAPI IWineD3DTextureImpl_GetParent(IWineD3DTexture *iface, IUnknown **pParent) { static void * WINAPI IWineD3DTextureImpl_GetParent(IWineD3DTexture *iface)
return resource_get_parent((IWineD3DResource *)iface, pParent); {
TRACE("iface %p.\n", iface);
return ((IWineD3DTextureImpl *)iface)->resource.parent;
} }
/* ****************************************************** /* ******************************************************
...@@ -463,7 +466,7 @@ static const IWineD3DTextureVtbl IWineD3DTexture_Vtbl = ...@@ -463,7 +466,7 @@ static const IWineD3DTextureVtbl IWineD3DTexture_Vtbl =
HRESULT texture_init(IWineD3DTextureImpl *texture, UINT width, UINT height, UINT levels, HRESULT texture_init(IWineD3DTextureImpl *texture, UINT width, UINT height, UINT levels,
IWineD3DDeviceImpl *device, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool, IWineD3DDeviceImpl *device, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool,
IUnknown *parent, const struct wined3d_parent_ops *parent_ops) void *parent, const struct wined3d_parent_ops *parent_ops)
{ {
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
const struct wined3d_format *format = wined3d_get_format(gl_info, format_id); const struct wined3d_format *format = wined3d_get_format(gl_info, format_id);
......
...@@ -79,13 +79,11 @@ static ULONG WINAPI IWineD3DVertexDeclarationImpl_Release(IWineD3DVertexDeclarat ...@@ -79,13 +79,11 @@ static ULONG WINAPI IWineD3DVertexDeclarationImpl_Release(IWineD3DVertexDeclarat
IWineD3DVertexDeclaration parts follow IWineD3DVertexDeclaration parts follow
******************************************* */ ******************************************* */
static HRESULT WINAPI IWineD3DVertexDeclarationImpl_GetParent(IWineD3DVertexDeclaration *iface, IUnknown** parent){ static void * WINAPI IWineD3DVertexDeclarationImpl_GetParent(IWineD3DVertexDeclaration *iface)
IWineD3DVertexDeclarationImpl *This = (IWineD3DVertexDeclarationImpl *)iface; {
TRACE("iface %p.\n", iface);
*parent= This->parent; return ((IWineD3DVertexDeclarationImpl *)iface)->parent;
IUnknown_AddRef(*parent);
TRACE("(%p) : returning %p\n", This, *parent);
return WINED3D_OK;
} }
static BOOL declaration_element_valid_ffp(const WINED3DVERTEXELEMENT *element) static BOOL declaration_element_valid_ffp(const WINED3DVERTEXELEMENT *element)
...@@ -188,7 +186,7 @@ static const IWineD3DVertexDeclarationVtbl IWineD3DVertexDeclaration_Vtbl = ...@@ -188,7 +186,7 @@ static const IWineD3DVertexDeclarationVtbl IWineD3DVertexDeclaration_Vtbl =
HRESULT vertexdeclaration_init(IWineD3DVertexDeclarationImpl *declaration, IWineD3DDeviceImpl *device, HRESULT vertexdeclaration_init(IWineD3DVertexDeclarationImpl *declaration, IWineD3DDeviceImpl *device,
const WINED3DVERTEXELEMENT *elements, UINT element_count, const WINED3DVERTEXELEMENT *elements, UINT element_count,
IUnknown *parent, const struct wined3d_parent_ops *parent_ops) void *parent, const struct wined3d_parent_ops *parent_ops)
{ {
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
WORD preloaded = 0; /* MAX_STREAMS, 16 */ WORD preloaded = 0; /* MAX_STREAMS, 16 */
......
...@@ -74,14 +74,11 @@ static ULONG STDMETHODCALLTYPE rendertarget_view_Release(IWineD3DRendertargetVie ...@@ -74,14 +74,11 @@ static ULONG STDMETHODCALLTYPE rendertarget_view_Release(IWineD3DRendertargetVie
/* IWineD3DBase methods */ /* IWineD3DBase methods */
static HRESULT STDMETHODCALLTYPE rendertarget_view_GetParent(IWineD3DRendertargetView *iface, IUnknown **parent) static void * STDMETHODCALLTYPE rendertarget_view_GetParent(IWineD3DRendertargetView *iface)
{ {
struct wined3d_rendertarget_view *This = (struct wined3d_rendertarget_view *)iface; TRACE("iface %p.\n", iface);
IUnknown_AddRef(This->parent);
*parent = This->parent;
return WINED3D_OK; return ((struct wined3d_rendertarget_view *)iface)->parent;
} }
/* IWineD3DRendertargetView methods */ /* IWineD3DRendertargetView methods */
...@@ -110,7 +107,7 @@ static const struct IWineD3DRendertargetViewVtbl wined3d_rendertarget_view_vtbl ...@@ -110,7 +107,7 @@ static const struct IWineD3DRendertargetViewVtbl wined3d_rendertarget_view_vtbl
}; };
void wined3d_rendertarget_view_init(struct wined3d_rendertarget_view *view, void wined3d_rendertarget_view_init(struct wined3d_rendertarget_view *view,
IWineD3DResource *resource, IUnknown *parent) IWineD3DResource *resource, void *parent)
{ {
view->vtbl = &wined3d_rendertarget_view_vtbl; view->vtbl = &wined3d_rendertarget_view_vtbl;
view->refcount = 1; view->refcount = 1;
......
...@@ -139,8 +139,11 @@ static ULONG WINAPI IWineD3DVolumeImpl_Release(IWineD3DVolume *iface) { ...@@ -139,8 +139,11 @@ static ULONG WINAPI IWineD3DVolumeImpl_Release(IWineD3DVolume *iface) {
/* **************************************************** /* ****************************************************
IWineD3DVolume IWineD3DResource parts follow IWineD3DVolume IWineD3DResource parts follow
**************************************************** */ **************************************************** */
static HRESULT WINAPI IWineD3DVolumeImpl_GetParent(IWineD3DVolume *iface, IUnknown **pParent) { static void * WINAPI IWineD3DVolumeImpl_GetParent(IWineD3DVolume *iface)
return resource_get_parent((IWineD3DResource *)iface, pParent); {
TRACE("iface %p.\n", iface);
return ((IWineD3DVolumeImpl *)iface)->resource.parent;
} }
static HRESULT WINAPI IWineD3DVolumeImpl_SetPrivateData(IWineD3DVolume *iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) { static HRESULT WINAPI IWineD3DVolumeImpl_SetPrivateData(IWineD3DVolume *iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
...@@ -325,7 +328,7 @@ static const IWineD3DVolumeVtbl IWineD3DVolume_Vtbl = ...@@ -325,7 +328,7 @@ static const IWineD3DVolumeVtbl IWineD3DVolume_Vtbl =
HRESULT volume_init(IWineD3DVolumeImpl *volume, IWineD3DDeviceImpl *device, UINT width, HRESULT volume_init(IWineD3DVolumeImpl *volume, IWineD3DDeviceImpl *device, UINT width,
UINT height, UINT depth, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool, UINT height, UINT depth, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool,
IUnknown *parent, const struct wined3d_parent_ops *parent_ops) void *parent, const struct wined3d_parent_ops *parent_ops)
{ {
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
const struct wined3d_format *format = wined3d_get_format(gl_info, format_id); const struct wined3d_format *format = wined3d_get_format(gl_info, format_id);
......
...@@ -186,8 +186,11 @@ static WINED3DRESOURCETYPE WINAPI IWineD3DVolumeTextureImpl_GetType(IWineD3DVolu ...@@ -186,8 +186,11 @@ static WINED3DRESOURCETYPE WINAPI IWineD3DVolumeTextureImpl_GetType(IWineD3DVolu
return resource_get_type((IWineD3DResource *)iface); return resource_get_type((IWineD3DResource *)iface);
} }
static HRESULT WINAPI IWineD3DVolumeTextureImpl_GetParent(IWineD3DVolumeTexture *iface, IUnknown **pParent) { static void * WINAPI IWineD3DVolumeTextureImpl_GetParent(IWineD3DVolumeTexture *iface)
return resource_get_parent((IWineD3DResource *)iface, pParent); {
TRACE("iface %p\n", iface);
return ((IWineD3DVolumeTextureImpl *)iface)->resource.parent;
} }
/* ****************************************************** /* ******************************************************
...@@ -385,7 +388,7 @@ static const IWineD3DVolumeTextureVtbl IWineD3DVolumeTexture_Vtbl = ...@@ -385,7 +388,7 @@ static const IWineD3DVolumeTextureVtbl IWineD3DVolumeTexture_Vtbl =
HRESULT volumetexture_init(IWineD3DVolumeTextureImpl *texture, UINT width, UINT height, HRESULT volumetexture_init(IWineD3DVolumeTextureImpl *texture, UINT width, UINT height,
UINT depth, UINT levels, IWineD3DDeviceImpl *device, DWORD usage, enum wined3d_format_id format_id, UINT depth, UINT levels, IWineD3DDeviceImpl *device, DWORD usage, enum wined3d_format_id format_id,
WINED3DPOOL pool, IUnknown *parent, const struct wined3d_parent_ops *parent_ops) WINED3DPOOL pool, void *parent, const struct wined3d_parent_ops *parent_ops)
{ {
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
const struct wined3d_format *format = wined3d_get_format(gl_info, format_id); const struct wined3d_format *format = wined3d_get_format(gl_info, format_id);
......
...@@ -76,7 +76,7 @@ wined3d_settings_t wined3d_settings = ...@@ -76,7 +76,7 @@ wined3d_settings_t wined3d_settings =
FALSE, /* No strict draw ordering. */ FALSE, /* No strict draw ordering. */
}; };
IWineD3D * WINAPI WineDirect3DCreate(UINT version, IUnknown *parent) IWineD3D * WINAPI WineDirect3DCreate(UINT version, void *parent)
{ {
IWineD3DImpl *object; IWineD3DImpl *object;
HRESULT hr; HRESULT hr;
......
...@@ -2178,8 +2178,7 @@ typedef HRESULT (__stdcall *D3DCB_ENUMRESOURCES)(IWineD3DResource *resource, voi ...@@ -2178,8 +2178,7 @@ typedef HRESULT (__stdcall *D3DCB_ENUMRESOURCES)(IWineD3DResource *resource, voi
] ]
interface IWineD3DBase : IUnknown interface IWineD3DBase : IUnknown
{ {
HRESULT GetParent( void *GetParent(
[out] IUnknown **parent
); );
} }
...@@ -2797,7 +2796,7 @@ interface IWineD3DDevice : IUnknown ...@@ -2797,7 +2796,7 @@ interface IWineD3DDevice : IUnknown
HRESULT CreateBuffer( HRESULT CreateBuffer(
[in] struct wined3d_buffer_desc *desc, [in] struct wined3d_buffer_desc *desc,
[in] const void *data, [in] const void *data,
[in] IUnknown *parent, [in] void *parent,
[in] const struct wined3d_parent_ops *parent_ops, [in] const struct wined3d_parent_ops *parent_ops,
[out] IWineD3DBuffer **buffer [out] IWineD3DBuffer **buffer
); );
...@@ -2805,17 +2804,17 @@ interface IWineD3DDevice : IUnknown ...@@ -2805,17 +2804,17 @@ interface IWineD3DDevice : IUnknown
[in] UINT length, [in] UINT length,
[in] DWORD usage, [in] DWORD usage,
[in] WINED3DPOOL pool, [in] WINED3DPOOL pool,
[out] IWineD3DBuffer **vertex_buffer, [in] void *parent,
[in] IUnknown *parent, [in] const struct wined3d_parent_ops *parent_ops,
[in] const struct wined3d_parent_ops *parent_ops [out] IWineD3DBuffer **vertex_buffer
); );
HRESULT CreateIndexBuffer( HRESULT CreateIndexBuffer(
[in] UINT length, [in] UINT length,
[in] DWORD usage, [in] DWORD usage,
[in] WINED3DPOOL pool, [in] WINED3DPOOL pool,
[out] IWineD3DBuffer **index_buffer, [in] void *parent,
[in] IUnknown *parent, [in] const struct wined3d_parent_ops *parent_ops,
[in] const struct wined3d_parent_ops *parent_ops [out] IWineD3DBuffer **index_buffer
); );
HRESULT CreateStateBlock( HRESULT CreateStateBlock(
[in] WINED3DSTATEBLOCKTYPE type, [in] WINED3DSTATEBLOCKTYPE type,
...@@ -2828,18 +2827,18 @@ interface IWineD3DDevice : IUnknown ...@@ -2828,18 +2827,18 @@ interface IWineD3DDevice : IUnknown
[in] BOOL lockable, [in] BOOL lockable,
[in] BOOL discard, [in] BOOL discard,
[in] UINT level, [in] UINT level,
[out] IWineD3DSurface **surface,
[in] DWORD usage, [in] DWORD usage,
[in] WINED3DPOOL pool, [in] WINED3DPOOL pool,
[in] WINED3DMULTISAMPLE_TYPE multisample_type, [in] WINED3DMULTISAMPLE_TYPE multisample_type,
[in] DWORD multisample_quality, [in] DWORD multisample_quality,
[in] WINED3DSURFTYPE surface_type, [in] WINED3DSURFTYPE surface_type,
[in] IUnknown *parent, [in] void *parent,
[in] const struct wined3d_parent_ops *parent_ops [in] const struct wined3d_parent_ops *parent_ops,
[out] IWineD3DSurface **surface
); );
HRESULT CreateRendertargetView( HRESULT CreateRendertargetView(
[in] IWineD3DResource *resource, [in] IWineD3DResource *resource,
[in] IUnknown *parent, [in] void *parent,
[out] IWineD3DRendertargetView **rendertarget_view [out] IWineD3DRendertargetView **rendertarget_view
); );
HRESULT CreateTexture( HRESULT CreateTexture(
...@@ -2849,9 +2848,9 @@ interface IWineD3DDevice : IUnknown ...@@ -2849,9 +2848,9 @@ interface IWineD3DDevice : IUnknown
[in] DWORD usage, [in] DWORD usage,
[in] enum wined3d_format_id format_id, [in] enum wined3d_format_id format_id,
[in] WINED3DPOOL pool, [in] WINED3DPOOL pool,
[out] IWineD3DTexture **texture, [in] void *parent,
[in] IUnknown *parent, [in] const struct wined3d_parent_ops *parent_ops,
[in] const struct wined3d_parent_ops *parent_ops [out] IWineD3DTexture **texture
); );
HRESULT CreateVolumeTexture( HRESULT CreateVolumeTexture(
[in] UINT width, [in] UINT width,
...@@ -2861,9 +2860,9 @@ interface IWineD3DDevice : IUnknown ...@@ -2861,9 +2860,9 @@ interface IWineD3DDevice : IUnknown
[in] DWORD usage, [in] DWORD usage,
[in] enum wined3d_format_id format_id, [in] enum wined3d_format_id format_id,
[in] WINED3DPOOL pool, [in] WINED3DPOOL pool,
[out] IWineD3DVolumeTexture **texture, [in] void *parent,
[in] IUnknown *parent, [in] const struct wined3d_parent_ops *parent_ops,
[in] const struct wined3d_parent_ops *parent_ops [out] IWineD3DVolumeTexture **texture
); );
HRESULT CreateVolume( HRESULT CreateVolume(
[in] UINT width, [in] UINT width,
...@@ -2872,9 +2871,9 @@ interface IWineD3DDevice : IUnknown ...@@ -2872,9 +2871,9 @@ interface IWineD3DDevice : IUnknown
[in] DWORD usage, [in] DWORD usage,
[in] enum wined3d_format_id format_id, [in] enum wined3d_format_id format_id,
[in] WINED3DPOOL pool, [in] WINED3DPOOL pool,
[out] IWineD3DVolume **volume, [in] void *parent,
[in] IUnknown *parent, [in] const struct wined3d_parent_ops *parent_ops,
[in] const struct wined3d_parent_ops *parent_ops [out] IWineD3DVolume **volume
); );
HRESULT CreateCubeTexture( HRESULT CreateCubeTexture(
[in] UINT edge_length, [in] UINT edge_length,
...@@ -2882,9 +2881,9 @@ interface IWineD3DDevice : IUnknown ...@@ -2882,9 +2881,9 @@ interface IWineD3DDevice : IUnknown
[in] DWORD usage, [in] DWORD usage,
[in] enum wined3d_format_id format_id, [in] enum wined3d_format_id format_id,
[in] WINED3DPOOL pool, [in] WINED3DPOOL pool,
[out] IWineD3DCubeTexture **texture, [in] void *parent,
[in] IUnknown *parent, [in] const struct wined3d_parent_ops *parent_ops,
[in] const struct wined3d_parent_ops *parent_ops [out] IWineD3DCubeTexture **texture
); );
HRESULT CreateQuery( HRESULT CreateQuery(
[in] WINED3DQUERYTYPE type, [in] WINED3DQUERYTYPE type,
...@@ -2892,49 +2891,49 @@ interface IWineD3DDevice : IUnknown ...@@ -2892,49 +2891,49 @@ interface IWineD3DDevice : IUnknown
); );
HRESULT CreateSwapChain( HRESULT CreateSwapChain(
[in] WINED3DPRESENT_PARAMETERS *present_parameters, [in] WINED3DPRESENT_PARAMETERS *present_parameters,
[out] IWineD3DSwapChain **swapchain, [in] WINED3DSURFTYPE surface_type,
[in] IUnknown *parent, [in] void *parent,
[in] WINED3DSURFTYPE surface_type [out] IWineD3DSwapChain **swapchain
); );
HRESULT CreateVertexDeclaration( HRESULT CreateVertexDeclaration(
[out] IWineD3DVertexDeclaration **declaration,
[in] IUnknown *parent,
[in] const struct wined3d_parent_ops *parent_ops,
[in] const WINED3DVERTEXELEMENT *elements, [in] const WINED3DVERTEXELEMENT *elements,
[in] UINT element_count [in] UINT element_count,
[in] void *parent,
[in] const struct wined3d_parent_ops *parent_ops,
[out] IWineD3DVertexDeclaration **declaration
); );
HRESULT CreateVertexDeclarationFromFVF( HRESULT CreateVertexDeclarationFromFVF(
[out] IWineD3DVertexDeclaration **declaration, [in] DWORD fvf,
[in] IUnknown *parent, [in] void *parent,
[in] const struct wined3d_parent_ops *parent_ops, [in] const struct wined3d_parent_ops *parent_ops,
[in] DWORD fvf [out] IWineD3DVertexDeclaration **declaration
); );
HRESULT CreateVertexShader( HRESULT CreateVertexShader(
[in] const DWORD *function, [in] const DWORD *function,
[in] const struct wined3d_shader_signature *output_signature, [in] const struct wined3d_shader_signature *output_signature,
[out] IWineD3DVertexShader **shader, [in] void *parent,
[in] IUnknown *parent, [in] const struct wined3d_parent_ops *parent_ops,
[in] const struct wined3d_parent_ops *parent_ops [out] IWineD3DVertexShader **shader
); );
HRESULT CreateGeometryShader( HRESULT CreateGeometryShader(
[in] const DWORD *byte_code, [in] const DWORD *byte_code,
[in] const struct wined3d_shader_signature *output_signature, [in] const struct wined3d_shader_signature *output_signature,
[out] IWineD3DGeometryShader **shader, [in] void *parent,
[in] IUnknown *parent, [in] const struct wined3d_parent_ops *parent_ops,
[in] const struct wined3d_parent_ops *parent_ops [out] IWineD3DGeometryShader **shader
); );
HRESULT CreatePixelShader( HRESULT CreatePixelShader(
[in] const DWORD *function, [in] const DWORD *function,
[in] const struct wined3d_shader_signature *output_signature, [in] const struct wined3d_shader_signature *output_signature,
[out] IWineD3DPixelShader **shader, [in] void *parent,
[in] IUnknown *parent, [in] const struct wined3d_parent_ops *parent_ops,
[in] const struct wined3d_parent_ops *parent_ops [out] IWineD3DPixelShader **shader
); );
HRESULT CreatePalette( HRESULT CreatePalette(
[in] DWORD flags, [in] DWORD flags,
[in] const PALETTEENTRY *palette_entry, [in] const PALETTEENTRY *palette_entry,
[out] IWineD3DPalette **palette, [in] void *parent,
[in] IUnknown *parent [out] IWineD3DPalette **palette
); );
HRESULT Init3D( HRESULT Init3D(
[in] WINED3DPRESENT_PARAMETERS *present_parameters [in] WINED3DPRESENT_PARAMETERS *present_parameters
...@@ -3388,7 +3387,7 @@ interface IWineD3DDevice : IUnknown ...@@ -3388,7 +3387,7 @@ interface IWineD3DDevice : IUnknown
); );
} }
IWineD3D * __stdcall WineDirect3DCreate(UINT dxVersion, IUnknown *parent); IWineD3D * __stdcall WineDirect3DCreate(UINT dxVersion, void *parent);
IWineD3DClipper * __stdcall WineDirect3DCreateClipper(void); IWineD3DClipper * __stdcall WineDirect3DCreateClipper(void);
void __stdcall wined3d_mutex_lock(void); void __stdcall wined3d_mutex_lock(void);
void __stdcall wined3d_mutex_unlock(void); void __stdcall wined3d_mutex_unlock(void);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment