Commit 435b528e authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

d3d9: Get rid of resource.c.

parent 82dd5bc2
......@@ -14,7 +14,6 @@ C_SRCS = \
indexbuffer.c \
pixelshader.c \
query.c \
resource.c \
stateblock.c \
surface.c \
swapchain.c \
......
......@@ -74,11 +74,17 @@ static ULONG WINAPI IDirect3DCubeTexture9Impl_Release(LPDIRECT3DCUBETEXTURE9 ifa
/* IDirect3DCubeTexture9 IDirect3DResource9 Interface follow: */
static HRESULT WINAPI IDirect3DCubeTexture9Impl_GetDevice(LPDIRECT3DCUBETEXTURE9 iface, IDirect3DDevice9** ppDevice) {
IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
IWineD3DDevice *wined3d_device;
HRESULT hr;
TRACE("(%p) Relay\n" , This);
EnterCriticalSection(&d3d9_cs);
hr = IDirect3DResource9Impl_GetDevice((LPDIRECT3DRESOURCE9) This, ppDevice);
hr = IWineD3DCubeTexture_GetDevice(This->wineD3DCubeTexture, &wined3d_device);
if (SUCCEEDED(hr))
{
IWineD3DDevice_GetParent(wined3d_device, (IUnknown **)ppDevice);
IWineD3DDevice_Release(wined3d_device);
}
LeaveCriticalSection(&d3d9_cs);
return hr;
}
......
......@@ -277,26 +277,6 @@ typedef struct IDirect3DSwapChain9Impl
BOOL isImplicit;
} IDirect3DSwapChain9Impl;
/* ------------------ */
/* IDirect3DResource9 */
/* ------------------ */
/*****************************************************************************
* IDirect3DResource9 implementation structure
*/
typedef struct IDirect3DResource9Impl
{
/* IUnknown fields */
const IDirect3DResource9Vtbl *lpVtbl;
LONG ref;
/* IDirect3DResource9 fields */
IWineD3DResource *wineD3DResource;
} IDirect3DResource9Impl;
extern HRESULT WINAPI IDirect3DResource9Impl_GetDevice(LPDIRECT3DRESOURCE9 iface, IDirect3DDevice9** ppDevice);
/* ----------------- */
/* IDirect3DSurface9 */
/* ----------------- */
......
......@@ -69,11 +69,17 @@ static ULONG WINAPI IDirect3DIndexBuffer9Impl_Release(LPDIRECT3DINDEXBUFFER9 ifa
/* IDirect3DIndexBuffer9 IDirect3DResource9 Interface follow: */
static HRESULT WINAPI IDirect3DIndexBuffer9Impl_GetDevice(LPDIRECT3DINDEXBUFFER9 iface, IDirect3DDevice9** ppDevice) {
IDirect3DIndexBuffer9Impl *This = (IDirect3DIndexBuffer9Impl *)iface;
IWineD3DDevice *wined3d_device;
HRESULT hr;
TRACE("(%p) Relay\n", This);
EnterCriticalSection(&d3d9_cs);
hr = IDirect3DResource9Impl_GetDevice((LPDIRECT3DRESOURCE9) This, ppDevice);
hr = IWineD3DIndexBuffer_GetDevice(This->wineD3DIndexBuffer, &wined3d_device);
if (SUCCEEDED(hr))
{
IWineD3DDevice_GetParent(wined3d_device, (IUnknown **)ppDevice);
IWineD3DDevice_Release(wined3d_device);
}
LeaveCriticalSection(&d3d9_cs);
return hr;
}
......
/*
* IDirect3DResource9 implementation
*
* Copyright 2002-2004 Jason Edmeades
* Raphael Junqueira
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "d3d9_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d9);
/* IDirect3DResource9 IUnknown parts follow: */
static HRESULT WINAPI IDirect3DResource9Impl_QueryInterface(LPDIRECT3DRESOURCE9 iface, REFIID riid, LPVOID* ppobj) {
IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface;
if (IsEqualGUID(riid, &IID_IUnknown)
|| IsEqualGUID(riid, &IID_IDirect3DResource9)) {
IDirect3DResource9_AddRef(iface);
*ppobj = This;
return S_OK;
}
WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
*ppobj = NULL;
return E_NOINTERFACE;
}
static ULONG WINAPI IDirect3DResource9Impl_AddRef(LPDIRECT3DRESOURCE9 iface) {
IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface;
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) : AddRef from %d\n", This, ref - 1);
return ref;
}
static ULONG WINAPI IDirect3DResource9Impl_Release(LPDIRECT3DRESOURCE9 iface) {
IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface;
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) : ReleaseRef to %d\n", This, ref);
if (ref == 0) {
IWineD3DResource_Release(This->wineD3DResource);
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
}
/* IDirect3DResource9 Interface follow: */
HRESULT WINAPI IDirect3DResource9Impl_GetDevice(LPDIRECT3DRESOURCE9 iface, IDirect3DDevice9** ppDevice) {
IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface;
IWineD3DDevice *myDevice = NULL;
TRACE("(%p) Relay\n", This);
IWineD3DResource_GetDevice(This->wineD3DResource, &myDevice);
IWineD3DDevice_GetParent(myDevice, (IUnknown **)ppDevice);
IWineD3DDevice_Release(myDevice);
return D3D_OK;
}
static HRESULT WINAPI IDirect3DResource9Impl_SetPrivateData(LPDIRECT3DRESOURCE9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface;
TRACE("(%p) Relay\n", This);
return IWineD3DResource_SetPrivateData(This->wineD3DResource, refguid, pData, SizeOfData, Flags);
}
static HRESULT WINAPI IDirect3DResource9Impl_GetPrivateData(LPDIRECT3DRESOURCE9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface;
TRACE("(%p) Relay\n", This);
return IWineD3DResource_GetPrivateData(This->wineD3DResource, refguid, pData, pSizeOfData);
}
static HRESULT WINAPI IDirect3DResource9Impl_FreePrivateData(LPDIRECT3DRESOURCE9 iface, REFGUID refguid) {
IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface;
TRACE("(%p) Relay\n", This);
return IWineD3DResource_FreePrivateData(This->wineD3DResource, refguid);
}
static DWORD WINAPI IDirect3DResource9Impl_SetPriority(LPDIRECT3DRESOURCE9 iface, DWORD PriorityNew) {
IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface;
TRACE("(%p) Relay\n", This);
return IWineD3DResource_SetPriority(This->wineD3DResource, PriorityNew);
}
static DWORD WINAPI IDirect3DResource9Impl_GetPriority(LPDIRECT3DRESOURCE9 iface) {
IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface;
TRACE("(%p) Relay\n", This);
return IWineD3DResource_GetPriority(This->wineD3DResource);
}
static void WINAPI IDirect3DResource9Impl_PreLoad(LPDIRECT3DRESOURCE9 iface) {
IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface;
TRACE("(%p) Relay\n", This);
IWineD3DResource_PreLoad(This->wineD3DResource);
return;
}
static D3DRESOURCETYPE WINAPI IDirect3DResource9Impl_GetType(LPDIRECT3DRESOURCE9 iface) {
IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface;
TRACE("(%p) Relay\n", This);
return IWineD3DResource_GetType(This->wineD3DResource);
}
const IDirect3DResource9Vtbl Direct3DResource9_Vtbl =
{
IDirect3DResource9Impl_QueryInterface,
IDirect3DResource9Impl_AddRef,
IDirect3DResource9Impl_Release,
IDirect3DResource9Impl_GetDevice,
IDirect3DResource9Impl_SetPrivateData,
IDirect3DResource9Impl_GetPrivateData,
IDirect3DResource9Impl_FreePrivateData,
IDirect3DResource9Impl_SetPriority,
IDirect3DResource9Impl_GetPriority,
IDirect3DResource9Impl_PreLoad,
IDirect3DResource9Impl_GetType
};
......@@ -69,11 +69,17 @@ static ULONG WINAPI IDirect3DStateBlock9Impl_Release(LPDIRECT3DSTATEBLOCK9 iface
/* IDirect3DStateBlock9 Interface follow: */
static HRESULT WINAPI IDirect3DStateBlock9Impl_GetDevice(LPDIRECT3DSTATEBLOCK9 iface, IDirect3DDevice9** ppDevice) {
IDirect3DStateBlock9Impl *This = (IDirect3DStateBlock9Impl *)iface;
IWineD3DDevice *wined3d_device;
HRESULT hr;
TRACE("(%p) Relay\n", This);
EnterCriticalSection(&d3d9_cs);
hr = IDirect3DResource9Impl_GetDevice((LPDIRECT3DRESOURCE9) This, ppDevice);
hr = IWineD3DStateBlock_GetDevice(This->wineD3DStateBlock, &wined3d_device);
if (SUCCEEDED(hr))
{
IWineD3DDevice_GetParent(wined3d_device, (IUnknown **)ppDevice);
IWineD3DDevice_Release(wined3d_device);
}
LeaveCriticalSection(&d3d9_cs);
return hr;
}
......
......@@ -92,11 +92,17 @@ static ULONG WINAPI IDirect3DSurface9Impl_Release(LPDIRECT3DSURFACE9 iface) {
/* IDirect3DSurface9 IDirect3DResource9 Interface follow: */
static HRESULT WINAPI IDirect3DSurface9Impl_GetDevice(LPDIRECT3DSURFACE9 iface, IDirect3DDevice9** ppDevice) {
IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
IWineD3DDevice *wined3d_device;
HRESULT hr;
TRACE("(%p)->(%p)\n", This, ppDevice);
EnterCriticalSection(&d3d9_cs);
hr = IDirect3DResource9Impl_GetDevice((LPDIRECT3DRESOURCE9) This, ppDevice);
hr = IWineD3DSurface_GetDevice(This->wineD3DSurface, &wined3d_device);
if (SUCCEEDED(hr))
{
IWineD3DDevice_GetParent(wined3d_device, (IUnknown **)ppDevice);
IWineD3DDevice_Release(wined3d_device);
}
LeaveCriticalSection(&d3d9_cs);
return hr;
}
......
......@@ -71,11 +71,17 @@ static ULONG WINAPI IDirect3DTexture9Impl_Release(LPDIRECT3DTEXTURE9 iface) {
/* IDirect3DTexture9 IDirect3DResource9 Interface follow: */
static HRESULT WINAPI IDirect3DTexture9Impl_GetDevice(LPDIRECT3DTEXTURE9 iface, IDirect3DDevice9** ppDevice) {
IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface;
IWineD3DDevice *wined3d_device;
HRESULT hr;
TRACE("(%p) Relay\n", This);
EnterCriticalSection(&d3d9_cs);
hr = IDirect3DResource9Impl_GetDevice((LPDIRECT3DRESOURCE9) This, ppDevice);
hr = IWineD3DTexture_GetDevice(This->wineD3DTexture, &wined3d_device);
if (SUCCEEDED(hr))
{
IWineD3DDevice_GetParent(wined3d_device, (IUnknown **)ppDevice);
IWineD3DDevice_Release(wined3d_device);
}
LeaveCriticalSection(&d3d9_cs);
return hr;
}
......
......@@ -70,11 +70,17 @@ static ULONG WINAPI IDirect3DVertexBuffer9Impl_Release(LPDIRECT3DVERTEXBUFFER9 i
/* IDirect3DVertexBuffer9 IDirect3DResource9 Interface follow: */
static HRESULT WINAPI IDirect3DVertexBuffer9Impl_GetDevice(LPDIRECT3DVERTEXBUFFER9 iface, IDirect3DDevice9** ppDevice) {
IDirect3DVertexBuffer9Impl *This = (IDirect3DVertexBuffer9Impl *)iface;
IWineD3DDevice *wined3d_device;
HRESULT hr;
TRACE("(%p) Relay\n", This);
EnterCriticalSection(&d3d9_cs);
hr = IDirect3DResource9Impl_GetDevice((LPDIRECT3DRESOURCE9) This, ppDevice);
hr = IWineD3DBuffer_GetDevice(This->wineD3DVertexBuffer, &wined3d_device);
if (SUCCEEDED(hr))
{
IWineD3DDevice_GetParent(wined3d_device, (IUnknown **)ppDevice);
IWineD3DDevice_Release(wined3d_device);
}
LeaveCriticalSection(&d3d9_cs);
return hr;
}
......
......@@ -68,8 +68,21 @@ static ULONG WINAPI IDirect3DVolumeTexture9Impl_Release(LPDIRECT3DVOLUMETEXTURE9
/* IDirect3DVolumeTexture9 IDirect3DResource9 Interface follow: */
static HRESULT WINAPI IDirect3DVolumeTexture9Impl_GetDevice(LPDIRECT3DVOLUMETEXTURE9 iface, IDirect3DDevice9** ppDevice) {
IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface;
IWineD3DDevice *wined3d_device;
HRESULT hr;
TRACE("(%p) Relay\n", This);
return IDirect3DResource9Impl_GetDevice((LPDIRECT3DRESOURCE9) This, ppDevice);
EnterCriticalSection(&d3d9_cs);
hr = IWineD3DStateBlock_GetDevice(This->wineD3DVolumeTexture, &wined3d_device);
if (SUCCEEDED(hr))
{
IWineD3DDevice_GetParent(wined3d_device, (IUnknown **)ppDevice);
IWineD3DDevice_Release(wined3d_device);
}
LeaveCriticalSection(&d3d9_cs);
return hr;
}
static HRESULT WINAPI IDirect3DVolumeTexture9Impl_SetPrivateData(LPDIRECT3DVOLUMETEXTURE9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
......
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