I’m currently looking for a way, to get timestamp that is as close as possible to the actual appearance of a new actor on the screen.
The idea is to take the time of SwapChain->Present() of that very frame, in which my actor will visible on the screen for the first time.
The best way would be of course, when I could send a command to the RHI, after I’ve called SpawnActor() in the game thread, to take the time of Present() of the according frame in which my actor will be visible on the screen. How could I achieve something like that and how difficult would it be (I’m not a programmer)?
However, since this is not for a game but for a neuroscientific experiment, I would also be happy with a less elegant but easier way to achieve this. One idea is to take the time of Present() on every time. When I then know the time of SpawnActor() I could figure out, when the according present() was called. But this would only work if I always know, how many frames are between my game thread and the RHI thread.
Can I be sure, that there is always one frame between SpawnActor() and the according Present(),so that I have to look for the second Present() after SpawnActor()? Or if I disable r.OneFrameThreadLag, can I be sure that the very next Present() after SpawnActor() is what I’m looking for?
Edit.: In case that it matters, I’m using directx11 on windows 10.