d3d11/tests: Test creating SM4 shaders on feature level 9.

Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Matteo Bruni 2016-03-09 23:19:24 +01:00 committed by Alexandre Julliard
parent 73c32df383
commit 1c8983bf75
1 changed files with 71 additions and 60 deletions

View File

@ -2031,86 +2031,97 @@ static void test_create_shader(void)
ok(hr == E_INVALIDARG, "Created a SM4 vertex shader from a pixel shader source, hr %#x, feature level %#x.\n",
hr, feature_level);
if (feature_level < D3D_FEATURE_LEVEL_10_0)
expected_refcount = get_refcount((IUnknown *)device) + (feature_level >= D3D_FEATURE_LEVEL_10_0);
hr = ID3D11Device_CreateVertexShader(device, vs_4_0, sizeof(vs_4_0), NULL, &vs);
if (feature_level >= D3D_FEATURE_LEVEL_10_0)
ok(SUCCEEDED(hr), "Failed to create SM4 vertex shader, hr %#x, feature level %#x.\n", hr, feature_level);
else
ok(hr == E_INVALIDARG, "Created a SM4 vertex shader, hr %#x, feature level %#x.\n", hr, feature_level);
refcount = get_refcount((IUnknown *)device);
ok(refcount >= expected_refcount, "Got unexpected refcount %u, expected >= %u.\n",
refcount, expected_refcount);
if (feature_level >= D3D_FEATURE_LEVEL_10_0)
{
refcount = ID3D11Device_Release(device);
ok(!refcount, "Device has %u references left.\n", refcount);
continue;
tmp = NULL;
expected_refcount = refcount + 1;
ID3D11VertexShader_GetDevice(vs, &tmp);
ok(tmp == device, "Got unexpected device %p, expected %p.\n", tmp, device);
refcount = get_refcount((IUnknown *)device);
ok(refcount == expected_refcount, "Got unexpected refcount %u, expected %u.\n",
refcount, expected_refcount);
ID3D11Device_Release(tmp);
hr = ID3D11VertexShader_QueryInterface(vs, &IID_ID3D10VertexShader, (void **)&iface);
ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE) /* Not available on all Windows versions. */,
"Vertex shader should implement ID3D10VertexShader.\n");
if (SUCCEEDED(hr)) IUnknown_Release(iface);
refcount = ID3D11VertexShader_Release(vs);
ok(!refcount, "Vertex shader has %u references left.\n", refcount);
}
expected_refcount = get_refcount((IUnknown *)device) + 1;
hr = ID3D11Device_CreateVertexShader(device, vs_4_0, sizeof(vs_4_0), NULL, &vs);
ok(SUCCEEDED(hr), "Failed to create SM4 vertex shader, hr %#x, feature level %#x.\n", hr, feature_level);
refcount = get_refcount((IUnknown *)device);
ok(refcount >= expected_refcount, "Got unexpected refcount %u, expected >= %u.\n",
refcount, expected_refcount);
tmp = NULL;
expected_refcount = refcount + 1;
ID3D11VertexShader_GetDevice(vs, &tmp);
ok(tmp == device, "Got unexpected device %p, expected %p.\n", tmp, device);
refcount = get_refcount((IUnknown *)device);
ok(refcount == expected_refcount, "Got unexpected refcount %u, expected %u.\n",
refcount, expected_refcount);
ID3D11Device_Release(tmp);
hr = ID3D11VertexShader_QueryInterface(vs, &IID_ID3D10VertexShader, (void **)&iface);
ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE) /* Not available on all Windows versions. */,
"Vertex shader should implement ID3D10VertexShader.\n");
if (SUCCEEDED(hr)) IUnknown_Release(iface);
refcount = ID3D11VertexShader_Release(vs);
ok(!refcount, "Vertex shader has %u references left.\n", refcount);
/* pixel shader */
expected_refcount = get_refcount((IUnknown *)device) + 1;
expected_refcount = get_refcount((IUnknown *)device) + (feature_level >= D3D_FEATURE_LEVEL_10_0);
hr = ID3D11Device_CreatePixelShader(device, ps_4_0, sizeof(ps_4_0), NULL, &ps);
ok(SUCCEEDED(hr), "Failed to create SM4 vertex shader, hr %#x, feature level %#x.\n", hr, feature_level);
if (feature_level >= D3D_FEATURE_LEVEL_10_0)
ok(SUCCEEDED(hr), "Failed to create SM4 pixel shader, hr %#x, feature level %#x.\n", hr, feature_level);
else
ok(hr == E_INVALIDARG, "Created a SM4 pixel shader, hr %#x, feature level %#x.\n", hr, feature_level);
refcount = get_refcount((IUnknown *)device);
ok(refcount >= expected_refcount, "Got unexpected refcount %u, expected >= %u.\n",
refcount, expected_refcount);
tmp = NULL;
expected_refcount = refcount + 1;
ID3D11PixelShader_GetDevice(ps, &tmp);
ok(tmp == device, "Got unexpected device %p, expected %p.\n", tmp, device);
refcount = get_refcount((IUnknown *)device);
ok(refcount == expected_refcount, "Got unexpected refcount %u, expected %u.\n",
refcount, expected_refcount);
ID3D11Device_Release(tmp);
if (feature_level >= D3D_FEATURE_LEVEL_10_0)
{
tmp = NULL;
expected_refcount = refcount + 1;
ID3D11PixelShader_GetDevice(ps, &tmp);
ok(tmp == device, "Got unexpected device %p, expected %p.\n", tmp, device);
refcount = get_refcount((IUnknown *)device);
ok(refcount == expected_refcount, "Got unexpected refcount %u, expected %u.\n",
refcount, expected_refcount);
ID3D11Device_Release(tmp);
hr = ID3D11PixelShader_QueryInterface(ps, &IID_ID3D10PixelShader, (void **)&iface);
ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE) /* Not available on all Windows versions. */,
"Pixel shader should implement ID3D10PixelShader.\n");
if (SUCCEEDED(hr)) IUnknown_Release(iface);
hr = ID3D11PixelShader_QueryInterface(ps, &IID_ID3D10PixelShader, (void **)&iface);
ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE) /* Not available on all Windows versions. */,
"Pixel shader should implement ID3D10PixelShader.\n");
if (SUCCEEDED(hr)) IUnknown_Release(iface);
refcount = ID3D11PixelShader_Release(ps);
ok(!refcount, "Pixel shader has %u references left.\n", refcount);
refcount = ID3D11PixelShader_Release(ps);
ok(!refcount, "Pixel shader has %u references left.\n", refcount);
}
/* geometry shader */
expected_refcount = get_refcount((IUnknown *)device) + 1;
expected_refcount = get_refcount((IUnknown *)device) + (feature_level >= D3D_FEATURE_LEVEL_10_0);
hr = ID3D11Device_CreateGeometryShader(device, gs_4_0, sizeof(gs_4_0), NULL, &gs);
ok(SUCCEEDED(hr), "Failed to create SM4 geometry shader, hr %#x.\n", hr);
if (feature_level >= D3D_FEATURE_LEVEL_10_0)
ok(SUCCEEDED(hr), "Failed to create SM4 geometry shader, hr %#x, feature level %#x.\n", hr, feature_level);
else
ok(hr == E_INVALIDARG, "Created a SM4 geometry shader, hr %#x, feature level %#x.\n", hr, feature_level);
refcount = get_refcount((IUnknown *)device);
ok(refcount >= expected_refcount, "Got unexpected refcount %u, expected >= %u.\n",
refcount, expected_refcount);
tmp = NULL;
expected_refcount = refcount + 1;
ID3D11GeometryShader_GetDevice(gs, &tmp);
ok(tmp == device, "Got unexpected device %p, expected %p.\n", tmp, device);
refcount = get_refcount((IUnknown *)device);
ok(refcount == expected_refcount, "Got unexpected refcount %u, expected %u.\n",
refcount, expected_refcount);
ID3D11Device_Release(tmp);
if (feature_level >= D3D_FEATURE_LEVEL_10_0)
{
tmp = NULL;
expected_refcount = refcount + 1;
ID3D11GeometryShader_GetDevice(gs, &tmp);
ok(tmp == device, "Got unexpected device %p, expected %p.\n", tmp, device);
refcount = get_refcount((IUnknown *)device);
ok(refcount == expected_refcount, "Got unexpected refcount %u, expected %u.\n",
refcount, expected_refcount);
ID3D11Device_Release(tmp);
hr = ID3D11GeometryShader_QueryInterface(gs, &IID_ID3D10GeometryShader, (void **)&iface);
ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE) /* Not available on all Windows versions. */,
"Geometry shader should implement ID3D10GeometryShader.\n");
if (SUCCEEDED(hr)) IUnknown_Release(iface);
hr = ID3D11GeometryShader_QueryInterface(gs, &IID_ID3D10GeometryShader, (void **)&iface);
ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE) /* Not available on all Windows versions. */,
"Geometry shader should implement ID3D10GeometryShader.\n");
if (SUCCEEDED(hr)) IUnknown_Release(iface);
refcount = ID3D11GeometryShader_Release(gs);
ok(!refcount, "Geometry shader has %u references left.\n", refcount);
refcount = ID3D11GeometryShader_Release(gs);
ok(!refcount, "Geometry shader has %u references left.\n", refcount);
}
refcount = ID3D11Device_Release(device);
ok(!refcount, "Device has %u references left.\n", refcount);