---
I don't see a method to wait for a fence, at least not without having a command queue. A suggestion I found online goes along the lines of:
if (fence->GetCompletedValue != expected) { HANDLE ev = CreateEvent(...); fence->SetEventOnCompletion(expected, ev); WaitForSingleObject(ev, INFINITE); CloseHandle(ev); }
Which I could write, but would be untested dead code as long as the other method is a stub. So busy waiting and writing one fixme every time we busy wait seems like a better choice for now.
-- v2: vkd3d: Forward MakeResident to EnqueueMakeResident. vkd3d: Improve the EnqueueMakeResident stub.
From: Stefan Dösinger stefan@codeweavers.com
--- libs/vkd3d/device.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c index 79028fc3d..8efaab854 100644 --- a/libs/vkd3d/device.c +++ b/libs/vkd3d/device.c @@ -3994,10 +3994,11 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_EnqueueMakeResident(ID3D12Device5 D3D12_RESIDENCY_FLAGS flags, UINT num_objects, ID3D12Pageable *const *objects, ID3D12Fence *fence, UINT64 fence_value) { - FIXME("iface %p, flags %#x, num_objects %u, objects %p, fence %p, fence_value %#"PRIx64" stub!\n", + FIXME_ONCE("iface %p, flags %#x, num_objects %u, objects %p, fence %p, fence_value %#"PRIx64" stub!\n", iface, flags, num_objects, objects, fence, fence_value);
- return E_NOTIMPL; + ID3D12Fence_Signal(fence, fence_value); + return S_OK; }
static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommandList1(ID3D12Device5 *iface,
From: Stefan Dösinger stefan@codeweavers.com
--- libs/vkd3d/device.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c index 8efaab854..5c801ca46 100644 --- a/libs/vkd3d/device.c +++ b/libs/vkd3d/device.c @@ -3736,10 +3736,19 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_OpenSharedHandleByName(ID3D12Devic static HRESULT STDMETHODCALLTYPE d3d12_device_MakeResident(ID3D12Device5 *iface, UINT object_count, ID3D12Pageable * const *objects) { - FIXME_ONCE("iface %p, object_count %u, objects %p stub!\n", - iface, object_count, objects); + ID3D12Fence *fence; + HRESULT hr;
- return S_OK; + TRACE("iface %p, object_count %u, objects %p.\n", iface, object_count, objects); + + if (FAILED(hr = ID3D12Device5_CreateFence(iface, 0, 0, &IID_ID3D12Fence, (void **)&fence))) + return hr; + + hr = ID3D12Device5_EnqueueMakeResident(iface, 0, object_count, objects, fence, 1); + if (SUCCEEDED(hr)) + ID3D12Fence_SetEventOnCompletion(fence, 1, NULL); + ID3D12Fence_Release(fence); + return hr; }
static HRESULT STDMETHODCALLTYPE d3d12_device_Evict(ID3D12Device5 *iface,
This merge request was approved by Giovanni Mascellani.
It's not obvious from the MR or commit messages, but this fixes a regression from exposing the ID3D12Device3 interface in commit 56cd609308cd51f56532b732f111a11b784c5c99.
This merge request was approved by Henri Verbeet.