1 | /*
|
---|
2 | * IDirect3DCubeTexture9 implementation
|
---|
3 | *
|
---|
4 | * Copyright 2002-2005 Jason Edmeades
|
---|
5 | * Copyright 2002-2005 Raphael Junqueira
|
---|
6 | * Copyright 2005 Oliver Stieber
|
---|
7 | *
|
---|
8 | * This library is free software; you can redistribute it and/or
|
---|
9 | * modify it under the terms of the GNU Lesser General Public
|
---|
10 | * License as published by the Free Software Foundation; either
|
---|
11 | * version 2.1 of the License, or (at your option) any later version.
|
---|
12 | *
|
---|
13 | * This library is distributed in the hope that it will be useful,
|
---|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
16 | * Lesser General Public License for more details.
|
---|
17 | *
|
---|
18 | * You should have received a copy of the GNU Lesser General Public
|
---|
19 | * License along with this library; if not, write to the Free Software
|
---|
20 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
---|
21 | */
|
---|
22 |
|
---|
23 | /*
|
---|
24 | * Sun LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
|
---|
25 | * other than GPL or LGPL is available it will apply instead, Sun elects to use only
|
---|
26 | * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
|
---|
27 | * a choice of LGPL license versions is made available with the language indicating
|
---|
28 | * that LGPLv2 or any later version may be used, or where a choice of which version
|
---|
29 | * of the LGPL is applied is otherwise unspecified.
|
---|
30 | */
|
---|
31 |
|
---|
32 | #include "config.h"
|
---|
33 | #include "d3d9_private.h"
|
---|
34 |
|
---|
35 | WINE_DEFAULT_DEBUG_CHANNEL(d3d9);
|
---|
36 |
|
---|
37 |
|
---|
38 | /* IDirect3DCubeTexture9 IUnknown parts follow: */
|
---|
39 | static HRESULT WINAPI IDirect3DCubeTexture9Impl_QueryInterface(LPDIRECT3DCUBETEXTURE9 iface, REFIID riid, LPVOID* ppobj) {
|
---|
40 | IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
---|
41 | if (IsEqualGUID(riid, &IID_IUnknown)
|
---|
42 | || IsEqualGUID(riid, &IID_IDirect3DResource9)
|
---|
43 | || IsEqualGUID(riid, &IID_IDirect3DBaseTexture9)
|
---|
44 | || IsEqualGUID(riid, &IID_IDirect3DCubeTexture9)) {
|
---|
45 | IDirect3DCubeTexture9_AddRef(iface);
|
---|
46 | *ppobj = This;
|
---|
47 | return S_OK;
|
---|
48 | }
|
---|
49 |
|
---|
50 | WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
|
---|
51 | *ppobj = NULL;
|
---|
52 | return E_NOINTERFACE;
|
---|
53 | }
|
---|
54 |
|
---|
55 | static ULONG WINAPI IDirect3DCubeTexture9Impl_AddRef(LPDIRECT3DCUBETEXTURE9 iface) {
|
---|
56 | IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
---|
57 | ULONG ref = InterlockedIncrement(&This->ref);
|
---|
58 |
|
---|
59 | TRACE("(%p) : AddRef from %d\n", This, ref - 1);
|
---|
60 |
|
---|
61 | return ref;
|
---|
62 | }
|
---|
63 |
|
---|
64 | static ULONG WINAPI IDirect3DCubeTexture9Impl_Release(LPDIRECT3DCUBETEXTURE9 iface) {
|
---|
65 | IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
---|
66 | ULONG ref = InterlockedDecrement(&This->ref);
|
---|
67 |
|
---|
68 | TRACE("(%p) : ReleaseRef to %d\n", This, ref);
|
---|
69 |
|
---|
70 | if (ref == 0) {
|
---|
71 | TRACE("Releasing child %p\n", This->wineD3DCubeTexture);
|
---|
72 |
|
---|
73 | EnterCriticalSection(&d3d9_cs);
|
---|
74 | IWineD3DCubeTexture_Destroy(This->wineD3DCubeTexture, D3D9CB_DestroySurface);
|
---|
75 | IDirect3DDevice9Ex_Release(This->parentDevice);
|
---|
76 | LeaveCriticalSection(&d3d9_cs);
|
---|
77 |
|
---|
78 | HeapFree(GetProcessHeap(), 0, This);
|
---|
79 | }
|
---|
80 | return ref;
|
---|
81 | }
|
---|
82 |
|
---|
83 | /* IDirect3DCubeTexture9 IDirect3DResource9 Interface follow: */
|
---|
84 | static HRESULT WINAPI IDirect3DCubeTexture9Impl_GetDevice(LPDIRECT3DCUBETEXTURE9 iface, IDirect3DDevice9** ppDevice) {
|
---|
85 | IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
---|
86 | IWineD3DDevice *wined3d_device;
|
---|
87 | HRESULT hr;
|
---|
88 | TRACE("(%p) Relay\n" , This);
|
---|
89 |
|
---|
90 | EnterCriticalSection(&d3d9_cs);
|
---|
91 | hr = IWineD3DCubeTexture_GetDevice(This->wineD3DCubeTexture, &wined3d_device);
|
---|
92 | if (SUCCEEDED(hr))
|
---|
93 | {
|
---|
94 | IWineD3DDevice_GetParent(wined3d_device, (IUnknown **)ppDevice);
|
---|
95 | IWineD3DDevice_Release(wined3d_device);
|
---|
96 | }
|
---|
97 | LeaveCriticalSection(&d3d9_cs);
|
---|
98 | return hr;
|
---|
99 | }
|
---|
100 |
|
---|
101 | static HRESULT WINAPI IDirect3DCubeTexture9Impl_SetPrivateData(LPDIRECT3DCUBETEXTURE9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
|
---|
102 | IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
---|
103 | HRESULT hr;
|
---|
104 | TRACE("(%p) Relay\n", This);
|
---|
105 |
|
---|
106 | EnterCriticalSection(&d3d9_cs);
|
---|
107 | hr = IWineD3DCubeTexture_SetPrivateData(This->wineD3DCubeTexture,refguid,pData,SizeOfData,Flags);
|
---|
108 | LeaveCriticalSection(&d3d9_cs);
|
---|
109 | return hr;
|
---|
110 | }
|
---|
111 |
|
---|
112 | static HRESULT WINAPI IDirect3DCubeTexture9Impl_GetPrivateData(LPDIRECT3DCUBETEXTURE9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
|
---|
113 | IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
---|
114 | HRESULT hr;
|
---|
115 | TRACE("(%p) Relay\n", This);
|
---|
116 |
|
---|
117 | EnterCriticalSection(&d3d9_cs);
|
---|
118 | hr = IWineD3DCubeTexture_GetPrivateData(This->wineD3DCubeTexture,refguid,pData,pSizeOfData);
|
---|
119 | LeaveCriticalSection(&d3d9_cs);
|
---|
120 | return hr;
|
---|
121 | }
|
---|
122 |
|
---|
123 | static HRESULT WINAPI IDirect3DCubeTexture9Impl_FreePrivateData(LPDIRECT3DCUBETEXTURE9 iface, REFGUID refguid) {
|
---|
124 | IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
---|
125 | HRESULT hr;
|
---|
126 | TRACE("(%p) Relay\n", This);
|
---|
127 |
|
---|
128 | EnterCriticalSection(&d3d9_cs);
|
---|
129 | hr = IWineD3DCubeTexture_FreePrivateData(This->wineD3DCubeTexture,refguid);
|
---|
130 | LeaveCriticalSection(&d3d9_cs);
|
---|
131 | return hr;
|
---|
132 | }
|
---|
133 |
|
---|
134 | static DWORD WINAPI IDirect3DCubeTexture9Impl_SetPriority(LPDIRECT3DCUBETEXTURE9 iface, DWORD PriorityNew) {
|
---|
135 | IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
---|
136 | DWORD ret;
|
---|
137 | TRACE("(%p) Relay\n", This);
|
---|
138 |
|
---|
139 | EnterCriticalSection(&d3d9_cs);
|
---|
140 | ret = IWineD3DCubeTexture_SetPriority(This->wineD3DCubeTexture, PriorityNew);
|
---|
141 | LeaveCriticalSection(&d3d9_cs);
|
---|
142 | return ret;
|
---|
143 | }
|
---|
144 |
|
---|
145 | static DWORD WINAPI IDirect3DCubeTexture9Impl_GetPriority(LPDIRECT3DCUBETEXTURE9 iface) {
|
---|
146 | IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
---|
147 | DWORD ret;
|
---|
148 | TRACE("(%p) Relay\n", This);
|
---|
149 |
|
---|
150 | EnterCriticalSection(&d3d9_cs);
|
---|
151 | ret = IWineD3DCubeTexture_GetPriority(This->wineD3DCubeTexture);
|
---|
152 | LeaveCriticalSection(&d3d9_cs);
|
---|
153 | return ret;
|
---|
154 | }
|
---|
155 |
|
---|
156 | static void WINAPI IDirect3DCubeTexture9Impl_PreLoad(LPDIRECT3DCUBETEXTURE9 iface) {
|
---|
157 | IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
---|
158 | TRACE("(%p) Relay\n", This);
|
---|
159 |
|
---|
160 | EnterCriticalSection(&d3d9_cs);
|
---|
161 | IWineD3DCubeTexture_PreLoad(This->wineD3DCubeTexture);
|
---|
162 | LeaveCriticalSection(&d3d9_cs);
|
---|
163 | }
|
---|
164 |
|
---|
165 | static D3DRESOURCETYPE WINAPI IDirect3DCubeTexture9Impl_GetType(LPDIRECT3DCUBETEXTURE9 iface) {
|
---|
166 | IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
---|
167 | D3DRESOURCETYPE ret;
|
---|
168 | TRACE("(%p) Relay\n", This);
|
---|
169 |
|
---|
170 | EnterCriticalSection(&d3d9_cs);
|
---|
171 | ret = IWineD3DCubeTexture_GetType(This->wineD3DCubeTexture);
|
---|
172 | LeaveCriticalSection(&d3d9_cs);
|
---|
173 | return ret;
|
---|
174 | }
|
---|
175 |
|
---|
176 | /* IDirect3DCubeTexture9 IDirect3DBaseTexture9 Interface follow: */
|
---|
177 | static DWORD WINAPI IDirect3DCubeTexture9Impl_SetLOD(LPDIRECT3DCUBETEXTURE9 iface, DWORD LODNew) {
|
---|
178 | IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
---|
179 | DWORD ret;
|
---|
180 | TRACE("(%p) Relay\n", This);
|
---|
181 |
|
---|
182 | EnterCriticalSection(&d3d9_cs);
|
---|
183 | ret = IWineD3DCubeTexture_SetLOD(This->wineD3DCubeTexture, LODNew);
|
---|
184 | LeaveCriticalSection(&d3d9_cs);
|
---|
185 | return ret;
|
---|
186 | }
|
---|
187 |
|
---|
188 | static DWORD WINAPI IDirect3DCubeTexture9Impl_GetLOD(LPDIRECT3DCUBETEXTURE9 iface) {
|
---|
189 | IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
---|
190 | DWORD ret;
|
---|
191 | TRACE("(%p) Relay\n", This);
|
---|
192 |
|
---|
193 | EnterCriticalSection(&d3d9_cs);
|
---|
194 | ret = IWineD3DCubeTexture_GetLOD(This->wineD3DCubeTexture);
|
---|
195 | LeaveCriticalSection(&d3d9_cs);
|
---|
196 | return ret;
|
---|
197 | }
|
---|
198 |
|
---|
199 | static DWORD WINAPI IDirect3DCubeTexture9Impl_GetLevelCount(LPDIRECT3DCUBETEXTURE9 iface) {
|
---|
200 | IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
---|
201 | DWORD ret;
|
---|
202 | TRACE("(%p) Relay\n", This);
|
---|
203 |
|
---|
204 | EnterCriticalSection(&d3d9_cs);
|
---|
205 | ret = IWineD3DCubeTexture_GetLevelCount(This->wineD3DCubeTexture);
|
---|
206 | LeaveCriticalSection(&d3d9_cs);
|
---|
207 | return ret;
|
---|
208 | }
|
---|
209 |
|
---|
210 | static HRESULT WINAPI IDirect3DCubeTexture9Impl_SetAutoGenFilterType(LPDIRECT3DCUBETEXTURE9 iface, D3DTEXTUREFILTERTYPE FilterType) {
|
---|
211 | IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
---|
212 | HRESULT hr;
|
---|
213 | TRACE("(%p) Relay\n", This);
|
---|
214 |
|
---|
215 | EnterCriticalSection(&d3d9_cs);
|
---|
216 | hr = IWineD3DCubeTexture_SetAutoGenFilterType(This->wineD3DCubeTexture, (WINED3DTEXTUREFILTERTYPE) FilterType);
|
---|
217 | LeaveCriticalSection(&d3d9_cs);
|
---|
218 | return hr;
|
---|
219 | }
|
---|
220 |
|
---|
221 | static D3DTEXTUREFILTERTYPE WINAPI IDirect3DCubeTexture9Impl_GetAutoGenFilterType(LPDIRECT3DCUBETEXTURE9 iface) {
|
---|
222 | IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
---|
223 | D3DTEXTUREFILTERTYPE ret;
|
---|
224 | TRACE("(%p) Relay\n", This);
|
---|
225 |
|
---|
226 | EnterCriticalSection(&d3d9_cs);
|
---|
227 | ret = (D3DTEXTUREFILTERTYPE) IWineD3DCubeTexture_GetAutoGenFilterType(This->wineD3DCubeTexture);
|
---|
228 | LeaveCriticalSection(&d3d9_cs);
|
---|
229 | return ret;
|
---|
230 | }
|
---|
231 |
|
---|
232 | static void WINAPI IDirect3DCubeTexture9Impl_GenerateMipSubLevels(LPDIRECT3DCUBETEXTURE9 iface) {
|
---|
233 | IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
---|
234 | TRACE("(%p) Relay\n", This);
|
---|
235 |
|
---|
236 | EnterCriticalSection(&d3d9_cs);
|
---|
237 | IWineD3DCubeTexture_GenerateMipSubLevels(This->wineD3DCubeTexture);
|
---|
238 | LeaveCriticalSection(&d3d9_cs);
|
---|
239 | }
|
---|
240 |
|
---|
241 | /* IDirect3DCubeTexture9 Interface follow: */
|
---|
242 | static HRESULT WINAPI IDirect3DCubeTexture9Impl_GetLevelDesc(LPDIRECT3DCUBETEXTURE9 iface, UINT Level, D3DSURFACE_DESC* pDesc) {
|
---|
243 | IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
---|
244 | WINED3DSURFACE_DESC wined3ddesc;
|
---|
245 | UINT tmpInt = -1;
|
---|
246 | WINED3DFORMAT format;
|
---|
247 | HRESULT hr;
|
---|
248 |
|
---|
249 | TRACE("(%p) Relay\n", This);
|
---|
250 |
|
---|
251 | /* As d3d8 and d3d9 structures differ, pass in ptrs to where data needs to go */
|
---|
252 | wined3ddesc.Format = &format;
|
---|
253 | wined3ddesc.Type = (WINED3DRESOURCETYPE *) &pDesc->Type;
|
---|
254 | wined3ddesc.Usage = &pDesc->Usage;
|
---|
255 | wined3ddesc.Pool = (WINED3DPOOL *) &pDesc->Pool;
|
---|
256 | wined3ddesc.Size = &tmpInt;
|
---|
257 | wined3ddesc.MultiSampleType = (WINED3DMULTISAMPLE_TYPE *) &pDesc->MultiSampleType;
|
---|
258 | wined3ddesc.MultiSampleQuality = &pDesc->MultiSampleQuality;
|
---|
259 | wined3ddesc.Width = &pDesc->Width;
|
---|
260 | wined3ddesc.Height = &pDesc->Height;
|
---|
261 |
|
---|
262 | EnterCriticalSection(&d3d9_cs);
|
---|
263 | hr = IWineD3DCubeTexture_GetLevelDesc(This->wineD3DCubeTexture, Level, &wined3ddesc);
|
---|
264 | LeaveCriticalSection(&d3d9_cs);
|
---|
265 |
|
---|
266 | if (SUCCEEDED(hr)) pDesc->Format = d3dformat_from_wined3dformat(format);
|
---|
267 |
|
---|
268 | return hr;
|
---|
269 | }
|
---|
270 |
|
---|
271 | static HRESULT WINAPI IDirect3DCubeTexture9Impl_GetCubeMapSurface(LPDIRECT3DCUBETEXTURE9 iface, D3DCUBEMAP_FACES FaceType, UINT Level, IDirect3DSurface9** ppCubeMapSurface) {
|
---|
272 | IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
---|
273 | HRESULT hrc = D3D_OK;
|
---|
274 | IWineD3DSurface *mySurface = NULL;
|
---|
275 |
|
---|
276 | TRACE("(%p) Relay\n", This);
|
---|
277 |
|
---|
278 | EnterCriticalSection(&d3d9_cs);
|
---|
279 | hrc = IWineD3DCubeTexture_GetCubeMapSurface(This->wineD3DCubeTexture, (WINED3DCUBEMAP_FACES) FaceType, Level, &mySurface);
|
---|
280 | if (hrc == D3D_OK && NULL != ppCubeMapSurface) {
|
---|
281 | IWineD3DCubeTexture_GetParent(mySurface, (IUnknown **)ppCubeMapSurface);
|
---|
282 | IWineD3DCubeTexture_Release(mySurface);
|
---|
283 | }
|
---|
284 | LeaveCriticalSection(&d3d9_cs);
|
---|
285 | return hrc;
|
---|
286 | }
|
---|
287 |
|
---|
288 | static HRESULT WINAPI IDirect3DCubeTexture9Impl_LockRect(LPDIRECT3DCUBETEXTURE9 iface, D3DCUBEMAP_FACES FaceType, UINT Level, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) {
|
---|
289 | IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
---|
290 | HRESULT hr;
|
---|
291 | TRACE("(%p) Relay\n", This);
|
---|
292 |
|
---|
293 | EnterCriticalSection(&d3d9_cs);
|
---|
294 | hr = IWineD3DCubeTexture_LockRect(This->wineD3DCubeTexture, (WINED3DCUBEMAP_FACES) FaceType, Level, (WINED3DLOCKED_RECT *) pLockedRect, pRect, Flags);
|
---|
295 | LeaveCriticalSection(&d3d9_cs);
|
---|
296 | return hr;
|
---|
297 | }
|
---|
298 |
|
---|
299 | static HRESULT WINAPI IDirect3DCubeTexture9Impl_UnlockRect(LPDIRECT3DCUBETEXTURE9 iface, D3DCUBEMAP_FACES FaceType, UINT Level) {
|
---|
300 | IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
---|
301 | HRESULT hr;
|
---|
302 | TRACE("(%p) Relay\n", This);
|
---|
303 |
|
---|
304 | EnterCriticalSection(&d3d9_cs);
|
---|
305 | hr = IWineD3DCubeTexture_UnlockRect(This->wineD3DCubeTexture, (WINED3DCUBEMAP_FACES) FaceType, Level);
|
---|
306 | LeaveCriticalSection(&d3d9_cs);
|
---|
307 | return hr;
|
---|
308 | }
|
---|
309 |
|
---|
310 | static HRESULT WINAPI IDirect3DCubeTexture9Impl_AddDirtyRect(LPDIRECT3DCUBETEXTURE9 iface, D3DCUBEMAP_FACES FaceType, CONST RECT* pDirtyRect) {
|
---|
311 | IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
---|
312 | HRESULT hr;
|
---|
313 | TRACE("(%p) Relay\n", This);
|
---|
314 |
|
---|
315 | EnterCriticalSection(&d3d9_cs);
|
---|
316 | hr = IWineD3DCubeTexture_AddDirtyRect(This->wineD3DCubeTexture, (WINED3DCUBEMAP_FACES) FaceType, pDirtyRect);
|
---|
317 | LeaveCriticalSection(&d3d9_cs);
|
---|
318 | return hr;
|
---|
319 | }
|
---|
320 |
|
---|
321 |
|
---|
322 | static const IDirect3DCubeTexture9Vtbl Direct3DCubeTexture9_Vtbl =
|
---|
323 | {
|
---|
324 | /* IUnknown */
|
---|
325 | IDirect3DCubeTexture9Impl_QueryInterface,
|
---|
326 | IDirect3DCubeTexture9Impl_AddRef,
|
---|
327 | IDirect3DCubeTexture9Impl_Release,
|
---|
328 | /* IDirect3DResource9 */
|
---|
329 | IDirect3DCubeTexture9Impl_GetDevice,
|
---|
330 | IDirect3DCubeTexture9Impl_SetPrivateData,
|
---|
331 | IDirect3DCubeTexture9Impl_GetPrivateData,
|
---|
332 | IDirect3DCubeTexture9Impl_FreePrivateData,
|
---|
333 | IDirect3DCubeTexture9Impl_SetPriority,
|
---|
334 | IDirect3DCubeTexture9Impl_GetPriority,
|
---|
335 | IDirect3DCubeTexture9Impl_PreLoad,
|
---|
336 | IDirect3DCubeTexture9Impl_GetType,
|
---|
337 | /* IDirect3DBaseTexture9 */
|
---|
338 | IDirect3DCubeTexture9Impl_SetLOD,
|
---|
339 | IDirect3DCubeTexture9Impl_GetLOD,
|
---|
340 | IDirect3DCubeTexture9Impl_GetLevelCount,
|
---|
341 | IDirect3DCubeTexture9Impl_SetAutoGenFilterType,
|
---|
342 | IDirect3DCubeTexture9Impl_GetAutoGenFilterType,
|
---|
343 | IDirect3DCubeTexture9Impl_GenerateMipSubLevels,
|
---|
344 | IDirect3DCubeTexture9Impl_GetLevelDesc,
|
---|
345 | IDirect3DCubeTexture9Impl_GetCubeMapSurface,
|
---|
346 | IDirect3DCubeTexture9Impl_LockRect,
|
---|
347 | IDirect3DCubeTexture9Impl_UnlockRect,
|
---|
348 | IDirect3DCubeTexture9Impl_AddDirtyRect
|
---|
349 | };
|
---|
350 |
|
---|
351 |
|
---|
352 |
|
---|
353 |
|
---|
354 | /* IDirect3DDevice9 IDirect3DCubeTexture9 Methods follow: */
|
---|
355 | HRESULT WINAPI IDirect3DDevice9Impl_CreateCubeTexture(LPDIRECT3DDEVICE9EX iface,
|
---|
356 | UINT EdgeLength, UINT Levels, DWORD Usage,
|
---|
357 | D3DFORMAT Format, D3DPOOL Pool,
|
---|
358 | IDirect3DCubeTexture9** ppCubeTexture, HANDLE* pSharedHandle) {
|
---|
359 |
|
---|
360 | IDirect3DCubeTexture9Impl *object;
|
---|
361 | IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
|
---|
362 | HRESULT hr = D3D_OK;
|
---|
363 |
|
---|
364 | TRACE("(%p) : ELen(%d) Lvl(%d) Usage(%d) fmt(%u), Pool(%d) Shared(%p)\n", This, EdgeLength, Levels, Usage, Format, Pool, pSharedHandle);
|
---|
365 |
|
---|
366 | /* Allocate the storage for the device */
|
---|
367 | object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
---|
368 |
|
---|
369 | if (NULL == object) {
|
---|
370 | ERR("(%p) allocation of CubeTexture failed\n", This);
|
---|
371 | return D3DERR_OUTOFVIDEOMEMORY;
|
---|
372 | }
|
---|
373 | object->lpVtbl = &Direct3DCubeTexture9_Vtbl;
|
---|
374 | object->ref = 1;
|
---|
375 | EnterCriticalSection(&d3d9_cs);
|
---|
376 | hr = IWineD3DDevice_CreateCubeTexture(This->WineD3DDevice, EdgeLength, Levels, Usage,
|
---|
377 | wined3dformat_from_d3dformat(Format), Pool, &object->wineD3DCubeTexture, (IUnknown *)object);
|
---|
378 | LeaveCriticalSection(&d3d9_cs);
|
---|
379 |
|
---|
380 | if (hr != D3D_OK){
|
---|
381 |
|
---|
382 | /* free up object */
|
---|
383 | WARN("(%p) call to IWineD3DDevice_CreateCubeTexture failed\n", This);
|
---|
384 | HeapFree(GetProcessHeap(), 0, object);
|
---|
385 | } else {
|
---|
386 | IDirect3DDevice9Ex_AddRef(iface);
|
---|
387 | object->parentDevice = iface;
|
---|
388 | *ppCubeTexture = (LPDIRECT3DCUBETEXTURE9) object;
|
---|
389 | TRACE("(%p) : Created cube texture %p\n", This, object);
|
---|
390 | }
|
---|
391 |
|
---|
392 | TRACE("(%p) returning %p\n",This, *ppCubeTexture);
|
---|
393 | return hr;
|
---|
394 | }
|
---|