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