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

Wine Cross Reference
wine/dlls/d3d9/query.c

Version: ~ [ wine-1.5.30 ] ~ [ wine-1.5.29 ] ~ [ wine-1.5.28 ] ~ [ wine-1.5.27 ] ~ [ wine-1.5.26 ] ~ [ wine-1.5.25 ] ~ [ wine-1.5.24 ] ~ [ wine-1.5.23 ] ~ [ wine-1.5.22 ] ~ [ wine-1.5.21 ] ~ [ wine-1.5.20 ] ~ [ wine-1.5.19 ] ~ [ wine-1.5.18 ] ~ [ wine-1.5.17 ] ~ [ wine-1.5.16 ] ~ [ wine-1.5.15 ] ~ [ wine-1.5.14 ] ~ [ wine-1.5.13 ] ~ [ wine-1.5.12 ] ~ [ wine-1.5.11 ] ~ [ wine-1.5.10 ] ~ [ wine-1.5.9 ] ~ [ wine-1.5.8 ] ~ [ wine-1.5.7 ] ~ [ wine-1.4.1 ] ~ [ wine-1.5.6 ] ~ [ wine-1.5.5 ] ~ [ wine-1.5.4 ] ~ [ wine-1.5.3 ] ~ [ wine-1.5.2 ] ~ [ wine-1.5.1 ] ~ [ wine-1.5.0 ] ~ [ wine-1.4 ] ~ [ wine-1.4-rc6 ] ~ [ wine-1.4-rc5 ] ~ [ wine-1.4-rc4 ] ~ [ wine-1.4-rc3 ] ~ [ wine-1.4-rc2 ] ~ [ wine-1.4-rc1 ] ~ [ wine-1.3.37 ] ~ [ wine-1.3.36 ] ~ [ wine-1.3.35 ] ~ [ wine-1.3.34 ] ~ [ wine-1.3.33 ] ~ [ wine-1.3.32 ] ~ [ wine-1.3.31 ] ~ [ wine-1.3.30 ] ~ [ wine-1.3.29 ] ~ [ wine-1.3.28 ] ~ [ wine-1.3.27 ] ~ [ wine-1.3.26 ] ~ [ wine-1.3.25 ] ~ [ wine-1.3.24 ] ~ [ wine-1.3.23 ] ~ [ wine-1.3.22 ] ~ [ wine-1.3.21 ] ~ [ wine-1.3.20 ] ~ [ wine-1.3.19 ] ~ [ wine-1.3.18 ] ~ [ wine-1.2.3 ] ~ [ wine-1.3.17 ] ~ [ wine-1.3.16 ] ~ [ wine-1.3.15 ] ~ [ wine-1.3.14 ] ~ [ wine-1.3.13 ] ~ [ wine-1.3.12 ] ~ [ wine-1.3.11 ] ~ [ wine-1.3.10 ] ~ [ wine-1.3.9 ] ~ [ wine-1.2.2 ] ~ [ wine-1.3.8 ] ~ [ wine-1.3.7 ] ~ [ wine-1.3.6 ] ~ [ wine-1.3.5 ] ~ [ wine-1.2.1 ] ~ [ wine-1.3.4 ] ~ [ wine-1.3.3 ] ~ [ wine-1.3.2 ] ~ [ wine-1.3.1 ] ~ [ wine-1.3.0 ] ~ [ wine-1.2 ] ~ [ wine-1.2-rc7 ] ~ [ wine-1.2-rc6 ] ~ [ wine-1.2-rc5 ] ~ [ wine-1.2-rc4 ] ~ [ wine-1.2-rc3 ] ~ [ wine-1.2-rc2 ] ~ [ wine-1.2-rc1 ] ~ [ wine-1.1.44 ] ~ [ wine-1.1.43 ] ~ [ wine-1.1.42 ] ~ [ wine-1.1.41 ] ~ [ wine-1.1.40 ] ~ [ wine-1.1.39 ] ~ [ wine-1.1.38 ] ~ [ wine-1.1.37 ] ~ [ wine-1.1.36 ] ~ [ wine-1.1.35 ] ~ [ wine-1.1.34 ] ~ [ 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  * IDirect3DQuery9 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 "d3d9_private.h"
 25 
 26 WINE_DEFAULT_DEBUG_CHANNEL(d3d9);
 27 
 28 /* IDirect3DQuery9 IUnknown parts follow: */
 29 static HRESULT WINAPI IDirect3DQuery9Impl_QueryInterface(LPDIRECT3DQUERY9 iface, REFIID riid, LPVOID* ppobj) {
 30     IDirect3DQuery9Impl *This = (IDirect3DQuery9Impl *)iface;
 31 
 32     TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), ppobj);
 33 
 34     if (IsEqualGUID(riid, &IID_IUnknown)
 35         || IsEqualGUID(riid, &IID_IDirect3DQuery9)) {
 36         IDirect3DQuery9_AddRef(iface);
 37         *ppobj = This;
 38         return S_OK;
 39     }
 40 
 41     WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
 42     *ppobj = NULL;
 43     return E_NOINTERFACE;
 44 }
 45 
 46 static ULONG WINAPI IDirect3DQuery9Impl_AddRef(LPDIRECT3DQUERY9 iface) {
 47     IDirect3DQuery9Impl *This = (IDirect3DQuery9Impl *)iface;
 48     ULONG ref = InterlockedIncrement(&This->ref);
 49 
 50     TRACE("%p increasing refcount to %u.\n", iface, ref);
 51 
 52     return ref;
 53 }
 54 
 55 static ULONG WINAPI IDirect3DQuery9Impl_Release(LPDIRECT3DQUERY9 iface) {
 56     IDirect3DQuery9Impl *This = (IDirect3DQuery9Impl *)iface;
 57     ULONG ref = InterlockedDecrement(&This->ref);
 58 
 59     TRACE("%p decreasing refcount to %u.\n", iface, ref);
 60 
 61     if (ref == 0) {
 62         wined3d_mutex_lock();
 63         IWineD3DQuery_Release(This->wineD3DQuery);
 64         wined3d_mutex_unlock();
 65 
 66         IDirect3DDevice9Ex_Release(This->parentDevice);
 67         HeapFree(GetProcessHeap(), 0, This);
 68     }
 69     return ref;
 70 }
 71 
 72 /* IDirect3DQuery9 Interface follow: */
 73 static HRESULT WINAPI IDirect3DQuery9Impl_GetDevice(IDirect3DQuery9 *iface, IDirect3DDevice9 **device)
 74 {
 75     IDirect3DQuery9Impl *This = (IDirect3DQuery9Impl *)iface;
 76 
 77     TRACE("iface %p, device %p.\n", iface, device);
 78 
 79     *device = (IDirect3DDevice9 *)This->parentDevice;
 80     IDirect3DDevice9_AddRef(*device);
 81 
 82     TRACE("Returning device %p.\n", *device);
 83 
 84     return D3D_OK;
 85 }
 86 
 87 static D3DQUERYTYPE WINAPI IDirect3DQuery9Impl_GetType(LPDIRECT3DQUERY9 iface) {
 88     IDirect3DQuery9Impl *This = (IDirect3DQuery9Impl *)iface;
 89     HRESULT hr;
 90 
 91     TRACE("iface %p.\n", iface);
 92 
 93     wined3d_mutex_lock();
 94     hr = IWineD3DQuery_GetType(This->wineD3DQuery);
 95     wined3d_mutex_unlock();
 96 
 97     return hr;
 98 }
 99 
