2 * IDirect3DCubeTexture9 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
26 #define NONAMELESSUNION
27 #define NONAMELESSSTRUCT
32 #include "wine/debug.h"
34 #include "d3d9_private.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(d3d);
38 /* IDirect3DCubeTexture9 IUnknown parts follow: */
39 HRESULT WINAPI IDirect3DCubeTexture9Impl_QueryInterface(LPDIRECT3DCUBETEXTURE9 iface, REFIID riid, LPVOID* ppobj) {
40 IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
42 if (IsEqualGUID(riid, &IID_IUnknown)
43 || IsEqualGUID(riid, &IID_IDirect3DResource9)
44 || IsEqualGUID(riid, &IID_IDirect3DBaseTexture9)
45 || IsEqualGUID(riid, &IID_IDirect3DCubeTexture9)) {
46 IDirect3DCubeTexture9Impl_AddRef(iface);
51 WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
55 ULONG WINAPI IDirect3DCubeTexture9Impl_AddRef(LPDIRECT3DCUBETEXTURE9 iface) {
56 IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
57 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
61 ULONG WINAPI IDirect3DCubeTexture9Impl_Release(LPDIRECT3DCUBETEXTURE9 iface) {
62 IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)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 for (j = 0; j < 6; j++) {
70 if (This->surfaces[j][i] != NULL) {
71 TRACE("(%p) : Releasing surface %p\n", This, This->surfaces[j][i]);
72 IDirect3DSurface9Impl_Release((LPDIRECT3DSURFACE9) This->surfaces[j][i]);
76 HeapFree(GetProcessHeap(), 0, This);
81 /* IDirect3DCubeTexture9 IDirect3DResource9 Interface follow: */
82 HRESULT WINAPI IDirect3DCubeTexture9Impl_GetDevice(LPDIRECT3DCUBETEXTURE9 iface, IDirect3DDevice9** ppDevice) {
83 IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
84 return IDirect3DResource9Impl_GetDevice((LPDIRECT3DRESOURCE9) This, ppDevice);
87 HRESULT WINAPI IDirect3DCubeTexture9Impl_SetPrivateData(LPDIRECT3DCUBETEXTURE9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
88 IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
89 FIXME("(%p) : stub\n", This);
93 HRESULT WINAPI IDirect3DCubeTexture9Impl_GetPrivateData(LPDIRECT3DCUBETEXTURE9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
94 IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
95 FIXME("(%p) : stub\n", This);
99 HRESULT WINAPI IDirect3DCubeTexture9Impl_FreePrivateData(LPDIRECT3DCUBETEXTURE9 iface, REFGUID refguid) {
100 IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
101 FIXME("(%p) : stub\n", This);
105 DWORD WINAPI IDirect3DCubeTexture9Impl_SetPriority(LPDIRECT3DCUBETEXTURE9 iface, DWORD PriorityNew) {
106 IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
107 return IDirect3DResource9Impl_SetPriority((LPDIRECT3DRESOURCE9) This, PriorityNew);
110 DWORD WINAPI IDirect3DCubeTexture9Impl_GetPriority(LPDIRECT3DCUBETEXTURE9 iface) {
111 IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
112 return IDirect3DResource9Impl_GetPriority((LPDIRECT3DRESOURCE9) This);
115 void WINAPI IDirect3DCubeTexture9Impl_PreLoad(LPDIRECT3DCUBETEXTURE9 iface) {
116 IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
117 FIXME("(%p) : stub\n", This);
121 D3DRESOURCETYPE WINAPI IDirect3DCubeTexture9Impl_GetType(LPDIRECT3DCUBETEXTURE9 iface) {
122 IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
123 return IDirect3DResource9Impl_GetType((LPDIRECT3DRESOURCE9) This);
126 /* IDirect3DCubeTexture9 IDirect3DBaseTexture9 Interface follow: */
127 DWORD WINAPI IDirect3DCubeTexture9Impl_SetLOD(LPDIRECT3DCUBETEXTURE9 iface, DWORD LODNew) {
128 IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
129 return IDirect3DBaseTexture9Impl_SetLOD((LPDIRECT3DBASETEXTURE9) This, LODNew);
132 DWORD WINAPI IDirect3DCubeTexture9Impl_GetLOD(LPDIRECT3DCUBETEXTURE9 iface) {
133 IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
134 return IDirect3DBaseTexture9Impl_GetLOD((LPDIRECT3DBASETEXTURE9) This);
137 DWORD WINAPI IDirect3DCubeTexture9Impl_GetLevelCount(LPDIRECT3DCUBETEXTURE9 iface) {
138 IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
139 return IDirect3DBaseTexture9Impl_GetLevelCount((LPDIRECT3DBASETEXTURE9) This);
142 HRESULT WINAPI IDirect3DCubeTexture9Impl_SetAutoGenFilterType(LPDIRECT3DCUBETEXTURE9 iface, D3DTEXTUREFILTERTYPE FilterType) {
143 IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
144 return IDirect3DBaseTexture9Impl_SetAutoGenFilterType((LPDIRECT3DBASETEXTURE9) This, FilterType);
147 D3DTEXTUREFILTERTYPE WINAPI IDirect3DCubeTexture9Impl_GetAutoGenFilterType(LPDIRECT3DCUBETEXTURE9 iface) {
148 IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
149 return IDirect3DBaseTexture9Impl_GetAutoGenFilterType((LPDIRECT3DBASETEXTURE9) This);
152 void WINAPI IDirect3DCubeTexture9Impl_GenerateMipSubLevels(LPDIRECT3DCUBETEXTURE9 iface) {
153 IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
154 FIXME("(%p) : stub\n", This);
158 /* IDirect3DCubeTexture9 Interface follow: */
159 HRESULT WINAPI IDirect3DCubeTexture9Impl_GetLevelDesc(LPDIRECT3DCUBETEXTURE9 iface, UINT Level, D3DSURFACE_DESC* pDesc) {
160 IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
161 if (Level < This->levels) {
162 TRACE("(%p) level (%d)\n", This, Level);
163 return IDirect3DSurface9Impl_GetDesc((LPDIRECT3DSURFACE9) This->surfaces[0][Level], pDesc);
165 FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->levels);
166 return D3DERR_INVALIDCALL;
171 HRESULT WINAPI IDirect3DCubeTexture9Impl_GetCubeMapSurface(LPDIRECT3DCUBETEXTURE9 iface, D3DCUBEMAP_FACES FaceType, UINT Level, IDirect3DSurface9** ppCubeMapSurface) {
172 IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
173 if (Level < This->levels) {
174 *ppCubeMapSurface = (LPDIRECT3DSURFACE9) This->surfaces[FaceType][Level];
175 IDirect3DSurface9Impl_AddRef((LPDIRECT3DSURFACE9) *ppCubeMapSurface);
176 TRACE("(%p) -> faceType(%d) level(%d) returning surface@%p \n", This, FaceType, Level, This->surfaces[FaceType][Level]);
178 FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->levels);
179 return D3DERR_INVALIDCALL;
184 HRESULT WINAPI IDirect3DCubeTexture9Impl_LockRect(LPDIRECT3DCUBETEXTURE9 iface, D3DCUBEMAP_FACES FaceType, UINT Level, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) {
186 IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
187 if (Level < This->levels) {
189 * Not dirtified while Surfaces don't notify dirtification
190 * This->Dirty = TRUE;
192 hr = IDirect3DSurface9Impl_LockRect((LPDIRECT3DSURFACE9) This->surfaces[FaceType][Level], pLockedRect, pRect, Flags);
193 TRACE("(%p) -> faceType(%d) level(%d) returning memory@%p success(%lu)\n", This, FaceType, Level, pLockedRect->pBits, hr);
195 FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->levels);
196 return D3DERR_INVALIDCALL;
201 HRESULT WINAPI IDirect3DCubeTexture9Impl_UnlockRect(LPDIRECT3DCUBETEXTURE9 iface, D3DCUBEMAP_FACES FaceType, UINT Level) {
203 IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
204 if (Level < This->levels) {
205 hr = IDirect3DSurface9Impl_UnlockRect((LPDIRECT3DSURFACE9) This->surfaces[FaceType][Level]);
206 TRACE("(%p) -> faceType(%d) level(%d) success(%lu)\n", This, FaceType, Level, hr);
208 FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->levels);
209 return D3DERR_INVALIDCALL;
214 HRESULT WINAPI IDirect3DCubeTexture9Impl_AddDirtyRect(LPDIRECT3DCUBETEXTURE9 iface, D3DCUBEMAP_FACES FaceType, CONST RECT* pDirtyRect) {
215 IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
216 FIXME("(%p) : stub\n", This);
222 IDirect3DCubeTexture9Vtbl Direct3DCubeTexture9_Vtbl =
224 IDirect3DCubeTexture9Impl_QueryInterface,
225 IDirect3DCubeTexture9Impl_AddRef,
226 IDirect3DCubeTexture9Impl_Release,
227 IDirect3DCubeTexture9Impl_GetDevice,
228 IDirect3DCubeTexture9Impl_SetPrivateData,
229 IDirect3DCubeTexture9Impl_GetPrivateData,
230 IDirect3DCubeTexture9Impl_FreePrivateData,
231 IDirect3DCubeTexture9Impl_SetPriority,
232 IDirect3DCubeTexture9Impl_GetPriority,
233 IDirect3DCubeTexture9Impl_PreLoad,
234 IDirect3DCubeTexture9Impl_GetType,
235 IDirect3DCubeTexture9Impl_SetLOD,
236 IDirect3DCubeTexture9Impl_GetLOD,
237 IDirect3DCubeTexture9Impl_GetLevelCount,
238 IDirect3DCubeTexture9Impl_SetAutoGenFilterType,
239 IDirect3DCubeTexture9Impl_GetAutoGenFilterType,
240 IDirect3DCubeTexture9Impl_GenerateMipSubLevels,
241 IDirect3DCubeTexture9Impl_GetLevelDesc,
242 IDirect3DCubeTexture9Impl_GetCubeMapSurface,
243 IDirect3DCubeTexture9Impl_LockRect,
244 IDirect3DCubeTexture9Impl_UnlockRect,
245 IDirect3DCubeTexture9Impl_AddDirtyRect
249 /* IDirect3DDevice9 IDirect3DCubeTexture9 Methods follow: */
250 HRESULT WINAPI IDirect3DDevice9Impl_CreateCubeTexture(LPDIRECT3DDEVICE9 iface,
251 UINT EdgeLength, UINT Levels, DWORD Usage,
252 D3DFORMAT Format, D3DPOOL Pool,
253 IDirect3DCubeTexture9** ppCubeTexture, HANDLE* pSharedHandle) {
255 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
256 FIXME("(%p) : stub\n", This);