Another new and notable feature of Silverlight 3 is support for hardware acceleration. In Silverlight 1 and 2, all rendering was done in software, which meant that the performance of complex animations and video playback depended heavily on the capabilities of the host PC. Silverlight 3, however, can take advantage of hardware GPUs. You can see this for yourself in Beta 1 and even measure the impact that it has on performance and CPU usage.
To demonstrate, I created a Silverlight 3 project named GPUDemo and added a bunch of XAML depicting a penguin to it. I set the penguin’s opacity to 0.5 and also defined some animations that rotate and scale the penguin continuously–all actions designed to stress a software rendering pipeline.
Here’s what the XAML looked like:
<UserControl x_Class=”GPUDemo.MainPage”
xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml”>
<Grid x_Name=”LayoutRoot”>
<Grid.Background>
<LinearGradientBrush StartPoint=”0.5,0.0″ EndPoint=”0.5,1.0″>
<GradientStop Color=”#e08080″ Offset=”0″ />
<GradientStop Color=”#8080e0″ Offset=”1″ />
</LinearGradientBrush>
</Grid.Background>
<Canvas x_Name=”Penguin” Width=”340″ Height=”322″ Opacity=”0.5″>
<Canvas.Triggers>
<EventTrigger RoutedEvent=”Canvas.Loaded”>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetName=”Rotate”
Storyboard.TargetProperty=”Angle”
From=”0″ To=”360″ Duration=”0:0:0.5″
RepeatBehavior=”Forever” />
<DoubleAnimation
Storyboard.TargetName=”Scale”
Storyboard.TargetProperty=”ScaleX”
From=”1.0″ To=”1.5″ Duration=”0:0:0.5″
AutoReverse=”True” RepeatBehavior=”Forever” />
<DoubleAnimation
Storyboard.TargetName=”Scale”
Storyboard.TargetProperty=”ScaleY”
From=”1.0″ To=”1.5″ Duration=”0:0:0.5″
AutoReverse=”True” RepeatBehavior=”Forever” />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Canvas.Triggers>
<Canvas.RenderTransform>
<TransformGroup>
<RotateTransform x_Name=”Rotate”
CenterX=”167″ CenterY=”202″ />
<ScaleTransform x_Name=”Scale”
CenterX=”167″ CenterY=”202″ />
</TransformGroup>
</Canvas.RenderTransform>
<!– Penguin XAML goes here –>
</Canvas>
</Grid>
</UserControl>
When I ran the program, I used Task Manager to gauge CPU usage. The reading varied from 13% to 35%, with the average being in the mid to high 20s. When a single application is using a third of the CPU, that application is obviously stressing the host PC.
Then I repeated the test with GPU support enabled. First, I opened GPUDemoTestPage.html and added one line to the <OBJECT> element that instantiates the Silverlight control:
<param name=”EnableGPUAcceleration” value=”true” />
Second, I added the following XAML to the penguin canvas to enable the entire penguin to be cached as a bitmap and rendered by the GPU:
<Canvas.CacheMode>
<BitmapCache />
</Canvas.CacheMode>
When I ran the application again, CPU usage ranged from 2% to 8%, clearly demonstrating that much of the rendering load had been offloaded to the GPU.
You can achieve similar results when you play video in a MediaElement, especially if the video is displayed at a non-native resolution, or if the video is an H.264/MP4 video–another new feature of Silverlight 3.
Incidentally, Silverlight 3 offers a cache visualization feature that’s enabled by including the following <PARAM> element in the control’s <OBJECT> tag:
<param name=”EnableCacheVisualization” value=”true” />
When cache visualization is enabled, objects that are cached (that is, handled by the GPU) are displayed in their normal colors, while objects that aren’t cached are tinted.
SIDE NOTE: Things have changed a lot in India since I was last here in November. Cars have to queue for inspection before they pull up to a hotel, and before you’re allowed into a hotel, you go through airport-like security. Security is especially tight at hotels in Mumbai, but you see it in here in Hyderabad, too. I don’t mind a little inconvenience to know that I’m safe in my hotel room and that there likely won’t be a repeat of the attacks of 26/11.
PUT MICROSOFT AZURE TO WORK
We tackle the ongoing challenges of running in Azure.
We were one of the first Microsoft Cloud Solution Providers (CSPs), we are Cloud OS Network (COSN) certified with many production environments on the Microsoft Cloud Platform including Azure Certified for Hybrid deployments leveraging private and public clouds.
We know how to make Azure work for you.
Architected to
meet your needs.
We build solutions to address your individual business objectives with an eye to sustained technology innovation.
Deployed
flawlessly.
We manage the entire lifecycle from start to finish to ensure no surprises and allow you to focus on your business.
Operated reliably
24x7x365.
We only engineer and deploy environments which can be managed and maintained for you by our team of experts 24x7x365.
20 years of experience makes us a trusted partner you can count on.
We have developed a core methodology to ensure we accurately capture your needs and translate them into the best solution possible. This process gives you the peace of mind that your cloud investment will be aligned with the return you seek. We can be counted on to bring our industry experience and real-world best practices to operate Azure environments.
Our methodology involves 4 steps:
Assess > Migrate > Re-Platform > Operate
Moving into the cloud is not a one time event. With every customer engagement, we deliver a structured approach as follows:
Assess:
Rely on our team to map your existing environment to a corresponding Azure cloud.
Migrate:
Easily move from your existing environment to a public or private Azure cloud.
Re-platform:
Understand how to transform your applications to better take advantage of Azure capabilities.
Operate:
Our team actively manages all maintenance and optimization to keep your environment running at its best.
Azure Environments Managed by Atmosera
We help you determine how best to run your applications in the deployment best suited for their unique requirements.
Global Reach
More data centers than AWS & Google cloud combined
50
Regions with 140 countries
‘+$15B
Invested by Microsoft
6
Regions for US Government
The Power of Microsoft’s
Hybrid Platform
Microsoft is the only hyperscaler to offer a true hybrid solution with the flexibility to run applications using private or public clouds — and the ability to move between them.
Atmosera has the skills and expertise necessary to help you architect, deploy and operate integrated hybrid cloud solutions based on Microsoft’s Azure stack and microservices.
Azure Certified for
Hybrid Cloud
Atmosera has developed core competencies and intellectual property to take full advantage of all Azure has to offer.
All Atmosera Azure services receive the “Azure Certified for Hybrid Cloud” designation which confirms it passed Microsoft’s rigorous validation process under the Cloud OS Network (COSN) program. Customers benefit from knowing that their solution was carefully planned and executed using best practices and proven methods.
Not Sure How to Get Started?
Atmosera Azure pre-configured solutions can help.
We find many customers are not sure how to get started.
We developed a series of pre-configured solutions around specific use cases common for many customers.
You can take advantage of thoroughly tested and optimized solutions and accelerate the return on your cloud investment.