Is it possible to utilize the GPU on WP7?

Jan 11, 2011 at 1:06 PM

Thanks for a great library. I was wondering whether it is possible to utilize the GPU for some operations (e.g. resize). Do you have an idea how to get your code to execute on the compositor thread?

Jan 11, 2011 at 1:57 PM

WP7 doesn't allow direct access to the GPU and most rendering operations (actually all) are performed on the CPU. Only BitmapCached (rendered) controls are handed over to the GPU and can be transformed by simple transformations. 

The WritreableBitmap constructor can only be used on the UI thread, but the operations actually only need an int array (pixels), the width and the height. I plan to add this in the future ( ). I wrote a bit how this can be implemented in this article: (See "Asynchronous Processing").


- Rene Schulte

Jan 11, 2011 at 3:24 PM

Thanks for your reply. In this case, would it be faster to implement the resize method using a scaling transformation? For example, if the user doesn't specify an interpolation method, would any of the following be faster?

var result = new WriteableBitmap(new Image() {
                                         Source = bmp,
                                         CacheMode = new BitmapCache() { RenderAtScale = scale }
                                     }, null);


var result = new WriteableBitmap(new Image() { Source = bmp },
                                 new ScaleTransform() {
ScaleX = (double)width / bmp.PixelWidth,
ScaleY = (double)height / bmp.PixelHeight

Jan 11, 2011 at 3:49 PM

Both won't work, cause the Image control has to be part of the VisualTree (it has to be visible), since the ctor (Render method) renders the control.

You can perform the fastest scale when you convert an JPEG into a WriteableBitmap using the built in PictureDecoder class and pass the right parameters:


- Rene

Jan 12, 2011 at 10:59 AM

Thanks a lot for the information. And thanks for taking the time and having the patience to educate me!

Dec 12, 2011 at 11:30 AM

I tried porting some of the particle effects using this method from here:

to Windows Phone 7, my fps went right down to 12-13 in the emulator. I assume this is because of the answers above. Any work arounds? Or WP7 plans to allows this to be rendered on the GPU? Or i have just mucked something up?

Sample code here if anyone is interested: