1 / 45

Innovations in high p erformance 2D graphics with DirectX

Innovations in high p erformance 2D graphics with DirectX. Dan McLachlan Principal Program Manager Lead Microsoft Corporation 3-191. Agenda. DirectX performance improvements N ew capabilities in Windows 8.1 Text Geometry Imaging. DirectX technologies are c ore to Windows.

rozene
Download Presentation

Innovations in high p erformance 2D graphics with DirectX

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Innovations in high performance 2D graphics with DirectX Dan McLachlan Principal Program Manager Lead Microsoft Corporation 3-191

  2. Agenda • DirectX performance improvements • New capabilities in Windows 8.1 • Text • Geometry • Imaging

  3. DirectX technologies are core to Windows.

  4. Performance demos

  5. Agenda • DirectX performance improvements • New capabilities in Windows 8.1 • Text • Geometry • Imaging

  6. Existing industry approaches • App does text analysis and replaces code points with bitmaps • Font foundries provide multiple fonts that are aligned, and app draws same text in multiple fonts to get layering • Fonts with embedded bitmaps

  7. Multi-color fonts in Windows 8.1 • Supported through new multi-layer glyphs • Extended the Windows OpenType implementation • Still text, so everything else just works. • New system font: Segoe UI Emoji • Supports the most commonly used emoji code points

  8. Color font demoDirectWrite / Direct2D

  9. Enabling color – DrawTextLayout • d2dContext->DrawTextLayout( • D2D1::Point2F(x, y), • m_layout.Get(), • D2D1_DRAW_TEXT_OPTIONS_CLIP • ); | D2D1_DRAW_TEXT_OPTIONS_ENABLE_COLOR_FONT

  10. Enabling color - DrawGlyphRun • d2dContext->DrawGlyphRun(…, glyphRun, … color, …);

  11. Enabling color - DrawGlyphRun • colorlayers = dWrite->TranslateColorGlyphRun(…, glyphRun, …); • Foreachlayer in colorLayers { • d2dContext->DrawGlyphRun(…, layer.GlyphRun, … layer.color, …); • }

  12. Agenda • DirectX performance improvements • New capabilities in Windows 8.1 • Text • Geometry • Imaging

  13. 2D geometry rendering performance • Complex geometry rendering CPU bound • Existing optimization techniques have limitations • Creating bitmaps • Not fully robust to rotations and scales • Bitmaps consume significant resources • Geometry meshes • Only aliased rendering is available

  14. Geometry Rendering Solutions • DirectX 11.1 hardware utilization • Geometry needs to be specified with D2D1_FILL_MODE_ALTERNATE • Geometry Realizations

  15. Geometry realizations • New Direct2D Geometry class • Enables amortizing generation costs over multiple frames • Creates device-dependent representation • Drawing uses minimal CPU resources • Tuned for optimal GPU resource usage

  16. Draw or fill geometryOnce per frame Geometry CPU Work GPU Work Rendered on GPU

  17. Create geometry realizationOnce per primitive Geometry CPU Work Geometry Realization Object

  18. Draw geometry realizationOnce per frame GPU Work Geometry Realization Rendered on GPU

  19. Will geometry realization work for you? • Is your geometry static? • Are the applied transformations only translations, rotations and uniform scales? • How you generate realizations will depend on your range of scale factors.

  20. Geometry realizations demoDirect2D

  21. Agenda • DirectX performance improvements • New capabilities in Windows 8.1 • Text • Geometry • Imaging

  22. Improving image effects performance • Defer rasterization as much as possible • Avoid using a RenderTarget bitmap only once • CommandLists can be helpful when different sections of code generate intermediates • Minimize redundant rasterization • Use RenderTarget bitmaps when you need the same image as input to multiple effects • CommandLists are a tool here too

  23. Agenda • DirectX performance improvements • New capabilities in Windows 8.1 • Text • Geometry • Imaging • Image Compression

  24. Image considerations in apps • Large part of memory utilization and start up time • Quality versus space trade-offs • Direct2D supports two new compressed image formats

  25. Jpeg image loading

  26. Jpeg image loading using YCBCR data

  27. Analysis of memory usage • Comparison of image data for some common Windows 8 apps.

  28. Block compression formats • Native graphics hardware support • BC1 – BC3 DirectX 9+ hardware • BC4 – BC5 DirectX 10+ hardware • BC6 – BC7 DirectX 11+ hardware • 4-8 bits per pixel • Can be up to 87.5 % smaller in memory than RGBA • Lossy image compression • MUST be a multiple of 4 in all dimensions

  29. Block compression 00 00 01 02 01 02 01 01 03 03 01 00 02 02 01 00 4x4 block Encoding Color1 Color2 16 – 2bit encoded colors

  30. Block compression • Choosing your Block compression format

  31. Cut The Rope image comparison Startbg.jpg (Background image) Original BGRA format (7.91MB decoded)

  32. Cut The Rope image comparison Startbg.jpg (Background image) BC1 compression (0.99MB decoded)

  33. Jpeg to BC-1 Jpeg version1 BC-1 version 1Decoding does not include YCBCR optimizations

  34. Using block compressed images • Use current authoring pipeline • Block compressed images are a runtime format • Generate them as part of your app build/packaging

  35. How to use Block Compressed images (DDS)

  36. Using image compression • Jpeg YCBCR compression • User assets • No conversion necessary • 25% - 63% working set savings over RGBA data • Smaller disk footprint compared to DDS • Block compression (DDS) • App-local assets • Build time conversion • Better with natural images than synthetic ones • 75% - 87.5% working set savings over RGBA data

  37. Summary • DirectX performance improvements • New capabilities in Windows 8.1 • Text • Geometry • Imaging

  38. Leverage new Windows 8.1 features to make your apps fast and fluid

  39. Call to action • Use new color fonts for emoticons AND scalable UI elements • Take advantage of Geometry Realizations to improve geometry rendering performance • Use compressed image formats and maintain compression on GPU for faster load times and better resource utilization

  40. Resources • Color Fonts Sample • Geometry Realization Sample • D2D1_FILL_MODE enumeration • Block Compressed Images Sample • JPEG YCBCR Optimizations Sample • Block Compression (MSDN).

  41. Other related talks

  42. Required Slide *delete this box when your slide is finalized Your MS Tag will be inserted here during the final scrub. Evaluate this session • Scan this QR codeto evaluate this session and be automatically entered in a drawing to win a prize!

More Related