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
23 #include "d3d9_private.h"
25 WINE_DEFAULT_DEBUG_CHANNEL(d3d);
27 /* IDirect3DCubeTexture9 IUnknown parts follow: */
28 HRESULT WINAPI IDirect3DCubeTexture9Impl_QueryInterface(LPDIRECT3DCUBETEXTURE9 iface, REFIID riid, LPVOID* ppobj) {
29 IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
31 if (IsEqualGUID(riid, &IID_IUnknown)
32 || IsEqualGUID(riid, &IID_IDirect3DResource9)
33 || IsEqualGUID(riid, &IID_IDirect3DBaseTexture9)
34 || IsEqualGUID(riid, &IID_IDirect3DCubeTexture9)) {
35 IDirect3DCubeTexture9Impl_AddRef(iface);
40 WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
44 ULONG WINAPI IDirect3DCubeTexture9Impl_AddRef(LPDIRECT3DCUBETEXTURE9 iface) {
45 IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
46 TRACE("(%p) : AddRef from %ld\n", This, This->ref);
50 ULONG WINAPI IDirect3DCubeTexture9Impl_Release(LPDIRECT3DCUBETEXTURE9 iface) {
51 IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
52 ULONG ref = --This->ref;
55 TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
57 for (i = 0; i < This->levels; i++) {
58 for (j = 0; j < 6; j++) {
59 if (This->surfaces[j][i] != NULL) {
60 TRACE("(%p) : Releasing surface %p\n", This, This->surfaces[j][i]);
61 IDirect3DSurface9Impl_Release((LPDIRECT3DSURFACE9) This->surfaces[j][i]);
65 HeapFree(GetProcessHeap(), 0, This);
70 /* IDirect3DCubeTexture9 IDirect3DResource9 Interface follow: */
71 HRESULT WINAPI IDirect3DCubeTexture9Impl_GetDevice(LPDIRECT3DCUBETEXTURE9 iface, IDirect3DDevice9** ppDevice) {
72 IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
73 return IDirect3DResource9Impl_GetDevice((LPDIRECT3DRESOURCE9) This, ppDevice);
76 HRESULT WINAPI IDirect3DCubeTexture9Impl_SetPrivateData(LPDIRECT3DCUBETEXTURE9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
77 IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
78 FIXME("(%p) : stub\n", This);
82 HRESULT WINAPI IDirect3DCubeTexture9Impl_GetPrivateData(LPDIRECT3DCUBETEXTURE9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
83 IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
84 FIXME("(%p) : stub\n", This);
88 HRESULT WINAPI IDirect3DCubeTexture9Impl_FreePrivateData(LPDIRECT3DCUBETEXTURE9 iface, REFGUID refguid) {
89 IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
90 FIXME("(%p) : stub\n", This);
94 DWORD WINAPI IDirect3DCubeTexture9Impl_SetPriority(LPDIRECT3DCUBETEXTURE9 iface, DWORD PriorityNew) {
95 IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
96 return IDirect3DResource9Impl_SetPriority((LPDIRECT3DRESOURCE9) This, PriorityNew);
99 DWORD WINAPI IDirect3DCubeTexture9Impl_GetPriority(LPDIRECT3DCUBETEXTURE9 iface) {
100 IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
101 return IDirect3DResource9Impl_GetPriority((LPDIRECT3DRESOURCE9) This);
104 void WINAPI IDirect3DCubeTexture9Impl_PreLoad(LPDIRECT3DCUBETEXTURE9 iface) {
105 IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
106 FIXME("(%p) : stub\n", This);
110 D3DRESOURCETYPE WINAPI IDirect3DCubeTexture9Impl_GetType(LPDIRECT3DCUBETEXTURE9 iface) {
111 IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
112 return IDirect3DResource9Impl_GetType((LPDIRECT3DRESOURCE9) This);
115 /* IDirect3DCubeTexture9 IDirect3DBaseTexture9 Interface follow: */
116 DWORD WINAPI IDirect3DCubeTexture9Impl_SetLOD(LPDIRECT3DCUBETEXTURE9 iface, DWORD LODNew) {
117 IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
118 return IDirect3DBaseTexture9Impl_SetLOD((LPDIRECT3DBASETEXTURE9) This, LODNew);
121 DWORD WINAPI IDirect3DCubeTexture9Impl_GetLOD(LPDIRECT3DCUBETEXTURE9 iface) {
122 IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
123 return IDirect3DBaseTexture9Impl_GetLOD((LPDIRECT3DBASETEXTURE9) This);
126 DWORD WINAPI IDirect3DCubeTexture9Impl_GetLevelCount(LPDIRECT3DCUBETEXTURE9 iface) {
127 IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
128 return IDirect3DBaseTexture9Impl_GetLevelCount((LPDIRECT3DBASETEXTURE9) This);
131 HRESULT WINAPI IDirect3DCubeTexture9Impl_SetAutoGenFilterType(LPDIRECT3DCUBETEXTURE9 iface, D3DTEXTUREFILTERTYPE FilterType) {
132 IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
133 return IDirect3DBaseTexture9Impl_SetAutoGenFilterType((LPDIRECT3DBASETEXTURE9) This, FilterType);
136 D3DTEXTUREFILTERTYPE WINAPI IDirect3DCubeTexture9Impl_GetAutoGenFilterType(LPDIRECT3DCUBETEXTURE9 iface) {
137 IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
138 return IDirect3DBaseTexture9Impl_GetAutoGenFilterType((LPDIRECT3DBASETEXTURE9) This);
141 void WINAPI IDirect3DCubeTexture9Impl_GenerateMipSubLevels(LPDIRECT3DCUBETEXTURE9 iface) {
142 IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
143 FIXME("(%p) : stub\n", This);
147 /* IDirect3DCubeTexture9 Interface follow: */
148 HRESULT WINAPI IDirect3DCubeTexture9Impl_GetLevelDesc(LPDIRECT3DCUBETEXTURE9 iface, UINT Level, D3DSURFACE_DESC* pDesc) {
149 IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
150 if (Level < This->levels) {
151 TRACE("(%p) level (%d)\n", This, Level);
152 return IDirect3DSurface9Impl_GetDesc((LPDIRECT3DSURFACE9) This->surfaces[0][Level], pDesc);
154 FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->levels);
155 return D3DERR_INVALIDCALL;
160 HRESULT WINAPI IDirect3DCubeTexture9Impl_GetCubeMapSurface(LPDIRECT3DCUBETEXTURE9 iface, D3DCUBEMAP_FACES FaceType, UINT Level, IDirect3DSurface9** ppCubeMapSurface) {
161 IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
162 if (Level < This->levels) {
163 *ppCubeMapSurface = (LPDIRECT3DSURFACE9) This->surfaces[FaceType][Level];
164 IDirect3DSurface9Impl_AddRef((LPDIRECT3DSURFACE9) *ppCubeMapSurface);
165 TRACE("(%p) -> faceType(%d) level(%d) returning surface@%p \n", This, FaceType, Level, This->surfaces[FaceType][Level]);
167 FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->levels);
168 return D3DERR_INVALIDCALL;
173 HRESULT WINAPI IDirect3DCubeTexture9Impl_LockRect(LPDIRECT3DCUBETEXTURE9 iface, D3DCUBEMAP_FACES FaceType, UINT Level, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) {
175 IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
176 if (Level < This->levels) {
178 * Not dirtified while Surfaces don't notify dirtification
179 * This->Dirty = TRUE;
181 hr = IDirect3DSurface9Impl_LockRect((LPDIRECT3DSURFACE9) This->surfaces[FaceType][Level], pLockedRect, pRect, Flags);
182 TRACE("(%p) -> faceType(%d) level(%d) returning memory@%p success(%lu)\n", This, FaceType, Level, pLockedRect->pBits, hr);
184 FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->levels);
185 return D3DERR_INVALIDCALL;
190 HRESULT WINAPI IDirect3DCubeTexture9Impl_UnlockRect(LPDIRECT3DCUBETEXTURE9 iface, D3DCUBEMAP_FACES FaceType, UINT Level) {
192 IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
193 if (Level < This->levels) {
194 hr = IDirect3DSurface9Impl_UnlockRect((LPDIRECT3DSURFACE9) This->surfaces[FaceType][Level]);
195 TRACE("(%p) -> faceType(%d) level(%d) success(%lu)\n", This, FaceType, Level, hr);
197 FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->levels);
198 return D3DERR_INVALIDCALL;
203 HRESULT WINAPI IDirect3DCubeTexture9Impl_AddDirtyRect(LPDIRECT3DCUBETEXTURE9 iface, D3DCUBEMAP_FACES FaceType, CONST RECT* pDirtyRect) {
204 IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
205 FIXME("(%p) : stub\n", This);
211 IDirect3DCubeTexture9Vtbl Direct3DCubeTexture9_Vtbl =
213 IDirect3DCubeTexture9Impl_QueryInterface,
214 IDirect3DCubeTexture9Impl_AddRef,
215 IDirect3DCubeTexture9Impl_Release,
216 IDirect3DCubeTexture9Impl_GetDevice,
217 IDirect3DCubeTexture9Impl_SetPrivateData,
218 IDirect3DCubeTexture9Impl_GetPrivateData,
219 IDirect3DCubeTexture9Impl_FreePrivateData,
220 IDirect3DCubeTexture9Impl_SetPriority,
221 IDirect3DCubeTexture9Impl_GetPriority,
222 IDirect3DCubeTexture9Impl_PreLoad,
223 IDirect3DCubeTexture9Impl_GetType,
224 IDirect3DCubeTexture9Impl_SetLOD,
225 IDirect3DCubeTexture9Impl_GetLOD,
226 IDirect3DCubeTexture9Impl_GetLevelCount,
227 IDirect3DCubeTexture9Impl_SetAutoGenFilterType,
228 IDirect3DCubeTexture9Impl_GetAutoGenFilterType,
229 IDirect3DCubeTexture9Impl_GenerateMipSubLevels,
230 IDirect3DCubeTexture9Impl_GetLevelDesc,
231 IDirect3DCubeTexture9Impl_GetCubeMapSurface,
232 IDirect3DCubeTexture9Impl_LockRect,
233 IDirect3DCubeTexture9Impl_UnlockRect,
234 IDirect3DCubeTexture9Impl_AddDirtyRect
238 /* IDirect3DDevice9 IDirect3DCubeTexture9 Methods follow: */
239 HRESULT WINAPI IDirect3DDevice9Impl_CreateCubeTexture(LPDIRECT3DDEVICE9 iface,
240 UINT EdgeLength, UINT Levels, DWORD Usage,
241 D3DFORMAT Format, D3DPOOL Pool,
242 IDirect3DCubeTexture9** ppCubeTexture, HANDLE* pSharedHandle) {
244 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
245 FIXME("(%p) : stub\n", This);