Changeset 23571 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d8/directx.c
- Timestamp:
- Oct 6, 2009 6:07:06 AM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 53228
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d8/directx.c
r22496 r23571 81 81 if (ref == 0) { 82 82 TRACE("Releasing wined3d %p\n", This->WineD3D); 83 EnterCriticalSection(&d3d8_cs); 83 84 wined3d_mutex_lock(); 84 85 IWineD3D_Release(This->WineD3D); 85 LeaveCriticalSection(&d3d8_cs); 86 wined3d_mutex_unlock(); 87 86 88 HeapFree(GetProcessHeap(), 0, This); 87 89 } … … 96 98 TRACE("(%p)->(%p)\n", This, pInitializeFunction); 97 99 98 EnterCriticalSection(&d3d8_cs);100 wined3d_mutex_lock(); 99 101 hr = IWineD3D_RegisterSoftwareDevice(This->WineD3D, pInitializeFunction); 100 LeaveCriticalSection(&d3d8_cs); 102 wined3d_mutex_unlock(); 103 101 104 return hr; 102 105 } … … 107 110 TRACE("(%p)\n", This); 108 111 109 EnterCriticalSection(&d3d8_cs);112 wined3d_mutex_lock(); 110 113 hr = IWineD3D_GetAdapterCount(This->WineD3D); 111 LeaveCriticalSection(&d3d8_cs); 114 wined3d_mutex_unlock(); 115 112 116 return hr; 113 117 } … … 129 133 adapter_id.device_name_size = 0; /* d3d9 only */ 130 134 131 EnterCriticalSection(&d3d8_cs);135 wined3d_mutex_lock(); 132 136 hr = IWineD3D_GetAdapterIdentifier(This->WineD3D, Adapter, Flags, &adapter_id); 133 LeaveCriticalSection(&d3d8_cs);137 wined3d_mutex_unlock(); 134 138 135 139 pIdentifier->DriverVersion = adapter_id.driver_version; … … 149 153 TRACE("(%p)->(%d)\n", This, Adapter); 150 154 151 EnterCriticalSection(&d3d8_cs);155 wined3d_mutex_lock(); 152 156 hr = IWineD3D_GetAdapterModeCount(This->WineD3D, Adapter, 0 /* format */); 153 LeaveCriticalSection(&d3d8_cs); 157 wined3d_mutex_unlock(); 158 154 159 return hr; 155 160 } … … 160 165 TRACE("(%p)->(%d, %d, %p)\n", This, Adapter, Mode, pMode); 161 166 162 EnterCriticalSection(&d3d8_cs);167 wined3d_mutex_lock(); 163 168 hr = IWineD3D_EnumAdapterModes(This->WineD3D, Adapter, WINED3DFMT_UNKNOWN, Mode, (WINED3DDISPLAYMODE *) pMode); 164 LeaveCriticalSection(&d3d8_cs);169 wined3d_mutex_unlock(); 165 170 166 171 if (SUCCEEDED(hr)) pMode->Format = d3dformat_from_wined3dformat(pMode->Format); … … 174 179 TRACE("(%p)->(%d,%p)\n", This, Adapter, pMode); 175 180 176 EnterCriticalSection(&d3d8_cs);181 wined3d_mutex_lock(); 177 182 hr = IWineD3D_GetAdapterDisplayMode(This->WineD3D, Adapter, (WINED3DDISPLAYMODE *) pMode); 178 LeaveCriticalSection(&d3d8_cs);183 wined3d_mutex_unlock(); 179 184 180 185 if (SUCCEEDED(hr)) pMode->Format = d3dformat_from_wined3dformat(pMode->Format); … … 190 195 TRACE("(%p)->(%d, %d, %d, %d, %s)\n", This, Adapter, CheckType, DisplayFormat, BackBufferFormat, Windowed ? "true" : "false"); 191 196 192 EnterCriticalSection(&d3d8_cs);197 wined3d_mutex_lock(); 193 198 hr = IWineD3D_CheckDeviceType(This->WineD3D, Adapter, CheckType, wined3dformat_from_d3dformat(DisplayFormat), 194 199 wined3dformat_from_d3dformat(BackBufferFormat), Windowed); 195 LeaveCriticalSection(&d3d8_cs); 200 wined3d_mutex_unlock(); 201 196 202 return hr; 197 203 } … … 224 230 } 225 231 226 EnterCriticalSection(&d3d8_cs);232 wined3d_mutex_lock(); 227 233 hr = IWineD3D_CheckDeviceFormat(This->WineD3D, Adapter, DeviceType, wined3dformat_from_d3dformat(AdapterFormat), 228 234 Usage, WineD3DRType, wined3dformat_from_d3dformat(CheckFormat), SURFACE_OPENGL); 229 LeaveCriticalSection(&d3d8_cs); 230 return hr; 231 } 232 233 static HRESULT WINAPI IDirect3D8Impl_CheckDeviceMultiSampleType(LPDIRECT3D8 iface, 234 UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SurfaceFormat, 235 BOOL Windowed, D3DMULTISAMPLE_TYPE MultiSampleType) { 235 wined3d_mutex_unlock(); 236 237 return hr; 238 } 239 240 static HRESULT WINAPI IDirect3D8Impl_CheckDeviceMultiSampleType(IDirect3D8 *iface, UINT Adapter, 241 D3DDEVTYPE DeviceType, D3DFORMAT SurfaceFormat, BOOL Windowed, D3DMULTISAMPLE_TYPE MultiSampleType) 242 { 236 243 IDirect3D8Impl *This = (IDirect3D8Impl *)iface; 237 244 HRESULT hr; 238 245 TRACE("(%p)-<(%d, %d, %d, %s, %d)\n", This, Adapter, DeviceType, SurfaceFormat, Windowed ? "true" : "false", MultiSampleType); 239 246 240 EnterCriticalSection(&d3d8_cs);247 wined3d_mutex_lock(); 241 248 hr = IWineD3D_CheckDeviceMultiSampleType(This->WineD3D, Adapter, DeviceType, 242 249 wined3dformat_from_d3dformat(SurfaceFormat), Windowed, (WINED3DMULTISAMPLE_TYPE) MultiSampleType, NULL); 243 LeaveCriticalSection(&d3d8_cs); 244 return hr; 245 } 246 247 static HRESULT WINAPI IDirect3D8Impl_CheckDepthStencilMatch(LPDIRECT3D8 iface, 248 UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, 249 D3DFORMAT RenderTargetFormat, D3DFORMAT DepthStencilFormat) { 250 wined3d_mutex_unlock(); 251 252 return hr; 253 } 254 255 static HRESULT WINAPI IDirect3D8Impl_CheckDepthStencilMatch(IDirect3D8 *iface, UINT Adapter, D3DDEVTYPE DeviceType, 256 D3DFORMAT AdapterFormat, D3DFORMAT RenderTargetFormat, D3DFORMAT DepthStencilFormat) 257 { 250 258 IDirect3D8Impl *This = (IDirect3D8Impl *)iface; 251 259 HRESULT hr; 252 260 TRACE("(%p)-<(%d, %d, %d, %d, %d)\n", This, Adapter, DeviceType, AdapterFormat, RenderTargetFormat, DepthStencilFormat); 253 261 254 EnterCriticalSection(&d3d8_cs);262 wined3d_mutex_lock(); 255 263 hr = IWineD3D_CheckDepthStencilMatch(This->WineD3D, Adapter, DeviceType, 256 264 wined3dformat_from_d3dformat(AdapterFormat), wined3dformat_from_d3dformat(RenderTargetFormat), 257 265 wined3dformat_from_d3dformat(DepthStencilFormat)); 258 LeaveCriticalSection(&d3d8_cs); 266 wined3d_mutex_unlock(); 267 259 268 return hr; 260 269 } … … 288 297 return D3DERR_INVALIDCALL; /*well this is what MSDN says to return*/ 289 298 } 290 EnterCriticalSection(&d3d8_cs); 299 300 wined3d_mutex_lock(); 291 301 hrc = IWineD3D_GetDeviceCaps(This->WineD3D, Adapter, DeviceType, pWineCaps); 292 LeaveCriticalSection(&d3d8_cs); 302 wined3d_mutex_unlock(); 303 293 304 fixup_caps(pWineCaps); 294 305 WINECAPSTOD3D8CAPS(pCaps, pWineCaps) … … 304 315 TRACE("(%p)->(%d)\n", This, Adapter); 305 316 306 EnterCriticalSection(&d3d8_cs);317 wined3d_mutex_lock(); 307 318 ret = IWineD3D_GetAdapterMonitor(This->WineD3D, Adapter); 308 LeaveCriticalSection(&d3d8_cs); 319 wined3d_mutex_unlock(); 320 309 321 return ret; 310 }311 312 ULONG WINAPI D3D8CB_DestroyRenderTarget(IWineD3DSurface *pSurface) {313 IDirect3DSurface8Impl* surfaceParent;314 TRACE("(%p) call back\n", pSurface);315 316 IWineD3DSurface_GetParent(pSurface, (IUnknown **) &surfaceParent);317 surfaceParent->isImplicit = FALSE;318 /* Surface had refcount of 0 GetParent addrefed to 1, so 1 Release is enough */319 return IDirect3DSurface8_Release((IDirect3DSurface8*) surfaceParent);320 322 } 321 323 … … 327 329 IUnknown_Release(swapChainParent); 328 330 return IUnknown_Release(swapChainParent); 329 }330 331 ULONG WINAPI D3D8CB_DestroyDepthStencilSurface(IWineD3DSurface *pSurface) {332 IDirect3DSurface8Impl* surfaceParent;333 TRACE("(%p) call back\n", pSurface);334 335 IWineD3DSurface_GetParent(pSurface, (IUnknown **) &surfaceParent);336 surfaceParent->isImplicit = FALSE;337 /* Surface had refcount of 0 GetParent addrefed to 1, so 1 Release is enough */338 return IDirect3DSurface8_Release((IDirect3DSurface8*) surfaceParent);339 331 } 340 332 … … 372 364 373 365 /* Allocate an associated WineD3DDevice object */ 374 EnterCriticalSection(&d3d8_cs);366 wined3d_mutex_lock(); 375 367 hr = IWineD3D_CreateDevice(This->WineD3D, Adapter, DeviceType, hFocusWindow, BehaviourFlags, 376 368 (IUnknown *)object, (IWineD3DDeviceParent *)&object->device_parent_vtbl, &object->WineD3DDevice); … … 379 371 HeapFree(GetProcessHeap(), 0, object); 380 372 *ppReturnedDeviceInterface = NULL; 381 LeaveCriticalSection(&d3d8_cs); 373 wined3d_mutex_unlock(); 374 382 375 return hr; 383 376 } … … 406 399 407 400 hr = IWineD3DDevice_Init3D(object->WineD3DDevice, &localParameters); 408 LeaveCriticalSection(&d3d8_cs);401 wined3d_mutex_unlock(); 409 402 410 403 pPresentationParameters->BackBufferWidth = localParameters.BackBufferWidth; … … 432 425 if(!object->decls) { 433 426 ERR("Out of memory\n"); 434 EnterCriticalSection(&d3d8_cs); 427 428 wined3d_mutex_lock(); 435 429 IWineD3DDevice_Release(object->WineD3DDevice); 436 LeaveCriticalSection(&d3d8_cs); 430 wined3d_mutex_unlock(); 431 437 432 HeapFree(GetProcessHeap(), 0, object); 438 433 *ppReturnedDeviceInterface = NULL;
Note:
See TracChangeset
for help on using the changeset viewer.