Giovanni Mascellani : tests: Work around a rounding difference between NVIDIA and AMD.

Alexandre Julliard julliard at winehq.org
Thu Mar 17 17:16:40 CDT 2022


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

Author: Giovanni Mascellani <gmascellani at codeweavers.com>
Date:   Thu Mar 17 14:35:50 2022 +0100

tests: Work around a rounding difference between NVIDIA and AMD.

NVIDIA and AMD round differently the assignment of 0.5f to a UAV
of type R16G16_UNORM. NVIDIA rounds to 0x7fff and AMD to 0x8000.
According to both Vulkan and D3D12 specifications, both values
are acceptable, but the discrepancy currently appears as a
failure on NVIDIA cards.

Work around the issue by using 0.25f instead of 0.5f, which is
rounded as 0x4000 on both implementations.

Signed-off-by: Giovanni Mascellani <gmascellani at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 tests/d3d12.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/d3d12.c b/tests/d3d12.c
index 5067dd97..d17a1c32 100644
--- a/tests/d3d12.c
+++ b/tests/d3d12.c
@@ -4930,7 +4930,7 @@ static void test_clear_unordered_access_view_buffer(void)
         {DXGI_FORMAT_R16G16_UNORM, { 0, BUFFER_SIZE / sizeof(uint32_t), 0, 0, D3D12_BUFFER_UAV_FLAG_NONE},
                 {0x1234, 0xabcd, 0, 0}, 0xabcd1234},
         {DXGI_FORMAT_R16G16_UNORM, { 0, BUFFER_SIZE / sizeof(uint32_t), 0, 0, D3D12_BUFFER_UAV_FLAG_NONE},
-                {0x3f000000 /* 0.5f */, 0x3f800000 /* 1.0f */, 0, 0}, 0xffff8000, true},
+                {0x3e800000 /* 0.25f */, 0x3f800000 /* 1.0f */, 0, 0}, 0xffff4000, true},
         {DXGI_FORMAT_R16G16_UNORM, { 0, BUFFER_SIZE / sizeof(uint32_t), 0, 0, D3D12_BUFFER_UAV_FLAG_NONE},
                 {0x40000000 /* 2.0f */, 0 /* 0.0f */, 0, 0}, 0x0000ffff, true},
         {DXGI_FORMAT_R16G16_UNORM, { 0, BUFFER_SIZE / sizeof(uint32_t), 0, 0, D3D12_BUFFER_UAV_FLAG_NONE},
@@ -5124,7 +5124,7 @@ static void test_clear_unordered_access_view_image(void)
         {DXGI_FORMAT_R11G11B10_FLOAT, 1, 1, 0, 0, 1, 0, {}, {1,       2, 3, 4}, 0x00c01001},
         /* Test float clears with formats. */
         {DXGI_FORMAT_R16G16_UNORM,    1, 1, 0, 0, 1, 0, {},
-                {0x3f000000 /* 0.5f */, 0x3f800000 /* 1.0f */, 0, 0}, 0xffff8000, true},
+                {0x3e800000 /* 0.25f */, 0x3f800000 /* 1.0f */, 0, 0}, 0xffff4000, true},
         {DXGI_FORMAT_R16G16_FLOAT,    1, 1, 0, 0, 1, 0, {},
                 {0x3f000000 /* 0.5f */, 0x3f800000 /* 1.0f */, 0, 0}, 0x3c003800, true},
         {DXGI_FORMAT_R8G8B8A8_UNORM,  1, 1, 0, 0, 1, 0, {},
@@ -34557,7 +34557,7 @@ static void test_bufinfo_instruction(void)
             uav_desc.Buffer.Flags = test->raw ? D3D12_BUFFER_UAV_FLAG_RAW : 0;
             uav_desc.Buffer.FirstElement = test->view_element_idx;
             uav_desc.Buffer.NumElements = test->view_element_count;
-            uav_desc.Buffer.StructureByteStride = test->buffer_structure_byte_stride;;
+            uav_desc.Buffer.StructureByteStride = test->buffer_structure_byte_stride;
             ID3D12Device_CreateUnorderedAccessView(device, buffer, NULL, &uav_desc, cpu_handle);
         }
         else




More information about the wine-cvs mailing list