Поделиться через


EnableGPUAcceleration (Silverlight Plug-in Object)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets or sets a value that indicates whether to use graphics processor unit (GPU) hardware acceleration for cached compositions, which potentially results in graphics optimization. You must set this parameter at startup of the application. You cannot change it after Silverlight content is loaded.

Syntax

object Element

<object ...>
  <param name="enableGPUAcceleration" value="true"/>
  ...
</object>
NoteNote:

By default, GPU acceleration is disabled. You set enableGPUAcceleration to true only if you want to enable GPU acceleration.

Silverlight.js

If used for initialization, you must use the createObjectEx method's JSON notation. You set the EnableGPUAcceleration property in the Settings object.

JavaScript

value = silverlightObject.settings.enableGPUAcceleration;

COM

Not available.

Managed Code

Remarks

To use GPU hardware acceleration in Silverlight effectively, you should understand how Silverlight uses hardware acceleration and cached composition in its architecture, and which Silverlight objects and rendering scenarios can benefit under hardware acceleration. For more information, see Silverlight Hardware Acceleration.

Hardware acceleration is only enabled on Windows Vista, Windows 7, and Windows XP. On Windows XP NVidia, ATI, Intel cards with a driver date post November 2004 is required for hardware acceleration.

The GPU acceleration feature does not work in windowless mode.

However, GPU acceleration does work in full-screen mode. Several full-screen video playback scenarios can particularly benefit if you enable the GPU acceleration feature.

At the per-object level, you set cached composition mode with the CacheMode property and BitmapCache values. But the overall GPU acceleration feature must be enabled at the Silverlight plug-in level, and by default the feature is disabled. Set the value of the EnableGPUAcceleration parameter to true to enable GPU acceleration.

During profiling and performance tuning phases of application development, you can set EnableCacheVisualization (Silverlight Plug-in Object) to true to produce an overlay visualization of the areas in your UI that are being hardware accelerated.

Out-of-browser applications do not have editable hosting HTML. To enable GPU acceleration for an out-of-browser application, set the attribute EnableGPUAcceleration to true on the OutOfBrowserSettings element that you declare in your Deployment XAML file.

If EnableGPUAcceleration is true AND EnableFramerateCounter is true, an additional frame counter displays in the upper-left corner as an overlay within the Silverlight content area. The format of this frame rate counter is as follows:

frameRate videoMemoryUsed GPUEnabledSurfaces intermediateSurfaces

videoMemoryUsed is in KB. intermediateSurfaces refers to surfaces implicitly created to represent the software-rendered parts of the application on the GPU.

Important noteImportant Note:

Silverlight for Windows Phone has a different set of operations that can use GPU acceleration, and a different default behavior; for more information, see Graphics in Silverlight for Windows Phone.