[PATCH vkd3d 5/5] tests: Add tests for NULL event handles in SetEventOnCompletion().

Henri Verbeet hverbeet at gmail.com
Thu Jan 13 10:19:02 CST 2022


On Mon, 10 Jan 2022 at 15:02, Conor McCarthy <cmccarthy at codeweavers.com> wrote:
> diff --git a/tests/d3d12_crosstest.h b/tests/d3d12_crosstest.h
> index 0b77bdee..557d0430 100644
> --- a/tests/d3d12_crosstest.h
> +++ b/tests/d3d12_crosstest.h
> @@ -226,6 +226,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;
> @@ -243,6 +252,23 @@ static void wait_queue_idle_(unsigned int line, ID3D12Device *device, ID3D12Comm
>      ID3D12Fence_Release(fence);
>  }
>
> +static 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;
>
This introduces build warnings. E.g.:

    In file included from <vkd3d>/tests/d3d12_invalid_usage.c:19:
    <vkd3d>/tests/d3d12_crosstest.h:255:13: warning:
‘wait_queue_idle_no_event_’ defined but not used [-Wunused-function]



More information about the wine-devel mailing list