fix: D3D12 screenshot implementation and tests
This commit is contained in:
@@ -73,11 +73,23 @@ uint64_t D3D12CommandQueue::GetCompletedValue() {
|
||||
}
|
||||
|
||||
void D3D12CommandQueue::WaitForIdle() {
|
||||
ID3D12Fence* fence = nullptr;
|
||||
HRESULT hResult = m_commandQueue->GetDevice(IID_PPV_ARGS(&fence));
|
||||
if (SUCCEEDED(hResult)) {
|
||||
m_commandQueue->Wait(fence, UINT64_MAX);
|
||||
fence->Release();
|
||||
// Get the device from the command queue
|
||||
ID3D12Device* device = nullptr;
|
||||
HRESULT hr = m_commandQueue->GetDevice(IID_PPV_ARGS(&device));
|
||||
if (SUCCEEDED(hr)) {
|
||||
// Create a fence to signal when queue is idle
|
||||
ID3D12Fence* fence = nullptr;
|
||||
hr = device->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&fence));
|
||||
if (SUCCEEDED(hr)) {
|
||||
// Signal the fence
|
||||
m_commandQueue->Signal(fence, 1);
|
||||
// Wait for it to complete
|
||||
while (fence->GetCompletedValue() < 1) {
|
||||
Sleep(1);
|
||||
}
|
||||
fence->Release();
|
||||
}
|
||||
device->Release();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user