[PATCH 9/9] d3d11/tests: Port test_create_depthstencil_state() from d3d10core.
Józef Kucia
jkucia at codeweavers.com
Thu Oct 1 18:31:54 CDT 2015
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
dlls/d3d11/tests/d3d11.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 64 insertions(+)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index d2deffd..bc44dbd 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -1469,6 +1469,69 @@ static void test_create_shader(void)
}
}
+static void test_create_depthstencil_state(void)
+{
+ ID3D11DepthStencilState *ds_state1, *ds_state2;
+ ID3D10DepthStencilState *d3d10_ds_state;
+ ULONG refcount, expected_refcount;
+ D3D11_DEPTH_STENCIL_DESC ds_desc;
+ ID3D11Device *device, *tmp;
+ HRESULT hr;
+
+ if (!(device = create_device(NULL)))
+ {
+ skip("Failed to create device.\n");
+ return;
+ }
+
+ hr = ID3D11Device_CreateDepthStencilState(device, NULL, &ds_state1);
+ ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+
+ ds_desc.DepthEnable = TRUE;
+ ds_desc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
+ ds_desc.DepthFunc = D3D11_COMPARISON_LESS;
+ ds_desc.StencilEnable = FALSE;
+ ds_desc.StencilReadMask = D3D11_DEFAULT_STENCIL_READ_MASK;
+ ds_desc.StencilWriteMask = D3D11_DEFAULT_STENCIL_WRITE_MASK;
+ ds_desc.FrontFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
+ ds_desc.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_KEEP;
+ ds_desc.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
+ ds_desc.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
+ ds_desc.BackFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
+ ds_desc.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_KEEP;
+ ds_desc.BackFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
+ ds_desc.BackFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
+
+ expected_refcount = get_refcount((IUnknown *)device) + 1;
+ hr = ID3D11Device_CreateDepthStencilState(device, &ds_desc, &ds_state1);
+ ok(SUCCEEDED(hr), "Failed to create depthstencil state, hr %#x.\n", hr);
+ hr = ID3D11Device_CreateDepthStencilState(device, &ds_desc, &ds_state2);
+ ok(SUCCEEDED(hr), "Failed to create depthstencil state, hr %#x.\n", hr);
+ ok(ds_state1 == ds_state2, "Got different depthstencil state objects.\n");
+ 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;
+ ID3D11DepthStencilState_GetDevice(ds_state1, &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 = ID3D11DepthStencilState_QueryInterface(ds_state1, &IID_ID3D10DepthStencilState, (void **)&d3d10_ds_state);
+ ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE) /* Not available on all Windows versions. */,
+ "Depth stencil state should implement ID3D10DepthStencilState.\n");
+ if (SUCCEEDED(hr)) ID3D10DepthStencilState_Release(d3d10_ds_state);
+
+ refcount = ID3D11DepthStencilState_Release(ds_state2);
+ ok(refcount == 1, "Got unexpected refcount %u.\n", refcount);
+ refcount = ID3D11DepthStencilState_Release(ds_state1);
+ ok(!refcount, "Got unexpected refcount %u.\n", refcount);
+
+ refcount = ID3D11Device_Release(device);
+ ok(!refcount, "Device has %u references left.\n", refcount);
+}
+
static void test_create_rasterizer_state(void)
{
ID3D11RasterizerState *rast_state1, *rast_state2;
@@ -1563,5 +1626,6 @@ START_TEST(d3d11)
test_create_rendertarget_view();
test_create_shader_resource_view();
test_create_shader();
+ test_create_depthstencil_state();
test_create_rasterizer_state();
}
--
2.4.9
More information about the wine-patches
mailing list