.NET/C# – determining the hardware acceleration support for your WPF apps
Posted by jpluimers on 2010/05/13
When you want to deploy WPF, it is important to check if you have sufficient hardware acceleration for your apps.
The most important things to check is the RenderCapability.
It gives you the Tier on which graphics is rendered.
The Tier tells something about hardware acceleration support, including a broad estimate of the pixel shader and vertex shader levels and DirectX versions.
Currently, there are 3 tiers:
- Tier zero:
- no acceleration at all;
- often an old DirectX version (< 7) or running over RDP.
- Tier one:
- basic hardware acceleration;
- DirectX versions 7 through 9,
- more than 30 megs of video RAM,
- at least PixelShader 1.0 and VertexShader 1.0 support
- Tier two: DirectX 10 and up,
- advanced hardware acceleration;
- more than 120 megs of video RAM,
- at least PixelShader 2.0 and VertexShader 2.0 support,
- and at least 4 MultiTexture units
Without proper acceleration, your apps will be slower than you want.
You can partially get around this by optimization, and by lowering your standards (which users often won’t even notice!).
Another thing you can do is partially downgrade the graphical capabilities of your application depending on the rendering tier.
The dynamic aspecf of WPF apps can make it tough to optimize them, which can make a huge difference if your hardware is not up to par.
MSDN has an excellent presentation on WPF Performance & Best Practices linked from a great chapter about Optimizing WPF Application Performance.
There are many more interesting web pages linking to the PPT.
Recommended reading when you want to improve WPF performance in your applications.
Here is the code:
using System;
using System.Windows.Media;
namespace RenderCapabilityConsoleApplication
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("RenderCapability:");
Console.WriteLine("Tier: {0}", RenderCapability.Tier >> 16);
short[] pixelShaderVersionsTimesTen =
{
10, // 1.0
11, // 1.1
12, // 1.2
13, // 1.3
14, // 1.4
20, // 2.0
30, // 3.0
40, // 4.0
41, // 4.1
50 // 5.0
};
foreach (short pixelShaderVersionTimesTen in pixelShaderVersionsTimesTen)
{
short ten = 10;
short pixelShaderMajorVersion = (short)(pixelShaderVersionTimesTen / ten);
short pixelShaderMinorVersion = (short)(pixelShaderVersionTimesTen % ten);
Console.WriteLine("IsPixelShaderVersionSupported({0}, {1}): {2}", pixelShaderMajorVersion, pixelShaderMinorVersion, RenderCapability.IsPixelShaderVersionSupported(pixelShaderMajorVersion, pixelShaderMinorVersion));
#if (SupportWPF4)
Console.WriteLine("MaxPixelShaderInstructionSlots({0}, {1}): {2}", pixelShaderMajorVersion, pixelShaderMinorVersion, RenderCapability.MaxPixelShaderInstructionSlots(pixelShaderMajorVersion, pixelShaderMinorVersion));
#endif
}
#if (SupportWPF4)
Console.WriteLine("MaxHardwareTextureSize : {0}", RenderCapability.MaxHardwareTextureSize );
#else
Console.WriteLine("IsPixelShaderVersionSupportedInSoftware: {0}", RenderCapability.IsPixelShaderVersionSupportedInSoftware);
Console.WriteLine("IsShaderEffectSoftwareRenderingSupported: {0}", RenderCapability.IsShaderEffectSoftwareRenderingSupported);
#endif
Console.Write("Press <Enter>");
Console.ReadLine();
}
}
}
–jeroen






Hardware acceleration | Radhika Vemura (Optimizing Performance of C# WPF apps-Tips & Tricks) said
[…] https://wiert.me/2010/05/13/netc-%E2%80%93-determining-the-hardware-acceleration-support-for-your-wpf… […]