Commit ce32dcce authored by Matteo Bruni's avatar Matteo Bruni Committed by Alexandre Julliard

d3d11: Pass the requested feature levels to dxgi.

parent ca3963b6
...@@ -132,7 +132,6 @@ HRESULT WINAPI D3D11CoreRegisterLayers(void) ...@@ -132,7 +132,6 @@ HRESULT WINAPI D3D11CoreRegisterLayers(void)
HRESULT WINAPI D3D11CoreCreateDevice(IDXGIFactory *factory, IDXGIAdapter *adapter, UINT flags, HRESULT WINAPI D3D11CoreCreateDevice(IDXGIFactory *factory, IDXGIAdapter *adapter, UINT flags,
const D3D_FEATURE_LEVEL *feature_levels, UINT levels, ID3D11Device **device) const D3D_FEATURE_LEVEL *feature_levels, UINT levels, ID3D11Device **device)
{ {
static const D3D_FEATURE_LEVEL level = D3D_FEATURE_LEVEL_10_0;
IUnknown *dxgi_device; IUnknown *dxgi_device;
HMODULE d3d11; HMODULE d3d11;
HRESULT hr; HRESULT hr;
...@@ -140,10 +139,8 @@ HRESULT WINAPI D3D11CoreCreateDevice(IDXGIFactory *factory, IDXGIAdapter *adapte ...@@ -140,10 +139,8 @@ HRESULT WINAPI D3D11CoreCreateDevice(IDXGIFactory *factory, IDXGIAdapter *adapte
TRACE("factory %p, adapter %p, flags %#x, feature_levels %p, levels %u, device %p.\n", TRACE("factory %p, adapter %p, flags %#x, feature_levels %p, levels %u, device %p.\n",
factory, adapter, flags, feature_levels, levels, device); factory, adapter, flags, feature_levels, levels, device);
FIXME("Ignoring feature levels.\n");
d3d11 = GetModuleHandleA("d3d11.dll"); d3d11 = GetModuleHandleA("d3d11.dll");
hr = DXGID3D10CreateDevice(d3d11, factory, adapter, flags, &level, 1, (void **)&dxgi_device); hr = DXGID3D10CreateDevice(d3d11, factory, adapter, flags, feature_levels, levels, (void **)&dxgi_device);
if (FAILED(hr)) if (FAILED(hr))
{ {
WARN("Failed to create device, returning %#x.\n", hr); WARN("Failed to create device, returning %#x.\n", hr);
...@@ -165,6 +162,15 @@ HRESULT WINAPI D3D11CreateDevice(IDXGIAdapter *adapter, D3D_DRIVER_TYPE driver_t ...@@ -165,6 +162,15 @@ HRESULT WINAPI D3D11CreateDevice(IDXGIAdapter *adapter, D3D_DRIVER_TYPE driver_t
const D3D_FEATURE_LEVEL *feature_levels, UINT levels, UINT sdk_version, ID3D11Device **device_out, const D3D_FEATURE_LEVEL *feature_levels, UINT levels, UINT sdk_version, ID3D11Device **device_out,
D3D_FEATURE_LEVEL *obtained_feature_level, ID3D11DeviceContext **immediate_context) D3D_FEATURE_LEVEL *obtained_feature_level, ID3D11DeviceContext **immediate_context)
{ {
static const D3D_FEATURE_LEVEL default_feature_levels[] =
{
D3D_FEATURE_LEVEL_11_0,
D3D_FEATURE_LEVEL_10_1,
D3D_FEATURE_LEVEL_10_0,
D3D_FEATURE_LEVEL_9_3,
D3D_FEATURE_LEVEL_9_2,
D3D_FEATURE_LEVEL_9_1,
};
IDXGIFactory *factory; IDXGIFactory *factory;
ID3D11Device *device; ID3D11Device *device;
HRESULT hr; HRESULT hr;
...@@ -262,6 +268,11 @@ HRESULT WINAPI D3D11CreateDevice(IDXGIAdapter *adapter, D3D_DRIVER_TYPE driver_t ...@@ -262,6 +268,11 @@ HRESULT WINAPI D3D11CreateDevice(IDXGIAdapter *adapter, D3D_DRIVER_TYPE driver_t
} }
} }
if (!feature_levels)
{
feature_levels = default_feature_levels;
levels = sizeof(default_feature_levels) / sizeof(default_feature_levels[0]);
}
hr = D3D11CoreCreateDevice(factory, adapter, flags, feature_levels, levels, &device); hr = D3D11CoreCreateDevice(factory, adapter, flags, feature_levels, levels, &device);
IDXGIAdapter_Release(adapter); IDXGIAdapter_Release(adapter);
IDXGIFactory_Release(factory); IDXGIFactory_Release(factory);
......
...@@ -1977,6 +1977,8 @@ static void test_create_shader(void) ...@@ -1977,6 +1977,8 @@ static void test_create_shader(void)
for (i = 0; i < sizeof(d3d11_feature_levels) / sizeof(*d3d11_feature_levels); ++i) for (i = 0; i < sizeof(d3d11_feature_levels) / sizeof(*d3d11_feature_levels); ++i)
{ {
D3D_FEATURE_LEVEL feature_level = d3d11_feature_levels[i]; D3D_FEATURE_LEVEL feature_level = d3d11_feature_levels[i];
BOOL todo = feature_level <= D3D_FEATURE_LEVEL_9_3;
if (!(device = create_device(&feature_level))) if (!(device = create_device(&feature_level)))
{ {
skip("Failed to create device for feature level %#x.\n", feature_level); skip("Failed to create device for feature level %#x.\n", feature_level);
...@@ -1985,16 +1987,22 @@ static void test_create_shader(void) ...@@ -1985,16 +1987,22 @@ static void test_create_shader(void)
/* level_9 shaders */ /* level_9 shaders */
hr = ID3D11Device_CreatePixelShader(device, ps_4_0_level_9_0, sizeof(ps_4_0_level_9_0), NULL, &ps); hr = ID3D11Device_CreatePixelShader(device, ps_4_0_level_9_0, sizeof(ps_4_0_level_9_0), NULL, &ps);
ok(SUCCEEDED(hr), "Failed to create ps_4_0_level_9_0 shader, hr %#x, feature level %#x.\n", hr, feature_level); todo_wine_if(todo)
ID3D11PixelShader_Release(ps); ok(SUCCEEDED(hr), "Failed to create ps_4_0_level_9_0 shader, hr %#x, feature level %#x.\n", hr, feature_level);
if (SUCCEEDED(hr))
ID3D11PixelShader_Release(ps);
hr = ID3D11Device_CreatePixelShader(device, ps_4_0_level_9_1, sizeof(ps_4_0_level_9_1), NULL, &ps); hr = ID3D11Device_CreatePixelShader(device, ps_4_0_level_9_1, sizeof(ps_4_0_level_9_1), NULL, &ps);
ok(SUCCEEDED(hr), "Failed to create ps_4_0_level_9_1 shader, hr %#x, feature level %#x.\n", hr, feature_level); todo_wine_if(todo)
ID3D11PixelShader_Release(ps); ok(SUCCEEDED(hr), "Failed to create ps_4_0_level_9_1 shader, hr %#x, feature level %#x.\n", hr, feature_level);
if (SUCCEEDED(hr))
ID3D11PixelShader_Release(ps);
hr = ID3D11Device_CreatePixelShader(device, ps_4_0_level_9_3, sizeof(ps_4_0_level_9_3), NULL, &ps); hr = ID3D11Device_CreatePixelShader(device, ps_4_0_level_9_3, sizeof(ps_4_0_level_9_3), NULL, &ps);
ok(SUCCEEDED(hr), "Failed to create ps_4_0_level_9_3 shader, hr %#x, feature level %#x.\n", hr, feature_level); todo_wine_if(todo)
ID3D11PixelShader_Release(ps); ok(SUCCEEDED(hr), "Failed to create ps_4_0_level_9_3 shader, hr %#x, feature level %#x.\n", hr, feature_level);
if (SUCCEEDED(hr))
ID3D11PixelShader_Release(ps);
/* vertex shader */ /* vertex shader */
hr = ID3D11Device_CreateVertexShader(device, vs_2_0, sizeof(vs_2_0), NULL, &vs); hr = ID3D11Device_CreateVertexShader(device, vs_2_0, sizeof(vs_2_0), NULL, &vs);
......
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