Sign in to follow this  

D2D performance improves when playing video. Why?

Recommended Posts

bjokel    100

I have written unmanaged C++ code that uses Direct2D/DirectWrite. Everything seems to work fine in a native (unmanaged) app - i.e. animations are very smooth, text quality quite good, low CPU usage, etc. The app uses hardware DXGI render target in a window.

I'd like to use use the same code in a managed app. The quickest way to see if my unmanaged code would work in a managed environmet was to create a C++/CLI windows forms app and a small mixed-mode wrapper. This 'almost' worked. Unfortunately I have run into a rather weird problem:

Initially the quality of animations is really bad - i.e. much worse than in the native app. Jerkiness, tearing, text on animated elements with some strange artifacts, etc. What's weird is that the animations improve (i.e. they are as good as in the native app) once the app starts playing video clips in a child window. The video clips are played using either DirectShow or Media Foundation. In both cases EVR renderer is used.

Does anyone have any idea why D2D rendering improves when video clips are played?


Share this post

Link to post
Share on other sites
Adam_42    3629
My guess would be that playing the video calls timeBeginPeriod(1) which has system wide side effects. For example it makes Sleep(1) much more likely to sleep for a time close to 1ms.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this