GPU Acceleration - Silverlight

There is a clearly defined set of transforms and optimizations developers can make to leverage the GPU on the phone through Silverlight. The Silverlight performance team is striving to add more hardware accelerated primitives, but at present, hardware acceleration is limited to:

  • JPEG Decoders (PNG decoders are not implemented yet)
  • Media Decoders (Video codecs, e.t.c.)
  • 4 Composition Transforms
    • Render Transform
    • Perspective Transform
    • Opacity Transform
    • Rectangular Clips

The real interesting story, however, is about pixel shaders. Though the Direct3D drivers and GPU support programmable pixel shaders, the only pixel shaders enabled and exposed to developers right now through Silverlight frameworks are blur and drop shadow shaders. These are fully hardware accelerated. Developers at present cannot write their own programmable shaders; there is no API for doing so. The Silverlight team is working hard to add additional hardware accelerated primitives, and eventually allow custom programmable pixel shaders for developers, but it likely won't be done in time for this release.

The UI thread framerate (which is essentially the device framerate we as end users care about) will be limited to 30 FPS, although the hardware is capable of in excess of 60 FPS. 30 FPS has been chosen by the WP7S team as the framerate cap for battery life concerns, and also threw in the age-old somewhat nebulous human eye response argument. Virtually all of the demos shown during MIX10 had the 30 FPS cap applied, and most if not all seemed visually smooth. There was some objection from a few developers to the 30 FPS cap, however the battery life concerns are very valid. That said, gamers are picky, and iPhone OS is capped at a faster 60 FPS - it might be worth it to sacrifice some battery if developers want that extra response.

An interesting consequence of how much the Silverlight UI is GPU accelerated, is that the emulator packaged as part of the CTP bundle at requires WDDM 1.1 for hardware acceleration on the desktop. Otherwise, everything is CPU-rendered in the emulator, resulting in some relatively laggy performance.

GPU Acceleration - XNA

Recall now that while the primary phone UI and most "normal" applications will run atop the Silverlight framework, games requiring twitchier response and wishing to leverage code reuse across PC, Xbox 360, and WP7S will run on the XNA framework. WP7S supports full hardware accelerated 3D with one exception - programmable shaders. Microsoft will eventually do so, it simply hasn't finished an API for doing so for launch. In its stead, however, XNA offers four configurable effects (which are themselves shaders) which it helps will mitigate lack of custom programmable shaders at least until it can provide a polished API. WP7S XNA developer Shawn Hargreaves blogs:

"Instead of programmable shaders, we augmented the existing BasicEffect with four new configurable effects: SkinnedEffect, EnvironmentMapEffect, DualTextureEffect, and AlphaTestEffect. These are designed to run efficiently on the mobile GPU hardware, and I think do a good job of providing enough flexibility for developers to create awesome looking games, while also meeting our goals of being able to ship a robust and well tested product on schedule."

The XNA title I demoed, "The Harvest," leverages these effects and came off looking extremely competitive as mentioned earlier. Remember the different aspect ratios and screen resolutions I was concerned about earlier?

Screen Resolutions - To Scale

Well, the XNA tools for WP7S incorporates support for an on-GPU hardware scaler. Developers can elect to detect whichever resolution the software is running on and render appropriately, or choose one, render at it across both, and scale appropriately. Touch input is even scaled appropriately as well. As a further boon, because 800 x 480 can still be challenging for mobile hardware, developers can render under resolution and scale up to 800 x 480 as a last resort.

The SoC & Hardware Requirements Emulator Findings


View All Comments

  • pcfxer - Sunday, March 21, 2010 - link

    Android is far easier to develop for than WM and iPhone. For my engineering project my team is developing a device for non-verbal users. Reply
  • pro5 - Monday, March 22, 2010 - link

    Is android Java only? (I don't know) but if so that would reason enough for me not to develop for it. C# and objective C are 'bad enough' but java has always left me cold (I'm a C++ coder mainly).

    If it can use native C++ then great, still doesn't make up for it's other short comings. The only real advantage I see to Android is how 'open' it is, but really that's more of killer than a helper in the dev community (if money is your goal). How does the GPU compare to Winphone for example? Where is the 'standard' development target (screen size, hardware features). Stuff like iPhone and WP7 are 'easier' to develop for because you never need to 2nd guess the user's hardware config or screen size (ok 2 sizes in the case of WP7 in future)
  • Penti - Monday, March 22, 2010 - link

    Android has the NDK so you can run native code, you don't need to run your code in dalvik. That means C and C++. Just as any other Linux based Phone OS. Such as WebOS. Of course Maemo too. Bada too of course, and of course none Linux based Symbian.

    The shit runs at the same hardware so what's your problem? Nobody is forcing you to develop for free. That you can release your apps without review is not a bad thing. Apps such as Firefox (Fennec) are ported to Maemo and being ported to Android. There's an Alpha for WinMo too. Something that can't be done on iPhone OS or Blackberry. Or WP7. If you only want to develop for a specific phone thats fine, but then you miss millions of other users. Even if you do android apps you don't need to support every single phone there is. Old phones won't be upgraded to newer versions of Android OS any way. And it's really the software platform that should have the focus any way.
  • jms102285 - Saturday, April 3, 2010 - link

    Hey Anand, I sent you an E-mail regarding what the implications of Microsoft Communications Server just before the release of the WP7 is.... I haven't heard anything back yet in over a week from anyone I mailed about it.

    Are you guys tight-lipped about it because of NDAs or something???
  • CSMR - Sunday, March 21, 2010 - link

    Not really ("> but hopefully it will be within a year.
    I'm hoping that it will get full, reliable exchange support (e-mail+calendar+tasks+scheduling meetings+search server etc.).

Log in

Don't have an account? Sign up now