[4/8] d3d8: Use D3DDEVTYPE -> WINED3DDEVTYPE enum conversion function instead of implicit conversion (clang)
Frédéric Delanoy
frederic.delanoy at gmail.com
Sun May 29 02:46:07 CDT 2011
No default label used in switch statements so the compiler warns about unhandled cases
---
dlls/d3d8/d3d8_private.h | 12 ++++++++++++
dlls/d3d8/device.c | 3 ++-
dlls/d3d8/directx.c | 12 +++++++-----
3 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/dlls/d3d8/d3d8_private.h b/dlls/d3d8/d3d8_private.h
index 880da8b..3ca7a0f 100644
--- a/dlls/d3d8/d3d8_private.h
+++ b/dlls/d3d8/d3d8_private.h
@@ -590,6 +590,18 @@ static inline WINED3DRESOURCETYPE wined3dresourcetype_from_d3dresourcetype(D3DRE
return (WINED3DRESOURCETYPE) type;
}
+static inline WINED3DDEVTYPE wined3ddevtype_from_d3ddevtype(D3DDEVTYPE type)
+{
+ switch (type)
+ {
+ case D3DDEVTYPE_HAL: return WINED3DDEVTYPE_HAL;
+ case D3DDEVTYPE_REF: return WINED3DDEVTYPE_REF;
+ case D3DDEVTYPE_SW: return WINED3DDEVTYPE_SW;
+ case D3DDEVTYPE_FORCE_DWORD: return WINED3DDEVTYPE_FORCE_DWORD;
+ }
+ return (WINED3DDEVTYPE) type;
+}
+
void load_local_constants(const DWORD *d3d8_elements, struct wined3d_shader *wined3d_vertex_shader) DECLSPEC_HIDDEN;
size_t parse_token(const DWORD *pToken) DECLSPEC_HIDDEN;
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index afc6595..8120c21 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -3118,7 +3118,8 @@ HRESULT device_init(IDirect3DDevice8Impl *device, struct wined3d *wined3d, UINT
if (!(flags & D3DCREATE_FPU_PRESERVE)) setup_fpu();
wined3d_mutex_lock();
- hr = wined3d_device_create(wined3d, adapter, device_type, focus_window, flags,
+ hr = wined3d_device_create(wined3d, adapter,
+ wined3ddevtype_from_d3ddevtype(device_type), focus_window, flags,
&device->device_parent, &device->wined3d_device);
if (FAILED(hr))
{
diff --git a/dlls/d3d8/directx.c b/dlls/d3d8/directx.c
index bd86070..1b62c19 100644
--- a/dlls/d3d8/directx.c
+++ b/dlls/d3d8/directx.c
@@ -211,7 +211,8 @@ static HRESULT WINAPI IDirect3D8Impl_CheckDeviceType(LPDIRECT3D8 iface, UINT Ada
iface, Adapter, CheckType, DisplayFormat, BackBufferFormat, Windowed);
wined3d_mutex_lock();
- hr = wined3d_check_device_type(This->WineD3D, Adapter, CheckType, wined3dformat_from_d3dformat(DisplayFormat),
+ hr = wined3d_check_device_type(This->WineD3D, Adapter, wined3ddevtype_from_d3ddevtype(CheckType),
+ wined3dformat_from_d3dformat(DisplayFormat),
wined3dformat_from_d3dformat(BackBufferFormat), Windowed);
wined3d_mutex_unlock();
@@ -249,7 +250,8 @@ static HRESULT WINAPI IDirect3D8Impl_CheckDeviceFormat(LPDIRECT3D8 iface, UINT A
}
wined3d_mutex_lock();
- hr = wined3d_check_device_format(This->WineD3D, Adapter, DeviceType, wined3dformat_from_d3dformat(AdapterFormat),
+ hr = wined3d_check_device_format(This->WineD3D, Adapter, wined3ddevtype_from_d3ddevtype(DeviceType),
+ wined3dformat_from_d3dformat(AdapterFormat),
Usage, WineD3DRType, wined3dformat_from_d3dformat(CheckFormat), SURFACE_OPENGL);
wined3d_mutex_unlock();
@@ -267,7 +269,7 @@ static HRESULT WINAPI IDirect3D8Impl_CheckDeviceMultiSampleType(IDirect3D8 *ifac
iface, Adapter, DeviceType, SurfaceFormat, Windowed, MultiSampleType);
wined3d_mutex_lock();
- hr = wined3d_check_device_multisample_type(This->WineD3D, Adapter, DeviceType,
+ hr = wined3d_check_device_multisample_type(This->WineD3D, Adapter, wined3ddevtype_from_d3ddevtype(DeviceType),
wined3dformat_from_d3dformat(SurfaceFormat), Windowed,
wined3dmultisampletype_from_d3dmultisampletype(MultiSampleType), NULL);
wined3d_mutex_unlock();
@@ -286,7 +288,7 @@ static HRESULT WINAPI IDirect3D8Impl_CheckDepthStencilMatch(IDirect3D8 *iface, U
iface, Adapter, DeviceType, AdapterFormat, RenderTargetFormat, DepthStencilFormat);
wined3d_mutex_lock();
- hr = wined3d_check_depth_stencil_match(This->WineD3D, Adapter, DeviceType,
+ hr = wined3d_check_depth_stencil_match(This->WineD3D, Adapter, wined3ddevtype_from_d3ddevtype(DeviceType),
wined3dformat_from_d3dformat(AdapterFormat), wined3dformat_from_d3dformat(RenderTargetFormat),
wined3dformat_from_d3dformat(DepthStencilFormat));
wined3d_mutex_unlock();
@@ -326,7 +328,7 @@ static HRESULT WINAPI IDirect3D8Impl_GetDeviceCaps(LPDIRECT3D8 iface, UINT Ada
}
wined3d_mutex_lock();
- hrc = wined3d_get_device_caps(This->WineD3D, Adapter, DeviceType, pWineCaps);
+ hrc = wined3d_get_device_caps(This->WineD3D, Adapter, wined3ddevtype_from_d3ddevtype(DeviceType), pWineCaps);
wined3d_mutex_unlock();
fixup_caps(pWineCaps);
--
1.7.5.3
More information about the wine-patches
mailing list