Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/dxgi/adapter.c | 30 ++++++++++++++------------ dlls/dxgi/dxgi_private.h | 3 --- dlls/dxgi/utils.c | 56 ------------------------------------------------ 3 files changed, 16 insertions(+), 73 deletions(-)
diff --git a/dlls/dxgi/adapter.c b/dlls/dxgi/adapter.c index 1f81d7717e1b..4bc57a244d1f 100644 --- a/dlls/dxgi/adapter.c +++ b/dlls/dxgi/adapter.c @@ -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; + adapter_id.driver_size = 0; + adapter_id.description_size = 0; + adapter_id.device_name_size = 0;
- if (umd_version) - { - adapter_id.driver_size = 0; - adapter_id.description_size = 0; - adapter_id.device_name_size = 0; + wined3d_mutex_lock(); + 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();
- wined3d_mutex_lock(); - hr = wined3d_get_adapter_identifier(adapter->factory->wined3d, adapter->ordinal, 0, &adapter_id); - wined3d_mutex_unlock(); - if (FAILED(hr)) - return hr; + 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; } diff --git a/dlls/dxgi/dxgi_private.h b/dlls/dxgi/dxgi_private.h index 8c3e41a390bb..78f188634fcb 100644 --- a/dlls/dxgi/dxgi_private.h +++ b/dlls/dxgi/dxgi_private.h @@ -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 */ diff --git a/dlls/dxgi/utils.c b/dlls/dxgi/utils.c index ad8e2a23f2ae..73b37fda8b57 100644 --- a/dlls/dxgi/utils.c +++ b/dlls/dxgi/utils.c @@ -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; -}