1 | /*
|
---|
2 | * IDirect3DVolumeTexture9 implementation
|
---|
3 | *
|
---|
4 | * Copyright 2002-2005 Jason Edmeades
|
---|
5 | * Raphael Junqueira
|
---|
6 | *
|
---|
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.
|
---|
11 | *
|
---|
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.
|
---|
16 | *
|
---|
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
---|
20 | */
|
---|
21 |
|
---|
22 | /*
|
---|
23 | * Sun LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
|
---|
24 | * other than GPL or LGPL is available it will apply instead, Sun elects to use only
|
---|
25 | * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
|
---|
26 | * a choice of LGPL license versions is made available with the language indicating
|
---|
27 | * that LGPLv2 or any later version may be used, or where a choice of which version
|
---|
28 | * of the LGPL is applied is otherwise unspecified.
|
---|
29 | */
|
---|
30 |
|
---|
31 | #include "config.h"
|
---|
32 | #include "d3d9_private.h"
|
---|
33 |
|
---|
34 | WINE_DEFAULT_DEBUG_CHANNEL(d3d9);
|
---|
35 |
|
---|
36 | /* IDirect3DVolumeTexture9 IUnknown parts follow: */
|
---|
37 | static HRESULT WINAPI IDirect3DVolumeTexture9Impl_QueryInterface(LPDIRECT3DVOLUMETEXTURE9 iface, REFIID riid, LPVOID* ppobj) {
|
---|
38 | IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface;
|
---|
39 |
|
---|
40 | if (IsEqualGUID(riid, &IID_IUnknown)
|
---|
41 | || IsEqualGUID(riid, &IID_IDirect3DResource9)
|
---|
42 | || IsEqualGUID(riid, &IID_IDirect3DBaseTexture9)
|
---|
43 | || IsEqualGUID(riid, &IID_IDirect3DVolumeTexture9)) {
|
---|
44 | IDirect3DVolumeTexture9_AddRef(iface);
|
---|
45 | *ppobj = This;
|
---|
46 | return S_OK;
|
---|
47 | }
|
---|
48 |
|
---|
49 | WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
|
---|
50 | *ppobj = NULL;
|
---|
51 | return E_NOINTERFACE;
|
---|
52 | }
|
---|
53 |
|
---|
54 | static ULONG WINAPI IDirect3DVolumeTexture9Impl_AddRef(LPDIRECT3DVOLUMETEXTURE9 iface) {
|
---|
55 | IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface;
|
---|
56 | ULONG ref = InterlockedIncrement(&This->ref);
|
---|
57 |
|
---|
58 | TRACE("(%p) : AddRef from %d\n", This, ref - 1);
|
---|
59 |
|
---|
60 | return ref;
|
---|
61 | }
|
---|
62 |
|
---|
63 | static ULONG WINAPI IDirect3DVolumeTexture9Impl_Release(LPDIRECT3DVOLUMETEXTURE9 iface) {
|
---|
64 | IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface;
|
---|
65 | ULONG ref = InterlockedDecrement(&This->ref);
|
---|
66 |
|
---|
67 | TRACE("(%p) : ReleaseRef to %d\n", This, ref);
|
---|
68 |
|
---|
69 | if (ref == 0) {
|
---|
70 | EnterCriticalSection(&d3d9_cs);
|
---|
71 | IWineD3DVolumeTexture_Destroy(This->wineD3DVolumeTexture, D3D9CB_DestroyVolume);
|
---|
72 | LeaveCriticalSection(&d3d9_cs);
|
---|
73 | IDirect3DDevice9Ex_Release(This->parentDevice);
|
---|
74 | HeapFree(GetProcessHeap(), 0, This);
|
---|
75 | }
|
---|
76 | return ref;
|
---|
77 | }
|
---|
78 |
|
---|
79 | /* IDirect3DVolumeTexture9 IDirect3DResource9 Interface follow: */
|
---|
80 | static HRESULT WINAPI IDirect3DVolumeTexture9Impl_GetDevice(LPDIRECT3DVOLUMETEXTURE9 iface, IDirect3DDevice9** ppDevice) {
|
---|
81 | IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface;
|
---|
82 | IWineD3DDevice *wined3d_device;
|
---|
83 | HRESULT hr;
|
---|
84 |
|
---|
85 | TRACE("(%p) Relay\n", This);
|
---|
86 |
|
---|
87 | EnterCriticalSection(&d3d9_cs);
|
---|
88 | hr = IWineD3DStateBlock_GetDevice(This->wineD3DVolumeTexture, &wined3d_device);
|
---|
89 | if (SUCCEEDED(hr))
|
---|
90 | {
|
---|
91 | IWineD3DDevice_GetParent(wined3d_device, (IUnknown **)ppDevice);
|
---|
92 | IWineD3DDevice_Release(wined3d_device);
|
---|
93 | }
|
---|
94 | LeaveCriticalSection(&d3d9_cs);
|
---|
95 |
|
---|
96 | return hr;
|
---|
97 | }
|
---|
98 |
|
---|
99 | static HRESULT WINAPI IDirect3DVolumeTexture9Impl_SetPrivateData(LPDIRECT3DVOLUMETEXTURE9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
|
---|
100 | IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface;
|
---|
101 | HRESULT hr;
|
---|
102 |
|
---|
103 | TRACE("(%p) Relay\n", This);
|
---|
104 |
|
---|
105 | EnterCriticalSection(&d3d9_cs);
|
---|
106 |
|
---|
107 | hr = IWineD3DVolumeTexture_SetPrivateData(This->wineD3DVolumeTexture, refguid, pData, SizeOfData, Flags);
|
---|
108 |
|
---|
109 | LeaveCriticalSection(&d3d9_cs);
|
---|
110 |
|
---|
111 | return hr;
|
---|
112 | }
|
---|
113 |
|
---|
114 | static HRESULT WINAPI IDirect3DVolumeTexture9Impl_GetPrivateData(LPDIRECT3DVOLUMETEXTURE9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
|
---|
115 | IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface;
|
---|
116 | HRESULT hr;
|
---|
117 |
|
---|
118 | TRACE("(%p) Relay\n", This);
|
---|
119 |
|
---|
120 | EnterCriticalSection(&d3d9_cs);
|
---|
121 |
|
---|
122 | hr = IWineD3DVolumeTexture_GetPrivateData(This->wineD3DVolumeTexture, refguid, pData, pSizeOfData);
|
---|
123 |
|
---|
124 | LeaveCriticalSection(&d3d9_cs);
|
---|
125 |
|
---|
126 | return hr;
|
---|
127 | }
|
---|
128 |
|
---|
129 | static HRESULT WINAPI IDirect3DVolumeTexture9Impl_FreePrivateData(LPDIRECT3DVOLUMETEXTURE9 iface, REFGUID refguid) {
|
---|
130 | IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface;
|
---|
131 | HRESULT hr;
|
---|
132 |
|
---|
133 | TRACE("(%p) Relay\n", This);
|
---|
134 |
|
---|
135 | EnterCriticalSection(&d3d9_cs);
|
---|
136 |
|
---|
137 | hr = IWineD3DVolumeTexture_FreePrivateData(This->wineD3DVolumeTexture, refguid);
|
---|
138 |
|
---|
139 | LeaveCriticalSection(&d3d9_cs);
|
---|
140 |
|
---|
141 | return hr;
|
---|
142 | }
|
---|
143 |
|
---|
144 | static DWORD WINAPI IDirect3DVolumeTexture9Impl_SetPriority(LPDIRECT3DVOLUMETEXTURE9 iface, DWORD PriorityNew) {
|
---|
145 | IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface;
|
---|
146 | DWORD priority;
|
---|
147 |
|
---|
148 | TRACE("(%p) Relay\n", This);
|
---|
149 |
|
---|
150 | EnterCriticalSection(&d3d9_cs);
|
---|
151 |
|
---|
152 | priority = IWineD3DVolumeTexture_SetPriority(This->wineD3DVolumeTexture, PriorityNew);
|
---|
153 |
|
---|
154 | LeaveCriticalSection(&d3d9_cs);
|
---|
155 |
|
---|
156 | return priority;
|
---|
157 | }
|
---|
158 |
|
---|
159 | static DWORD WINAPI IDirect3DVolumeTexture9Impl_GetPriority(LPDIRECT3DVOLUMETEXTURE9 iface) {
|
---|
160 | IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface;
|
---|
161 | DWORD priority;
|
---|
162 |
|
---|
163 | TRACE("(%p) Relay\n", This);
|
---|
164 |
|
---|
165 | EnterCriticalSection(&d3d9_cs);
|
---|
166 |
|
---|
167 | priority = IWineD3DVolumeTexture_GetPriority(This->wineD3DVolumeTexture);
|
---|
168 |
|
---|
169 | LeaveCriticalSection(&d3d9_cs);
|
---|
170 |
|
---|
171 | return priority;
|
---|
172 | }
|
---|
173 |
|
---|
174 | static void WINAPI IDirect3DVolumeTexture9Impl_PreLoad(LPDIRECT3DVOLUMETEXTURE9 iface) {
|
---|
175 | IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface;
|
---|
176 |
|
---|
177 | TRACE("(%p) Relay\n", This);
|
---|
178 |
|
---|
179 | EnterCriticalSection(&d3d9_cs);
|
---|
180 |
|
---|
181 | IWineD3DVolumeTexture_PreLoad(This->wineD3DVolumeTexture);
|
---|
182 |
|
---|
183 | LeaveCriticalSection(&d3d9_cs);
|
---|
184 | }
|
---|
185 |
|
---|
186 | static D3DRESOURCETYPE WINAPI IDirect3DVolumeTexture9Impl_GetType(LPDIRECT3DVOLUMETEXTURE9 iface) {
|
---|
187 | IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface;
|
---|
188 | D3DRESOURCETYPE type;
|
---|
189 |
|
---|
190 | TRACE("(%p) Relay\n", This);
|
---|
191 |
|
---|
192 | EnterCriticalSection(&d3d9_cs);
|
---|
193 |
|
---|
194 | type = IWineD3DVolumeTexture_GetType(This->wineD3DVolumeTexture);
|
---|
195 |
|
---|
196 | LeaveCriticalSection(&d3d9_cs);
|
---|
197 |
|
---|
198 | return type;
|
---|
199 | }
|
---|
200 |
|
---|
201 | /* IDirect3DVolumeTexture9 IDirect3DBaseTexture9 Interface follow: */
|
---|
202 | static DWORD WINAPI IDirect3DVolumeTexture9Impl_SetLOD(LPDIRECT3DVOLUMETEXTURE9 iface, DWORD LODNew) {
|
---|
203 | IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface;
|
---|
204 | DWORD lod;
|
---|
205 |
|
---|
206 | TRACE("(%p) Relay\n", This);
|
---|
207 |
|
---|
208 | EnterCriticalSection(&d3d9_cs);
|
---|
209 |
|
---|
210 | lod = IWineD3DVolumeTexture_SetLOD(This->wineD3DVolumeTexture, LODNew);
|
---|
211 |
|
---|
212 | LeaveCriticalSection(&d3d9_cs);
|
---|
213 |
|
---|
214 | return lod;
|
---|
215 | }
|
---|
216 |
|
---|
217 | static DWORD WINAPI IDirect3DVolumeTexture9Impl_GetLOD(LPDIRECT3DVOLUMETEXTURE9 iface) {
|
---|
218 | IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface;
|
---|
219 | DWORD lod;
|
---|
220 |
|
---|
221 | TRACE("(%p) Relay\n", This);
|
---|
222 |
|
---|
223 | EnterCriticalSection(&d3d9_cs);
|
---|
224 |
|
---|
225 | lod = IWineD3DVolumeTexture_GetLOD(This->wineD3DVolumeTexture);
|
---|
226 |
|
---|
227 | LeaveCriticalSection(&d3d9_cs);
|
---|
228 |
|
---|
229 | return lod;
|
---|
230 | }
|
---|
231 |
|
---|
232 | static DWORD WINAPI IDirect3DVolumeTexture9Impl_GetLevelCount(LPDIRECT3DVOLUMETEXTURE9 iface) {
|
---|
233 | IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface;
|
---|
234 | DWORD level_count;
|
---|
235 |
|
---|
236 | TRACE("(%p) Relay\n", This);
|
---|
237 |
|
---|
238 | EnterCriticalSection(&d3d9_cs);
|
---|
239 |
|
---|
240 | level_count = IWineD3DVolumeTexture_GetLevelCount(This->wineD3DVolumeTexture);
|
---|
241 |
|
---|
242 | LeaveCriticalSection(&d3d9_cs);
|
---|
243 |
|
---|
244 | return level_count;
|
---|
245 | }
|
---|
246 |
|
---|
247 | static HRESULT WINAPI IDirect3DVolumeTexture9Impl_SetAutoGenFilterType(LPDIRECT3DVOLUMETEXTURE9 iface, D3DTEXTUREFILTERTYPE FilterType) {
|
---|
248 | IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface;
|
---|
249 | HRESULT hr;
|
---|
250 |
|
---|
251 | TRACE("(%p) Relay\n", This);
|
---|
252 |
|
---|
253 | EnterCriticalSection(&d3d9_cs);
|
---|
254 |
|
---|
255 | hr = IWineD3DVolumeTexture_SetAutoGenFilterType(This->wineD3DVolumeTexture, (WINED3DTEXTUREFILTERTYPE) FilterType);
|
---|
256 |
|
---|
257 | LeaveCriticalSection(&d3d9_cs);
|
---|
258 |
|
---|
259 | return hr;
|
---|
260 | }
|
---|
261 |
|
---|
262 | static D3DTEXTUREFILTERTYPE WINAPI IDirect3DVolumeTexture9Impl_GetAutoGenFilterType(LPDIRECT3DVOLUMETEXTURE9 iface) {
|
---|
263 | IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface;
|
---|
264 | D3DTEXTUREFILTERTYPE filter_type;
|
---|
265 |
|
---|
266 | TRACE("(%p) Relay\n", This);
|
---|
267 |
|
---|
268 | EnterCriticalSection(&d3d9_cs);
|
---|
269 |
|
---|
270 | filter_type = (D3DTEXTUREFILTERTYPE)IWineD3DVolumeTexture_GetAutoGenFilterType(This->wineD3DVolumeTexture);
|
---|
271 |
|
---|
272 | LeaveCriticalSection(&d3d9_cs);
|
---|
273 |
|
---|
274 | return filter_type;
|
---|
275 | }
|
---|
276 |
|
---|
277 | static void WINAPI IDirect3DVolumeTexture9Impl_GenerateMipSubLevels(LPDIRECT3DVOLUMETEXTURE9 iface) {
|
---|
278 | IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface;
|
---|
279 |
|
---|
280 | TRACE("(%p) Relay\n", This);
|
---|
281 |
|
---|
282 | EnterCriticalSection(&d3d9_cs);
|
---|
283 |
|
---|
284 | IWineD3DVolumeTexture_GenerateMipSubLevels(This->wineD3DVolumeTexture);
|
---|
285 |
|
---|
286 | LeaveCriticalSection(&d3d9_cs);
|
---|
287 | }
|
---|
288 |
|
---|
289 | /* IDirect3DVolumeTexture9 Interface follow: */
|
---|
290 | static HRESULT WINAPI IDirect3DVolumeTexture9Impl_GetLevelDesc(LPDIRECT3DVOLUMETEXTURE9 iface, UINT Level, D3DVOLUME_DESC* pDesc) {
|
---|
291 | IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface;
|
---|
292 | WINED3DVOLUME_DESC wined3ddesc;
|
---|
293 | UINT tmpInt = -1;
|
---|
294 | WINED3DFORMAT format;
|
---|
295 | HRESULT hr;
|
---|
296 |
|
---|
297 | TRACE("(%p) Relay\n", This);
|
---|
298 |
|
---|
299 | /* As d3d8 and d3d9 structures differ, pass in ptrs to where data needs to go */
|
---|
300 | wined3ddesc.Format = &format;
|
---|
301 | wined3ddesc.Type = (WINED3DRESOURCETYPE *)&pDesc->Type;
|
---|
302 | wined3ddesc.Usage = &pDesc->Usage;
|
---|
303 | wined3ddesc.Pool = (WINED3DPOOL *) &pDesc->Pool;
|
---|
304 | wined3ddesc.Size = &tmpInt;
|
---|
305 | wined3ddesc.Width = &pDesc->Width;
|
---|
306 | wined3ddesc.Height = &pDesc->Height;
|
---|
307 | wined3ddesc.Depth = &pDesc->Depth;
|
---|
308 |
|
---|
309 | EnterCriticalSection(&d3d9_cs);
|
---|
310 |
|
---|
311 | hr = IWineD3DVolumeTexture_GetLevelDesc(This->wineD3DVolumeTexture, Level, &wined3ddesc);
|
---|
312 |
|
---|
313 | LeaveCriticalSection(&d3d9_cs);
|
---|
314 |
|
---|
315 | if (SUCCEEDED(hr)) pDesc->Format = d3dformat_from_wined3dformat(format);
|
---|
316 |
|
---|
317 | return hr;
|
---|
318 | }
|
---|
319 |
|
---|
320 | static HRESULT WINAPI IDirect3DVolumeTexture9Impl_GetVolumeLevel(LPDIRECT3DVOLUMETEXTURE9 iface, UINT Level, IDirect3DVolume9** ppVolumeLevel) {
|
---|
321 | IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface;
|
---|
322 | HRESULT hrc = D3D_OK;
|
---|
323 | IWineD3DVolume *myVolume = NULL;
|
---|
324 |
|
---|
325 | TRACE("(%p) Relay\n", This);
|
---|
326 |
|
---|
327 | EnterCriticalSection(&d3d9_cs);
|
---|
328 |
|
---|
329 | hrc = IWineD3DVolumeTexture_GetVolumeLevel(This->wineD3DVolumeTexture, Level, &myVolume);
|
---|
330 | if (hrc == D3D_OK && NULL != ppVolumeLevel) {
|
---|
331 | IWineD3DVolumeTexture_GetParent(myVolume, (IUnknown **)ppVolumeLevel);
|
---|
332 | IWineD3DVolumeTexture_Release(myVolume);
|
---|
333 | }
|
---|
334 |
|
---|
335 | LeaveCriticalSection(&d3d9_cs);
|
---|
336 |
|
---|
337 | return hrc;
|
---|
338 | }
|
---|
339 |
|
---|
340 | static HRESULT WINAPI IDirect3DVolumeTexture9Impl_LockBox(LPDIRECT3DVOLUMETEXTURE9 iface, UINT Level, D3DLOCKED_BOX* pLockedVolume, CONST D3DBOX* pBox, DWORD Flags) {
|
---|
341 | IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface;
|
---|
342 | HRESULT hr;
|
---|
343 |
|
---|
344 | TRACE("(%p) Relay %p %p %p %d\n", This, This->wineD3DVolumeTexture, pLockedVolume, pBox,Flags);
|
---|
345 |
|
---|
346 | EnterCriticalSection(&d3d9_cs);
|
---|
347 |
|
---|
348 | hr = IWineD3DVolumeTexture_LockBox(This->wineD3DVolumeTexture, Level, (WINED3DLOCKED_BOX *)pLockedVolume,
|
---|
349 | (const WINED3DBOX *)pBox, Flags);
|
---|
350 |
|
---|
351 | LeaveCriticalSection(&d3d9_cs);
|
---|
352 |
|
---|
353 | return hr;
|
---|
354 | }
|
---|
355 |
|
---|
356 | static HRESULT WINAPI IDirect3DVolumeTexture9Impl_UnlockBox(LPDIRECT3DVOLUMETEXTURE9 iface, UINT Level) {
|
---|
357 | IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface;
|
---|
358 | HRESULT hr;
|
---|
359 |
|
---|
360 | TRACE("(%p) Relay %p %d\n", This, This->wineD3DVolumeTexture, Level);
|
---|
361 |
|
---|
362 | EnterCriticalSection(&d3d9_cs);
|
---|
363 |
|
---|
364 | hr = IWineD3DVolumeTexture_UnlockBox(This->wineD3DVolumeTexture, Level);
|
---|
365 |
|
---|
366 | LeaveCriticalSection(&d3d9_cs);
|
---|
367 |
|
---|
368 | return hr;
|
---|
369 | }
|
---|
370 |
|
---|
371 | static HRESULT WINAPI IDirect3DVolumeTexture9Impl_AddDirtyBox(LPDIRECT3DVOLUMETEXTURE9 iface, CONST D3DBOX* pDirtyBox) {
|
---|
372 | IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface;
|
---|
373 | HRESULT hr;
|
---|
374 |
|
---|
375 | TRACE("(%p) Relay\n", This);
|
---|
376 |
|
---|
377 | EnterCriticalSection(&d3d9_cs);
|
---|
378 |
|
---|
379 | hr = IWineD3DVolumeTexture_AddDirtyBox(This->wineD3DVolumeTexture, (CONST WINED3DBOX *)pDirtyBox);
|
---|
380 |
|
---|
381 | LeaveCriticalSection(&d3d9_cs);
|
---|
382 |
|
---|
383 | return hr;
|
---|
384 | }
|
---|
385 |
|
---|
386 |
|
---|
387 | static const IDirect3DVolumeTexture9Vtbl Direct3DVolumeTexture9_Vtbl =
|
---|
388 | {
|
---|
389 | /* IUnknown */
|
---|
390 | IDirect3DVolumeTexture9Impl_QueryInterface,
|
---|
391 | IDirect3DVolumeTexture9Impl_AddRef,
|
---|
392 | IDirect3DVolumeTexture9Impl_Release,
|
---|
393 | /* IDirect3DResource9 */
|
---|
394 | IDirect3DVolumeTexture9Impl_GetDevice,
|
---|
395 | IDirect3DVolumeTexture9Impl_SetPrivateData,
|
---|
396 | IDirect3DVolumeTexture9Impl_GetPrivateData,
|
---|
397 | IDirect3DVolumeTexture9Impl_FreePrivateData,
|
---|
398 | IDirect3DVolumeTexture9Impl_SetPriority,
|
---|
399 | IDirect3DVolumeTexture9Impl_GetPriority,
|
---|
400 | IDirect3DVolumeTexture9Impl_PreLoad,
|
---|
401 | IDirect3DVolumeTexture9Impl_GetType,
|
---|
402 | /* IDirect3DBaseTexture9 */
|
---|
403 | IDirect3DVolumeTexture9Impl_SetLOD,
|
---|
404 | IDirect3DVolumeTexture9Impl_GetLOD,
|
---|
405 | IDirect3DVolumeTexture9Impl_GetLevelCount,
|
---|
406 | IDirect3DVolumeTexture9Impl_SetAutoGenFilterType,
|
---|
407 | IDirect3DVolumeTexture9Impl_GetAutoGenFilterType,
|
---|
408 | IDirect3DVolumeTexture9Impl_GenerateMipSubLevels,
|
---|
409 | /* IDirect3DVolumeTexture9 */
|
---|
410 | IDirect3DVolumeTexture9Impl_GetLevelDesc,
|
---|
411 | IDirect3DVolumeTexture9Impl_GetVolumeLevel,
|
---|
412 | IDirect3DVolumeTexture9Impl_LockBox,
|
---|
413 | IDirect3DVolumeTexture9Impl_UnlockBox,
|
---|
414 | IDirect3DVolumeTexture9Impl_AddDirtyBox
|
---|
415 | };
|
---|
416 |
|
---|
417 |
|
---|
418 | /* IDirect3DDevice9 IDirect3DVolumeTexture9 Methods follow: */
|
---|
419 | HRESULT WINAPI IDirect3DDevice9Impl_CreateVolumeTexture(LPDIRECT3DDEVICE9EX iface,
|
---|
420 | UINT Width, UINT Height, UINT Depth, UINT Levels, DWORD Usage,
|
---|
421 | D3DFORMAT Format, D3DPOOL Pool,
|
---|
422 | IDirect3DVolumeTexture9** ppVolumeTexture, HANDLE* pSharedHandle) {
|
---|
423 |
|
---|
424 | IDirect3DVolumeTexture9Impl *object;
|
---|
425 | IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
|
---|
426 | HRESULT hrc = D3D_OK;
|
---|
427 |
|
---|
428 | TRACE("(%p) Relay\n", This);
|
---|
429 |
|
---|
430 | /* Allocate the storage for the device */
|
---|
431 | object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DVolumeTexture9Impl));
|
---|
432 | if (NULL == object) {
|
---|
433 | ERR("(%p) allocation of memory failed, returning D3DERR_OUTOFVIDEOMEMORY\n", This);
|
---|
434 | return D3DERR_OUTOFVIDEOMEMORY;
|
---|
435 | }
|
---|
436 |
|
---|
437 | object->lpVtbl = &Direct3DVolumeTexture9_Vtbl;
|
---|
438 | object->ref = 1;
|
---|
439 |
|
---|
440 | EnterCriticalSection(&d3d9_cs);
|
---|
441 |
|
---|
442 | hrc = IWineD3DDevice_CreateVolumeTexture(This->WineD3DDevice, Width, Height, Depth, Levels,
|
---|
443 | Usage & WINED3DUSAGE_MASK, wined3dformat_from_d3dformat(Format),
|
---|
444 | Pool, &object->wineD3DVolumeTexture, (IUnknown *)object);
|
---|
445 |
|
---|
446 | LeaveCriticalSection(&d3d9_cs);
|
---|
447 |
|
---|
448 | if (hrc != D3D_OK) {
|
---|
449 |
|
---|
450 | /* free up object */
|
---|
451 | WARN("(%p) call to IWineD3DDevice_CreateVolumeTexture failed\n", This);
|
---|
452 | HeapFree(GetProcessHeap(), 0, object);
|
---|
453 | } else {
|
---|
454 | IDirect3DDevice9Ex_AddRef(iface);
|
---|
455 | object->parentDevice = iface;
|
---|
456 | *ppVolumeTexture = (LPDIRECT3DVOLUMETEXTURE9) object;
|
---|
457 | TRACE("(%p) : Created volume texture %p\n", This, object);
|
---|
458 | }
|
---|
459 | TRACE("(%p) returning %p\n", This , *ppVolumeTexture);
|
---|
460 | return hrc;
|
---|
461 | }
|
---|