tests: Add test for fence signal with NULL event.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
This commit is contained in:
Hans-Kristian Arntzen 2021-07-15 15:09:05 +02:00
parent e1bb5f3b77
commit 3f3162ab5f
3 changed files with 31 additions and 2 deletions

View File

@ -5165,7 +5165,8 @@ static void test_fence_values(void)
{
++next_value;
queue_signal(queue, fence, next_value);
wait_queue_idle(device, queue);
/* Sprinke in some tests for no event path. */
wait_queue_idle_no_event(device, queue);
value = ID3D12Fence_GetCompletedValue(fence);
ok(value == next_value, "Got value %#"PRIx64", expected %#"PRIx64".\n", value, next_value);
}
@ -5199,7 +5200,7 @@ static void test_fence_values(void)
ok(hr == S_OK, "Failed to create fence, hr %#x.\n", hr);
next_value = (uint64_t)1 << 60;
queue_signal(queue, fence, next_value);
wait_queue_idle(device, queue);
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;

View File

@ -230,6 +230,15 @@ static HRESULT wait_for_fence(ID3D12Fence *fence, uint64_t value)
return ret == WAIT_OBJECT_0 ? S_OK : E_FAIL;
}
static 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);
}
static void wait_queue_idle_(unsigned int line, ID3D12Device *device, ID3D12CommandQueue *queue)
{
ID3D12Fence *fence;
@ -247,6 +256,23 @@ static void wait_queue_idle_(unsigned int line, ID3D12Device *device, ID3D12Comm
ID3D12Fence_Release(fence);
}
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 bool use_warp_device;
static unsigned int use_adapter_idx;

View File

@ -23,6 +23,8 @@
#define wait_queue_idle(a, b) wait_queue_idle_(__LINE__, a, b)
static void wait_queue_idle_(unsigned int line, ID3D12Device *device, ID3D12CommandQueue *queue);
#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);
static ID3D12Device *create_device(void);
static inline void set_rect(RECT *rect, int left, int top, int right, int bottom)