100 static DWORD WINAPI IDirect3DQuery9Impl_GetDataSize(LPDIRECT3DQUERY9 iface) {
101     IDirect3DQuery9Impl *This = (IDirect3DQuery9Impl *)iface;
102     DWORD ret;
103 
104     TRACE("iface %p.\n", iface);
105 
106     wined3d_mutex_lock();
107     ret = IWineD3DQuery_GetDataSize(This->wineD3DQuery);
108     wined3d_mutex_unlock();
109 
110     return ret;
111 }
112 
113 static HRESULT WINAPI IDirect3DQuery9Impl_Issue(LPDIRECT3DQUERY9 iface, DWORD dwIssueFlags) {
114     IDirect3DQuery9Impl *This = (IDirect3DQuery9Impl *)iface;
115     HRESULT hr;
116 
117     TRACE("iface %p, flags %#x.\n", iface, dwIssueFlags);
118 
119     wined3d_mutex_lock();
120     hr = IWineD3DQuery_Issue(This->wineD3DQuery, dwIssueFlags);
121     wined3d_mutex_unlock();
122 
123     return hr;
124 }
125 
126 static HRESULT WINAPI IDirect3DQuery9Impl_GetData(LPDIRECT3DQUERY9 iface, void* pData, DWORD dwSize, DWORD dwGetDataFlags) {
127     IDirect3DQuery9Impl *This = (IDirect3DQuery9Impl *)iface;
128     HRESULT hr;
129 
130     TRACE("iface %p, data %p, size %u, flags %#x.\n",
131             iface, pData, dwSize, dwGetDataFlags);
132 
133     wined3d_mutex_lock();
134     hr = IWineD3DQuery_GetData(This->wineD3DQuery, pData, dwSize, dwGetDataFlags);
135     wined3d_mutex_unlock();
136 
137     return hr;
138 }
139 
140 
141 static const IDirect3DQuery9Vtbl Direct3DQuery9_Vtbl =
142 {
143     IDirect3DQuery9Impl_QueryInterface,
144     IDirect3DQuery9Impl_AddRef,
145     IDirect3DQuery9Impl_Release,
146     IDirect3DQuery9Impl_GetDevice,
147     IDirect3DQuery9Impl_GetType,
148     IDirect3DQuery9Impl_GetDataSize,
149     IDirect3DQuery9Impl_Issue,
150     IDirect3DQuery9Impl_GetData
151 };
152 
153 HRESULT query_init(IDirect3DQuery9Impl *query, IDirect3DDevice9Impl *device, D3DQUERYTYPE type)
154 {
155     HRESULT hr;
156 
157     query->lpVtbl = &Direct3DQuery9_Vtbl;
158     query->ref = 1;
159 
160     wined3d_mutex_lock();
161     hr = IWineD3DDevice_CreateQuery(device->WineD3DDevice, type, &query->wineD3DQuery, (IUnknown *)query);
162     wined3d_mutex_unlock();
163     if (FAILED(hr))
164     {
165         WARN("Failed to create wined3d query, hr %#x.\n", hr);
166         return hr;
167     }
168 
169     query->parentDevice = (IDirect3DDevice9Ex *)device;
170     IDirect3DDevice9Ex_AddRef(query->parentDevice);
171 
172     return D3D_OK;
173 }
174 

~ [ 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.