TRACE("(%p) : ReleaseRef to %d\n", This, ref);
if (ref == 0) {
- wined3d_mutex_lock();
+ EnterCriticalSection(&d3d9_cs);
IWineD3D_Release(This->WineD3D);
- wined3d_mutex_unlock();
-
+ LeaveCriticalSection(&d3d9_cs);
HeapFree(GetProcessHeap(), 0, This);
}
HRESULT hr;
TRACE("(%p)->(%p)\n", This, pInitializeFunction);
- wined3d_mutex_lock();
+ EnterCriticalSection(&d3d9_cs);
hr = IWineD3D_RegisterSoftwareDevice(This->WineD3D, pInitializeFunction);
- wined3d_mutex_unlock();
-
+ LeaveCriticalSection(&d3d9_cs);
return hr;
}
HRESULT hr;
TRACE("%p\n", This);
- wined3d_mutex_lock();
+ EnterCriticalSection(&d3d9_cs);
hr = IWineD3D_GetAdapterCount(This->WineD3D);
- wined3d_mutex_unlock();
-
+ LeaveCriticalSection(&d3d9_cs);
return hr;
}
WINED3DADAPTER_IDENTIFIER adapter_id;
HRESULT hr;
- adapter_id.driver = pIdentifier->Driver;
- adapter_id.driver_size = sizeof(pIdentifier->Driver);
- adapter_id.description = pIdentifier->Description;
- adapter_id.description_size = sizeof(pIdentifier->Description);
- adapter_id.device_name = pIdentifier->DeviceName;
- adapter_id.device_name_size = sizeof(pIdentifier->DeviceName);
-
- wined3d_mutex_lock();
+ /* dx8 and dx9 have different structures to be filled in, with incompatible
+ layouts so pass in pointers to the places to be filled via an internal
+ structure */
+ adapter_id.Driver = pIdentifier->Driver;
+ adapter_id.Description = pIdentifier->Description;
+ adapter_id.DeviceName = pIdentifier->DeviceName;
+ adapter_id.DriverVersion = &pIdentifier->DriverVersion;
+ adapter_id.VendorId = &pIdentifier->VendorId;
+ adapter_id.DeviceId = &pIdentifier->DeviceId;
+ adapter_id.SubSysId = &pIdentifier->SubSysId;
+ adapter_id.Revision = &pIdentifier->Revision;
+ adapter_id.DeviceIdentifier = &pIdentifier->DeviceIdentifier;
+ adapter_id.WHQLLevel = &pIdentifier->WHQLLevel;
+
+ EnterCriticalSection(&d3d9_cs);
hr = IWineD3D_GetAdapterIdentifier(This->WineD3D, Adapter, Flags, &adapter_id);
- wined3d_mutex_unlock();
-
- pIdentifier->DriverVersion = adapter_id.driver_version;
- pIdentifier->VendorId = adapter_id.vendor_id;
- pIdentifier->DeviceId = adapter_id.device_id;
- pIdentifier->SubSysId = adapter_id.subsystem_id;
- pIdentifier->Revision = adapter_id.revision;
- memcpy(&pIdentifier->DeviceIdentifier, &adapter_id.device_identifier, sizeof(pIdentifier->DeviceIdentifier));
- pIdentifier->WHQLLevel = adapter_id.whql_level;
-
+ LeaveCriticalSection(&d3d9_cs);
return hr;
}
return 0;
}
- wined3d_mutex_lock();
+ EnterCriticalSection(&d3d9_cs);
hr = IWineD3D_GetAdapterModeCount(This->WineD3D, Adapter, wined3dformat_from_d3dformat(Format));
- wined3d_mutex_unlock();
-
+ LeaveCriticalSection(&d3d9_cs);
return hr;
}
if(Format != D3DFMT_X8R8G8B8 && Format != D3DFMT_R5G6B5)
return D3DERR_INVALIDCALL;
- wined3d_mutex_lock();
+ EnterCriticalSection(&d3d9_cs);
hr = IWineD3D_EnumAdapterModes(This->WineD3D, Adapter, wined3dformat_from_d3dformat(Format),
Mode, (WINED3DDISPLAYMODE *) pMode);
- wined3d_mutex_unlock();
+ LeaveCriticalSection(&d3d9_cs);
if (SUCCEEDED(hr)) pMode->Format = d3dformat_from_wined3dformat(pMode->Format);
IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
HRESULT hr;
- wined3d_mutex_lock();
+ EnterCriticalSection(&d3d9_cs);
hr = IWineD3D_GetAdapterDisplayMode(This->WineD3D, Adapter, (WINED3DDISPLAYMODE *) pMode);
- wined3d_mutex_unlock();
+ LeaveCriticalSection(&d3d9_cs);
if (SUCCEEDED(hr)) pMode->Format = d3dformat_from_wined3dformat(pMode->Format);
return hr;
}
-static HRESULT WINAPI IDirect3D9Impl_CheckDeviceType(IDirect3D9Ex *iface, UINT Adapter,
- D3DDEVTYPE CheckType, D3DFORMAT DisplayFormat, D3DFORMAT BackBufferFormat, BOOL Windowed)
-{
+static HRESULT WINAPI IDirect3D9Impl_CheckDeviceType(LPDIRECT3D9EX iface,
+ UINT Adapter, D3DDEVTYPE CheckType, D3DFORMAT DisplayFormat,
+ D3DFORMAT BackBufferFormat, BOOL Windowed) {
IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
HRESULT hr;
TRACE("(%p)->(%d, %d, %d, %d, %s\n", This, Adapter, CheckType, DisplayFormat,
BackBufferFormat, Windowed ? "true" : "false");
- wined3d_mutex_lock();
+ EnterCriticalSection(&d3d9_cs);
hr = IWineD3D_CheckDeviceType(This->WineD3D, Adapter, CheckType, wined3dformat_from_d3dformat(DisplayFormat),
wined3dformat_from_d3dformat(BackBufferFormat), Windowed);
- wined3d_mutex_unlock();
-
+ LeaveCriticalSection(&d3d9_cs);
return hr;
}
-static HRESULT WINAPI IDirect3D9Impl_CheckDeviceFormat(IDirect3D9Ex *iface, UINT Adapter, D3DDEVTYPE DeviceType,
- D3DFORMAT AdapterFormat, DWORD Usage, D3DRESOURCETYPE RType, D3DFORMAT CheckFormat)
-{
+static HRESULT WINAPI IDirect3D9Impl_CheckDeviceFormat(LPDIRECT3D9EX iface,
+ UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat,
+ DWORD Usage, D3DRESOURCETYPE RType, D3DFORMAT CheckFormat) {
IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
HRESULT hr;
WINED3DRESOURCETYPE WineD3DRType;
TRACE("%p\n", This);
- /* This format is nothing special and it is supported perfectly.
- * However, ati and nvidia driver on windows do not mark this format as
- * supported (tested with the dxCapsViewer) and pretending to
- * support this format uncovers a bug in Battlefield 1942 (fonts are missing)
- * So do the same as Windows drivers and pretend not to support it on dx8 and 9
- */
- if(CheckFormat == D3DFMT_R8G8B8)
- {
- WARN("D3DFMT_R8G8B8 is not available on windows, returning D3DERR_NOTAVAILABLE\n");
- return D3DERR_NOTAVAILABLE;
- }
-
switch(RType) {
case D3DRTYPE_VERTEXBUFFER:
case D3DRTYPE_INDEXBUFFER:
break;
}
- wined3d_mutex_lock();
+ EnterCriticalSection(&d3d9_cs);
hr = IWineD3D_CheckDeviceFormat(This->WineD3D, Adapter, DeviceType, wined3dformat_from_d3dformat(AdapterFormat),
Usage, WineD3DRType, wined3dformat_from_d3dformat(CheckFormat), SURFACE_OPENGL);
- wined3d_mutex_unlock();
-
+ LeaveCriticalSection(&d3d9_cs);
return hr;
}
-static HRESULT WINAPI IDirect3D9Impl_CheckDeviceMultiSampleType(IDirect3D9Ex *iface, UINT Adapter,
- D3DDEVTYPE DeviceType, D3DFORMAT SurfaceFormat, BOOL Windowed, D3DMULTISAMPLE_TYPE MultiSampleType,
- DWORD *pQualityLevels)
-{
+static HRESULT WINAPI IDirect3D9Impl_CheckDeviceMultiSampleType(LPDIRECT3D9EX iface,
+ UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SurfaceFormat,
+ BOOL Windowed, D3DMULTISAMPLE_TYPE MultiSampleType, DWORD* pQualityLevels) {
IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
HRESULT hr;
TRACE("%p\n", This);
- wined3d_mutex_lock();
+ EnterCriticalSection(&d3d9_cs);
hr = IWineD3D_CheckDeviceMultiSampleType(This->WineD3D, Adapter, DeviceType,
wined3dformat_from_d3dformat(SurfaceFormat), Windowed, MultiSampleType, pQualityLevels);
- wined3d_mutex_unlock();
-
+ LeaveCriticalSection(&d3d9_cs);
return hr;
}
-static HRESULT WINAPI IDirect3D9Impl_CheckDepthStencilMatch(IDirect3D9Ex *iface, UINT Adapter,
- D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, D3DFORMAT RenderTargetFormat, D3DFORMAT DepthStencilFormat)
-{
+static HRESULT WINAPI IDirect3D9Impl_CheckDepthStencilMatch(LPDIRECT3D9EX iface,
+ UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat,
+ D3DFORMAT RenderTargetFormat, D3DFORMAT DepthStencilFormat) {
IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
HRESULT hr;
TRACE("%p\n", This);
- wined3d_mutex_lock();
+ EnterCriticalSection(&d3d9_cs);
hr = IWineD3D_CheckDepthStencilMatch(This->WineD3D, Adapter, DeviceType,
wined3dformat_from_d3dformat(AdapterFormat), wined3dformat_from_d3dformat(RenderTargetFormat),
wined3dformat_from_d3dformat(DepthStencilFormat));
- wined3d_mutex_unlock();
-
+ LeaveCriticalSection(&d3d9_cs);
return hr;
}
HRESULT hr;
TRACE("%p\n", This);
- wined3d_mutex_lock();
+ EnterCriticalSection(&d3d9_cs);
hr = IWineD3D_CheckDeviceFormatConversion(This->WineD3D, Adapter, DeviceType,
wined3dformat_from_d3dformat(SourceFormat), wined3dformat_from_d3dformat(TargetFormat));
- wined3d_mutex_unlock();
-
+ LeaveCriticalSection(&d3d9_cs);
return hr;
}
return D3DERR_INVALIDCALL; /*well this is what MSDN says to return*/
}
memset(pCaps, 0, sizeof(*pCaps));
-
- wined3d_mutex_lock();
+ EnterCriticalSection(&d3d9_cs);
hrc = IWineD3D_GetDeviceCaps(This->WineD3D, Adapter, DeviceType, pWineCaps);
- wined3d_mutex_unlock();
-
+ LeaveCriticalSection(&d3d9_cs);
WINECAPSTOD3D9CAPS(pCaps, pWineCaps)
HeapFree(GetProcessHeap(), 0, pWineCaps);
HMONITOR ret;
TRACE("%p\n", This);
- wined3d_mutex_lock();
+ EnterCriticalSection(&d3d9_cs);
ret = IWineD3D_GetAdapterMonitor(This->WineD3D, Adapter);
- wined3d_mutex_unlock();
-
+ LeaveCriticalSection(&d3d9_cs);
return ret;
}
*ppReturnedDeviceInterface = (IDirect3DDevice9 *)object;
/* Allocate an associated WineD3DDevice object */
- wined3d_mutex_lock();
+ EnterCriticalSection(&d3d9_cs);
hr = IWineD3D_CreateDevice(This->WineD3D, Adapter, DeviceType, hFocusWindow, BehaviourFlags,
(IUnknown *)object, (IWineD3DDeviceParent *)&object->device_parent_vtbl, &object->WineD3DDevice);
if (hr != D3D_OK) {
HeapFree(GetProcessHeap(), 0, object);
*ppReturnedDeviceInterface = NULL;
- wined3d_mutex_unlock();
-
+ LeaveCriticalSection(&d3d9_cs);
return hr;
}
* can be used without further checking
*/
object->convertedDecls = HeapAlloc(GetProcessHeap(), 0, 0);
- wined3d_mutex_unlock();
+ LeaveCriticalSection(&d3d9_cs);
return hr;
}