=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: d3d11: Partially implement d3d11_device_CheckFeatureSupport().

Alexandre Julliard julliard at winehq.org
Fri Jun 24 08:33:45 CDT 2016


Module: wine
Branch: master
Commit: 60a799f422551f941a421887e3dc9e6a71eb0f66
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=60a799f422551f941a421887e3dc9e6a71eb0f66

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Fri Jun 24 11:46:01 2016 +0200

d3d11: Partially implement d3d11_device_CheckFeatureSupport().

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/d3d11/device.c      | 23 +++++++++++++++++++++--
 dlls/d3d11/tests/d3d11.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++
 include/d3d11.idl        |  6 ++++++
 3 files changed, 76 insertions(+), 2 deletions(-)

diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index dfdd0d2..03fafc6 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -2689,10 +2689,29 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CheckCounter(ID3D11Device *iface,
 static HRESULT STDMETHODCALLTYPE d3d11_device_CheckFeatureSupport(ID3D11Device *iface, D3D11_FEATURE feature,
         void *feature_support_data, UINT feature_support_data_size)
 {
-    FIXME("iface %p, feature %u, feature_support_data %p, feature_support_data_size %u stub!\n",
+    TRACE("iface %p, feature %u, feature_support_data %p, feature_support_data_size %u.\n",
             iface, feature, feature_support_data, feature_support_data_size);
 
-    return E_NOTIMPL;
+    switch (feature)
+    {
+        case D3D11_FEATURE_THREADING:
+        {
+            D3D11_FEATURE_DATA_THREADING *threading_data = feature_support_data;
+            if (feature_support_data_size != sizeof(*threading_data))
+            {
+                WARN("Invalid data size.\n");
+                return E_INVALIDARG;
+            }
+
+            threading_data->DriverConcurrentCreates = FALSE;
+            threading_data->DriverCommandLists = FALSE;
+            return S_OK;
+        }
+
+        default:
+            FIXME("Unhandled feature %#x.\n", feature);
+            return E_NOTIMPL;
+    }
 }
 
 static HRESULT STDMETHODCALLTYPE d3d11_device_GetPrivateData(ID3D11Device *iface, REFGUID guid,
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index 8626b68..62c119a 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -8468,6 +8468,54 @@ static void test_null_sampler(void)
     release_test_context(&test_context);
 }
 
+static void test_check_feature_support(void)
+{
+    D3D11_FEATURE_DATA_THREADING threading[2];
+    ID3D11Device *device;
+    ULONG refcount;
+    HRESULT hr;
+
+    if (!(device = create_device(NULL)))
+    {
+        skip("Failed to create device.\n");
+        return;
+    }
+
+    memset(threading, 0xef, sizeof(threading));
+
+    hr = ID3D11Device_CheckFeatureSupport(device, D3D11_FEATURE_THREADING, NULL, 0);
+    ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+    hr = ID3D11Device_CheckFeatureSupport(device, D3D11_FEATURE_THREADING, threading, 0);
+    ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+    hr = ID3D11Device_CheckFeatureSupport(device, D3D11_FEATURE_THREADING, threading, sizeof(*threading) - 1);
+    ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+    hr = ID3D11Device_CheckFeatureSupport(device, D3D11_FEATURE_THREADING, threading, sizeof(*threading) / 2);
+    ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+    hr = ID3D11Device_CheckFeatureSupport(device, D3D11_FEATURE_THREADING, threading, sizeof(*threading) + 1);
+    ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+    hr = ID3D11Device_CheckFeatureSupport(device, D3D11_FEATURE_THREADING, threading, sizeof(*threading) * 2);
+    ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+
+    ok(threading[0].DriverConcurrentCreates == 0xefefefef,
+            "Got unexpected concurrent creates %#x.\n", threading[0].DriverConcurrentCreates);
+    ok(threading[0].DriverCommandLists == 0xefefefef,
+            "Got unexpected command lists %#x.\n", threading[0].DriverCommandLists);
+    ok(threading[1].DriverConcurrentCreates == 0xefefefef,
+            "Got unexpected concurrent creates %#x.\n", threading[1].DriverConcurrentCreates);
+    ok(threading[1].DriverCommandLists == 0xefefefef,
+            "Got unexpected command lists %#x.\n", threading[1].DriverCommandLists);
+
+    hr = ID3D11Device_CheckFeatureSupport(device, D3D11_FEATURE_THREADING, threading, sizeof(*threading));
+    ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
+    ok(threading->DriverConcurrentCreates == TRUE || threading->DriverConcurrentCreates == FALSE,
+            "Got unexpected concurrent creates %#x.\n", threading->DriverConcurrentCreates);
+    ok(threading->DriverCommandLists == TRUE || threading->DriverCommandLists == FALSE,
+            "Got unexpected command lists %#x.\n", threading->DriverCommandLists);
+
+    refcount = ID3D11Device_Release(device);
+    ok(!refcount, "Device has %u references left.\n", refcount);
+}
+
 START_TEST(d3d11)
 {
     test_create_device();
@@ -8513,4 +8561,5 @@ START_TEST(d3d11)
     test_sm4_breakc_instruction();
     test_input_assembler();
     test_null_sampler();
+    test_check_feature_support();
 }
diff --git a/include/d3d11.idl b/include/d3d11.idl
index 9d4d8fd..cd177c2 100644
--- a/include/d3d11.idl
+++ b/include/d3d11.idl
@@ -439,6 +439,12 @@ typedef enum D3D11_FEATURE
     D3D11_FEATURE_D3D9_SHADOW_SUPPORT
 } D3D11_FEATURE;
 
+typedef struct D3D11_FEATURE_DATA_THREADING
+{
+    BOOL DriverConcurrentCreates;
+    BOOL DriverCommandLists;
+} D3D11_FEATURE_DATA_THREADING;
+
 typedef struct D3D11_FEATURE_DATA_D3D11_OPTIONS
 {
     BOOL OutputMergerLogicOp;




More information about the wine-cvs mailing list