2 * IDirect3DVolumeTexture8 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 /* IDirect3DVolumeTexture8 IUnknown parts follow: */
27 static HRESULT WINAPI IDirect3DVolumeTexture8Impl_QueryInterface(LPDIRECT3DVOLUMETEXTURE8 iface, REFIID riid, LPVOID *ppobj) {
28 IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface;
30 if (IsEqualGUID(riid, &IID_IUnknown)
31 || IsEqualGUID(riid, &IID_IDirect3DResource8)
32 || IsEqualGUID(riid, &IID_IDirect3DBaseTexture8)
33 || IsEqualGUID(riid, &IID_IDirect3DVolumeTexture8)) {
34 IUnknown_AddRef(iface);
39 WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
44 static ULONG WINAPI IDirect3DVolumeTexture8Impl_AddRef(LPDIRECT3DVOLUMETEXTURE8 iface) {
45 IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface;
46 ULONG ref = InterlockedIncrement(&This->ref);
48 TRACE("(%p) : AddRef from %d\n", This, ref - 1);
53 static ULONG WINAPI IDirect3DVolumeTexture8Impl_Release(LPDIRECT3DVOLUMETEXTURE8 iface) {
54 IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface;
55 ULONG ref = InterlockedDecrement(&This->ref);
57 TRACE("(%p) : ReleaseRef to %d\n", This, ref);
61 IWineD3DVolumeTexture_Destroy(This->wineD3DVolumeTexture, D3D8CB_DestroyVolume);
62 wined3d_mutex_unlock();
64 IUnknown_Release(This->parentDevice);
65 HeapFree(GetProcessHeap(), 0, This);
70 /* IDirect3DVolumeTexture8 IDirect3DResource8 Interface follow: */
71 static HRESULT WINAPI IDirect3DVolumeTexture8Impl_GetDevice(LPDIRECT3DVOLUMETEXTURE8 iface, IDirect3DDevice8 **ppDevice) {
72 IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface;
73 IWineD3DDevice *wined3d_device;
75 TRACE("(%p) Relay\n", This);
78 hr = IWineD3DVolumeTexture_GetDevice(This->wineD3DVolumeTexture, &wined3d_device);
81 IWineD3DDevice_GetParent(wined3d_device, (IUnknown **)ppDevice);
82 IWineD3DDevice_Release(wined3d_device);
84 wined3d_mutex_unlock();
89 static HRESULT WINAPI IDirect3DVolumeTexture8Impl_SetPrivateData(LPDIRECT3DVOLUMETEXTURE8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
90 IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface;
92 TRACE("(%p) Relay\n", This);
95 hr = IWineD3DVolumeTexture_SetPrivateData(This->wineD3DVolumeTexture, refguid, pData, SizeOfData, Flags);
96 wined3d_mutex_unlock();
101 static HRESULT WINAPI IDirect3DVolumeTexture8Impl_GetPrivateData(LPDIRECT3DVOLUMETEXTURE8 iface, REFGUID refguid, void *pData, DWORD *pSizeOfData) {
102 IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface;
104 TRACE("(%p) Relay\n", This);
106 wined3d_mutex_lock();
107 hr = IWineD3DVolumeTexture_GetPrivateData(This->wineD3DVolumeTexture, refguid, pData, pSizeOfData);
108 wined3d_mutex_unlock();
113 static HRESULT WINAPI IDirect3DVolumeTexture8Impl_FreePrivateData(LPDIRECT3DVOLUMETEXTURE8 iface, REFGUID refguid) {
114 IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface;
116 TRACE("(%p) Relay\n", This);
118 wined3d_mutex_lock();
119 hr = IWineD3DVolumeTexture_FreePrivateData(This->wineD3DVolumeTexture, refguid);
120 wined3d_mutex_unlock();
125 static DWORD WINAPI IDirect3DVolumeTexture8Impl_SetPriority(LPDIRECT3DVOLUMETEXTURE8 iface, DWORD PriorityNew) {
126 IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface;
128 TRACE("(%p) Relay\n", This);
130 wined3d_mutex_lock();
131 ret = IWineD3DVolumeTexture_SetPriority(This->wineD3DVolumeTexture, PriorityNew);
132 wined3d_mutex_unlock();
137 static DWORD WINAPI IDirect3DVolumeTexture8Impl_GetPriority(LPDIRECT3DVOLUMETEXTURE8 iface) {
138 IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface;
140 TRACE("(%p) Relay\n", This);
142 wined3d_mutex_lock();
143 ret = IWineD3DVolumeTexture_GetPriority(This->wineD3DVolumeTexture);
144 wined3d_mutex_unlock();
149 static void WINAPI IDirect3DVolumeTexture8Impl_PreLoad(LPDIRECT3DVOLUMETEXTURE8 iface) {
150 IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface;
151 TRACE("(%p) Relay\n", This);
153 wined3d_mutex_lock();
154 IWineD3DVolumeTexture_PreLoad(This->wineD3DVolumeTexture);
155 wined3d_mutex_unlock();
158 static D3DRESOURCETYPE WINAPI IDirect3DVolumeTexture8Impl_GetType(LPDIRECT3DVOLUMETEXTURE8 iface) {
159 IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface;
160 D3DRESOURCETYPE type;
161 TRACE("(%p) Relay\n", This);
163 wined3d_mutex_lock();
164 type = IWineD3DVolumeTexture_GetType(This->wineD3DVolumeTexture);
165 wined3d_mutex_unlock();
170 /* IDirect3DVolumeTexture8 IDirect3DBaseTexture8 Interface follow: */
171 static DWORD WINAPI IDirect3DVolumeTexture8Impl_SetLOD(LPDIRECT3DVOLUMETEXTURE8 iface, DWORD LODNew) {
172 IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface;
174 TRACE("(%p) Relay\n", This);
176 wined3d_mutex_lock();
177 ret = IWineD3DVolumeTexture_SetLOD(This->wineD3DVolumeTexture, LODNew);
178 wined3d_mutex_unlock();
183 static DWORD WINAPI IDirect3DVolumeTexture8Impl_GetLOD(LPDIRECT3DVOLUMETEXTURE8 iface) {
184 IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface;
186 TRACE("(%p) Relay\n", This);
188 wined3d_mutex_lock();
189 ret = IWineD3DVolumeTexture_GetLOD(This->wineD3DVolumeTexture);
190 wined3d_mutex_unlock();
195 static DWORD WINAPI IDirect3DVolumeTexture8Impl_GetLevelCount(LPDIRECT3DVOLUMETEXTURE8 iface) {
196 IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface;
198 TRACE("(%p) Relay\n", This);
200 wined3d_mutex_lock();
201 ret = IWineD3DVolumeTexture_GetLevelCount(This->wineD3DVolumeTexture);
202 wined3d_mutex_unlock();
207 /* IDirect3DVolumeTexture8 Interface follow: */
208 static HRESULT WINAPI IDirect3DVolumeTexture8Impl_GetLevelDesc(LPDIRECT3DVOLUMETEXTURE8 iface, UINT Level, D3DVOLUME_DESC* pDesc) {
209 IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface;
210 WINED3DVOLUME_DESC wined3ddesc;
213 TRACE("(%p) Relay\n", This);
215 wined3d_mutex_lock();
216 hr = IWineD3DVolumeTexture_GetLevelDesc(This->wineD3DVolumeTexture, Level, &wined3ddesc);
217 wined3d_mutex_unlock();
221 pDesc->Format = d3dformat_from_wined3dformat(wined3ddesc.Format);
222 pDesc->Type = wined3ddesc.Type;
223 pDesc->Usage = wined3ddesc.Usage;
224 pDesc->Pool = wined3ddesc.Pool;
225 pDesc->Size = wined3ddesc.Size;
226 pDesc->Width = wined3ddesc.Width;
227 pDesc->Height = wined3ddesc.Height;
228 pDesc->Depth = wined3ddesc.Depth;
234 static HRESULT WINAPI IDirect3DVolumeTexture8Impl_GetVolumeLevel(LPDIRECT3DVOLUMETEXTURE8 iface, UINT Level, IDirect3DVolume8 **ppVolumeLevel) {
235 IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface;
236 HRESULT hrc = D3D_OK;
237 IWineD3DVolume *myVolume = NULL;
239 TRACE("(%p) Relay\n", This);
241 wined3d_mutex_lock();
242 hrc = IWineD3DVolumeTexture_GetVolumeLevel(This->wineD3DVolumeTexture, Level, &myVolume);
243 if (hrc == D3D_OK && NULL != ppVolumeLevel) {
244 IWineD3DVolumeTexture_GetParent(myVolume, (IUnknown **)ppVolumeLevel);
245 IWineD3DVolumeTexture_Release(myVolume);
247 wined3d_mutex_unlock();
252 static HRESULT WINAPI IDirect3DVolumeTexture8Impl_LockBox(LPDIRECT3DVOLUMETEXTURE8 iface, UINT Level, D3DLOCKED_BOX *pLockedVolume, CONST D3DBOX *pBox, DWORD Flags) {
253 IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface;
255 TRACE("(%p) Relay %p %p %p %d\n", This, This->wineD3DVolumeTexture, pLockedVolume, pBox,Flags);
257 wined3d_mutex_lock();
258 hr = IWineD3DVolumeTexture_LockBox(This->wineD3DVolumeTexture, Level, (WINED3DLOCKED_BOX *) pLockedVolume, (CONST WINED3DBOX *) pBox, Flags);
259 wined3d_mutex_unlock();
264 static HRESULT WINAPI IDirect3DVolumeTexture8Impl_UnlockBox(LPDIRECT3DVOLUMETEXTURE8 iface, UINT Level) {
265 IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface;
267 TRACE("(%p) Relay %p %d\n", This, This->wineD3DVolumeTexture, Level);
269 wined3d_mutex_lock();
270 hr = IWineD3DVolumeTexture_UnlockBox(This->wineD3DVolumeTexture, Level);
271 wined3d_mutex_unlock();
276 static HRESULT WINAPI IDirect3DVolumeTexture8Impl_AddDirtyBox(LPDIRECT3DVOLUMETEXTURE8 iface, CONST D3DBOX *pDirtyBox) {
277 IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface;
279 TRACE("(%p) Relay\n", This);
281 wined3d_mutex_lock();
282 hr = IWineD3DVolumeTexture_AddDirtyBox(This->wineD3DVolumeTexture, (CONST WINED3DBOX *) pDirtyBox);
283 wined3d_mutex_unlock();
289 const IDirect3DVolumeTexture8Vtbl Direct3DVolumeTexture8_Vtbl =
292 IDirect3DVolumeTexture8Impl_QueryInterface,
293 IDirect3DVolumeTexture8Impl_AddRef,
294 IDirect3DVolumeTexture8Impl_Release,
295 /* IDirect3DResource8 */
296 IDirect3DVolumeTexture8Impl_GetDevice,
297 IDirect3DVolumeTexture8Impl_SetPrivateData,
298 IDirect3DVolumeTexture8Impl_GetPrivateData,
299 IDirect3DVolumeTexture8Impl_FreePrivateData,
300 IDirect3DVolumeTexture8Impl_SetPriority,
301 IDirect3DVolumeTexture8Impl_GetPriority,
302 IDirect3DVolumeTexture8Impl_PreLoad,
303 IDirect3DVolumeTexture8Impl_GetType,
304 /* IDirect3DBaseTexture8 */
305 IDirect3DVolumeTexture8Impl_SetLOD,
306 IDirect3DVolumeTexture8Impl_GetLOD,
307 IDirect3DVolumeTexture8Impl_GetLevelCount,
308 /* IDirect3DVolumeTexture8 */
309 IDirect3DVolumeTexture8Impl_GetLevelDesc,
310 IDirect3DVolumeTexture8Impl_GetVolumeLevel,
311 IDirect3DVolumeTexture8Impl_LockBox,
312 IDirect3DVolumeTexture8Impl_UnlockBox,
313 IDirect3DVolumeTexture8Impl_AddDirtyBox