d3d11/tests: Add test for predication state refcounting.

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>
This commit is contained in:
Józef Kucia 2017-05-10 15:54:08 +02:00 committed by Alexandre Julliard
parent 6c5a90e193
commit 6f11fd9728
1 changed files with 19 additions and 0 deletions

View File

@ -5227,11 +5227,13 @@ static void test_private_data(void)
static void test_state_refcounting(const D3D_FEATURE_LEVEL feature_level)
{
ID3D11RasterizerState *rasterizer_state, *tmp_rasterizer_state;
ID3D11Predicate *predicate, *tmp_predicate;
ID3D11SamplerState *sampler, *tmp_sampler;
ID3D11ShaderResourceView *srv, *tmp_srv;
ID3D11RenderTargetView *rtv, *tmp_rtv;
D3D11_RASTERIZER_DESC rasterizer_desc;
D3D11_TEXTURE2D_DESC texture_desc;
D3D11_QUERY_DESC predicate_desc;
D3D11_SAMPLER_DESC sampler_desc;
struct device_desc device_desc;
ID3D11DeviceContext *context;
@ -5340,6 +5342,23 @@ static void test_state_refcounting(const D3D_FEATURE_LEVEL feature_level)
refcount = ID3D11RenderTargetView_Release(tmp_rtv);
ok(!refcount, "Got refcount %u, expected 0.\n", refcount);
/* ID3D11Predicate */
if (feature_level >= D3D_FEATURE_LEVEL_10_0)
{
predicate_desc.Query = D3D11_QUERY_OCCLUSION_PREDICATE;
predicate_desc.MiscFlags = 0;
hr = ID3D11Device_CreatePredicate(device, &predicate_desc, &predicate);
ok(SUCCEEDED(hr), "Failed to create predicate, hr %#x.\n", hr);
ID3D11DeviceContext_SetPredication(context, predicate, TRUE);
refcount = ID3D11Predicate_Release(predicate);
ok(!refcount, "Got refcount %u, expected 0.\n", refcount);
ID3D11DeviceContext_GetPredication(context, &tmp_predicate, NULL);
ok(tmp_predicate == predicate, "Got predicate %p, expected %p.\n", tmp_predicate, predicate);
refcount = ID3D11Predicate_Release(tmp_predicate);
ok(!refcount, "Got refcount %u, expected 0.\n", refcount);
}
ID3D11DeviceContext_Release(context);
refcount = ID3D11Device_Release(device);
ok(!refcount, "Device has %u references left.\n", refcount);