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

dxgi: Introduce wined3d_feature_level_from_d3d() helper function.

parent ea5db7dd
......@@ -621,27 +621,36 @@ HRESULT dxgi_set_private_data_interface(struct wined3d_private_store *store,
return hr;
}
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)
static enum wined3d_feature_level wined3d_feature_level_from_d3d(D3D_FEATURE_LEVEL feature_level)
{
static const struct
switch (feature_level)
{
D3D_FEATURE_LEVEL d3d;
enum wined3d_feature_level wined3d;
case D3D_FEATURE_LEVEL_11_1:
return WINED3D_FEATURE_LEVEL_11;
case D3D_FEATURE_LEVEL_11_0:
return WINED3D_FEATURE_LEVEL_11;
case D3D_FEATURE_LEVEL_10_1:
return WINED3D_FEATURE_LEVEL_10;
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_SM2;
default:
FIXME("Unhandled feature level %#x.\n", feature_level);
return 0;
}
wined3d_feature_levels[] =
{
{D3D_FEATURE_LEVEL_11_1, WINED3D_FEATURE_LEVEL_11},
{D3D_FEATURE_LEVEL_11_0, WINED3D_FEATURE_LEVEL_11},
{D3D_FEATURE_LEVEL_10_1, WINED3D_FEATURE_LEVEL_10},
{D3D_FEATURE_LEVEL_10_0, WINED3D_FEATURE_LEVEL_10},
{D3D_FEATURE_LEVEL_9_3, WINED3D_FEATURE_LEVEL_9_SM3},
{D3D_FEATURE_LEVEL_9_2, WINED3D_FEATURE_LEVEL_9_SM2},
{D3D_FEATURE_LEVEL_9_1, WINED3D_FEATURE_LEVEL_9_SM2},
};
D3D_FEATURE_LEVEL selected_feature_level = 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, j;
unsigned int i;
HRESULT hr;
wined3d_mutex_lock();
......@@ -653,31 +662,19 @@ D3D_FEATURE_LEVEL dxgi_check_feature_level_support(struct dxgi_factory *factory,
for (i = 0; i < level_count; ++i)
{
for (j = 0; j < ARRAY_SIZE(wined3d_feature_levels); ++j)
{
if (feature_levels[i] == wined3d_feature_levels[j].d3d)
{
if (caps.max_feature_level >= wined3d_feature_levels[j].wined3d)
wined3d_feature_level = wined3d_feature_level_from_d3d(feature_levels[i]);
if (wined3d_feature_level && caps.max_feature_level >= wined3d_feature_level)
{
selected_feature_level = feature_levels[i];
TRACE("Choosing supported feature level %s.\n",
debug_feature_level(selected_feature_level));
}
break;
}
debug_feature_level(feature_levels[i]));
return feature_levels[i];
}
if (selected_feature_level)
break;
if (j == ARRAY_SIZE(wined3d_feature_levels))
FIXME("Unexpected feature level %#x.\n", feature_levels[i]);
else
TRACE("Feature level %s not supported, trying next fallback if available.\n",
debug_feature_level(feature_levels[i]));
}
if (!selected_feature_level)
FIXME_(winediag)("None of the requested D3D feature levels is supported on this GPU "
"with the current shader backend.\n");
return selected_feature_level;
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