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 call to determine this, but can't lay my hands on it right now.
Also, is there an easy, code based way to force one rendering pipeline over the other?
A rendering tier value of 1 or 2 means that most of the graphics features of WPF will use hardware acceleration if the necessary system resources are available and have not been exhausted. This corresponds to a DirectX version that is greater than or equal to 9.0.
WPF uses vector graphics as its rendering data format. Vector graphics—which include Scalable Vector Graphics (SVG), Windows metafiles (. wmf), and TrueType fonts—store rendering data and transmit it as a list of instructions that describe how to recreate an image using graphics primitives.
Check RenderCapability.Tier
[UPDATE]
RenderCapability.Tier >> 16
.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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With