Commit 04887860 authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

dxgi: Merge dxgi_check_feature_level_support() into dxgi_adapter_CheckInterfaceSupport().

parent 47cf3204
......@@ -209,9 +209,10 @@ static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetDesc(IWineDXGIAdapter *iface, D
static HRESULT STDMETHODCALLTYPE dxgi_adapter_CheckInterfaceSupport(IWineDXGIAdapter *iface,
REFGUID guid, LARGE_INTEGER *umd_version)
{
static const D3D_FEATURE_LEVEL feature_level = D3D_FEATURE_LEVEL_10_0;
struct dxgi_adapter *adapter = impl_from_IWineDXGIAdapter(iface);
struct wined3d_adapter_identifier adapter_id;
struct wined3d_caps caps;
struct wined3d *wined3d;
HRESULT hr;
TRACE("iface %p, guid %s, umd_version %p.\n", iface, debugstr_guid(guid), umd_version);
......@@ -224,23 +225,24 @@ static HRESULT STDMETHODCALLTYPE dxgi_adapter_CheckInterfaceSupport(IWineDXGIAda
return DXGI_ERROR_UNSUPPORTED;
}
if (!dxgi_check_feature_level_support(adapter->factory, adapter, &feature_level, 1))
return DXGI_ERROR_UNSUPPORTED;
if (umd_version)
{
adapter_id.driver_size = 0;
adapter_id.description_size = 0;
adapter_id.device_name_size = 0;
wined3d_mutex_lock();
hr = wined3d_get_adapter_identifier(adapter->factory->wined3d, adapter->ordinal, 0, &adapter_id);
wined3d = adapter->factory->wined3d;
hr = wined3d_get_device_caps(wined3d, adapter->ordinal, WINED3D_DEVICE_TYPE_HAL, &caps);
if (SUCCEEDED(hr))
hr = wined3d_get_adapter_identifier(wined3d, adapter->ordinal, 0, &adapter_id);
wined3d_mutex_unlock();
if (FAILED(hr))
return hr;
if (caps.max_feature_level < WINED3D_FEATURE_LEVEL_10)
return DXGI_ERROR_UNSUPPORTED;
if (umd_version)
*umd_version = adapter_id.driver_version;
}
return S_OK;
}
......
......@@ -199,7 +199,4 @@ struct dxgi_surface
HRESULT dxgi_surface_init(struct dxgi_surface *surface, IDXGIDevice *device,
IUnknown *outer, struct wined3d_texture *wined3d_texture) DECLSPEC_HIDDEN;
D3D_FEATURE_LEVEL dxgi_check_feature_level_support(struct dxgi_factory *factory, struct dxgi_adapter *adapter,
const D3D_FEATURE_LEVEL *feature_levels, unsigned int level_count) DECLSPEC_HIDDEN;
#endif /* __WINE_DXGI_PRIVATE_H */
......@@ -619,59 +619,3 @@ HRESULT dxgi_set_private_data_interface(struct wined3d_private_store *store,
return hr;
}
static enum wined3d_feature_level wined3d_feature_level_from_d3d(D3D_FEATURE_LEVEL feature_level)
{
switch (feature_level)
{
case D3D_FEATURE_LEVEL_11_1:
return WINED3D_FEATURE_LEVEL_11_1;
case D3D_FEATURE_LEVEL_11_0:
return WINED3D_FEATURE_LEVEL_11;
case D3D_FEATURE_LEVEL_10_1:
return WINED3D_FEATURE_LEVEL_10_1;
case D3D_FEATURE_LEVEL_10_0:
return WINED3D_FEATURE_LEVEL_10;
case D3D_FEATURE_LEVEL_9_3:
return WINED3D_FEATURE_LEVEL_9_SM3;
case D3D_FEATURE_LEVEL_9_2:
return WINED3D_FEATURE_LEVEL_9_SM2;
case D3D_FEATURE_LEVEL_9_1:
return WINED3D_FEATURE_LEVEL_9_1;
default:
FIXME("Unhandled feature level %#x.\n", feature_level);
return 0;
}
}
D3D_FEATURE_LEVEL dxgi_check_feature_level_support(struct dxgi_factory *factory, struct dxgi_adapter *adapter,
const D3D_FEATURE_LEVEL *feature_levels, unsigned int level_count)
{
enum wined3d_feature_level wined3d_feature_level;
struct wined3d_caps caps;
unsigned int i;
HRESULT hr;
wined3d_mutex_lock();
hr = wined3d_get_device_caps(factory->wined3d, adapter->ordinal, WINED3D_DEVICE_TYPE_HAL, &caps);
wined3d_mutex_unlock();
if (FAILED(hr))
level_count = 0;
for (i = 0; i < level_count; ++i)
{
wined3d_feature_level = wined3d_feature_level_from_d3d(feature_levels[i]);
if (wined3d_feature_level && caps.max_feature_level >= wined3d_feature_level)
{
TRACE("Choosing supported feature level %s.\n",
debug_feature_level(feature_levels[i]));
return feature_levels[i];
}
TRACE("Feature level %s not supported, trying next fallback if available.\n",
debug_feature_level(feature_levels[i]));
}
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment