Replies: 1 comment
-
The big thing to remember is that the sample you reference uses a lambda passed into the stepped timer class to do the present. This means that the lock is in the same scope as the Present call, not the WaitForVBlank call. This means that the lock should be destroyed when the call to WaitForVBlank occurs. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm attempting to port an UWP app that is written in C++/WinRT and uses DirectX (SwapChainPanel) over to the Windows App SDK. However, I'm struggling with how to port the rendering thread/loop.
The rendering loop of the UWP app is essentially a copy of one of the UWP sample apps that Microsoft originally provided. The code looks as follows:
The ported rendering loop utilizes a
DispatcherQueueController
instead of anIAsyncAction
because I just could not get theThreadPool::RunAsync
to run. The code looks as follows:The ported code compiles and it does run. However, if I add multiple DirectX components to my app and switch between them (they're on different tabs) in debug mode I get the following assertion:
I then realized that if I comment out the line
_dxgiOutput->WaitForVBlank();
the assertion does not appear. According to the documentation
WaitForVBlank
"halts a thread until the next vertical blank occurs" which means that the code renders frames in sync with the monitor refresh rate. That is precisely what I want but I just cannot getDispatcherQueueController
to collaborate withWaitForVBlank
.What would be the proper way to create a Windows App SDK compatible DirectX rendering loop that makes use of
WaitForVBlank
?Beta Was this translation helpful? Give feedback.
All reactions