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 | if (ref == 1)
|
---|
62 | {
|
---|
63 | IDirect3DDevice9Ex_AddRef(This->parentDevice);
|
---|
64 | wined3d_mutex_lock();
|
---|
65 | IWineD3DCubeTexture_AddRef(This->wineD3DCubeTexture);
|
---|
66 | wined3d_mutex_unlock();
|
---|
67 | }
|
---|
68 |
|
---|
69 | return ref;
|
---|
70 | }
|
---|
71 |
|
---|
72 | static ULONG WINAPI IDirect3DCubeTexture9Impl_Release(LPDIRECT3DCUBETEXTURE9 iface) {
|
---|
73 | IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
---|
74 | ULONG ref = InterlockedDecrement(&This->ref);
|
---|
75 |
|
---|
76 | TRACE("(%p) : ReleaseRef to %d\n", This, ref);
|
---|
77 |
|
---|
78 | if (ref == 0) {
|
---|
79 | TRACE("Releasing child %p\n", This->wineD3DCubeTexture);
|
---|
80 |
|
---|
81 | IDirect3DDevice9Ex_Release(This->parentDevice);
|
---|
82 | wined3d_mutex_lock();
|
---|
83 | IWineD3DCubeTexture_Release(This->wineD3DCubeTexture);
|
---|
84 | wined3d_mutex_unlock();
|
---|
85 | }
|
---|
86 | return ref;
|
---|
87 | }
|
---|
88 |
|
---|
89 | /* IDirect3DCubeTexture9 IDirect3DResource9 Interface follow: */
|
---|
90 | static HRESULT WINAPI IDirect3DCubeTexture9Impl_GetDevice(LPDIRECT3DCUBETEXTURE9 iface, IDirect3DDevice9** ppDevice) {
|
---|
91 | IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
---|
92 | IWineD3DDevice *wined3d_device;
|
---|
93 | HRESULT hr;
|
---|
94 | TRACE("(%p) Relay\n" , This);
|
---|
95 |
|
---|
96 | wined3d_mutex_lock();
|
---|
97 | hr = IWineD3DCubeTexture_GetDevice(This->wineD3DCubeTexture, &wined3d_device);
|
---|
98 | if (SUCCEEDED(hr))
|
---|
99 | {
|
---|
100 | IWineD3DDevice_GetParent(wined3d_device, (IUnknown **)ppDevice);
|
---|
101 | IWineD3DDevice_Release(wined3d_device);
|
---|
102 | }
|
---|
103 | wined3d_mutex_unlock();
|
---|
104 |
|
---|
105 | return hr;
|
---|
106 | }
|
---|
107 |
|
---|
108 | static HRESULT WINAPI IDirect3DCubeTexture9Impl_SetPrivateData(LPDIRECT3DCUBETEXTURE9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
|
---|
109 | IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
---|
110 | HRESULT hr;
|
---|
111 | TRACE("(%p) Relay\n", This);
|
---|
112 |
|
---|
113 | wined3d_mutex_lock();
|
---|
114 | hr = IWineD3DCubeTexture_SetPrivateData(This->wineD3DCubeTexture,refguid,pData,SizeOfData,Flags);
|
---|
115 | wined3d_mutex_unlock();
|
---|
116 |
|
---|
117 | return hr;
|
---|
118 | }
|
---|
119 |
|
---|
120 | static HRESULT WINAPI IDirect3DCubeTexture9Impl_GetPrivateData(LPDIRECT3DCUBETEXTURE9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
|
---|
121 | IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
---|
122 | HRESULT hr;
|
---|
123 | TRACE("(%p) Relay\n", This);
|
---|
124 |
|
---|
125 | wined3d_mutex_lock();
|
---|
126 | hr = IWineD3DCubeTexture_GetPrivateData(This->wineD3DCubeTexture,refguid,pData,pSizeOfData);
|
---|
127 | wined3d_mutex_unlock();
|
---|
128 |
|
---|
129 | return hr;
|
---|
130 | }
|
---|
131 |
|
---|
132 | static HRESULT WINAPI IDirect3DCubeTexture9Impl_FreePrivateData(LPDIRECT3DCUBETEXTURE9 iface, REFGUID refguid) {
|
---|
133 | IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
---|
134 | HRESULT hr;
|
---|
135 | TRACE("(%p) Relay\n", This);
|
---|
136 |
|
---|
137 | wined3d_mutex_lock();
|
---|
138 | hr = IWineD3DCubeTexture_FreePrivateData(This->wineD3DCubeTexture,refguid);
|
---|
139 | wined3d_mutex_unlock();
|
---|
140 |
|
---|
141 | return hr;
|
---|
142 | }
|
---|
143 |
|
---|
144 | static DWORD WINAPI IDirect3DCubeTexture9Impl_SetPriority(LPDIRECT3DCUBETEXTURE9 iface, DWORD PriorityNew) {
|
---|
145 | IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
---|
146 | DWORD ret;
|
---|
147 | TRACE("(%p) Relay\n", This);
|
---|
148 |
|
---|
149 | wined3d_mutex_lock();
|
---|
150 | ret = IWineD3DCubeTexture_SetPriority(This->wineD3DCubeTexture, PriorityNew);
|
---|
151 | wined3d_mutex_unlock();
|
---|
152 |
|
---|
153 | return ret;
|
---|
154 | }
|
---|
155 |
|
---|
156 | static DWORD WINAPI IDirect3DCubeTexture9Impl_GetPriority(LPDIRECT3DCUBETEXTURE9 iface) {
|
---|
157 | IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
---|
158 | DWORD ret;
|
---|
159 | TRACE("(%p) Relay\n", This);
|
---|
160 |
|
---|
161 | wined3d_mutex_lock();
|
---|
162 | ret = IWineD3DCubeTexture_GetPriority(This->wineD3DCubeTexture);
|
---|
163 | wined3d_mutex_unlock();
|
---|
164 |
|
---|
165 | return ret;
|
---|
166 | }
|
---|
167 |
|
---|
168 | static void WINAPI IDirect3DCubeTexture9Impl_PreLoad(LPDIRECT3DCUBETEXTURE9 iface) {
|
---|
169 | IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
---|
170 | TRACE("(%p) Relay\n", This);
|
---|
171 |
|
---|
172 | wined3d_mutex_lock();
|
---|
173 | IWineD3DCubeTexture_PreLoad(This->wineD3DCubeTexture);
|
---|
174 | wined3d_mutex_unlock();
|
---|
175 | }
|
---|
176 |
|
---|
177 | static D3DRESOURCETYPE WINAPI IDirect3DCubeTexture9Impl_GetType(LPDIRECT3DCUBETEXTURE9 iface) {
|
---|
178 | IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
---|
179 | D3DRESOURCETYPE ret;
|
---|
180 | TRACE("(%p) Relay\n", This);
|
---|
181 |
|
---|
182 | wined3d_mutex_lock();
|
---|
183 | ret = IWineD3DCubeTexture_GetType(This->wineD3DCubeTexture);
|
---|
184 | wined3d_mutex_unlock();
|
---|
185 |
|
---|
186 | return ret;
|
---|
187 | }
|
---|
188 |
|
---|
189 | /* IDirect3DCubeTexture9 IDirect3DBaseTexture9 Interface follow: */
|
---|
190 | static DWORD WINAPI IDirect3DCubeTexture9Impl_SetLOD(LPDIRECT3DCUBETEXTURE9 iface, DWORD LODNew) {
|
---|
191 | IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
---|
192 | DWORD ret;
|
---|
193 | TRACE("(%p) Relay\n", This);
|
---|
194 |
|
---|
195 | wined3d_mutex_lock();
|
---|
196 | ret = IWineD3DCubeTexture_SetLOD(This->wineD3DCubeTexture, LODNew);
|
---|
197 | wined3d_mutex_unlock();
|
---|
198 |
|
---|
199 | return ret;
|
---|
200 | }
|
---|
201 |
|
---|
202 | static DWORD WINAPI IDirect3DCubeTexture9Impl_GetLOD(LPDIRECT3DCUBETEXTURE9 iface) {
|
---|
203 | IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
---|
204 | DWORD ret;
|
---|
205 | TRACE("(%p) Relay\n", This);
|
---|
206 |
|
---|
207 | wined3d_mutex_lock();
|
---|
208 | ret = IWineD3DCubeTexture_GetLOD(This->wineD3DCubeTexture);
|
---|
209 | wined3d_mutex_unlock();
|
---|
210 |
|
---|
211 | return ret;
|
---|
212 | }
|
---|
213 |
|
---|
214 | static DWORD WINAPI IDirect3DCubeTexture9Impl_GetLevelCount(LPDIRECT3DCUBETEXTURE9 iface) {
|
---|
215 | IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
---|
216 | DWORD ret;
|
---|
217 | TRACE("(%p) Relay\n", This);
|
---|
218 |
|
---|
219 | wined3d_mutex_lock();
|
---|
220 | ret = IWineD3DCubeTexture_GetLevelCount(This->wineD3DCubeTexture);
|
---|
221 | wined3d_mutex_unlock();
|
---|
222 |
|
---|
223 | return ret;
|
---|
224 | }
|
---|
225 |
|
---|
226 | static HRESULT WINAPI IDirect3DCubeTexture9Impl_SetAutoGenFilterType(LPDIRECT3DCUBETEXTURE9 iface, D3DTEXTUREFILTERTYPE FilterType) {
|
---|
227 | IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
---|
228 | HRESULT hr;
|
---|
229 | TRACE("(%p) Relay\n", This);
|
---|
230 |
|
---|
231 | wined3d_mutex_lock();
|
---|
232 | hr = IWineD3DCubeTexture_SetAutoGenFilterType(This->wineD3DCubeTexture, (WINED3DTEXTUREFILTERTYPE) FilterType);
|
---|
233 | wined3d_mutex_unlock();
|
---|
234 |
|
---|
235 | return hr;
|
---|
236 | }
|
---|
237 |
|
---|
238 | static D3DTEXTUREFILTERTYPE WINAPI IDirect3DCubeTexture9Impl_GetAutoGenFilterType(LPDIRECT3DCUBETEXTURE9 iface) {
|
---|
239 | IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
---|
240 | D3DTEXTUREFILTERTYPE ret;
|
---|
241 | TRACE("(%p) Relay\n", This);
|
---|
242 |
|
---|
243 | wined3d_mutex_lock();
|
---|
244 | ret = (D3DTEXTUREFILTERTYPE) IWineD3DCubeTexture_GetAutoGenFilterType(This->wineD3DCubeTexture);
|
---|
245 | wined3d_mutex_unlock();
|
---|
246 |
|
---|
247 | return ret;
|
---|
248 | }
|
---|
249 |
|
---|
250 | static void WINAPI IDirect3DCubeTexture9Impl_GenerateMipSubLevels(LPDIRECT3DCUBETEXTURE9 iface) {
|
---|
251 | IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
---|
252 | TRACE("(%p) Relay\n", This);
|
---|
253 |
|
---|
254 | wined3d_mutex_lock();
|
---|
255 | IWineD3DCubeTexture_GenerateMipSubLevels(This->wineD3DCubeTexture);
|
---|
256 | wined3d_mutex_unlock();
|
---|
257 | }
|
---|
258 |
|
---|
259 | /* IDirect3DCubeTexture9 Interface follow: */
|
---|
260 | static HRESULT WINAPI IDirect3DCubeTexture9Impl_GetLevelDesc(LPDIRECT3DCUBETEXTURE9 iface, UINT Level, D3DSURFACE_DESC* pDesc) {
|
---|
261 | IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
---|
262 | WINED3DSURFACE_DESC wined3ddesc;
|
---|
263 | HRESULT hr;
|
---|
264 |
|
---|
265 | TRACE("(%p) Relay\n", This);
|
---|
266 |
|
---|
267 | wined3d_mutex_lock();
|
---|
268 | hr = IWineD3DCubeTexture_GetLevelDesc(This->wineD3DCubeTexture, Level, &wined3ddesc);
|
---|
269 | wined3d_mutex_unlock();
|
---|
270 |
|
---|
271 | if (SUCCEEDED(hr))
|
---|
272 | {
|
---|
273 | pDesc->Format = d3dformat_from_wined3dformat(wined3ddesc.format);
|
---|
274 | pDesc->Type = wined3ddesc.resource_type;
|
---|
275 | pDesc->Usage = wined3ddesc.usage;
|
---|
276 | pDesc->Pool = wined3ddesc.pool;
|
---|
277 | pDesc->MultiSampleType = wined3ddesc.multisample_type;
|
---|
278 | pDesc->MultiSampleQuality = wined3ddesc.multisample_quality;
|
---|
279 | pDesc->Width = wined3ddesc.width;
|
---|
280 | pDesc->Height = wined3ddesc.height;
|
---|
281 | }
|
---|
282 |
|
---|
283 | return hr;
|
---|
284 | }
|
---|
285 |
|
---|
286 | static HRESULT WINAPI IDirect3DCubeTexture9Impl_GetCubeMapSurface(LPDIRECT3DCUBETEXTURE9 iface, D3DCUBEMAP_FACES FaceType, UINT Level, IDirect3DSurface9** ppCubeMapSurface) {
|
---|
287 | IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
---|
288 | HRESULT hrc = D3D_OK;
|
---|
289 | IWineD3DSurface *mySurface = NULL;
|
---|
290 |
|
---|
291 | TRACE("(%p) Relay\n", This);
|
---|
292 |
|
---|
293 | wined3d_mutex_lock();
|
---|
294 | hrc = IWineD3DCubeTexture_GetCubeMapSurface(This->wineD3DCubeTexture, (WINED3DCUBEMAP_FACES) FaceType, Level, &mySurface);
|
---|
295 | if (hrc == D3D_OK && NULL != ppCubeMapSurface) {
|
---|
296 | IWineD3DCubeTexture_GetParent(mySurface, (IUnknown **)ppCubeMapSurface);
|
---|
297 | IWineD3DCubeTexture_Release(mySurface);
|
---|
298 | }
|
---|
299 | wined3d_mutex_unlock();
|
---|
300 |
|
---|
301 | return hrc;
|
---|
302 | }
|
---|
303 |
|
---|
304 | static HRESULT WINAPI IDirect3DCubeTexture9Impl_LockRect(LPDIRECT3DCUBETEXTURE9 iface, D3DCUBEMAP_FACES FaceType, UINT Level, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) {
|
---|
305 | IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
---|
306 | HRESULT hr;
|
---|
307 | TRACE("(%p) Relay\n", This);
|
---|
308 |
|
---|
309 | wined3d_mutex_lock();
|
---|
310 | hr = IWineD3DCubeTexture_LockRect(This->wineD3DCubeTexture, (WINED3DCUBEMAP_FACES) FaceType, Level, (WINED3DLOCKED_RECT *) pLockedRect, pRect, Flags);
|
---|
311 | wined3d_mutex_unlock();
|
---|
312 |
|
---|
313 | return hr;
|
---|
314 | }
|
---|
315 |
|
---|
316 | static HRESULT WINAPI IDirect3DCubeTexture9Impl_UnlockRect(LPDIRECT3DCUBETEXTURE9 iface, D3DCUBEMAP_FACES FaceType, UINT Level) {
|
---|
317 | IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
---|
318 | HRESULT hr;
|
---|
319 | TRACE("(%p) Relay\n", This);
|
---|
320 |
|
---|
321 | wined3d_mutex_lock();
|
---|
322 | hr = IWineD3DCubeTexture_UnlockRect(This->wineD3DCubeTexture, (WINED3DCUBEMAP_FACES) FaceType, Level);
|
---|
323 | wined3d_mutex_unlock();
|
---|
324 |
|
---|
325 | return hr;
|
---|
326 | }
|
---|
327 |
|
---|
328 | static HRESULT WINAPI IDirect3DCubeTexture9Impl_AddDirtyRect(LPDIRECT3DCUBETEXTURE9 iface, D3DCUBEMAP_FACES FaceType, CONST RECT* pDirtyRect) {
|
---|
329 | IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface;
|
---|
330 | HRESULT hr;
|
---|
331 | TRACE("(%p) Relay\n", This);
|
---|
332 |
|
---|
333 | wined3d_mutex_lock();
|
---|
334 | hr = IWineD3DCubeTexture_AddDirtyRect(This->wineD3DCubeTexture, (WINED3DCUBEMAP_FACES) FaceType, pDirtyRect);
|
---|
335 | wined3d_mutex_unlock();
|
---|
336 |
|
---|
337 | return hr;
|
---|
338 | }
|
---|
339 |
|
---|
340 |
|
---|
341 | static const IDirect3DCubeTexture9Vtbl Direct3DCubeTexture9_Vtbl =
|
---|
342 | {
|
---|
343 | /* IUnknown */
|
---|
344 | IDirect3DCubeTexture9Impl_QueryInterface,
|
---|
345 | IDirect3DCubeTexture9Impl_AddRef,
|
---|
346 | IDirect3DCubeTexture9Impl_Release,
|
---|
347 | /* IDirect3DResource9 */
|
---|
348 | IDirect3DCubeTexture9Impl_GetDevice,
|
---|
349 | IDirect3DCubeTexture9Impl_SetPrivateData,
|
---|
350 | IDirect3DCubeTexture9Impl_GetPrivateData,
|
---|
351 | IDirect3DCubeTexture9Impl_FreePrivateData,
|
---|
352 | IDirect3DCubeTexture9Impl_SetPriority,
|
---|
353 | IDirect3DCubeTexture9Impl_GetPriority,
|
---|
354 | IDirect3DCubeTexture9Impl_PreLoad,
|
---|
355 | IDirect3DCubeTexture9Impl_GetType,
|
---|
356 | /* IDirect3DBaseTexture9 */
|
---|
357 | IDirect3DCubeTexture9Impl_SetLOD,
|
---|
358 | IDirect3DCubeTexture9Impl_GetLOD,
|
---|
359 | IDirect3DCubeTexture9Impl_GetLevelCount,
|
---|
360 | IDirect3DCubeTexture9Impl_SetAutoGenFilterType,
|
---|
361 | IDirect3DCubeTexture9Impl_GetAutoGenFilterType,
|
---|
362 | IDirect3DCubeTexture9Impl_GenerateMipSubLevels,
|
---|
363 | IDirect3DCubeTexture9Impl_GetLevelDesc,
|
---|
364 | IDirect3DCubeTexture9Impl_GetCubeMapSurface,
|
---|
365 | IDirect3DCubeTexture9Impl_LockRect,
|
---|
366 | IDirect3DCubeTexture9Impl_UnlockRect,
|
---|
367 | IDirect3DCubeTexture9Impl_AddDirtyRect
|
---|
368 | };
|
---|
369 |
|
---|
370 | static void STDMETHODCALLTYPE cubetexture_wined3d_object_destroyed(void *parent)
|
---|
371 | {
|
---|
372 | HeapFree(GetProcessHeap(), 0, parent);
|
---|
373 | }
|
---|
374 |
|
---|
375 | static const struct wined3d_parent_ops d3d9_cubetexture_wined3d_parent_ops =
|
---|
376 | {
|
---|
377 | cubetexture_wined3d_object_destroyed,
|
---|
378 | };
|
---|
379 |
|
---|
380 | HRESULT cubetexture_init(IDirect3DCubeTexture9Impl *texture, IDirect3DDevice9Impl *device,
|
---|
381 | UINT edge_length, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool)
|
---|
382 | {
|
---|
383 | HRESULT hr;
|
---|
384 |
|
---|
385 | texture->lpVtbl = &Direct3DCubeTexture9_Vtbl;
|
---|
386 | texture->ref = 1;
|
---|
387 |
|
---|
388 | wined3d_mutex_lock();
|
---|
389 | hr = IWineD3DDevice_CreateCubeTexture(device->WineD3DDevice, edge_length, levels, usage,
|
---|
390 | wined3dformat_from_d3dformat(format), pool, &texture->wineD3DCubeTexture,
|
---|
391 | (IUnknown *)texture, &d3d9_cubetexture_wined3d_parent_ops);
|
---|
392 | wined3d_mutex_unlock();
|
---|
393 | if (FAILED(hr))
|
---|
394 | {
|
---|
395 | WARN("Failed to create wined3d cube texture, hr %#x.\n", hr);
|
---|
396 | return hr;
|
---|
397 | }
|
---|
398 |
|
---|
399 | texture->parentDevice = (IDirect3DDevice9Ex *)device;
|
---|
400 | IDirect3DDevice9Ex_AddRef(texture->parentDevice);
|
---|
401 |
|
---|
402 | return D3D_OK;
|
---|
403 | }
|
---|