Rémi Bernon : d3d11/tests: Add tests for ID3DDeviceContextState_SetPrivateData.

Alexandre Julliard julliard at winehq.org
Wed Feb 3 15:39:28 CST 2021


Module: wine
Branch: master
Commit: bbda37edbde7ae6cc5e6a48f6e796663ea03e59c
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=bbda37edbde7ae6cc5e6a48f6e796663ea03e59c

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Tue Feb  2 16:41:02 2021 +0100

d3d11/tests: Add tests for ID3DDeviceContextState_SetPrivateData.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/d3d11/tests/d3d11.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index fbf88891e83..2a94621e1e3 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -6597,6 +6597,8 @@ static void test_state_refcounting(const D3D_FEATURE_LEVEL feature_level)
 
 static void test_device_context_state(void)
 {
+    static const GUID test_guid =
+            {0xfdb37466, 0x428f, 0x4edf, {0xa3, 0x7f, 0x9b, 0x1d, 0xf4, 0x88, 0xc5, 0xfc}};
 #if 0
     float4 main(float4 pos : POSITION) : POSITION
     {
@@ -6781,7 +6783,9 @@ static void test_device_context_state(void)
     ID3D11Device1 *device, *device2;
     struct vec4 constant;
     ID3D11Buffer *cb, *srvb, *uavb, *tmp_cb;
+    DWORD data_size;
     ULONG refcount;
+    char data[64];
     HRESULT hr;
 
     if (!(d3d11_device = create_device(NULL)))
@@ -6936,6 +6940,19 @@ static void test_device_context_state(void)
     refcount = get_refcount(vs);
     todo_wine ok(refcount == 1, "Got refcount %u, expected 1.\n", refcount);
 
+    hr = ID3DDeviceContextState_SetPrivateData(context_state, &test_guid, sizeof(constant), &constant);
+    ok(hr == S_OK, "Failed to set private data, hr %#x.\n", hr);
+    refcount = ID3DDeviceContextState_Release(context_state);
+    ok(!refcount, "Got refcount %u, expected 0.\n", refcount);
+    ID3D11DeviceContext1_SwapDeviceContextState(context, previous_context_state, &context_state);
+    data_size = sizeof(data);
+    memset(data, 0xa5, sizeof(data));
+    hr = ID3DDeviceContextState_GetPrivateData(context_state, &test_guid, &data_size, data);
+    todo_wine ok(hr == S_OK, "Failed to get private data, hr %#x.\n", hr);
+    todo_wine ok(data_size == sizeof(constant), "Got private data size %x, expected %x.\n", data_size, sizeof(constant));
+    todo_wine ok(!memcmp(data, &constant, sizeof(constant)), "Got unexpected private data.\n");
+    ID3D11DeviceContext1_SwapDeviceContextState(context, context_state, NULL);
+
     context_type = ID3D11DeviceContext1_GetType(context);
     ok(context_type == D3D11_DEVICE_CONTEXT_IMMEDIATE, "Unexpected context type %u.\n", context_type);
 




More information about the wine-cvs mailing list