ManyStrings - FPS doubles in rate after window focus change

Jun 22, 2012 at 7:19 PM


First of, thanks again for this stellar work.

I just have small question, regarding the "ManyStrings" sample application.

I found that the FPS can double in rate after a window focus change (minimize / restore application window), when the "Text Layouts" setting is enabled.

On my computer, for instance, the FPS can go from an avg. of 70 to 130 after a window focus change.

Another odd thing I have noticed also, is that this improvement in rate will happen a few seconds after the "window restore" if Batch Draws is disabled, but will happen instantaneously if Batch Draws is enabled.

Note that this 2x gain is independent of the 10x gain from setting TextLayouts Disable->Enable, which happens instantaneously.

I'm no expert in DirectX, but I just wonder if somebody out there would know the cause of this behavior. I'm just curious if it's there's a state or something that triggers this behavior. If it's controllable or not. Maybe there's some Voodoo Magic, I don't know about :)

I've noticed the same behavior in my application also.

Thanks again!


Jul 3, 2012 at 11:02 PM

That sounds very strange. Could be a driver issue or have something to do with Aero or overlapping windows. Does it happen both when you start from Visual Studio and when double-clicking the .exe ?

Does it happen only with the font-wrapper or in other apps too?

Does it happen in that sample if you turn on static geometry?

Does it happen in debug and release?

Do you have multiple monitors?

Try creating a device with D3D11_CREATE_DEVICE_DEBUG flag and run with the debugger, and see if you get debug output.

Since you say that it happens when text-layouts are enabled it could be a small constant slowdown that is more noticeable when FPS is higher. I doubt DirectWrite would care about the window-focus.. but threading issues might cause strangeness.. and focus change might reset thread timings. You can try using the D3D11_CREATE_DEVICE_SINGLETHREADED and D3D11_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS flags when creating the D3D11 device to avoid additional threads in your application (don't use this in a finished app unless you know why). I have previously noticed fairly random performance differences with multi-threading, where threads block each other. I'd be surprised if this happens after the first few frames in an example with constant strings though..

Glad to hear you like the font-wrapper!