=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: tests: Fix unsupported formats tests on WARP.

Alexandre Julliard julliard at winehq.org
Mon Oct 1 20:40:45 CDT 2018


Module: vkd3d
Branch: master
Commit: 8995c681d56eab59900df1ebf7ff6fc6c59d59bc
URL:    https://source.winehq.org/git/vkd3d.git/?a=commit;h=8995c681d56eab59900df1ebf7ff6fc6c59d59bc

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Mon Oct  1 13:57:12 2018 +0200

tests: Fix unsupported formats tests on WARP.

A recent version of WARP supports B8G8R8A8 UAVs even on
D3D_FEATURE_LEVEL_11_0.

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>

---

 include/private/vkd3d_test.h |  6 ++++++
 tests/d3d12.c                | 39 ++++++++++++++++++++++++++-------------
 2 files changed, 32 insertions(+), 13 deletions(-)

diff --git a/include/private/vkd3d_test.h b/include/private/vkd3d_test.h
index 8e657ac..fd3ed15 100644
--- a/include/private/vkd3d_test.h
+++ b/include/private/vkd3d_test.h
@@ -90,6 +90,12 @@ vkd3d_test_platform_is_windows(void)
     return !strcmp(vkd3d_test_platform, "windows");
 }
 
+static inline bool
+broken(bool condition)
+{
+    return condition && vkd3d_test_platform_is_windows();
+}
+
 static void
 vkd3d_test_check_ok(unsigned int line, bool result, const char *fmt, va_list args)
 {
diff --git a/tests/d3d12.c b/tests/d3d12.c
index cff4397..dd842bc 100644
--- a/tests/d3d12.c
+++ b/tests/d3d12.c
@@ -869,6 +869,11 @@ static ID3D12Device *create_device(void)
     return device;
 }
 
+static bool broken_on_warp(bool condition)
+{
+    return broken(use_warp_device && condition);
+}
+
 static bool is_min_max_filtering_supported(ID3D12Device *device)
 {
     D3D12_FEATURE_DATA_D3D12_OPTIONS options;
@@ -1307,12 +1312,18 @@ static void test_format_support(void)
     unsigned int i;
     HRESULT hr;
 
-    static const D3D12_FEATURE_DATA_FORMAT_SUPPORT unsupported_format_features[] =
+    static const struct
     {
-        {DXGI_FORMAT_B8G8R8A8_TYPELESS, D3D12_FORMAT_SUPPORT1_TYPED_UNORDERED_ACCESS_VIEW,
-                D3D12_FORMAT_SUPPORT2_UAV_TYPED_LOAD | D3D12_FORMAT_SUPPORT2_UAV_TYPED_STORE},
-        {DXGI_FORMAT_B8G8R8A8_UNORM,    D3D12_FORMAT_SUPPORT1_TYPED_UNORDERED_ACCESS_VIEW,
-                D3D12_FORMAT_SUPPORT2_UAV_TYPED_LOAD | D3D12_FORMAT_SUPPORT2_UAV_TYPED_STORE},
+        D3D12_FEATURE_DATA_FORMAT_SUPPORT f;
+        bool broken;
+    }
+    unsupported_format_features[] =
+    {
+        /* A recent version of WARP suppots B8G8R8A8 UAVs even on D3D_FEATURE_LEVEL_11_0. */
+        {{DXGI_FORMAT_B8G8R8A8_TYPELESS, D3D12_FORMAT_SUPPORT1_TYPED_UNORDERED_ACCESS_VIEW,
+                D3D12_FORMAT_SUPPORT2_UAV_TYPED_LOAD | D3D12_FORMAT_SUPPORT2_UAV_TYPED_STORE}, true},
+        {{DXGI_FORMAT_B8G8R8A8_UNORM,    D3D12_FORMAT_SUPPORT1_TYPED_UNORDERED_ACCESS_VIEW,
+                D3D12_FORMAT_SUPPORT2_UAV_TYPED_LOAD | D3D12_FORMAT_SUPPORT2_UAV_TYPED_STORE}, true},
     };
 
     if (!(device = create_device()))
@@ -1333,16 +1344,18 @@ static void test_format_support(void)
     for (i = 0; i < ARRAY_SIZE(unsupported_format_features); ++i)
     {
         memset(&format_support, 0, sizeof(format_support));
-        format_support.Format = unsupported_format_features[i].Format;
+        format_support.Format = unsupported_format_features[i].f.Format;
         hr = ID3D12Device_CheckFeatureSupport(device, D3D12_FEATURE_FORMAT_SUPPORT,
                 &format_support, sizeof(format_support));
         ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
-        ok(!(format_support.Support1 & unsupported_format_features[i].Support1),
-                "Format %#x supports %#x.\n", unsupported_format_features[i].Format,
-                format_support.Support1 & unsupported_format_features[i].Support1);
-        ok(!(format_support.Support2 & unsupported_format_features[i].Support2),
-                "Format %#x supports %#x.\n", unsupported_format_features[i].Format,
-                format_support.Support2 & unsupported_format_features[i].Support2);
+        ok(!(format_support.Support1 & unsupported_format_features[i].f.Support1)
+                || broken_on_warp(unsupported_format_features[i].broken),
+                "Format %#x supports %#x.\n", unsupported_format_features[i].f.Format,
+                format_support.Support1 & unsupported_format_features[i].f.Support1);
+        ok(!(format_support.Support2 & unsupported_format_features[i].f.Support2)
+                || broken_on_warp(unsupported_format_features[i].broken),
+                "Format %#x supports %#x.\n", unsupported_format_features[i].f.Format,
+                format_support.Support2 & unsupported_format_features[i].f.Support2);
     }
 
     refcount = ID3D12Device_Release(device);
@@ -1709,7 +1722,7 @@ static void test_create_committed_resource(void)
     hr = ID3D12Device_CreateCommittedResource(device, &heap_properties, D3D12_HEAP_FLAG_NONE,
             &resource_desc, D3D12_RESOURCE_STATE_RENDER_TARGET, NULL,
             &IID_ID3D12Resource, (void **)&resource);
-    todo(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+    todo(hr == E_INVALIDARG || broken_on_warp(true), "Got unexpected hr %#x.\n", hr);
     if (SUCCEEDED(hr))
         ID3D12Resource_Release(resource);
 




More information about the wine-cvs mailing list