What’s New in Graphics for 4.0 Beta 2

Last beta I mentioned we were saving the best for Beta 2 so thank you for waiting 🙂

New Features

  • The PixelShader class now accepts Pixel Shader 3.0 shaders when your hardware supports them. Important: There is no software rendering for PS 3.0. For example, you won't see PS 3.0 Effects over Remote Desktop, when printing, in RenderTargetBitmap, etc...
  • You can now tell us to cache the render output of an element tree in memory using what we've been calling the "cached composition" feature. The APIs for this feature are UIElement.CacheMode and BitmapCacheBrush. Think of this as hardware RenderTargetBitmap but without the BitmapSource APIs. Cached composition is more efficient than VisualBrush and allows you to specify a scale to render at if you know you'll be zooming. We'll have to write about this more later.
  • Brand new text rendering and layout. One of the biggest complaints about WPF has been small text "clarity" so we added "Display" mode text rendering which snaps to the pixel grid and looks just like the GDI rendering the rest of Windows uses. Rendering of East Asian fonts that have embedded bitmaps has also improved. All of the details are over at the WPF Text blog. You should be able to notice a big difference over Beta 1 in Visual Studio 2010.
  • My team didn't do this, but it helps us out quite a bit. WPF layout can position elements on sub-pixel boundaries which causes blurry bitmaps or seams. There have been specific workarounds for these things but no general fix. Now you can set layout rounding on the element tree root and walk away.

Some Notable Bug Fixes

  • We've fixed most of our D3D9D.dll issues. If you're on XP SP3 you'll still hit a problem that's out of our control. To workaround that or any other issue, you can copy d3d9d.dll to the exe folder, rename it to d3d9.dll, and check the "break on error" box in the control panel as usual but do not enable d3d9d.dll globally. Or you can use the checked D3D9.dll as mentioned in the release notes I just linked to.
  • Fixed all known D3DImage device lost and timing bugs. If you find more, let us know ASAP.
  • ColorContext should finally work in all scenarios! It can still throw exceptions when the embedded ColorContext is bad. I believe we shipped Beta 2 with some backwards compat exception issues that have been fixed for final release.
  • WriteableBitmap was not respecting dirty rect size. If your dirty region is small compared to the size of the entire WriteableBitmap, you will see CPU improvement.
  • Minor 3D performance improvements. We reduced the amount of DrawPrimitive() calls for large indexed meshes and slightly improved CPU usage for large Model3D counts.
  • We reduced the amount of GC.Collect(2) calls caused by bitmap allocations
  • The render thread no longer dies when you create "32 / number of monitors" WPF AppDomains.

A Notable Bug

  • Remember how I said we disabled hardware rendering if you didn't have PS 2.0? Well, that wasn't true. We thought we did but there was a bug and it's in Beta 2 as well. It'll be true for the final release.

It's also worth mentioning that .NET Framework 4.0 setup size has shrunk dramatically. The full x86 installer is down to ~38MB and the new "client" installer down to ~31MB. Full 3.5 SP1 is 231MB!

-- Jordan

Comments (7)

  1. jdavis says:

    WebGL has pixel and vertex shaders from the equivalent of partial trust.  Are there any plans on the WPF or IE side to match this?

  2. NickDarnell says:

    "Important: There is no software rendering for PS 3.0. For example, you won’t see PS 3.0 Effects over Remote Desktop, when printing, in RenderTargetBitmap, etc…"

    So is there anyway to render a visual with a ps_3_0 shader on them to an off-screen location where the pixels could be copied after being rendered.

  3. Groky says:

    Is there a way in WPF 4.0 to export a hardware-rendered 3D scene to file? RenderTargetBitmap forces software rendering. I am at the stage where I can see my beautiful scene on-screen fine, but I cannot export the scene to disk. At least, without it taking 10 seconds.

    See http://stackoverflow.com/questions/2179042/rendertargetbitmap-and-viewport3d-quality-issues

  4. zer0mus says:


    RTB was designed to use software rendering because it happens on the UI thread. Unfortunately, the only options for software D3D9 rendering are high quality but slow (refrast) or low quality but "fast" (rgbrast). We use the latter. If we change our rendering to D3D10, we’ll be able to use WARP which should be fast and high quality.

    — Jordan

  5. zer0mus says:


    No. PS 3.0 is much more complex thas 2.0 and we didn’t have time to add software emulation for it. Customers have been demanding HW 3.0 so strongly that we couldn’t ignore them any more just because SW was hard. There may be SW 3.0 in the future.

  6. jdavis says:

    When the WARP10 stuff is added be sure not to leave out the geometry shader! 🙂

  7. UncleRedz says:


    With the changes done to D3DImage in .NET 4, are there any new restrictions on how the D3D surfaces should be allocated in order to work correctly with D3DImage/WPF?

    See my question here for details,




Skip to main content