2 * IDirect3DTexture9 implementation
4 * Copyright 2002-2003 Jason Edmeades
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.
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.
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
24 #define NONAMELESSUNION
25 #define NONAMELESSSTRUCT
32 #include "wine/debug.h"
34 #include "d3d9_private.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(d3d);
38 /* IDirect3DTexture9 IUnknown parts follow: */
39 HRESULT WINAPI IDirect3DTexture9Impl_QueryInterface(LPDIRECT3DTEXTURE9 iface, REFIID riid, LPVOID* ppobj) {
40 ICOM_THIS(IDirect3DTexture9Impl,iface);
42 if (IsEqualGUID(riid, &IID_IUnknown)
43 || IsEqualGUID(riid, &IID_IDirect3DResource9)
44 || IsEqualGUID(riid, &IID_IDirect3DBaseTexture9)
45 || IsEqualGUID(riid, &IID_IDirect3DTexture9)) {
46 IDirect3DTexture9Impl_AddRef(iface);
51 WARN("(%p)->(%s,%p) not found\n", This, debugstr_guid(riid), ppobj);
55 ULONG WINAPI IDirect3DTexture9Impl_AddRef(LPDIRECT3DTEXTURE9 iface) {
56 ICOM_THIS(IDirect3DTexture9Impl,iface);
57 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
61 ULONG WINAPI IDirect3DTexture9Impl_Release(LPDIRECT3DTEXTURE9 iface) {
62 ICOM_THIS(IDirect3DTexture9Impl,iface);
63 ULONG ref = --This->ref;
66 TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
68 for (i = 0; i < This->levels; i++) {
69 if (NULL != This->surfaces[i]) {
70 TRACE("(%p) : Releasing surface %p\n", This, This->surfaces[i]);
71 IDirect3DSurface9Impl_Release((LPDIRECT3DSURFACE9) This->surfaces[i]);
74 HeapFree(GetProcessHeap(), 0, This);
79 /* IDirect3DTexture9 IDirect3DResource9 Interface follow: */
80 HRESULT WINAPI IDirect3DTexture9Impl_GetDevice(LPDIRECT3DTEXTURE9 iface, IDirect3DDevice9** ppDevice) {
81 ICOM_THIS(IDirect3DTexture9Impl,iface);
82 return IDirect3DResource9Impl_GetDevice((LPDIRECT3DRESOURCE9) This, ppDevice);
85 HRESULT WINAPI IDirect3DTexture9Impl_SetPrivateData(LPDIRECT3DTEXTURE9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
86 ICOM_THIS(IDirect3DTexture9Impl,iface);
87 FIXME("(%p) : stub\n", This);
91 HRESULT WINAPI IDirect3DTexture9Impl_GetPrivateData(LPDIRECT3DTEXTURE9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
92 ICOM_THIS(IDirect3DTexture9Impl,iface);
93 FIXME("(%p) : stub\n", This);
97 HRESULT WINAPI IDirect3DTexture9Impl_FreePrivateData(LPDIRECT3DTEXTURE9 iface, REFGUID refguid) {
98 ICOM_THIS(IDirect3DTexture9Impl,iface);
99 FIXME("(%p) : stub\n", This);
103 DWORD WINAPI IDirect3DTexture9Impl_SetPriority(LPDIRECT3DTEXTURE9 iface, DWORD PriorityNew) {
104 ICOM_THIS(IDirect3DTexture9Impl,iface);
105 return IDirect3DResource9Impl_SetPriority((LPDIRECT3DRESOURCE9) This, PriorityNew);
108 DWORD WINAPI IDirect3DTexture9Impl_GetPriority(LPDIRECT3DTEXTURE9 iface) {
109 ICOM_THIS(IDirect3DTexture9Impl,iface);
110 return IDirect3DResource9Impl_GetPriority((LPDIRECT3DRESOURCE9) This);
113 void WINAPI IDirect3DTexture9Impl_PreLoad(LPDIRECT3DTEXTURE9 iface) {
114 ICOM_THIS(IDirect3DTexture9Impl,iface);
115 FIXME("(%p) : stub\n", This);
119 D3DRESOURCETYPE WINAPI IDirect3DTexture9Impl_GetType(LPDIRECT3DTEXTURE9 iface) {
120 ICOM_THIS(IDirect3DTexture9Impl,iface);
121 return IDirect3DResource9Impl_GetType((LPDIRECT3DRESOURCE9) This);
124 /* IDirect3DTexture9 IDirect3DBaseTexture9 Interface follow: */
125 DWORD WINAPI IDirect3DTexture9Impl_SetLOD(LPDIRECT3DTEXTURE9 iface, DWORD LODNew) {
126 ICOM_THIS(IDirect3DTexture9Impl,iface);
127 return IDirect3DBaseTexture9Impl_SetLOD((LPDIRECT3DBASETEXTURE9) This, LODNew);
130 DWORD WINAPI IDirect3DTexture9Impl_GetLOD(LPDIRECT3DTEXTURE9 iface) {
131 ICOM_THIS(IDirect3DTexture9Impl,iface);
132 return IDirect3DBaseTexture9Impl_GetLOD((LPDIRECT3DBASETEXTURE9) This);
135 DWORD WINAPI IDirect3DTexture9Impl_GetLevelCount(LPDIRECT3DTEXTURE9 iface) {
136 ICOM_THIS(IDirect3DTexture9Impl,iface);
137 return IDirect3DBaseTexture9Impl_GetLevelCount((LPDIRECT3DBASETEXTURE9) This);
140 HRESULT WINAPI IDirect3DTexture9Impl_SetAutoGenFilterType(LPDIRECT3DTEXTURE9 iface, D3DTEXTUREFILTERTYPE FilterType) {
141 ICOM_THIS(IDirect3DTexture9Impl,iface);
142 return IDirect3DBaseTexture9Impl_SetAutoGenFilterType((LPDIRECT3DBASETEXTURE9) This, FilterType);
145 D3DTEXTUREFILTERTYPE WINAPI IDirect3DTexture9Impl_GetAutoGenFilterType(LPDIRECT3DTEXTURE9 iface) {
146 ICOM_THIS(IDirect3DTexture9Impl,iface);
147 return IDirect3DBaseTexture9Impl_GetAutoGenFilterType((LPDIRECT3DBASETEXTURE9) This);
150 void WINAPI IDirect3DTexture9Impl_GenerateMipSubLevels(LPDIRECT3DTEXTURE9 iface) {
151 ICOM_THIS(IDirect3DTexture9Impl,iface);
152 FIXME("(%p) : stub\n", This);
156 /* IDirect3DTexture9 Interface follow: */
157 HRESULT WINAPI IDirect3DTexture9Impl_GetLevelDesc(LPDIRECT3DTEXTURE9 iface, UINT Level, D3DSURFACE_DESC* pDesc) {
158 ICOM_THIS(IDirect3DTexture9Impl,iface);
160 if (Level < This->levels) {
161 TRACE("(%p) Level (%d)\n", This, Level);
162 return IDirect3DSurface9Impl_GetDesc((LPDIRECT3DSURFACE9) This->surfaces[Level], pDesc);
164 FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->levels);
165 return D3DERR_INVALIDCALL;
170 HRESULT WINAPI IDirect3DTexture9Impl_GetSurfaceLevel(LPDIRECT3DTEXTURE9 iface, UINT Level, IDirect3DSurface9** ppSurfaceLevel) {
171 ICOM_THIS(IDirect3DTexture9Impl,iface);
172 *ppSurfaceLevel = (LPDIRECT3DSURFACE9) This->surfaces[Level];
173 IDirect3DSurface9Impl_AddRef((LPDIRECT3DSURFACE9) This->surfaces[Level]);
174 TRACE("(%p) : returning %p for level %d\n", This, *ppSurfaceLevel, Level);
178 HRESULT WINAPI IDirect3DTexture9Impl_LockRect(LPDIRECT3DTEXTURE9 iface, UINT Level,D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) {
180 ICOM_THIS(IDirect3DTexture9Impl,iface);
181 if (Level < This->levels) {
183 * Not dirtified while Surfaces don't notify dirtification
184 * This->impl.parent.Dirty = TRUE;
186 hr = IDirect3DSurface9Impl_LockRect((LPDIRECT3DSURFACE9) This->surfaces[Level], pLockedRect, pRect, Flags);
187 TRACE("(%p) Level (%d) success(%lu)\n", This, Level, hr);
189 FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->levels);
190 return D3DERR_INVALIDCALL;
195 HRESULT WINAPI IDirect3DTexture9Impl_UnlockRect(LPDIRECT3DTEXTURE9 iface, UINT Level) {
197 ICOM_THIS(IDirect3DTexture9Impl,iface);
198 if (Level < This->levels) {
199 hr = IDirect3DSurface9Impl_UnlockRect((LPDIRECT3DSURFACE9) This->surfaces[Level]);
200 TRACE("(%p) Level (%d) success(%lu)\n", This, Level, hr);
202 FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->levels);
203 return D3DERR_INVALIDCALL;
208 HRESULT WINAPI IDirect3DTexture9Impl_AddDirtyRect(LPDIRECT3DTEXTURE9 iface, CONST RECT* pDirtyRect) {
209 ICOM_THIS(IDirect3DTexture9Impl,iface);
210 FIXME("(%p) : stub\n", This);
216 ICOM_VTABLE(IDirect3DTexture9) Direct3DTexture9_Vtbl =
218 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
219 IDirect3DTexture9Impl_QueryInterface,
220 IDirect3DTexture9Impl_AddRef,
221 IDirect3DTexture9Impl_Release,
222 IDirect3DTexture9Impl_GetDevice,
223 IDirect3DTexture9Impl_SetPrivateData,
224 IDirect3DTexture9Impl_GetPrivateData,
225 IDirect3DTexture9Impl_FreePrivateData,
226 IDirect3DTexture9Impl_SetPriority,
227 IDirect3DTexture9Impl_GetPriority,
228 IDirect3DTexture9Impl_PreLoad,
229 IDirect3DTexture9Impl_GetType,
230 IDirect3DTexture9Impl_SetLOD,
231 IDirect3DTexture9Impl_GetLOD,
232 IDirect3DTexture9Impl_GetLevelCount,
233 IDirect3DTexture9Impl_SetAutoGenFilterType,
234 IDirect3DTexture9Impl_GetAutoGenFilterType,
235 IDirect3DTexture9Impl_GenerateMipSubLevels,
236 IDirect3DTexture9Impl_GetLevelDesc,
237 IDirect3DTexture9Impl_GetSurfaceLevel,
238 IDirect3DTexture9Impl_LockRect,
239 IDirect3DTexture9Impl_UnlockRect,
240 IDirect3DTexture9Impl_AddDirtyRect
244 /* IDirect3DDevice9 IDirect3DTexture9 Methods follow: */
245 HRESULT WINAPI IDirect3DDevice9Impl_CreateTexture(LPDIRECT3DDEVICE9 iface, UINT Width, UINT Height, UINT Levels, DWORD Usage,
246 D3DFORMAT Format, D3DPOOL Pool, IDirect3DTexture9** ppTexture, HANDLE* pSharedHandle) {
247 ICOM_THIS(IDirect3DDevice9Impl,iface);
248 FIXME("(%p) : stub\n", This);