d3d9: Introduce a helper to convert d3d9 device types to wined3d types.

Signed-off-by: Chip Davis <cdavis@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2020-04-02 15:04:56 +04:30 committed by Alexandre Julliard
parent 4997657116
commit fb408f1662
3 changed files with 18 additions and 12 deletions

View File

@ -399,6 +399,11 @@ static inline enum wined3d_multisample_type wined3d_multisample_type_from_d3d(D3
return (enum wined3d_multisample_type)type;
}
static inline enum wined3d_device_type wined3d_device_type_from_d3d(D3DDEVTYPE type)
{
return (enum wined3d_device_type)type;
}
static inline enum wined3d_scanline_ordering wined3d_scanline_ordering_from_d3d(D3DSCANLINEORDERING ordering)
{
return (enum wined3d_scanline_ordering)ordering;

View File

@ -4681,7 +4681,7 @@ HRESULT device_init(struct d3d9_device *device, struct d3d9 *parent, struct wine
wined3d_mutex_lock();
wined3d_adapter = wined3d_output_get_adapter(parent->wined3d_outputs[output_idx]);
if (FAILED(hr = wined3d_device_create(wined3d, wined3d_adapter, device_type,
if (FAILED(hr = wined3d_device_create(wined3d, wined3d_adapter, wined3d_device_type_from_d3d(device_type),
focus_window, flags, 4, feature_levels, ARRAY_SIZE(feature_levels),
&device->device_parent, &device->wined3d_device)))
{
@ -4690,7 +4690,7 @@ HRESULT device_init(struct d3d9_device *device, struct d3d9 *parent, struct wine
return hr;
}
wined3d_get_device_caps(wined3d_adapter, device_type, &wined3d_caps);
wined3d_get_device_caps(wined3d_adapter, wined3d_device_type_from_d3d(device_type), &wined3d_caps);
d3d9_caps_from_wined3dcaps(parent, adapter, &caps, &wined3d_caps);
device->max_user_clip_planes = caps.MaxUserClipPlanes;
device->vs_uniform_count = caps.MaxVertexShaderConst;

View File

@ -268,8 +268,8 @@ static HRESULT WINAPI d3d9_CheckDeviceType(IDirect3D9Ex *iface, UINT adapter, D3
return WINED3DERR_NOTAVAILABLE;
wined3d_mutex_lock();
hr = wined3d_check_device_type(d3d9->wined3d, d3d9->wined3d_outputs[output_idx], device_type,
wined3dformat_from_d3dformat(display_format),
hr = wined3d_check_device_type(d3d9->wined3d, d3d9->wined3d_outputs[output_idx],
wined3d_device_type_from_d3d(device_type), wined3dformat_from_d3dformat(display_format),
wined3dformat_from_d3dformat(backbuffer_format), windowed);
wined3d_mutex_unlock();
@ -334,13 +334,13 @@ static HRESULT WINAPI d3d9_CheckDeviceFormat(IDirect3D9Ex *iface, UINT adapter,
{
DWORD levels;
hr = wined3d_check_device_multisample_type(wined3d_adapter, device_type,
hr = wined3d_check_device_multisample_type(wined3d_adapter, wined3d_device_type_from_d3d(device_type),
WINED3DFMT_D24_UNORM_S8_UINT, FALSE, WINED3D_MULTISAMPLE_NON_MASKABLE, &levels);
if (SUCCEEDED(hr) && !levels)
hr = D3DERR_NOTAVAILABLE;
}
else
hr = wined3d_check_device_format(d3d9->wined3d, wined3d_adapter, device_type,
hr = wined3d_check_device_format(d3d9->wined3d, wined3d_adapter, wined3d_device_type_from_d3d(device_type),
wined3dformat_from_d3dformat(adapter_format), usage, bind_flags,
wined3d_rtype, wined3dformat_from_d3dformat(format));
wined3d_mutex_unlock();
@ -368,7 +368,8 @@ static HRESULT WINAPI d3d9_CheckDeviceMultiSampleType(IDirect3D9Ex *iface, UINT
wined3d_mutex_lock();
wined3d_adapter = wined3d_output_get_adapter(d3d9->wined3d_outputs[output_idx]);
hr = wined3d_check_device_multisample_type(wined3d_adapter, device_type, wined3dformat_from_d3dformat(format),
hr = wined3d_check_device_multisample_type(wined3d_adapter,
wined3d_device_type_from_d3d(device_type), wined3dformat_from_d3dformat(format),
windowed, wined3d_multisample_type_from_d3d(multisample_type), levels);
wined3d_mutex_unlock();
if (hr == WINED3DERR_NOTAVAILABLE && levels)
@ -394,9 +395,9 @@ static HRESULT WINAPI d3d9_CheckDepthStencilMatch(IDirect3D9Ex *iface, UINT adap
wined3d_mutex_lock();
wined3d_adapter = wined3d_output_get_adapter(d3d9->wined3d_outputs[output_idx]);
hr = wined3d_check_depth_stencil_match(wined3d_adapter, device_type,
wined3dformat_from_d3dformat(adapter_format), wined3dformat_from_d3dformat(rt_format),
wined3dformat_from_d3dformat(ds_format));
hr = wined3d_check_depth_stencil_match(wined3d_adapter,
wined3d_device_type_from_d3d(device_type), wined3dformat_from_d3dformat(adapter_format),
wined3dformat_from_d3dformat(rt_format), wined3dformat_from_d3dformat(ds_format));
wined3d_mutex_unlock();
return hr;
@ -418,7 +419,7 @@ static HRESULT WINAPI d3d9_CheckDeviceFormatConversion(IDirect3D9Ex *iface, UINT
wined3d_mutex_lock();
hr = wined3d_check_device_format_conversion(d3d9->wined3d_outputs[output_idx],
device_type, wined3dformat_from_d3dformat(src_format),
wined3d_device_type_from_d3d(device_type), wined3dformat_from_d3dformat(src_format),
wined3dformat_from_d3dformat(dst_format));
wined3d_mutex_unlock();
@ -446,7 +447,7 @@ static HRESULT WINAPI d3d9_GetDeviceCaps(IDirect3D9Ex *iface, UINT adapter, D3DD
wined3d_mutex_lock();
wined3d_adapter = wined3d_output_get_adapter(d3d9->wined3d_outputs[output_idx]);
hr = wined3d_get_device_caps(wined3d_adapter, device_type, &wined3d_caps);
hr = wined3d_get_device_caps(wined3d_adapter, wined3d_device_type_from_d3d(device_type), &wined3d_caps);
wined3d_mutex_unlock();
d3d9_caps_from_wined3dcaps(d3d9, adapter, caps, &wined3d_caps);