Changeset 28475 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/query.c
- Timestamp:
- Apr 19, 2010 3:27:01 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/query.c
r25949 r28475 160 160 }; 161 161 162 HRESULT query_init(IDirect3DQuery9Impl *query, IDirect3DDevice9Impl *device, D3DQUERYTYPE type) 163 { 164 HRESULT hr; 162 165 163 /* IDirect3DDevice9 IDirect3DQuery9 Methods follow: */ 164 HRESULT WINAPI IDirect3DDevice9Impl_CreateQuery(LPDIRECT3DDEVICE9EX iface, D3DQUERYTYPE Type, IDirect3DQuery9** ppQuery) { 165 IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; 166 IDirect3DQuery9Impl *object = NULL; 167 HRESULT hr = D3D_OK; 166 query->lpVtbl = &Direct3DQuery9_Vtbl; 167 query->ref = 1; 168 168 169 TRACE("iface %p, type %#x, query %p.\n", iface, Type, ppQuery); 170 171 if (!ppQuery) 169 wined3d_mutex_lock(); 170 hr = IWineD3DDevice_CreateQuery(device->WineD3DDevice, type, &query->wineD3DQuery, (IUnknown *)query); 171 wined3d_mutex_unlock(); 172 if (FAILED(hr)) 172 173 { 173 wined3d_mutex_lock(); 174 hr = IWineD3DDevice_CreateQuery(This->WineD3DDevice, Type, NULL, NULL); 175 wined3d_mutex_unlock(); 176 174 WARN("Failed to create wined3d query, hr %#x.\n", hr); 177 175 return hr; 178 176 } 179 177 180 /* Allocate the storage for the device */ 181 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DQuery9Impl)); 182 if (NULL == object) { 183 ERR("Allocation of memory failed, returning D3DERR_OUTOFVIDEOMEMORY\n"); 184 return D3DERR_OUTOFVIDEOMEMORY; 185 } 178 query->parentDevice = (IDirect3DDevice9Ex *)device; 179 IDirect3DDevice9Ex_AddRef(query->parentDevice); 186 180 187 object->lpVtbl = &Direct3DQuery9_Vtbl; 188 object->ref = 1; 189 190 wined3d_mutex_lock(); 191 hr = IWineD3DDevice_CreateQuery(This->WineD3DDevice, Type, &object->wineD3DQuery, (IUnknown *)object); 192 wined3d_mutex_unlock(); 193 194 if (FAILED(hr)) { 195 196 /* free up object */ 197 WARN("(%p) call to IWineD3DDevice_CreateQuery failed\n", This); 198 HeapFree(GetProcessHeap(), 0, object); 199 } else { 200 IDirect3DDevice9Ex_AddRef(iface); 201 object->parentDevice = iface; 202 *ppQuery = (LPDIRECT3DQUERY9) object; 203 TRACE("(%p) : Created query %p\n", This , object); 204 } 205 TRACE("(%p) : returning %x\n", This, hr); 206 return hr; 181 return D3D_OK; 207 182 }
Note:
See TracChangeset
for help on using the changeset viewer.