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 TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppobj);
34 if (IsEqualGUID(riid, &IID_IUnknown)
35 || IsEqualGUID(riid, &IID_IWineD3DResource)) {
36 IUnknown_AddRef(iface);
43 ULONG WINAPI IWineD3DResourceImpl_AddRef(IWineD3DResource *iface) {
44 IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface;
45 ULONG ref = InterlockedIncrement(&This->resource.ref);
46 TRACE("(%p) : AddRef increasing from %ld\n", This, ref - 1);
50 ULONG WINAPI IWineD3DResourceImpl_Release(IWineD3DResource *iface) {
51 IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface;
52 ULONG ref = InterlockedDecrement(&This->resource.ref);
53 TRACE("(%p) : Releasing from %ld\n", This, ref + 1);
55 IWineD3DDevice_Release((IWineD3DDevice *)This->resource.wineD3DDevice);
56 HeapFree(GetProcessHeap(), 0, This);
61 /* IDirect3DResource Interface follow: */
62 HRESULT WINAPI IWineD3DResourceImpl_GetDevice(IWineD3DResource *iface, IWineD3DDevice** ppDevice) {
63 IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface;
64 TRACE("(%p) : returning %p\n", This, This->resource.wineD3DDevice);
65 *ppDevice = (IWineD3DDevice *) This->resource.wineD3DDevice;
66 IWineD3DDevice_AddRef(*ppDevice);
70 /* Private Date is not implemented yet */
71 HRESULT WINAPI IWineD3DResourceImpl_SetPrivateData(IWineD3DResource *iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
72 IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface;
73 FIXME("(%p) : stub\n", This); return D3D_OK;
75 HRESULT WINAPI IWineD3DResourceImpl_GetPrivateData(IWineD3DResource *iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
76 IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface;
77 FIXME("(%p) : stub\n", This); return D3D_OK;
79 HRESULT WINAPI IWineD3DResourceImpl_FreePrivateData(IWineD3DResource *iface, REFGUID refguid) {
80 IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface;
81 FIXME("(%p) : stub\n", This); return D3D_OK;
84 /* Priority support is not implemented yet */
85 DWORD WINAPI IWineD3DResourceImpl_SetPriority(IWineD3DResource *iface, DWORD PriorityNew) {
86 IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface;
87 FIXME("(%p) : stub\n", This);
90 DWORD WINAPI IWineD3DResourceImpl_GetPriority(IWineD3DResource *iface) {
91 IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface;
92 FIXME("(%p) : stub\n", This);
96 /* Preloading of resources is not supported yet */
97 void WINAPI IWineD3DResourceImpl_PreLoad(IWineD3DResource *iface) {
98 IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface;
99 FIXME("(%p) : stub\n", This);
102 D3DRESOURCETYPE WINAPI IWineD3DResourceImpl_GetType(IWineD3DResource *iface) {
103 IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface;
104 TRACE("(%p) : returning %d\n", This, This->resource.resourceType);
105 return This->resource.resourceType;
108 HRESULT WINAPI IWineD3DResourceImpl_GetParent(IWineD3DResource *iface, IUnknown **pParent) {
109 IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface;
110 IUnknown_AddRef(This->resource.parent);
111 *pParent = This->resource.parent;
116 IWineD3DResourceVtbl IWineD3DResource_Vtbl =
118 IWineD3DResourceImpl_QueryInterface,
119 IWineD3DResourceImpl_AddRef,
120 IWineD3DResourceImpl_Release,
121 IWineD3DResourceImpl_GetParent,
122 IWineD3DResourceImpl_GetDevice,
123 IWineD3DResourceImpl_SetPrivateData,
124 IWineD3DResourceImpl_GetPrivateData,
125 IWineD3DResourceImpl_FreePrivateData,
126 IWineD3DResourceImpl_SetPriority,
127 IWineD3DResourceImpl_GetPriority,
128 IWineD3DResourceImpl_PreLoad,
129 IWineD3DResourceImpl_GetType