views:

49

answers:

2

Hi,

I'm wondering if someone can help with this or has had a similar problem. I am trying to make a basic game in WP7 using Silverlight and I can't get the GPU acceleration to kick in.

The frame rate counters are visible which would indicate the GPU is being used, directx versions is 10 and directx driver versions is WDDM 1.1.

I've tried cutting the code right back to something simple like:

    <Canvas x:Name="LayoutRoot" CacheMode="BitmapCache">
    <Rectangle x:Name="test" Fill="Green" Width="100" Height="100" Canvas.Left="50" Canvas.Top="200" CacheMode="BitmapCache" />
</Canvas>

and the rectangle still has the blue tint to it indicating it is not being GPU accelerated.

Any ideas why this may be?

Thanks for your time

A: 

I am not an expert but maybe you need to use XNA, not Silverlight for getting GPU acceleration?

Blue Cloud
Thanks for the reply, as far as I know it works in Silverlight too as on the desktop
JimmySavile
I also forgot to mention this is using the latest emulator, not a device..
JimmySavile
Why answer if you admittedly don't know the answer?
Jay
+1  A: 

Are you sure you got the idea right?

Another great way to see what is getting cached visually is to use the EnableCacheVisualization flag mentioned earlier. Again, this is not available in the Public Preview release, but will be available in a future version.
Turning this on will add a blue tint and some transparency on every texture we hand off to the GPU. The result of this visualization is a heat map where the darkest shades of blue correspond to multiple textures being overlaid on top of each other. This allows you to see some hidden objects that might not be an obvious contributor to fill rate on first inspection. The larger the area covered by adding up each rectangle here, the more pixels being handed off to the GPU. Note that turning on the EnableCacheVisualization flag causes the GPU to do extra work and therefore can degrade the frame rate, depending on the current fill rate and how many textures are being shaded. The frame rate counters will not indicate the true frame rate of the application when this flag is used. Also, as mentioned previously, the behavior of the EnableCacheVisualization flag is different on Silverlight for Windows Phone and Silverlight for other platforms. On Windows Phone, textures that are accelerated by the GPU are tinted. On other platforms, the tinted regions show textures that are not accelerated by the GPU.

Why did you add CacheMode="BitmapCache" to these objects? I would add this only to the object that uses animation based on callbacks updates. Other animations (storyboards animations) uses caching by default as well as ScrollViewer, Listbox etc.

lukas
I read the reverse here: http://msdn.microsoft.com/en-us/library/system.windows.interop.settings.enablecachevisualization%28VS.95%29.aspx "Gets or sets a value that indicates whether to use a non-production analysis visualization mode, which shows areas of a page that are not being GPU accelerated with a colored overlay. Do not use in production code.". Originally I was moving the image across the screen manually so wanted it cached, thought i'd just try a more simple bit of code to see what was going wrong..
JimmySavile
My mistake, you're right, it's reversed in WP7 "Colored regions show textures that are passed to the GPU for acceleration in Silverlight for Windows Phone. In the Silverlight browser plug-in, colored regions show textures that are not accelerated by the GPU.". Must just be really bad performance of the emulator :( Thanks!
JimmySavile