I\'m benchmarking a WPF application on various platforms and I need an easy way to determine if WPF is using hardware or software rendering.
I seem to recall a cal
To answer the second half of your question, there is no way I believe really to force one way over the other. Hardware rendering is automatically used if available, otherwise, software is.
If you need to test it in Software mode, you'll need to use a low spec machine or use Remote Desktop to view the application running on another computer. Apart from reduced performance/framerate however, there shouldn't be any visible differences in appearance between the two. Use the RenderCapability class to know if you should disable things such as animation or effects in favour of performance.
Or use the Profiling Tools...
New checkbox was added to tint the target application elements that use SW rendered legacy Bitmap Effects.
Check RenderCapability.Tier
[UPDATE]
RenderCapability.Tier >> 16
Maybe the following can help with the second part of your question, that is, can you force one rendering pipeline over another:
You can change a registry setting to disable hardware acceleration and force software rendering to occur at all times. We often use this to see if a particular issue we are seeing ... is related to video drivers. As an example of what I am talking about see this WPF forum post.
One obvious thing to note here though ... is that this affects all WPF applications and really should only be used for testing purposes.
To disable hardware acceleration:
[HKEY_CURRENT_USER\Software\Microsoft\Avalon.Graphics]
"DisableHWAcceleration"=dword:00000001
To enable hardware acceleration:
[HKEY_CURRENT_USER\Software\Microsoft\Avalon.Graphics]
"DisableHWAcceleration"=dword:00000000
Check out this MSDN link for more info.
I agreee with the second answer but that just says something about the ability of the machine to run using hw rendering not if the app is actually hw rendered.
I made a simple app using a canvas and just rotating a rectangle with RotateTransform uses way to much CPU for a hw rendered application. That and the 'RenderCapability.Tier' value is 2 so there's enough hw capability to do it.
Why doesn't then?
.NET 4.0 provides the ability to force software rendering in code:
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
if (WeThinkWeShouldRenderInSoftware())
RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly;
}
}
See this post for more information.