- mor usefull debug functions debug_d3dusage and debug_d3ddevicetype
[wine] / dlls / d3d8 / resource.c
1 /*
2  * IDirect3DResource8 implementation
3  *
4  * Copyright 2002 Jason Edmeades
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20
21 #include "config.h"
22
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winuser.h"
26 #include "wingdi.h"
27 #include "wine/debug.h"
28
29 #include "d3d8_private.h"
30
31 WINE_DEFAULT_DEBUG_CHANNEL(d3d);
32
33 /* IDirect3DResource IUnknown parts follow: */
34 HRESULT WINAPI IDirect3DResource8Impl_QueryInterface(LPDIRECT3DRESOURCE8 iface,REFIID riid,LPVOID *ppobj)
35 {
36     ICOM_THIS(IDirect3DResource8Impl,iface);
37
38     if (IsEqualGUID(riid, &IID_IUnknown)
39         || IsEqualGUID(riid, &IID_IDirect3DResource8)) {
40         IDirect3DResource8Impl_AddRef(iface);
41         *ppobj = This;
42         return D3D_OK;
43     }
44
45     WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
46     return E_NOINTERFACE;
47 }
48
49 ULONG WINAPI IDirect3DResource8Impl_AddRef(LPDIRECT3DRESOURCE8 iface) {
50     ICOM_THIS(IDirect3DResource8Impl,iface);
51     TRACE("(%p) : AddRef from %ld\n", This, This->ref);
52     return ++(This->ref);
53 }
54
55 ULONG WINAPI IDirect3DResource8Impl_Release(LPDIRECT3DRESOURCE8 iface) {
56     ICOM_THIS(IDirect3DResource8Impl,iface);
57     ULONG ref = --This->ref;
58     TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
59     if (ref == 0)
60         HeapFree(GetProcessHeap(), 0, This);
61     return ref;
62 }
63
64 /* IDirect3DResource Interface follow: */
65 HRESULT  WINAPI        IDirect3DResource8Impl_GetDevice(LPDIRECT3DRESOURCE8 iface, IDirect3DDevice8** ppDevice) {
66     ICOM_THIS(IDirect3DResource8Impl,iface);
67     TRACE("(%p) : returning %p\n", This, This->Device);
68     *ppDevice = (LPDIRECT3DDEVICE8) This->Device;
69     IDirect3DDevice8Impl_AddRef(*ppDevice);
70     return D3D_OK;
71 }
72 HRESULT  WINAPI        IDirect3DResource8Impl_SetPrivateData(LPDIRECT3DRESOURCE8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
73     ICOM_THIS(IDirect3DResource8Impl,iface);
74     FIXME("(%p) : stub\n", This);    return D3D_OK;
75 }
76 HRESULT  WINAPI        IDirect3DResource8Impl_GetPrivateData(LPDIRECT3DRESOURCE8 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
77     ICOM_THIS(IDirect3DResource8Impl,iface);
78     FIXME("(%p) : stub\n", This);    return D3D_OK;
79 }
80 HRESULT  WINAPI        IDirect3DResource8Impl_FreePrivateData(LPDIRECT3DRESOURCE8 iface, REFGUID refguid) {
81     ICOM_THIS(IDirect3DResource8Impl,iface);
82     FIXME("(%p) : stub\n", This);    return D3D_OK;
83 }
84 DWORD    WINAPI        IDirect3DResource8Impl_SetPriority(LPDIRECT3DRESOURCE8 iface, DWORD PriorityNew) {
85     ICOM_THIS(IDirect3DResource8Impl,iface);
86     FIXME("(%p) : stub\n", This);
87     return 0;
88 }
89 DWORD    WINAPI        IDirect3DResource8Impl_GetPriority(LPDIRECT3DRESOURCE8 iface) {
90     ICOM_THIS(IDirect3DResource8Impl,iface);
91     FIXME("(%p) : stub\n", This);
92     return 0;
93 }
94 void     WINAPI        IDirect3DResource8Impl_PreLoad(LPDIRECT3DRESOURCE8 iface) {
95     ICOM_THIS(IDirect3DResource8Impl,iface);
96     FIXME("(%p) : stub\n", This);
97 }
98 D3DRESOURCETYPE WINAPI IDirect3DResource8Impl_GetType(LPDIRECT3DRESOURCE8 iface) {
99     ICOM_THIS(IDirect3DResource8Impl,iface);
100     TRACE("(%p) : returning %d\n", This, This->ResourceType);
101     return This->ResourceType;
102 }
103
104 ICOM_VTABLE(IDirect3DResource8) Direct3DResource8_Vtbl =
105 {
106     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
107     IDirect3DResource8Impl_QueryInterface,
108     IDirect3DResource8Impl_AddRef,
109     IDirect3DResource8Impl_Release,
110     IDirect3DResource8Impl_GetDevice,
111     IDirect3DResource8Impl_SetPrivateData,
112     IDirect3DResource8Impl_GetPrivateData,
113     IDirect3DResource8Impl_FreePrivateData,
114     IDirect3DResource8Impl_SetPriority,
115     IDirect3DResource8Impl_GetPriority,
116     IDirect3DResource8Impl_PreLoad,
117     IDirect3DResource8Impl_GetType
118 };