How do you determine if WPF is using Hardware or Software Rendering? How do you determine if WPF is using Hardware or Software Rendering? wpf wpf

How do you determine if WPF is using Hardware or Software Rendering?


Check RenderCapability.Tier

[UPDATE]

  • RenderCapability.IsPixelShaderVersionSupported - Gets a value that indicates whether the specified pixel shader version is supported.
  • RenderCapability.IsShaderEffectSoftwareRenderingSupported - Gets a value that indicates whether the system can render bitmap effects in software.
  • RenderCapability.Tier - Gets a value that indicates the rendering tier for the current thread.
  • RenderCapability.TierChanged - Occurs when the rendering tier has changed for the Dispatcher object of the current thread.

RenderCapability.Tier >> 16

  • Rendering Tier 0 - No graphics hardware acceleration. The DirectX version level is less than version 7.0.
  • Rendering Tier 1 - Partial graphics hardware acceleration. The DirectX version level is greater than or equal to version 7.0, and lesser than version 9.0.
  • Rendering Tier 2 - Most graphics features use graphics hardware acceleration. The DirectX version level is greater than or equal to version 9.0.


.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.


Based on the RenderingTier links, here is some code:

        logger.InfoFormat("WPF Tier = {0}",RenderCapability.Tier / 0x10000);        RenderCapability.TierChanged +=            (sender, args) => logger.InfoFormat("WPF Tier Changed to {0}",                                                RenderCapability.Tier / 0x10000);

I'm still testing and working on this. See future edits/answers for what I find.