Changeset 23571 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/directx.c
- Timestamp:
- Oct 6, 2009 6:07:06 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Wine/d3d9/directx.c
r22496 r23571 79 79 80 80 if (ref == 0) { 81 EnterCriticalSection(&d3d9_cs);81 wined3d_mutex_lock(); 82 82 IWineD3D_Release(This->WineD3D); 83 LeaveCriticalSection(&d3d9_cs); 83 wined3d_mutex_unlock(); 84 84 85 HeapFree(GetProcessHeap(), 0, This); 85 86 } … … 94 95 TRACE("(%p)->(%p)\n", This, pInitializeFunction); 95 96 96 EnterCriticalSection(&d3d9_cs);97 wined3d_mutex_lock(); 97 98 hr = IWineD3D_RegisterSoftwareDevice(This->WineD3D, pInitializeFunction); 98 LeaveCriticalSection(&d3d9_cs); 99 wined3d_mutex_unlock(); 100 99 101 return hr; 100 102 } … … 105 107 TRACE("%p\n", This); 106 108 107 EnterCriticalSection(&d3d9_cs);109 wined3d_mutex_lock(); 108 110 hr = IWineD3D_GetAdapterCount(This->WineD3D); 109 LeaveCriticalSection(&d3d9_cs); 111 wined3d_mutex_unlock(); 112 110 113 return hr; 111 114 } … … 123 126 adapter_id.device_name_size = sizeof(pIdentifier->DeviceName); 124 127 125 EnterCriticalSection(&d3d9_cs);128 wined3d_mutex_lock(); 126 129 hr = IWineD3D_GetAdapterIdentifier(This->WineD3D, Adapter, Flags, &adapter_id); 127 LeaveCriticalSection(&d3d9_cs);130 wined3d_mutex_unlock(); 128 131 129 132 pIdentifier->DriverVersion = adapter_id.driver_version; … … 148 151 } 149 152 150 EnterCriticalSection(&d3d9_cs);153 wined3d_mutex_lock(); 151 154 hr = IWineD3D_GetAdapterModeCount(This->WineD3D, Adapter, wined3dformat_from_d3dformat(Format)); 152 LeaveCriticalSection(&d3d9_cs); 155 wined3d_mutex_unlock(); 156 153 157 return hr; 154 158 } … … 163 167 return D3DERR_INVALIDCALL; 164 168 165 EnterCriticalSection(&d3d9_cs);169 wined3d_mutex_lock(); 166 170 hr = IWineD3D_EnumAdapterModes(This->WineD3D, Adapter, wined3dformat_from_d3dformat(Format), 167 171 Mode, (WINED3DDISPLAYMODE *) pMode); 168 LeaveCriticalSection(&d3d9_cs);172 wined3d_mutex_unlock(); 169 173 170 174 if (SUCCEEDED(hr)) pMode->Format = d3dformat_from_wined3dformat(pMode->Format); … … 177 181 HRESULT hr; 178 182 179 EnterCriticalSection(&d3d9_cs);183 wined3d_mutex_lock(); 180 184 hr = IWineD3D_GetAdapterDisplayMode(This->WineD3D, Adapter, (WINED3DDISPLAYMODE *) pMode); 181 LeaveCriticalSection(&d3d9_cs);185 wined3d_mutex_unlock(); 182 186 183 187 if (SUCCEEDED(hr)) pMode->Format = d3dformat_from_wined3dformat(pMode->Format); … … 186 190 } 187 191 188 static HRESULT WINAPI IDirect3D9Impl_CheckDeviceType( LPDIRECT3D9EX iface,189 UINT Adapter, D3DDEVTYPE CheckType, D3DFORMAT DisplayFormat, 190 D3DFORMAT BackBufferFormat, BOOL Windowed){192 static HRESULT WINAPI IDirect3D9Impl_CheckDeviceType(IDirect3D9Ex *iface, UINT Adapter, 193 D3DDEVTYPE CheckType, D3DFORMAT DisplayFormat, D3DFORMAT BackBufferFormat, BOOL Windowed) 194 { 191 195 IDirect3D9Impl *This = (IDirect3D9Impl *)iface; 192 196 HRESULT hr; … … 194 198 BackBufferFormat, Windowed ? "true" : "false"); 195 199 196 EnterCriticalSection(&d3d9_cs);200 wined3d_mutex_lock(); 197 201 hr = IWineD3D_CheckDeviceType(This->WineD3D, Adapter, CheckType, wined3dformat_from_d3dformat(DisplayFormat), 198 202 wined3dformat_from_d3dformat(BackBufferFormat), Windowed); 199 LeaveCriticalSection(&d3d9_cs); 200 return hr; 201 } 202 203 static HRESULT WINAPI IDirect3D9Impl_CheckDeviceFormat(LPDIRECT3D9EX iface, 204 UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, 205 DWORD Usage, D3DRESOURCETYPE RType, D3DFORMAT CheckFormat) { 203 wined3d_mutex_unlock(); 204 205 return hr; 206 } 207 208 static HRESULT WINAPI IDirect3D9Impl_CheckDeviceFormat(IDirect3D9Ex *iface, UINT Adapter, D3DDEVTYPE DeviceType, 209 D3DFORMAT AdapterFormat, DWORD Usage, D3DRESOURCETYPE RType, D3DFORMAT CheckFormat) 210 { 206 211 IDirect3D9Impl *This = (IDirect3D9Impl *)iface; 207 212 HRESULT hr; … … 232 237 } 233 238 234 EnterCriticalSection(&d3d9_cs);239 wined3d_mutex_lock(); 235 240 hr = IWineD3D_CheckDeviceFormat(This->WineD3D, Adapter, DeviceType, wined3dformat_from_d3dformat(AdapterFormat), 236 241 Usage, WineD3DRType, wined3dformat_from_d3dformat(CheckFormat), SURFACE_OPENGL); 237 LeaveCriticalSection(&d3d9_cs); 238 return hr; 239 } 240 241 static HRESULT WINAPI IDirect3D9Impl_CheckDeviceMultiSampleType(LPDIRECT3D9EX iface, 242 UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SurfaceFormat, 243 BOOL Windowed, D3DMULTISAMPLE_TYPE MultiSampleType, DWORD* pQualityLevels) { 242 wined3d_mutex_unlock(); 243 244 return hr; 245 } 246 247 static HRESULT WINAPI IDirect3D9Impl_CheckDeviceMultiSampleType(IDirect3D9Ex *iface, UINT Adapter, 248 D3DDEVTYPE DeviceType, D3DFORMAT SurfaceFormat, BOOL Windowed, D3DMULTISAMPLE_TYPE MultiSampleType, 249 DWORD *pQualityLevels) 250 { 244 251 IDirect3D9Impl *This = (IDirect3D9Impl *)iface; 245 252 HRESULT hr; 246 253 TRACE("%p\n", This); 247 254 248 EnterCriticalSection(&d3d9_cs);255 wined3d_mutex_lock(); 249 256 hr = IWineD3D_CheckDeviceMultiSampleType(This->WineD3D, Adapter, DeviceType, 250 257 wined3dformat_from_d3dformat(SurfaceFormat), Windowed, MultiSampleType, pQualityLevels); 251 LeaveCriticalSection(&d3d9_cs); 252 return hr; 253 } 254 255 static HRESULT WINAPI IDirect3D9Impl_CheckDepthStencilMatch(LPDIRECT3D9EX iface, 256 UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, 257 D3DFORMAT RenderTargetFormat, D3DFORMAT DepthStencilFormat) { 258 wined3d_mutex_unlock(); 259 260 return hr; 261 } 262 263 static HRESULT WINAPI IDirect3D9Impl_CheckDepthStencilMatch(IDirect3D9Ex *iface, UINT Adapter, 264 D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, D3DFORMAT RenderTargetFormat, D3DFORMAT DepthStencilFormat) 265 { 258 266 IDirect3D9Impl *This = (IDirect3D9Impl *)iface; 259 267 HRESULT hr; 260 268 TRACE("%p\n", This); 261 269 262 EnterCriticalSection(&d3d9_cs);270 wined3d_mutex_lock(); 263 271 hr = IWineD3D_CheckDepthStencilMatch(This->WineD3D, Adapter, DeviceType, 264 272 wined3dformat_from_d3dformat(AdapterFormat), wined3dformat_from_d3dformat(RenderTargetFormat), 265 273 wined3dformat_from_d3dformat(DepthStencilFormat)); 266 LeaveCriticalSection(&d3d9_cs); 274 wined3d_mutex_unlock(); 275 267 276 return hr; 268 277 } … … 273 282 TRACE("%p\n", This); 274 283 275 EnterCriticalSection(&d3d9_cs);284 wined3d_mutex_lock(); 276 285 hr = IWineD3D_CheckDeviceFormatConversion(This->WineD3D, Adapter, DeviceType, 277 286 wined3dformat_from_d3dformat(SourceFormat), wined3dformat_from_d3dformat(TargetFormat)); 278 LeaveCriticalSection(&d3d9_cs); 287 wined3d_mutex_unlock(); 288 279 289 return hr; 280 290 } … … 337 347 338 348 pCaps->MaxVertexShaderConst = min(D3D9_MAX_VERTEX_SHADER_CONSTANTF, pCaps->MaxVertexShaderConst); 349 pCaps->NumSimultaneousRTs = min(D3D9_MAX_SIMULTANEOUS_RENDERTARGETS, pCaps->NumSimultaneousRTs); 339 350 } 340 351 … … 354 365 } 355 366 memset(pCaps, 0, sizeof(*pCaps)); 356 EnterCriticalSection(&d3d9_cs); 367 368 wined3d_mutex_lock(); 357 369 hrc = IWineD3D_GetDeviceCaps(This->WineD3D, Adapter, DeviceType, pWineCaps); 358 LeaveCriticalSection(&d3d9_cs); 370 wined3d_mutex_unlock(); 371 359 372 WINECAPSTOD3D9CAPS(pCaps, pWineCaps) 360 373 HeapFree(GetProcessHeap(), 0, pWineCaps); … … 374 387 TRACE("%p\n", This); 375 388 376 EnterCriticalSection(&d3d9_cs);389 wined3d_mutex_lock(); 377 390 ret = IWineD3D_GetAdapterMonitor(This->WineD3D, Adapter); 378 LeaveCriticalSection(&d3d9_cs); 391 wined3d_mutex_unlock(); 392 379 393 return ret; 380 }381 382 ULONG WINAPI D3D9CB_DestroyRenderTarget(IWineD3DSurface *pSurface) {383 IDirect3DSurface9Impl* surfaceParent;384 TRACE("(%p) call back\n", pSurface);385 386 IWineD3DSurface_GetParent(pSurface, (IUnknown **) &surfaceParent);387 surfaceParent->isImplicit = FALSE;388 /* Surface had refcount of 0 GetParent addrefed to 1, so 1 Release is enough */389 return IDirect3DSurface9_Release((IDirect3DSurface9*) surfaceParent);390 394 } 391 395 … … 398 402 /* Swap chain had refcount of 0 GetParent addrefed to 1, so 1 Release is enough */ 399 403 return IDirect3DSwapChain9_Release((IDirect3DSwapChain9*) swapChainParent); 400 }401 402 ULONG WINAPI D3D9CB_DestroyDepthStencilSurface(IWineD3DSurface *pSurface) {403 IDirect3DSurface9Impl* surfaceParent;404 TRACE("(%p) call back\n", pSurface);405 406 IWineD3DSurface_GetParent(pSurface, (IUnknown **) &surfaceParent);407 surfaceParent->isImplicit = FALSE;408 /* Surface had refcount of 0 GetParent addrefed to 1, so 1 Release is enough */409 return IDirect3DSurface9_Release((IDirect3DSurface9*) surfaceParent);410 404 } 411 405 … … 442 436 443 437 /* Allocate an associated WineD3DDevice object */ 444 EnterCriticalSection(&d3d9_cs);438 wined3d_mutex_lock(); 445 439 hr = IWineD3D_CreateDevice(This->WineD3D, Adapter, DeviceType, hFocusWindow, BehaviourFlags, 446 440 (IUnknown *)object, (IWineD3DDeviceParent *)&object->device_parent_vtbl, &object->WineD3DDevice); … … 448 442 HeapFree(GetProcessHeap(), 0, object); 449 443 *ppReturnedDeviceInterface = NULL; 450 LeaveCriticalSection(&d3d9_cs); 444 wined3d_mutex_unlock(); 445 451 446 return hr; 452 447 } … … 516 511 */ 517 512 object->convertedDecls = HeapAlloc(GetProcessHeap(), 0, 0); 518 LeaveCriticalSection(&d3d9_cs);513 wined3d_mutex_unlock(); 519 514 520 515 return hr;
Note:
See TracChangeset
for help on using the changeset viewer.