~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Wine Cross Reference
wine/dlls/d3d8/stateblock.c

Version: ~ [ wine-1.1.33 ] ~ [ wine-1.1.32 ] ~ [ wine-1.1.31 ] ~ [ wine-1.1.30 ] ~ [ wine-1.1.29 ] ~ [ wine-1.1.28 ] ~ [ wine-1.1.27 ] ~ [ wine-1.1.26 ] ~ [ wine-1.1.25 ] ~ [ wine-1.1.24 ] ~ [ wine-1.1.23 ] ~ [ wine-1.1.22 ] ~ [ wine-1.1.21 ] ~ [ wine-1.1.20 ] ~ [ wine-1.1.19 ] ~ [ wine-1.1.18 ] ~ [ wine-1.1.17 ] ~ [ wine-1.1.16 ] ~ [ wine-1.1.15 ] ~ [ wine-1.1.14 ] ~ [ wine-1.1.13 ] ~ [ wine-1.1.12 ] ~ [ wine-1.1.11 ] ~ [ wine-1.1.10 ] ~ [ wine-1.1.9 ] ~ [ wine-1.1.8 ] ~ [ wine-1.1.7 ] ~ [ wine-1.0.1 ] ~ [ wine-1.1.6 ] ~ [ wine-1.1.5 ] ~ [ wine-1.1.4 ] ~ [ wine-1.1.3 ] ~ [ wine-1.1.2 ] ~ [ wine-1.1.1 ] ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~

  1 /*
  2  * IDirect3DStateBlock8 implementation
  3  *
  4  * Copyright 2002-2003 Raphael Junqueira
  5  * Copyright 2002-2003 Jason Edmeades
  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 #include "config.h"
 24 #include "d3d8_private.h"
 25 
 26 WINE_DEFAULT_DEBUG_CHANNEL(d3d8);
 27 
 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;
 32 
 33     TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), ppobj);
 34 
 35     if (IsEqualGUID(riid, &IID_IUnknown)
 36         || IsEqualGUID(riid, &IID_IDirect3DStateBlock8)) {
 37         IUnknown_AddRef(iface);
 38         *ppobj = This;
 39         return S_OK;
 40     }
 41 
 42     WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
 43     *ppobj = NULL;
 44     return E_NOINTERFACE;
 45 }
 46 
 47 static ULONG WINAPI IDirect3DStateBlock8Impl_AddRef(IDirect3DStateBlock8 *iface) {
 48     IDirect3DStateBlock8Impl *This = (IDirect3DStateBlock8Impl *)iface;
 49     ULONG ref = InterlockedIncrement(&This->ref);
 50 
 51     TRACE("%p increasing refcount to %u.\n", iface, ref);
 52 
 53     return ref;
 54 }
 55 
 56 static ULONG WINAPI IDirect3DStateBlock8Impl_Release(IDirect3DStateBlock8 *iface) {
 57     IDirect3DStateBlock8Impl *This = (IDirect3DStateBlock8Impl *)iface;
 58     ULONG ref = InterlockedDecrement(&This->ref);
 59 
 60     TRACE("%p decreasing refcount to %u.\n", iface, ref);
 61 
 62     if (ref == 0) {
 63         wined3d_mutex_lock();
 64         IWineD3DStateBlock_Release(This->wineD3DStateBlock);
 65         wined3d_mutex_unlock();
 66 
 67         HeapFree(GetProcessHeap(), 0, This);
 68     }
 69     return ref;
 70 }
 71 
 72 /* IDirect3DStateBlock8 Interface follow: */
 73 static HRESULT WINAPI IDirect3DStateBlock8Impl_GetDevice(IDirect3DStateBlock8 *iface, IDirect3DDevice8 **ppDevice) {
 74     IDirect3DStateBlock8Impl *This = (IDirect3DStateBlock8Impl *)iface;
 75     IWineD3DDevice *wined3d_device;
 76     HRESULT hr;
 77 
 78     TRACE("iface %p, device %p.\n", iface, ppDevice);
 79 
 80     wined3d_mutex_lock();
 81     hr = IWineD3DStateBlock_GetDevice(This->wineD3DStateBlock, &wined3d_device);
 82     if (SUCCEEDED(hr))
 83     {
 84         IWineD3DDevice_GetParent(wined3d_device, (IUnknown **)ppDevice);
 85         IWineD3DDevice_Release(wined3d_device);
 86     }
 87     wined3d_mutex_unlock();
 88 
 89     return hr;
 90 }
 91 
 92 static HRESULT WINAPI IDirect3DStateBlock8Impl_Capture(IDirect3DStateBlock8 *iface) {
 93     IDirect3DStateBlock8Impl *This = (IDirect3DStateBlock8Impl *)iface;
 94     HRESULT hr;
 95 
 96     TRACE("iface %p.\n", iface);
 97 
 98     wined3d_mutex_lock();
 99     hr = IWineD3DStateBlock_Capture(This->wineD3DStateBlock);
100     wined3d_mutex_unlock();
101 
102     return hr;
103 }
104 
105 static HRESULT WINAPI IDirect3DStateBlock8Impl_Apply(IDirect3DStateBlock8 *iface) {
106     IDirect3DStateBlock8Impl *This = (IDirect3DStateBlock8Impl *)iface;
107     HRESULT hr;
108 
109     TRACE("iface %p.\n", iface);
110 
111     wined3d_mutex_lock();
112     hr = IWineD3DStateBlock_Apply(This->wineD3DStateBlock);
113     wined3d_mutex_unlock();
114 
115     return hr;
116 }
117 
118 const IDirect3DStateBlock8Vtbl Direct3DStateBlock8_Vtbl =
119 {
120     /* IUnknown */
121     IDirect3DStateBlock8Impl_QueryInterface,
122     IDirect3DStateBlock8Impl_AddRef,
123     IDirect3DStateBlock8Impl_Release,
124     /* IDirect3DStateBlock8 */
125     IDirect3DStateBlock8Impl_GetDevice,
126     IDirect3DStateBlock8Impl_Capture,
127     IDirect3DStateBlock8Impl_Apply
128 };
129 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.