2 * IDirect3DStateBlock8 implementation
4 * Copyright 2002-2003 Raphael Junqueira
5 * Copyright 2002-2003 Jason Edmeades
6 * Copyright 2005 Oliver Stieber
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.
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.
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
24 #include "d3d8_private.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(d3d8
);
28 /* NOTE: DirectX8 doesn't export an IDirect3DStateBlock8, the interface is used internally to keep d3d8 and d3d9 as similar as possible */
29 /* IDirect3DStateBlock8 IUnknown parts follow: */
30 static HRESULT WINAPI
IDirect3DStateBlock8Impl_QueryInterface(IDirect3DStateBlock8
*iface
, REFIID riid
, LPVOID
*ppobj
) {
31 IDirect3DStateBlock8Impl
*This
= (IDirect3DStateBlock8Impl
*)iface
;
33 if (IsEqualGUID(riid
, &IID_IUnknown
)
34 || IsEqualGUID(riid
, &IID_IDirect3DStateBlock8
)) {
35 IUnknown_AddRef(iface
);
40 WARN("(%p)->(%s,%p),not found\n", This
, debugstr_guid(riid
), ppobj
);
45 static ULONG WINAPI
IDirect3DStateBlock8Impl_AddRef(IDirect3DStateBlock8
*iface
) {
46 IDirect3DStateBlock8Impl
*This
= (IDirect3DStateBlock8Impl
*)iface
;
47 ULONG ref
= InterlockedIncrement(&This
->ref
);
49 TRACE("(%p) : AddRef from %d\n", This
, ref
- 1);
54 static ULONG WINAPI
IDirect3DStateBlock8Impl_Release(IDirect3DStateBlock8
*iface
) {
55 IDirect3DStateBlock8Impl
*This
= (IDirect3DStateBlock8Impl
*)iface
;
56 ULONG ref
= InterlockedDecrement(&This
->ref
);
58 TRACE("(%p) : ReleaseRef to %d\n", This
, ref
);
62 IWineD3DStateBlock_Release(This
->wineD3DStateBlock
);
63 wined3d_mutex_unlock();
65 HeapFree(GetProcessHeap(), 0, This
);
70 /* IDirect3DStateBlock8 Interface follow: */
71 static HRESULT WINAPI
IDirect3DStateBlock8Impl_GetDevice(IDirect3DStateBlock8
*iface
, IDirect3DDevice8
**ppDevice
) {
72 IDirect3DStateBlock8Impl
*This
= (IDirect3DStateBlock8Impl
*)iface
;
73 IWineD3DDevice
*wined3d_device
;
76 TRACE("(%p) Relay\n", This
);
79 hr
= IWineD3DStateBlock_GetDevice(This
->wineD3DStateBlock
, &wined3d_device
);
82 IWineD3DDevice_GetParent(wined3d_device
, (IUnknown
**)ppDevice
);
83 IWineD3DDevice_Release(wined3d_device
);
85 wined3d_mutex_unlock();
90 static HRESULT WINAPI
IDirect3DStateBlock8Impl_Capture(IDirect3DStateBlock8
*iface
) {
91 IDirect3DStateBlock8Impl
*This
= (IDirect3DStateBlock8Impl
*)iface
;
94 TRACE("(%p) Relay\n", This
);
97 hr
= IWineD3DStateBlock_Capture(This
->wineD3DStateBlock
);
98 wined3d_mutex_unlock();
103 static HRESULT WINAPI
IDirect3DStateBlock8Impl_Apply(IDirect3DStateBlock8
*iface
) {
104 IDirect3DStateBlock8Impl
*This
= (IDirect3DStateBlock8Impl
*)iface
;
107 TRACE("(%p) Relay\n", This
);
109 wined3d_mutex_lock();
110 hr
= IWineD3DStateBlock_Apply(This
->wineD3DStateBlock
);
111 wined3d_mutex_unlock();
116 const IDirect3DStateBlock8Vtbl Direct3DStateBlock8_Vtbl
=
119 IDirect3DStateBlock8Impl_QueryInterface
,
120 IDirect3DStateBlock8Impl_AddRef
,
121 IDirect3DStateBlock8Impl_Release
,
122 /* IDirect3DStateBlock8 */
123 IDirect3DStateBlock8Impl_GetDevice
,
124 IDirect3DStateBlock8Impl_Capture
,
125 IDirect3DStateBlock8Impl_Apply