Skip to content

Instantly share code, notes, and snippets.

@vlj
Last active August 29, 2015 14:21
Show Gist options
  • Save vlj/8032af4568f3cf1dce59 to your computer and use it in GitHub Desktop.
Save vlj/8032af4568f3cf1dce59 to your computer and use it in GitHub Desktop.
void D3D12GSRender::semaphorePGRAPHBackendRelease(u32 offset, u32 value)
{
ID3D12Fence *fence;
check(
m_device->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&fence))
);
HANDLE handle = CreateEvent(0, FALSE, FALSE, 0);
fence->SetEventOnCompletion(1, handle);
m_commandQueueGraphic->Signal(fence, 1);
std::thread valueChangerThread([&]() {
WaitForSingleObject(handle, INFINITE);
CloseHandle(handle);
fence->Release();
vm::write32(m_label_addr + offset, value);
});
valueChangerThread.detach();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment