Silverlight 3 Beta 1 bring us new and highly expected future – hardware acceleration. This short article will answer simple questions is how it could be enabled/used, where it is supported and when should be used.
Well, the first answer is relatively simple. To enable hardware acceleration one need to do following:
In plugin settings enable GPU Acceleration:
<param name=”EnableGPUAcceleration” value=”true” />
Next, set the “CacheMode” property of desired element to to “BitmapCache”:
Now desired elements will be cached and will use hardware acceleration.
Now the support issue. The hardware acceleration is supported as following:
- Windows: Browser & Fullscreen (on machines with DirectX 9.0c)
- Mac: Fullscreen only
The last question left is when this feature should be used? The most impulsive answer I heard here is “everywhere”. But in real word the picture is slightly different.
Only 3 properties could be hardware accelerated (at least in current Beta stage): Transforms, Rectangular Clipping and Blending. This means, that if your application doesn’t use those properties you will not benefit from this feature. If so, why not set the CacheMode on topmost element? The answer is simple – this will introduce more overhead to the rendering system which will try to calculate what should be cached and what not. Also, rendering mechanism uses unmanaged intermediate surfaces while rendering hardware accelerated elements and they could be pretty expensive especially if not really used. The best practice from here is to set it only on the specific “leaf-most” element which will be hardware accelerated. Another point here – use it only if there is real user-detectable impact.
Source for simple application which uses this feature is here.