How to use Custom Present?

Does anyone have example code or documentation on how to properly use a Custom Present callback? (FRHICustomPresent | Unreal Engine Documentation)

What I want to do is get a hook to every frame render so I can exactly check if frame rate was made or if a frame was instead duplicated. My understanding (which could be completely wrong) is that you can set up a custom present object via RHI which would have its Present function called every frame. However, it doesn’t seem to be doing that. I do get the OnBackBufferResize call when playing on VR, but no Present and no OnAcquireThreadOwnership is ever called.

I suspect this is because I don’t properly understand how this is supposed to work, but the online documentation is a bit lacking, and my google searches have come up bust. Can anyone help?

I have more information on my situation. I can break at the following call:

D3D11Viewport.cpp in
bool FD3D11Viewport::PresentChecked(int32 SyncInterval)


	if (IsValidRef(CustomPresent))
	{
		bNeedNativePresent = CustomPresent->Present(SyncInterval);
	}

CustomPresent seems valid, but when I try to step into CustomPresent->Present it just skips right over it, and doesn’t hit the breakpoint in my custom Present call. I would expect it to call my CustomPresent class at this point. Does anyone have any advice for me as to why that would occur or how to continue debugging? Is this somehow related to game thread versus render thread? I’m sure I’m doing something stupid, but I just don’t know what. Any help would be most appreciated!

I think I’ve figured out my issue. It looks like through a call to GEngine->StereoRenderingDevice->UpdateViewport, a different CustomPresent is overwriting mine every frame, either in dll SteamVR or Unreal Oculus, which is why I can’t step into it.

So my new question is this: Does anyone know of a way to exactly test if a vsynced frame missed timing and is duplicated? Currently I estimate using a Tick on the player controller, but that is only an approximation of frame timing. I need to exactly know that frame rate is perfect or not.

Did you find any solution to your problem? I’m interesting too…