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
30 #include "wine/debug.h"
32 #include "d3d9_private.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(d3d);
36 /* IDirect3DTexture9 IUnknown parts follow: */
37 HRESULT WINAPI IDirect3DTexture9Impl_QueryInterface(LPDIRECT3DTEXTURE9 iface, REFIID riid, LPVOID* ppobj) {
38 ICOM_THIS(IDirect3DTexture9Impl,iface);
40 if (IsEqualGUID(riid, &IID_IUnknown)
41 || IsEqualGUID(riid, &IID_IDirect3DResource9)
42 || IsEqualGUID(riid, &IID_IDirect3DBaseTexture9)
43 || IsEqualGUID(riid, &IID_IDirect3DTexture9)) {
44 IDirect3DTexture9Impl_AddRef(iface);
49 WARN("(%p)->(%s,%p) not found\n", This, debugstr_guid(riid), ppobj);
53 ULONG WINAPI IDirect3DTexture9Impl_AddRef(LPDIRECT3DTEXTURE9 iface) {
54 ICOM_THIS(IDirect3DTexture9Impl,iface);
55 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
59 ULONG WINAPI IDirect3DTexture9Impl_Release(LPDIRECT3DTEXTURE9 iface) {
60 ICOM_THIS(IDirect3DTexture9Impl,iface);
61 ULONG ref = --This->ref;
64 TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
66 for (i = 0; i < This->levels; i++) {
67 if (NULL != This->surfaces[i]) {
68 TRACE("(%p) : Releasing surface %p\n", This, This->surfaces[i]);
69 IDirect3DSurface9Impl_Release((LPDIRECT3DSURFACE9) This->surfaces[i]);
72 HeapFree(GetProcessHeap(), 0, This);
77 /* IDirect3DTexture9 IDirect3DResource9 Interface follow: */
78 HRESULT WINAPI IDirect3DTexture9Impl_GetDevice(LPDIRECT3DTEXTURE9 iface, IDirect3DDevice9** ppDevice) {
79 ICOM_THIS(IDirect3DTexture9Impl,iface);
80 return IDirect3DResource9Impl_GetDevice((LPDIRECT3DRESOURCE9) This, ppDevice);
83 HRESULT WINAPI IDirect3DTexture9Impl_SetPrivateData(LPDIRECT3DTEXTURE9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
84 ICOM_THIS(IDirect3DTexture9Impl,iface);
85 FIXME("(%p) : stub\n", This);
89 HRESULT WINAPI IDirect3DTexture9Impl_GetPrivateData(LPDIRECT3DTEXTURE9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
90 ICOM_THIS(IDirect3DTexture9Impl,iface);
91 FIXME("(%p) : stub\n", This);
95 HRESULT WINAPI IDirect3DTexture9Impl_FreePrivateData(LPDIRECT3DTEXTURE9 iface, REFGUID refguid) {
96 ICOM_THIS(IDirect3DTexture9Impl,iface);
97 FIXME("(%p) : stub\n", This);
101 DWORD WINAPI IDirect3DTexture9Impl_SetPriority(LPDIRECT3DTEXTURE9 iface, DWORD PriorityNew) {
102 ICOM_THIS(IDirect3DTexture9Impl,iface);
103 return IDirect3DResource9Impl_SetPriority((LPDIRECT3DRESOURCE9) This, PriorityNew);
106 DWORD WINAPI IDirect3DTexture9Impl_GetPriority(LPDIRECT3DTEXTURE9 iface) {
107 ICOM_THIS(IDirect3DTexture9Impl,iface);
108 return IDirect3DResource9Impl_GetPriority((LPDIRECT3DRESOURCE9) This);
111 void WINAPI IDirect3DTexture9Impl_PreLoad(LPDIRECT3DTEXTURE9 iface) {
112 ICOM_THIS(IDirect3DTexture9Impl,iface);
113 FIXME("(%p) : stub\n", This);
117 D3DRESOURCETYPE WINAPI IDirect3DTexture9Impl_GetType(LPDIRECT3DTEXTURE9 iface) {
118 ICOM_THIS(IDirect3DTexture9Impl,iface);
119 return IDirect3DResource9Impl_GetType((LPDIRECT3DRESOURCE9) This);
122 /* IDirect3DTexture9 IDirect3DBaseTexture9 Interface follow: */
123 DWORD WINAPI IDirect3DTexture9Impl_SetLOD(LPDIRECT3DTEXTURE9 iface, DWORD LODNew) {
124 ICOM_THIS(IDirect3DTexture9Impl,iface);
125 return IDirect3DBaseTexture9Impl_SetLOD((LPDIRECT3DBASETEXTURE9) This, LODNew);
128 DWORD WINAPI IDirect3DTexture9Impl_GetLOD(LPDIRECT3DTEXTURE9 iface) {
129 ICOM_THIS(IDirect3DTexture9Impl,iface);
130 return IDirect3DBaseTexture9Impl_GetLOD((LPDIRECT3DBASETEXTURE9) This);
133 DWORD WINAPI IDirect3DTexture9Impl_GetLevelCount(LPDIRECT3DTEXTURE9 iface) {
134 ICOM_THIS(IDirect3DTexture9Impl,iface);
135 return IDirect3DBaseTexture9Impl_GetLevelCount((LPDIRECT3DBASETEXTURE9) This);
138 HRESULT WINAPI IDirect3DTexture9Impl_SetAutoGenFilterType(LPDIRECT3DTEXTURE9 iface, D3DTEXTUREFILTERTYPE FilterType) {
139 ICOM_THIS(IDirect3DTexture9Impl,iface);
140 return IDirect3DBaseTexture9Impl_SetAutoGenFilterType((LPDIRECT3DBASETEXTURE9) This, FilterType);
143 D3DTEXTUREFILTERTYPE WINAPI IDirect3DTexture9Impl_GetAutoGenFilterType(LPDIRECT3DTEXTURE9 iface) {
144 ICOM_THIS(IDirect3DTexture9Impl,iface);
145 return IDirect3DBaseTexture9Impl_GetAutoGenFilterType((LPDIRECT3DBASETEXTURE9) This);
148 void WINAPI IDirect3DTexture9Impl_GenerateMipSubLevels(LPDIRECT3DTEXTURE9 iface) {
149 ICOM_THIS(IDirect3DTexture9Impl,iface);
150 FIXME("(%p) : stub\n", This);
154 /* IDirect3DTexture9 Interface follow: */
155 HRESULT WINAPI IDirect3DTexture9Impl_GetLevelDesc(LPDIRECT3DTEXTURE9 iface, UINT Level, D3DSURFACE_DESC* pDesc) {
156 ICOM_THIS(IDirect3DTexture9Impl,iface);
158 if (Level < This->levels) {
159 TRACE("(%p) Level (%d)\n", This, Level);
160 return IDirect3DSurface9Impl_GetDesc((LPDIRECT3DSURFACE9) This->surfaces[Level], pDesc);
162 FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->levels);
163 return D3DERR_INVALIDCALL;
168 HRESULT WINAPI IDirect3DTexture9Impl_GetSurfaceLevel(LPDIRECT3DTEXTURE9 iface, UINT Level, IDirect3DSurface9** ppSurfaceLevel) {
169 ICOM_THIS(IDirect3DTexture9Impl,iface);
170 *ppSurfaceLevel = (LPDIRECT3DSURFACE9) This->surfaces[Level];
171 IDirect3DSurface9Impl_AddRef((LPDIRECT3DSURFACE9) This->surfaces[Level]);
172 TRACE("(%p) : returning %p for level %d\n", This, *ppSurfaceLevel, Level);
176 HRESULT WINAPI IDirect3DTexture9Impl_LockRect(LPDIRECT3DTEXTURE9 iface, UINT Level,D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) {
178 ICOM_THIS(IDirect3DTexture9Impl,iface);
179 if (Level < This->levels) {
181 * Not dirtified while Surfaces don't notify dirtification
182 * This->impl.parent.Dirty = TRUE;
184 hr = IDirect3DSurface9Impl_LockRect((LPDIRECT3DSURFACE9) This->surfaces[Level], pLockedRect, pRect, Flags);
185 TRACE("(%p) Level (%d) success(%lu)\n", This, Level, hr);
187 FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->levels);
188 return D3DERR_INVALIDCALL;
193 HRESULT WINAPI IDirect3DTexture9Impl_UnlockRect(LPDIRECT3DTEXTURE9 iface, UINT Level) {
195 ICOM_THIS(IDirect3DTexture9Impl,iface);
196 if (Level < This->levels) {
197 hr = IDirect3DSurface9Impl_UnlockRect((LPDIRECT3DSURFACE9) This->surfaces[Level]);
198 TRACE("(%p) Level (%d) success(%lu)\n", This, Level, hr);
200 FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->levels);
201 return D3DERR_INVALIDCALL;
206 HRESULT WINAPI IDirect3DTexture9Impl_AddDirtyRect(LPDIRECT3DTEXTURE9 iface, CONST RECT* pDirtyRect) {
207 ICOM_THIS(IDirect3DTexture9Impl,iface);
208 FIXME("(%p) : stub\n", This);
214 ICOM_VTABLE(IDirect3DTexture9) Direct3DTexture9_Vtbl =
216 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
217 IDirect3DTexture9Impl_QueryInterface,
218 IDirect3DTexture9Impl_AddRef,
219 IDirect3DTexture9Impl_Release,
220 IDirect3DTexture9Impl_GetDevice,
221 IDirect3DTexture9Impl_SetPrivateData,
222 IDirect3DTexture9Impl_GetPrivateData,
223 IDirect3DTexture9Impl_FreePrivateData,
224 IDirect3DTexture9Impl_SetPriority,
225 IDirect3DTexture9Impl_GetPriority,
226 IDirect3DTexture9Impl_PreLoad,
227 IDirect3DTexture9Impl_GetType,
228 IDirect3DTexture9Impl_SetLOD,
229 IDirect3DTexture9Impl_GetLOD,
230 IDirect3DTexture9Impl_GetLevelCount,
231 IDirect3DTexture9Impl_SetAutoGenFilterType,
232 IDirect3DTexture9Impl_GetAutoGenFilterType,
233 IDirect3DTexture9Impl_GenerateMipSubLevels,
234 IDirect3DTexture9Impl_GetLevelDesc,
235 IDirect3DTexture9Impl_GetSurfaceLevel,
236 IDirect3DTexture9Impl_LockRect,
237 IDirect3DTexture9Impl_UnlockRect,
238 IDirect3DTexture9Impl_AddDirtyRect
242 /* IDirect3DDevice9 IDirect3DTexture9 Methods follow: */
243 HRESULT WINAPI IDirect3DDevice9Impl_CreateTexture(LPDIRECT3DDEVICE9 iface, UINT Width, UINT Height, UINT Levels, DWORD Usage,
244 D3DFORMAT Format, D3DPOOL Pool, IDirect3DTexture9** ppTexture, HANDLE* pSharedHandle) {
245 ICOM_THIS(IDirect3DDevice9Impl,iface);
246 FIXME("(%p) : stub\n", This);