- CoSetState info should be thread local.
[wine] / dlls / d3d9 / basetexture.c
1 /*
2  * IDirect3DBaseTexture9 implementation
3  *
4  * Copyright 2002-2003 Jason Edmeades
5  *                     Raphael Junqueira
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  */
21
22 #include "config.h"
23
24 #include <stdarg.h>
25
26 #define NONAMELESSUNION
27 #define NONAMELESSSTRUCT
28 #include "windef.h"
29 #include "winbase.h"
30 #include "winuser.h"
31 #include "wingdi.h"
32 #include "wine/debug.h"
33
34 #include "d3d9_private.h"
35
36 WINE_DEFAULT_DEBUG_CHANNEL(d3d);
37
38 /* IDirect3DBaseTexture9 IUnknown parts follow: */
39 HRESULT WINAPI IDirect3DBaseTexture9Impl_QueryInterface(LPDIRECT3DBASETEXTURE9 iface, REFIID riid, LPVOID* ppobj) {
40     ICOM_THIS(IDirect3DBaseTexture9Impl,iface);
41
42     if (IsEqualGUID(riid, &IID_IUnknown)
43         || IsEqualGUID(riid, &IID_IDirect3DResource9)
44         || IsEqualGUID(riid, &IID_IDirect3DBaseTexture9)) {
45         IDirect3DBaseTexture9Impl_AddRef(iface);
46         *ppobj = This;
47         return D3D_OK;
48     }
49
50     WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
51     return E_NOINTERFACE;
52 }
53
54 ULONG WINAPI IDirect3DBaseTexture9Impl_AddRef(LPDIRECT3DBASETEXTURE9 iface) {
55     ICOM_THIS(IDirect3DBaseTexture9Impl,iface);
56     TRACE("(%p) : AddRef from %ld\n", This, This->ref);
57     return ++(This->ref);
58 }
59
60 ULONG WINAPI IDirect3DBaseTexture9Impl_Release(LPDIRECT3DBASETEXTURE9 iface) {
61     ICOM_THIS(IDirect3DBaseTexture9Impl,iface);
62     ULONG ref = --This->ref;
63     TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
64     if (ref == 0)
65         HeapFree(GetProcessHeap(), 0, This);
66     return ref;
67 }
68
69 /* IDirect3DBaseTexture9 IDirect3DResource9 Interface follow: */
70 HRESULT WINAPI IDirect3DBaseTexture9Impl_GetDevice(LPDIRECT3DBASETEXTURE9 iface, IDirect3DDevice9** ppDevice) {
71     ICOM_THIS(IDirect3DBaseTexture9Impl,iface);
72     return IDirect3DResource9Impl_GetDevice((LPDIRECT3DRESOURCE9) This, ppDevice);
73 }
74
75 HRESULT WINAPI IDirect3DBaseTexture9Impl_SetPrivateData(LPDIRECT3DBASETEXTURE9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
76     ICOM_THIS(IDirect3DBaseTexture9Impl,iface);
77     FIXME("(%p) : stub\n", This);
78     return D3D_OK;
79 }
80
81 HRESULT WINAPI IDirect3DBaseTexture9Impl_GetPrivateData(LPDIRECT3DBASETEXTURE9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
82     ICOM_THIS(IDirect3DBaseTexture9Impl,iface);
83     FIXME("(%p) : stub\n", This);
84     return D3D_OK;
85 }
86
87 HRESULT WINAPI IDirect3DBaseTexture9Impl_FreePrivateData(LPDIRECT3DBASETEXTURE9 iface, REFGUID refguid) {
88     ICOM_THIS(IDirect3DBaseTexture9Impl,iface);
89     FIXME("(%p) : stub\n", This);
90     return D3D_OK;
91 }
92
93 DWORD WINAPI IDirect3DBaseTexture9Impl_SetPriority(LPDIRECT3DBASETEXTURE9 iface, DWORD PriorityNew) {
94     ICOM_THIS(IDirect3DBaseTexture9Impl,iface);
95     return IDirect3DResource9Impl_SetPriority((LPDIRECT3DRESOURCE9) This, PriorityNew);
96 }
97
98 DWORD WINAPI IDirect3DBaseTexture9Impl_GetPriority(LPDIRECT3DBASETEXTURE9 iface) {
99     ICOM_THIS(IDirect3DBaseTexture9Impl,iface);
100     return IDirect3DResource9Impl_GetPriority((LPDIRECT3DRESOURCE9) This);
101 }
102
103 void WINAPI IDirect3DBaseTexture9Impl_PreLoad(LPDIRECT3DBASETEXTURE9 iface) {
104     ICOM_THIS(IDirect3DBaseTexture9Impl,iface);
105     FIXME("(%p) : stub\n", This);
106     return ;
107 }
108
109 D3DRESOURCETYPE WINAPI IDirect3DBaseTexture9Impl_GetType(LPDIRECT3DBASETEXTURE9 iface) {
110     ICOM_THIS(IDirect3DBaseTexture9Impl,iface);
111     return IDirect3DResource9Impl_GetType((LPDIRECT3DRESOURCE9) This);
112 }
113
114 /* IDirect3DBaseTexture9 Interface follow: */
115 DWORD  WINAPI IDirect3DBaseTexture9Impl_SetLOD(LPDIRECT3DBASETEXTURE9 iface, DWORD LODNew) {
116     ICOM_THIS(IDirect3DBaseTexture9Impl,iface);
117     FIXME("(%p) : stub\n", This);
118     return 0;
119 }
120
121 DWORD WINAPI IDirect3DBaseTexture9Impl_GetLOD(LPDIRECT3DBASETEXTURE9 iface) {
122     ICOM_THIS(IDirect3DBaseTexture9Impl,iface);
123     FIXME("(%p) : stub\n", This);
124     return 0;
125 }
126
127 DWORD WINAPI IDirect3DBaseTexture9Impl_GetLevelCount(LPDIRECT3DBASETEXTURE9 iface) {
128     ICOM_THIS(IDirect3DBaseTexture9Impl,iface);
129     FIXME("(%p) : stub\n", This);    
130     return 0;
131 }
132
133 HRESULT WINAPI IDirect3DBaseTexture9Impl_SetAutoGenFilterType(LPDIRECT3DBASETEXTURE9 iface, D3DTEXTUREFILTERTYPE FilterType) {
134   ICOM_THIS(IDirect3DBaseTexture9Impl,iface);
135   FIXME("(%p) : stub\n", This);
136   return D3D_OK;
137 }
138
139 D3DTEXTUREFILTERTYPE WINAPI IDirect3DBaseTexture9Impl_GetAutoGenFilterType(LPDIRECT3DBASETEXTURE9 iface) {
140   ICOM_THIS(IDirect3DBaseTexture9Impl,iface);
141   FIXME("(%p) : stub\n", This);
142   return D3DTEXF_NONE;
143 }
144
145 void WINAPI IDirect3DBaseTexture9Impl_GenerateMipSubLevels(LPDIRECT3DBASETEXTURE9 iface) {
146   ICOM_THIS(IDirect3DBaseTexture9Impl,iface);
147   FIXME("(%p) : stub\n", This);
148   return ;
149 }
150
151
152 ICOM_VTABLE(IDirect3DBaseTexture9) Direct3DBaseTexture9_Vtbl =
153 {
154     ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
155     IDirect3DBaseTexture9Impl_QueryInterface,
156     IDirect3DBaseTexture9Impl_AddRef,
157     IDirect3DBaseTexture9Impl_Release,
158     IDirect3DBaseTexture9Impl_GetDevice,
159     IDirect3DBaseTexture9Impl_SetPrivateData,
160     IDirect3DBaseTexture9Impl_GetPrivateData,
161     IDirect3DBaseTexture9Impl_FreePrivateData,
162     IDirect3DBaseTexture9Impl_SetPriority,
163     IDirect3DBaseTexture9Impl_GetPriority,
164     IDirect3DBaseTexture9Impl_PreLoad,
165     IDirect3DBaseTexture9Impl_GetType,
166     IDirect3DBaseTexture9Impl_SetLOD,
167     IDirect3DBaseTexture9Impl_GetLOD,
168     IDirect3DBaseTexture9Impl_GetLevelCount,
169     IDirect3DBaseTexture9Impl_SetAutoGenFilterType,
170     IDirect3DBaseTexture9Impl_GetAutoGenFilterType,
171     IDirect3DBaseTexture9Impl_GenerateMipSubLevels   
172 };