Software Rendering Usage in WPF
As you know by default WPF uses Hardware acceleration (GPU) to render its content (aka Hardware rendering).
In most cases rendering using Hardware (HW) acceleration is much more performant than rendering using Software. In some small cases SW rendering may be faster (E.g. low end graphics card sometimes found in Netbooks).
WPF will always attempt to use HW rendering, but in certain cases WPF will fall to Software rendering and the application may not be aware of it.
Some folks wanted to better understand all the possible cases, so am I am listed these below.
WPF will render in Software when:
Machine video driver date is old (before 11/2004)
WPF detected a "Tier 0" graphic card.
This means that no graphics hardware acceleration is supported and DirectX version level is less than version 7.0.
The rendered Window's size exceeds the max video card texture size.
One common scenario for this to happen if you have a WPF window spanning across multiple monitors.
You run your application over Remote Desktop Protocol (e.g. Remote Desktop, Terminal Server, Remote Assistant, etc)
Until NET 3.5 SP1 and earlier, remoting between Vista to Vista with DWM on, leveraged a custom WPF primitive remoting protocol. In all other scenarios content was remoted as bitmaps. Starting with the release of NET 3.5 SP1 (including NET 4), WPF renders the application content using a software rasterizer on the server and then remotes the content as bitmaps in all cases. Read more here.
Rendering in Virtual Machine.
WPF will try and render in HW but on some VMs the graphic emulator that comes with the VM is not working correctly. User will have to switch to software to fix the problem.
The Application is calling the force Software API. E.g.
RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly; // Force Software rendering per Process – New in NET4
hwndTarget.RenderMode = RenderMode.SoftwareOnly; // Force Software rendering per Window– Introduced in Net 3.5 SP1
You set the global registry key. E.g.:
Note: Since this reg key impacts all WPF application consider using this key for testing purposes only.
Application uses legacy style bitmap effects.
Note: these are obsolete in NET4.
Application printed content.
Rasterized content that uses RenderTargetBitmap
Tiled content that uses TileBrush
Layered windows (only on XP SP2/W2k3 or before that do not have Hotfix installed.
Graphics hardware failures, such as "Out Of Video Memory" (OOVM).
WPF try to free up video memory and stay in HW rendering but it may not always work and WPF will fall to Software
Which tools can I use to detect if my app renders in Software? The easiest way is to use Perforator which is included with the WPF Performance Profiling Tools and check below check boxes.
Read more here.
Draw software rendering with purple tint
Draws all areas rendered by using the software rendering pipeline with a purple tint. This includes software render targets, software 3D content, and per-primitive software fallback.
Draw software rendered bitmap effects with red tint
Draws legacy software rendered bitmap effects with red tint.
How can I detect if my app renders in Software in code? Check the RenderingCapability.Tier . You can also listen on the Tier change event.