2 * IWineD3DResource Implementation
4 * Copyright 2002-2004 Jason Edmeades
5 * Copyright 2003-2004 Raphael Junqueira
6 * Copyright 2004 Christian Costa
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include "wined3d_private.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(d3d);
27 #define GLINFO_LOCATION ((IWineD3DImpl *)(((IWineD3DDeviceImpl *)This->resource.wineD3DDevice)->wineD3D))->gl_info
29 /* IDirect3DResource IUnknown parts follow: */
30 HRESULT WINAPI IWineD3DResourceImpl_QueryInterface(IWineD3DResource *iface, REFIID riid, LPVOID *ppobj)
32 IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface;
33 WARN("(%p)->(%s,%p) should not be called\n",This,debugstr_guid(riid),ppobj);
37 ULONG WINAPI IWineD3DResourceImpl_AddRef(IWineD3DResource *iface) {
38 IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface;
39 TRACE("(%p) : AddRef increasing from %ld\n", This, This->resource.ref);
40 return InterlockedIncrement(&This->resource.ref);
43 ULONG WINAPI IWineD3DResourceImpl_Release(IWineD3DResource *iface) {
44 IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface;
46 TRACE("(%p) : Releasing from %ld\n", This, This->resource.ref);
47 ref = InterlockedDecrement(&This->resource.ref);
49 IWineD3DDevice_Release((IWineD3DDevice *)This->resource.wineD3DDevice);
50 HeapFree(GetProcessHeap(), 0, This);
55 /* IDirect3DResource Interface follow: */
56 HRESULT WINAPI IWineD3DResourceImpl_GetDevice(IWineD3DResource *iface, IWineD3DDevice** ppDevice) {
57 IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface;
58 TRACE("(%p) : returning %p\n", This, This->resource.wineD3DDevice);
59 *ppDevice = (IWineD3DDevice *) This->resource.wineD3DDevice;
60 IWineD3DDevice_AddRef(*ppDevice);
64 /* Private Date is not implemented yet */
65 HRESULT WINAPI IWineD3DResourceImpl_SetPrivateData(IWineD3DResource *iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
66 IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface;
67 FIXME("(%p) : stub\n", This); return D3D_OK;
69 HRESULT WINAPI IWineD3DResourceImpl_GetPrivateData(IWineD3DResource *iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
70 IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface;
71 FIXME("(%p) : stub\n", This); return D3D_OK;
73 HRESULT WINAPI IWineD3DResourceImpl_FreePrivateData(IWineD3DResource *iface, REFGUID refguid) {
74 IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface;
75 FIXME("(%p) : stub\n", This); return D3D_OK;
78 /* Priority support is not implemented yet */
79 DWORD WINAPI IWineD3DResourceImpl_SetPriority(IWineD3DResource *iface, DWORD PriorityNew) {
80 IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface;
81 FIXME("(%p) : stub\n", This);
84 DWORD WINAPI IWineD3DResourceImpl_GetPriority(IWineD3DResource *iface) {
85 IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface;
86 FIXME("(%p) : stub\n", This);
90 /* Preloading of resources is not supported yet */
91 void WINAPI IWineD3DResourceImpl_PreLoad(IWineD3DResource *iface) {
92 IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface;
93 FIXME("(%p) : stub\n", This);
96 D3DRESOURCETYPE WINAPI IWineD3DResourceImpl_GetType(IWineD3DResource *iface) {
97 IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface;
98 TRACE("(%p) : returning %d\n", This, This->resource.resourceType);
99 return This->resource.resourceType;
102 HRESULT WINAPI IWineD3DResourceImpl_GetParent(IWineD3DResource *iface, IUnknown **pParent) {
103 IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface;
104 IUnknown_AddRef(This->resource.parent);
105 *pParent = This->resource.parent;
110 IWineD3DResourceVtbl IWineD3DResource_Vtbl =
112 IWineD3DResourceImpl_QueryInterface,
113 IWineD3DResourceImpl_AddRef,
114 IWineD3DResourceImpl_Release,
115 IWineD3DResourceImpl_GetParent,
116 IWineD3DResourceImpl_GetDevice,
117 IWineD3DResourceImpl_SetPrivateData,
118 IWineD3DResourceImpl_GetPrivateData,
119 IWineD3DResourceImpl_FreePrivateData,
120 IWineD3DResourceImpl_SetPriority,
121 IWineD3DResourceImpl_GetPriority,
122 IWineD3DResourceImpl_PreLoad,
123 IWineD3DResourceImpl_GetType