[PATCH vkd3d v2 2/2] tests: Add tests for NULL event handles in SetEventOnCompletion().
Conor McCarthy
cmccarthy at codeweavers.com
Mon Jan 17 23:54:12 CST 2022
Testing this before NULL event handling is patched results in a crash.
Based on a vkd3d-proton patch by Hans-Kristian Arntzen.
Signed-off-by: Conor McCarthy <cmccarthy at codeweavers.com>
---
tests/d3d12.c | 12 ++++++++++--
tests/d3d12_test_utils.h | 27 +++++++++++++++++++++++++++
2 files changed, 37 insertions(+), 2 deletions(-)
diff --git a/tests/d3d12.c b/tests/d3d12.c
index 9d4fb7d4..b0fe529c 100644
--- a/tests/d3d12.c
+++ b/tests/d3d12.c
@@ -4412,11 +4412,14 @@ static void test_fence_values(void)
value = ID3D12Fence_GetCompletedValue(fence);
ok(value == next_value, "Got value %#"PRIx64", expected %#"PRIx64".\n", value, next_value);
- for (i = 0; i < 100; ++i)
+ for (i = 0; i < 200; ++i)
{
++next_value;
queue_signal(queue, fence, next_value);
- wait_queue_idle(device, queue);
+ if ((i * 11) & 8)
+ wait_queue_idle_no_event(device, queue);
+ else
+ wait_queue_idle(device, queue);
value = ID3D12Fence_GetCompletedValue(fence);
ok(value == next_value, "Got value %#"PRIx64", expected %#"PRIx64".\n", value, next_value);
}
@@ -4453,6 +4456,11 @@ static void test_fence_values(void)
wait_queue_idle(device, queue);
value = ID3D12Fence_GetCompletedValue(fence);
ok(value == next_value, "Got value %#"PRIx64", expected %#"PRIx64".\n", value, next_value);
+ next_value <<= 1;
+ queue_signal(queue, fence, next_value);
+ wait_queue_idle_no_event(device, queue);
+ value = ID3D12Fence_GetCompletedValue(fence);
+ ok(value == next_value, "Got value %#"PRIx64", expected %#"PRIx64".\n", value, next_value);
next_value = 0;
queue_signal(queue, fence, next_value);
wait_queue_idle(device, queue);
diff --git a/tests/d3d12_test_utils.h b/tests/d3d12_test_utils.h
index 46dcd876..b8227282 100644
--- a/tests/d3d12_test_utils.h
+++ b/tests/d3d12_test_utils.h
@@ -28,6 +28,33 @@ struct vec4
static void wait_queue_idle_(unsigned int line, ID3D12Device *device, ID3D12CommandQueue *queue);
static ID3D12Device *create_device(void);
+static inline HRESULT wait_for_fence_no_event(ID3D12Fence *fence, uint64_t value)
+{
+ if (ID3D12Fence_GetCompletedValue(fence) >= value)
+ return S_OK;
+
+ /* This is defined to block on the value with infinite timeout. */
+ return ID3D12Fence_SetEventOnCompletion(fence, value, NULL);
+}
+
+#define wait_queue_idle_no_event(a, b) wait_queue_idle_no_event_(__LINE__, a, b)
+static inline void wait_queue_idle_no_event_(unsigned int line, ID3D12Device *device, ID3D12CommandQueue *queue)
+{
+ ID3D12Fence *fence;
+ HRESULT hr;
+
+ hr = ID3D12Device_CreateFence(device, 0, D3D12_FENCE_FLAG_NONE,
+ &IID_ID3D12Fence, (void **)&fence);
+ assert_that_(line)(hr == S_OK, "Failed to create fence, hr %#x.\n", hr);
+
+ hr = ID3D12CommandQueue_Signal(queue, fence, 1);
+ assert_that_(line)(hr == S_OK, "Failed to signal fence, hr %#x.\n", hr);
+ hr = wait_for_fence_no_event(fence, 1);
+ assert_that_(line)(hr == S_OK, "Failed to wait for fence, hr %#x.\n", hr);
+
+ ID3D12Fence_Release(fence);
+}
+
static void set_rect(RECT *rect, int left, int top, int right, int bottom)
{
rect->left = left;
--
2.34.1
More information about the wine-devel
mailing list