Conor McCarthy : tests: Add tests for ID3D12CommandQueue_GetClockCalibration().
Alexandre Julliard
julliard at winehq.org
Fri Jan 14 15:06:54 CST 2022
Module: vkd3d
Branch: master
Commit: 3d044c4453087acc43aafb4e94dac4970661f0b0
URL: https://source.winehq.org/git/vkd3d.git/?a=commit;h=3d044c4453087acc43aafb4e94dac4970661f0b0
Author: Conor McCarthy <cmccarthy at codeweavers.com>
Date: Sat Jan 15 01:17:19 2022 +1000
tests: Add tests for ID3D12CommandQueue_GetClockCalibration().
Based on a vkd3d-proton patch by Hans-Kristian Arntzen.
Signed-off-by: Conor McCarthy <cmccarthy at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
tests/d3d12.c | 30 ++++++++++++++++++++++++++++++
tests/d3d12_crosstest.h | 14 ++++++++++++++
2 files changed, 44 insertions(+)
diff --git a/tests/d3d12.c b/tests/d3d12.c
index 0d706df..9d4fb7d 100644
--- a/tests/d3d12.c
+++ b/tests/d3d12.c
@@ -36013,6 +36013,35 @@ done:
destroy_test_context(&context);
}
+static void test_clock_calibration(void)
+{
+ uint64_t cpu_times[2] = {0}, gpu_times[2] = {0};
+ struct test_context context;
+ HRESULT hr;
+
+ if (!init_test_context(&context, NULL))
+ return;
+
+ hr = ID3D12CommandQueue_GetClockCalibration(context.queue, &gpu_times[0], &cpu_times[0]);
+ todo
+ ok(hr == S_OK, "Failed to retrieve calibrated timestamps, hr %#x.\n", hr);
+
+ vkd3d_sleep(100);
+
+ hr = ID3D12CommandQueue_GetClockCalibration(context.queue, &gpu_times[1], &cpu_times[1]);
+ todo
+ ok(hr == S_OK, "Failed to retrieve calibrated timestamps, hr %#x.\n", hr);
+
+ todo
+ ok(gpu_times[1] > gpu_times[0], "Inconsistent GPU timestamps %"PRIu64" and %"PRIu64".\n",
+ gpu_times[0], gpu_times[1]);
+ todo
+ ok(cpu_times[1] > cpu_times[0], "Inconsistent CPU timestamps %"PRIu64" and %"PRIu64".\n",
+ cpu_times[0], cpu_times[1]);
+
+ destroy_test_context(&context);
+}
+
START_TEST(d3d12)
{
parse_args(argc, argv);
@@ -36190,4 +36219,5 @@ START_TEST(d3d12)
run_test(test_resource_arrays);
run_test(test_unbounded_resource_arrays);
run_test(test_unbounded_samplers);
+ run_test(test_clock_calibration);
}
diff --git a/tests/d3d12_crosstest.h b/tests/d3d12_crosstest.h
index 0b77bde..fc76180 100644
--- a/tests/d3d12_crosstest.h
+++ b/tests/d3d12_crosstest.h
@@ -60,6 +60,7 @@ typedef int HRESULT;
#else
# define VKD3D_UTILS_API_VERSION VKD3D_API_VERSION_1_2
# include <pthread.h>
+# include <unistd.h>
# include "vkd3d.h"
# include "vkd3d_utils.h"
#endif
@@ -203,6 +204,19 @@ static inline bool join_thread(HANDLE untyped_thread)
}
#endif
+#ifdef _WIN32
+static inline void vkd3d_sleep(unsigned int ms)
+{
+ Sleep(ms);
+}
+
+#else
+static inline void vkd3d_sleep(unsigned int ms)
+{
+ usleep(1000 * ms);
+}
+#endif
+
static HRESULT wait_for_fence(ID3D12Fence *fence, uint64_t value)
{
unsigned int ret;
More information about the wine-cvs
mailing list