d3d11/tests: Add tests showing that views do not keep resource reference.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
oldstable
Józef Kucia 2017-02-02 12:43:35 +01:00 committed by Alexandre Julliard
parent ab9cc27331
commit 0ce7d71c46
1 changed files with 19 additions and 0 deletions

View File

@ -2751,8 +2751,11 @@ static void test_create_depthstencil_view(void)
get_dsv_desc(current_desc, &tests[i].dsv_desc);
}
expected_refcount = get_refcount((IUnknown *)texture);
hr = ID3D11Device_CreateDepthStencilView(device, (ID3D11Resource *)texture, current_desc, &dsview);
ok(SUCCEEDED(hr), "Test %u: Failed to create depth stencil view, hr %#x.\n", i, hr);
refcount = get_refcount((IUnknown *)texture);
todo_wine ok(refcount == expected_refcount, "Got refcount %u, expected %u.\n", refcount, expected_refcount);
hr = ID3D11DepthStencilView_QueryInterface(dsview, &IID_ID3D10DepthStencilView, (void **)&iface);
ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE) /* Not available on all Windows versions. */,
@ -3112,8 +3115,11 @@ static void test_create_rendertarget_view(void)
get_rtv_desc(current_desc, &tests[i].rtv_desc);
}
expected_refcount = get_refcount((IUnknown *)texture);
hr = ID3D11Device_CreateRenderTargetView(device, texture, current_desc, &rtview);
ok(SUCCEEDED(hr), "Test %u: Failed to create render target view, hr %#x.\n", i, hr);
refcount = get_refcount((IUnknown *)texture);
todo_wine ok(refcount == expected_refcount, "Got refcount %u, expected %u.\n", refcount, expected_refcount);
hr = ID3D11RenderTargetView_QueryInterface(rtview, &IID_ID3D10RenderTargetView, (void **)&iface);
ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE) /* Not available on all Windows versions. */,
@ -3468,8 +3474,11 @@ static void test_create_shader_resource_view(void)
get_srv_desc(current_desc, &tests[i].srv_desc);
}
expected_refcount = get_refcount((IUnknown *)texture);
hr = ID3D11Device_CreateShaderResourceView(device, texture, current_desc, &srview);
ok(SUCCEEDED(hr), "Test %u: Failed to create a shader resource view, hr %#x.\n", i, hr);
refcount = get_refcount((IUnknown *)texture);
todo_wine ok(refcount == expected_refcount, "Got refcount %u, expected %u.\n", refcount, expected_refcount);
hr = ID3D11ShaderResourceView_QueryInterface(srview, &IID_ID3D10ShaderResourceView, (void **)&iface);
ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE) /* Not available on all Windows versions. */,
@ -8143,6 +8152,7 @@ static void test_swapchain_views(void)
ID3D11DeviceContext *context;
ID3D11RenderTargetView *rtv;
ID3D11Device *device;
ULONG refcount;
HRESULT hr;
static const struct vec4 color = {0.2f, 0.3f, 0.5f, 1.0f};
@ -8153,6 +8163,9 @@ static void test_swapchain_views(void)
device = test_context.device;
context = test_context.immediate_context;
refcount = get_refcount((IUnknown *)test_context.backbuffer);
todo_wine ok(refcount == 1, "Got unexpected refcount %u.\n", refcount);
draw_color_quad(&test_context, &color);
check_texture_color(test_context.backbuffer, 0xff7f4c33, 1);
@ -8163,6 +8176,9 @@ static void test_swapchain_views(void)
ok(SUCCEEDED(hr), "Failed to create render target view, hr %#x.\n", hr);
ID3D11DeviceContext_OMSetRenderTargets(context, 1, &rtv, NULL);
refcount = get_refcount((IUnknown *)test_context.backbuffer);
todo_wine ok(refcount == 1, "Got unexpected refcount %u.\n", refcount);
draw_color_quad(&test_context, &color);
todo_wine check_texture_color(test_context.backbuffer, 0xffbc957c, 1);
@ -10376,8 +10392,11 @@ static void test_create_unordered_access_view(void)
get_uav_desc(current_desc, &tests[i].uav_desc);
}
expected_refcount = get_refcount((IUnknown *)texture);
hr = ID3D11Device_CreateUnorderedAccessView(device, texture, current_desc, &uav);
ok(SUCCEEDED(hr), "Test %u: Failed to create unordered access view, hr %#x.\n", i, hr);
refcount = get_refcount((IUnknown *)texture);
todo_wine ok(refcount == expected_refcount, "Got refcount %u, expected %u.\n", refcount, expected_refcount);
memset(&uav_desc, 0, sizeof(uav_desc));
ID3D11UnorderedAccessView_GetDesc(uav, &uav_desc);