2 * IDirect3DCubeTexture8 implementation
4 * Copyright 2005 Oliver Stieber
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include "d3d8_private.h"
24 WINE_DEFAULT_DEBUG_CHANNEL(d3d8
);
26 /* IDirect3DCubeTexture8 IUnknown parts follow: */
27 static HRESULT WINAPI
IDirect3DCubeTexture8Impl_QueryInterface(LPDIRECT3DCUBETEXTURE8 iface
, REFIID riid
, LPVOID
*ppobj
) {
28 IDirect3DCubeTexture8Impl
*This
= (IDirect3DCubeTexture8Impl
*)iface
;
29 if (IsEqualGUID(riid
, &IID_IUnknown
)
30 || IsEqualGUID(riid
, &IID_IDirect3DResource8
)
31 || IsEqualGUID(riid
, &IID_IDirect3DBaseTexture8
)
32 || IsEqualGUID(riid
, &IID_IDirect3DCubeTexture8
)) {
33 IUnknown_AddRef(iface
);
38 WARN("(%p)->(%s,%p),not found\n", This
, debugstr_guid(riid
), ppobj
);
43 static ULONG WINAPI
IDirect3DCubeTexture8Impl_AddRef(LPDIRECT3DCUBETEXTURE8 iface
) {
44 IDirect3DCubeTexture8Impl
*This
= (IDirect3DCubeTexture8Impl
*)iface
;
45 ULONG ref
= InterlockedIncrement(&This
->ref
);
47 TRACE("(%p) : AddRef from %ld\n", This
, ref
- 1);
52 static ULONG WINAPI
IDirect3DCubeTexture8Impl_Release(LPDIRECT3DCUBETEXTURE8 iface
) {
53 IDirect3DCubeTexture8Impl
*This
= (IDirect3DCubeTexture8Impl
*)iface
;
54 ULONG ref
= InterlockedDecrement(&This
->ref
);
56 TRACE("(%p) : ReleaseRef to %ld\n", This
, ref
);
59 TRACE("Releasing child %p\n", This
->wineD3DCubeTexture
);
60 IWineD3DCubeTexture_Release(This
->wineD3DCubeTexture
);
61 IUnknown_Release(This
->parentDevice
);
62 HeapFree(GetProcessHeap(), 0, This
);
67 /* IDirect3DCubeTexture8 IDirect3DResource8 Interface follow: */
68 static HRESULT WINAPI
IDirect3DCubeTexture8Impl_GetDevice(LPDIRECT3DCUBETEXTURE8 iface
, IDirect3DDevice8
**ppDevice
) {
69 IDirect3DCubeTexture8Impl
*This
= (IDirect3DCubeTexture8Impl
*)iface
;
70 TRACE("(%p) Relay\n" , This
);
71 return IDirect3DResource8Impl_GetDevice((LPDIRECT3DRESOURCE8
) This
, ppDevice
);
74 static HRESULT WINAPI
IDirect3DCubeTexture8Impl_SetPrivateData(LPDIRECT3DCUBETEXTURE8 iface
, REFGUID refguid
, CONST
void* pData
, DWORD SizeOfData
, DWORD Flags
) {
75 IDirect3DCubeTexture8Impl
*This
= (IDirect3DCubeTexture8Impl
*)iface
;
76 TRACE("(%p) Relay\n", This
);
77 return IWineD3DCubeTexture_SetPrivateData(This
->wineD3DCubeTexture
,refguid
,pData
,SizeOfData
,Flags
);
80 static HRESULT WINAPI
IDirect3DCubeTexture8Impl_GetPrivateData(LPDIRECT3DCUBETEXTURE8 iface
, REFGUID refguid
, void *pData
, DWORD
*pSizeOfData
) {
81 IDirect3DCubeTexture8Impl
*This
= (IDirect3DCubeTexture8Impl
*)iface
;
82 TRACE("(%p) Relay\n", This
);
83 return IWineD3DCubeTexture_GetPrivateData(This
->wineD3DCubeTexture
,refguid
,pData
,pSizeOfData
);
86 static HRESULT WINAPI
IDirect3DCubeTexture8Impl_FreePrivateData(LPDIRECT3DCUBETEXTURE8 iface
, REFGUID refguid
) {
87 IDirect3DCubeTexture8Impl
*This
= (IDirect3DCubeTexture8Impl
*)iface
;
88 TRACE("(%p) Relay\n", This
);
89 return IWineD3DCubeTexture_FreePrivateData(This
->wineD3DCubeTexture
,refguid
);
92 static DWORD WINAPI
IDirect3DCubeTexture8Impl_SetPriority(LPDIRECT3DCUBETEXTURE8 iface
, DWORD PriorityNew
) {
93 IDirect3DCubeTexture8Impl
*This
= (IDirect3DCubeTexture8Impl
*)iface
;
94 TRACE("(%p) Relay\n", This
);
95 return IWineD3DCubeTexture_SetPriority(This
->wineD3DCubeTexture
, PriorityNew
);
98 static DWORD WINAPI
IDirect3DCubeTexture8Impl_GetPriority(LPDIRECT3DCUBETEXTURE8 iface
) {
99 IDirect3DCubeTexture8Impl
*This
= (IDirect3DCubeTexture8Impl
*)iface
;
100 TRACE("(%p) Relay\n", This
);
101 return IWineD3DCubeTexture_GetPriority(This
->wineD3DCubeTexture
);
104 static void WINAPI
IDirect3DCubeTexture8Impl_PreLoad(LPDIRECT3DCUBETEXTURE8 iface
) {
105 IDirect3DCubeTexture8Impl
*This
= (IDirect3DCubeTexture8Impl
*)iface
;
106 TRACE("(%p) Relay\n", This
);
107 return IWineD3DCubeTexture_PreLoad(This
->wineD3DCubeTexture
);
110 static D3DRESOURCETYPE WINAPI
IDirect3DCubeTexture8Impl_GetType(LPDIRECT3DCUBETEXTURE8 iface
) {
111 IDirect3DCubeTexture8Impl
*This
= (IDirect3DCubeTexture8Impl
*)iface
;
112 TRACE("(%p) Relay\n", This
);
113 return IWineD3DCubeTexture_GetType(This
->wineD3DCubeTexture
);
116 /* IDirect3DCubeTexture8 IDirect3DBaseTexture8 Interface follow: */
117 static DWORD WINAPI
IDirect3DCubeTexture8Impl_SetLOD(LPDIRECT3DCUBETEXTURE8 iface
, DWORD LODNew
) {
118 IDirect3DCubeTexture8Impl
*This
= (IDirect3DCubeTexture8Impl
*)iface
;
119 TRACE("(%p) Relay\n", This
);
120 return IWineD3DCubeTexture_SetLOD(This
->wineD3DCubeTexture
, LODNew
);
123 static DWORD WINAPI
IDirect3DCubeTexture8Impl_GetLOD(LPDIRECT3DCUBETEXTURE8 iface
) {
124 IDirect3DCubeTexture8Impl
*This
= (IDirect3DCubeTexture8Impl
*)iface
;
125 TRACE("(%p) Relay\n", This
);
126 return IWineD3DCubeTexture_GetLOD((LPDIRECT3DBASETEXTURE8
) This
);
129 static DWORD WINAPI
IDirect3DCubeTexture8Impl_GetLevelCount(LPDIRECT3DCUBETEXTURE8 iface
) {
130 IDirect3DCubeTexture8Impl
*This
= (IDirect3DCubeTexture8Impl
*)iface
;
131 TRACE("(%p) Relay\n", This
);
132 return IWineD3DCubeTexture_GetLevelCount(This
->wineD3DCubeTexture
);
135 /* IDirect3DCubeTexture8 Interface follow: */
136 static HRESULT WINAPI
IDirect3DCubeTexture8Impl_GetLevelDesc(LPDIRECT3DCUBETEXTURE8 iface
, UINT Level
, D3DSURFACE_DESC
*pDesc
) {
137 IDirect3DCubeTexture8Impl
*This
= (IDirect3DCubeTexture8Impl
*)iface
;
138 WINED3DSURFACE_DESC wined3ddesc
;
140 TRACE("(%p) Relay\n", This
);
142 /* As d3d8 and d3d9 structures differ, pass in ptrs to where data needs to go */
143 wined3ddesc
.Format
= (WINED3DFORMAT
*)&pDesc
->Format
;
144 wined3ddesc
.Type
= (WINED3DRESOURCETYPE
*)&pDesc
->Type
;
145 wined3ddesc
.Usage
= &pDesc
->Usage
;
146 wined3ddesc
.Pool
= (WINED3DPOOL
*) &pDesc
->Pool
;
147 wined3ddesc
.Size
= &pDesc
->Size
;
148 wined3ddesc
.MultiSampleType
= (WINED3DMULTISAMPLE_TYPE
*) &pDesc
->MultiSampleType
;
149 wined3ddesc
.MultiSampleQuality
= NULL
; /* DirectX9 only */
150 wined3ddesc
.Width
= &pDesc
->Width
;
151 wined3ddesc
.Height
= &pDesc
->Height
;
153 return IWineD3DCubeTexture_GetLevelDesc(This
->wineD3DCubeTexture
, Level
, &wined3ddesc
);
156 static HRESULT WINAPI
IDirect3DCubeTexture8Impl_GetCubeMapSurface(LPDIRECT3DCUBETEXTURE8 iface
, D3DCUBEMAP_FACES FaceType
, UINT Level
, IDirect3DSurface8
**ppCubeMapSurface
) {
157 IDirect3DCubeTexture8Impl
*This
= (IDirect3DCubeTexture8Impl
*)iface
;
158 HRESULT hrc
= D3D_OK
;
159 IWineD3DSurface
*mySurface
= NULL
;
161 TRACE("(%p) Relay\n", This
);
163 hrc
= IWineD3DCubeTexture_GetCubeMapSurface(This
->wineD3DCubeTexture
, (WINED3DCUBEMAP_FACES
) FaceType
, Level
, &mySurface
);
164 if (hrc
== D3D_OK
&& NULL
!= ppCubeMapSurface
) {
165 IWineD3DCubeTexture_GetParent(mySurface
, (IUnknown
**)ppCubeMapSurface
);
166 IWineD3DCubeTexture_Release(mySurface
);
171 static HRESULT WINAPI
IDirect3DCubeTexture8Impl_LockRect(LPDIRECT3DCUBETEXTURE8 iface
, D3DCUBEMAP_FACES FaceType
, UINT Level
, D3DLOCKED_RECT
* pLockedRect
, CONST RECT
*pRect
, DWORD Flags
) {
172 IDirect3DCubeTexture8Impl
*This
= (IDirect3DCubeTexture8Impl
*)iface
;
173 TRACE("(%p) Relay\n", This
);
174 return IWineD3DCubeTexture_LockRect(This
->wineD3DCubeTexture
, (WINED3DCUBEMAP_FACES
) FaceType
, Level
, (WINED3DLOCKED_RECT
*) pLockedRect
, pRect
, Flags
);
177 static HRESULT WINAPI
IDirect3DCubeTexture8Impl_UnlockRect(LPDIRECT3DCUBETEXTURE8 iface
, D3DCUBEMAP_FACES FaceType
, UINT Level
) {
178 IDirect3DCubeTexture8Impl
*This
= (IDirect3DCubeTexture8Impl
*)iface
;
179 TRACE("(%p) Relay\n", This
);
180 return IWineD3DCubeTexture_UnlockRect(This
->wineD3DCubeTexture
, (WINED3DCUBEMAP_FACES
) FaceType
, Level
);
183 static HRESULT WINAPI
IDirect3DCubeTexture8Impl_AddDirtyRect(LPDIRECT3DCUBETEXTURE8 iface
, D3DCUBEMAP_FACES FaceType
, CONST RECT
*pDirtyRect
) {
184 IDirect3DCubeTexture8Impl
*This
= (IDirect3DCubeTexture8Impl
*)iface
;
185 TRACE("(%p) Relay\n", This
);
186 return IWineD3DCubeTexture_AddDirtyRect(This
->wineD3DCubeTexture
, (WINED3DCUBEMAP_FACES
) FaceType
, pDirtyRect
);
190 const IDirect3DCubeTexture8Vtbl Direct3DCubeTexture8_Vtbl
=
193 IDirect3DCubeTexture8Impl_QueryInterface
,
194 IDirect3DCubeTexture8Impl_AddRef
,
195 IDirect3DCubeTexture8Impl_Release
,
196 /* IDirect3DResource8 */
197 IDirect3DCubeTexture8Impl_GetDevice
,
198 IDirect3DCubeTexture8Impl_SetPrivateData
,
199 IDirect3DCubeTexture8Impl_GetPrivateData
,
200 IDirect3DCubeTexture8Impl_FreePrivateData
,
201 IDirect3DCubeTexture8Impl_SetPriority
,
202 IDirect3DCubeTexture8Impl_GetPriority
,
203 IDirect3DCubeTexture8Impl_PreLoad
,
204 IDirect3DCubeTexture8Impl_GetType
,
205 /* IDirect3DBaseTexture8 */
206 IDirect3DCubeTexture8Impl_SetLOD
,
207 IDirect3DCubeTexture8Impl_GetLOD
,
208 IDirect3DCubeTexture8Impl_GetLevelCount
,
209 /* IDirect3DCubeTexture8 */
210 IDirect3DCubeTexture8Impl_GetLevelDesc
,
211 IDirect3DCubeTexture8Impl_GetCubeMapSurface
,
212 IDirect3DCubeTexture8Impl_LockRect
,
213 IDirect3DCubeTexture8Impl_UnlockRect
,
214 IDirect3DCubeTexture8Impl_AddDirtyRect