![Page 1: Innovations in high p erformance 2D graphics with DirectX](https://reader035.vdocument.in/reader035/viewer/2022062521/568166be550346895ddac59b/html5/thumbnails/1.jpg)
![Page 2: Innovations in high p erformance 2D graphics with DirectX](https://reader035.vdocument.in/reader035/viewer/2022062521/568166be550346895ddac59b/html5/thumbnails/2.jpg)
Innovations in high performance 2D graphics with DirectXDan McLachlanPrincipal Program Manager Lead Microsoft Corporation3-191
![Page 3: Innovations in high p erformance 2D graphics with DirectX](https://reader035.vdocument.in/reader035/viewer/2022062521/568166be550346895ddac59b/html5/thumbnails/3.jpg)
DirectX performance improvementsNew capabilities in Windows 8.1TextGeometryImaging
Agenda
![Page 4: Innovations in high p erformance 2D graphics with DirectX](https://reader035.vdocument.in/reader035/viewer/2022062521/568166be550346895ddac59b/html5/thumbnails/4.jpg)
DirectX technologies are core to Windows.
![Page 5: Innovations in high p erformance 2D graphics with DirectX](https://reader035.vdocument.in/reader035/viewer/2022062521/568166be550346895ddac59b/html5/thumbnails/5.jpg)
Performance demos
![Page 6: Innovations in high p erformance 2D graphics with DirectX](https://reader035.vdocument.in/reader035/viewer/2022062521/568166be550346895ddac59b/html5/thumbnails/6.jpg)
DirectX performance improvementsNew capabilities in Windows 8.1TextGeometryImaging
Agenda
![Page 7: Innovations in high p erformance 2D graphics with DirectX](https://reader035.vdocument.in/reader035/viewer/2022062521/568166be550346895ddac59b/html5/thumbnails/7.jpg)
![Page 8: Innovations in high p erformance 2D graphics with DirectX](https://reader035.vdocument.in/reader035/viewer/2022062521/568166be550346895ddac59b/html5/thumbnails/8.jpg)
Existing industry approachesApp does text analysis and replaces code points with bitmapsFont foundries provide multiple fonts that are aligned, and app draws same text in multiple fonts to get layeringFonts with embedded bitmaps
![Page 9: Innovations in high p erformance 2D graphics with DirectX](https://reader035.vdocument.in/reader035/viewer/2022062521/568166be550346895ddac59b/html5/thumbnails/9.jpg)
Multi-color fonts in Windows 8.1Supported through new multi-layer glyphsExtended the Windows OpenType implementationStill text, so everything else just works.New system font: Segoe UI EmojiSupports the most commonly used emoji code points
![Page 10: Innovations in high p erformance 2D graphics with DirectX](https://reader035.vdocument.in/reader035/viewer/2022062521/568166be550346895ddac59b/html5/thumbnails/10.jpg)
Color font demoDirectWrite / Direct2D
![Page 11: Innovations in high p erformance 2D graphics with DirectX](https://reader035.vdocument.in/reader035/viewer/2022062521/568166be550346895ddac59b/html5/thumbnails/11.jpg)
Enabling color – DrawTextLayout d2dContext->DrawTextLayout( D2D1::Point2F(x, y), m_layout.Get(), D2D1_DRAW_TEXT_OPTIONS_CLIP );
| D2D1_DRAW_TEXT_OPTIONS_ENABLE_COLOR_FONT
![Page 12: Innovations in high p erformance 2D graphics with DirectX](https://reader035.vdocument.in/reader035/viewer/2022062521/568166be550346895ddac59b/html5/thumbnails/12.jpg)
Enabling color - DrawGlyphRun
d2dContext->DrawGlyphRun(…, glyphRun, … color, …);
![Page 13: Innovations in high p erformance 2D graphics with DirectX](https://reader035.vdocument.in/reader035/viewer/2022062521/568166be550346895ddac59b/html5/thumbnails/13.jpg)
Enabling color - DrawGlyphRuncolorlayers = dWrite->TranslateColorGlyphRun(…, glyphRun, …); Foreach layer in colorLayers {
d2dContext->DrawGlyphRun(…, layer.GlyphRun, … layer.color, …); }
![Page 14: Innovations in high p erformance 2D graphics with DirectX](https://reader035.vdocument.in/reader035/viewer/2022062521/568166be550346895ddac59b/html5/thumbnails/14.jpg)
DirectX performance improvementsNew capabilities in Windows 8.1TextGeometryImaging
Agenda
![Page 15: Innovations in high p erformance 2D graphics with DirectX](https://reader035.vdocument.in/reader035/viewer/2022062521/568166be550346895ddac59b/html5/thumbnails/15.jpg)
2D geometry rendering performanceComplex geometry rendering CPU boundExisting optimization techniques have limitationsCreating bitmaps• Not fully robust to rotations and scales• Bitmaps consume significant resources
Geometry meshes• Only aliased rendering is available
![Page 16: Innovations in high p erformance 2D graphics with DirectX](https://reader035.vdocument.in/reader035/viewer/2022062521/568166be550346895ddac59b/html5/thumbnails/16.jpg)
Geometry Rendering SolutionsDirectX 11.1 hardware utilizationGeometry needs to be specified with D2D1_FILL_MODE_ALTERNATE
Geometry Realizations
![Page 17: Innovations in high p erformance 2D graphics with DirectX](https://reader035.vdocument.in/reader035/viewer/2022062521/568166be550346895ddac59b/html5/thumbnails/17.jpg)
Geometry realizationsNew Direct2D Geometry class Enables amortizing generation costs over multiple framesCreates device-dependent representationDrawing uses minimal CPU resourcesTuned for optimal GPU resource usage
![Page 18: Innovations in high p erformance 2D graphics with DirectX](https://reader035.vdocument.in/reader035/viewer/2022062521/568166be550346895ddac59b/html5/thumbnails/18.jpg)
Curve
Evaluatio
n
Tessellation
Antialiasing
Brushing
Draw or fill geometryOnce per frame
CPU Work
Geometry
Rendered on GPU
GPU Work
![Page 19: Innovations in high p erformance 2D graphics with DirectX](https://reader035.vdocument.in/reader035/viewer/2022062521/568166be550346895ddac59b/html5/thumbnails/19.jpg)
Create geometry realizationOnce per primitive
Geometry
Geometry Realization
Object
Curve
Evaluatio
n
Tessellation
CPU Work
![Page 20: Innovations in high p erformance 2D graphics with DirectX](https://reader035.vdocument.in/reader035/viewer/2022062521/568166be550346895ddac59b/html5/thumbnails/20.jpg)
Antialiasing
Brushing
Draw geometry realizationOnce per frame
Geometry Realization
Rendered on GPU
GPU Work
![Page 21: Innovations in high p erformance 2D graphics with DirectX](https://reader035.vdocument.in/reader035/viewer/2022062521/568166be550346895ddac59b/html5/thumbnails/21.jpg)
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.
![Page 22: Innovations in high p erformance 2D graphics with DirectX](https://reader035.vdocument.in/reader035/viewer/2022062521/568166be550346895ddac59b/html5/thumbnails/22.jpg)
Geometry realizations demoDirect2D
![Page 23: Innovations in high p erformance 2D graphics with DirectX](https://reader035.vdocument.in/reader035/viewer/2022062521/568166be550346895ddac59b/html5/thumbnails/23.jpg)
DirectX performance improvementsNew capabilities in Windows 8.1TextGeometryImaging
Agenda
![Page 24: Innovations in high p erformance 2D graphics with DirectX](https://reader035.vdocument.in/reader035/viewer/2022062521/568166be550346895ddac59b/html5/thumbnails/24.jpg)
Improving image effects performanceDefer rasterization as much as possibleAvoid using a RenderTarget bitmap only onceCommandLists can be helpful when different sections of code generate intermediatesMinimize redundant rasterizationUse RenderTarget bitmaps when you need the same image as input to multiple effectsCommandLists are a tool here too
![Page 25: Innovations in high p erformance 2D graphics with DirectX](https://reader035.vdocument.in/reader035/viewer/2022062521/568166be550346895ddac59b/html5/thumbnails/25.jpg)
DirectX performance improvementsNew capabilities in Windows 8.1TextGeometryImaging• Image Compression
Agenda
![Page 26: Innovations in high p erformance 2D graphics with DirectX](https://reader035.vdocument.in/reader035/viewer/2022062521/568166be550346895ddac59b/html5/thumbnails/26.jpg)
Image considerations in appsLarge part of memory utilization and start up timeQuality versus space trade-offs
Direct2D supports two new compressed image formats
![Page 27: Innovations in high p erformance 2D graphics with DirectX](https://reader035.vdocument.in/reader035/viewer/2022062521/568166be550346895ddac59b/html5/thumbnails/27.jpg)
Jpeg image loading
Direct2Dbitmap
32bppPBGRApixel data
Inverse discrete cosine
transform and dequantization
Huffman decompression
Chroma upsampling
Color space conversion
(YCBCR -> RGB)
WIC Format convert
CompressedJPEG data
JPEGFile
![Page 28: Innovations in high p erformance 2D graphics with DirectX](https://reader035.vdocument.in/reader035/viewer/2022062521/568166be550346895ddac59b/html5/thumbnails/28.jpg)
Jpeg image loading using YCBCR data
8bppY (luma)pixel data
Direct2D YCBCR effect
16bppCBCR(chroma)pixel data
Direct2D bitmap
Direct2D bitmap
Inverse discrete cosine
transform and dequantization
Huffman decompression
Chroma upsampling
Color space conversion
(YCBCR -> RGB)
WIC Format convert
CompressedJPEG data
JPEGFile
Direct2Dbitmap
32bppPBGRApixel data
![Page 29: Innovations in high p erformance 2D graphics with DirectX](https://reader035.vdocument.in/reader035/viewer/2022062521/568166be550346895ddac59b/html5/thumbnails/29.jpg)
Comparison of image data for some common Windows 8 apps.
Analysis of memory usage
App JPEGs - RGBA JPEGs - YCBCR % Savings
Music 41.4 MB 15.5 MB 63%
Photos 36.3 MB 13.6 MB 63%
Weather 23.8 MB 17.8 MB 25%
News 66.2 MB 24.8 MB 63%
![Page 30: Innovations in high p erformance 2D graphics with DirectX](https://reader035.vdocument.in/reader035/viewer/2022062521/568166be550346895ddac59b/html5/thumbnails/30.jpg)
Block compression formatsNative graphics hardware support• BC1 – BC3 DirectX 9+ hardware• BC4 – BC5 DirectX 10+ hardware• BC6 – BC7 DirectX 11+ hardware
4-8 bits per pixelCan be up to 87.5 % smaller in memory than RGBALossy image compressionMUST be a multiple of 4 in all dimensions
![Page 31: Innovations in high p erformance 2D graphics with DirectX](https://reader035.vdocument.in/reader035/viewer/2022062521/568166be550346895ddac59b/html5/thumbnails/31.jpg)
Block compression
4x4 block
R
B
G
00
01
02
03
01 02 00 00
01 00 03 03
01 00 02 02
01 01 01 02
Color1 Color2 16 – 2bit encoded colorsEncoding
![Page 32: Innovations in high p erformance 2D graphics with DirectX](https://reader035.vdocument.in/reader035/viewer/2022062521/568166be550346895ddac59b/html5/thumbnails/32.jpg)
Choosing your Block compression format
Block compression
Source DataData Compression Resolution(in bits)
Format Bits / Pixel
Three-component color and alpha
Color (5:6:5), Alpha (1) or no alpha BC1 4
Three-component color and alpha Color (5:6:5), Alpha (4) BC2 8
Three-component color and alpha Color (5:6:5), Alpha (3*) BC3 8
![Page 33: Innovations in high p erformance 2D graphics with DirectX](https://reader035.vdocument.in/reader035/viewer/2022062521/568166be550346895ddac59b/html5/thumbnails/33.jpg)
Cut The Rope image comparisonStartbg.jpg (Background image)
Original BGRA format (7.91MB decoded)
![Page 34: Innovations in high p erformance 2D graphics with DirectX](https://reader035.vdocument.in/reader035/viewer/2022062521/568166be550346895ddac59b/html5/thumbnails/34.jpg)
Cut The Rope image comparisonStartbg.jpg (Background image)
BC1 compression (0.99MB decoded)
![Page 35: Innovations in high p erformance 2D graphics with DirectX](https://reader035.vdocument.in/reader035/viewer/2022062521/568166be550346895ddac59b/html5/thumbnails/35.jpg)
Jpeg to BC-1Jpeg version1
1Decoding does not include YCBCR optimizations
BC-1 version
![Page 36: Innovations in high p erformance 2D graphics with DirectX](https://reader035.vdocument.in/reader035/viewer/2022062521/568166be550346895ddac59b/html5/thumbnails/36.jpg)
Using block compressed imagesUse current authoring pipelineBlock compressed images are a runtime formatGenerate them as part of your app build/packaging
Visual assets(JPEG, PNG, etc)
DDS file(block compressed) Direct2D bitmapConvert
to DDSDirectly readblock data
Design time Run timeBuild time
![Page 37: Innovations in high p erformance 2D graphics with DirectX](https://reader035.vdocument.in/reader035/viewer/2022062521/568166be550346895ddac59b/html5/thumbnails/37.jpg)
How to use Block Compressed images (DDS)
![Page 38: Innovations in high p erformance 2D graphics with DirectX](https://reader035.vdocument.in/reader035/viewer/2022062521/568166be550346895ddac59b/html5/thumbnails/38.jpg)
Using image compressionJpeg YCBCR compression• User assets• No conversion necessary• 25% - 63% working set savings over RGBA data• Smaller disk footprint compared to DDSBlock compression (DDS)• App-local assets• Build time conversion• Better with natural images than synthetic ones• 75% - 87.5% working set savings over RGBA data
![Page 39: Innovations in high p erformance 2D graphics with DirectX](https://reader035.vdocument.in/reader035/viewer/2022062521/568166be550346895ddac59b/html5/thumbnails/39.jpg)
DirectX performance improvementsNew capabilities in Windows 8.1TextGeometryImaging
Summary
![Page 40: Innovations in high p erformance 2D graphics with DirectX](https://reader035.vdocument.in/reader035/viewer/2022062521/568166be550346895ddac59b/html5/thumbnails/40.jpg)
Leverage new Windows 8.1 features to make your apps fast and fluid
![Page 41: Innovations in high p erformance 2D graphics with DirectX](https://reader035.vdocument.in/reader035/viewer/2022062521/568166be550346895ddac59b/html5/thumbnails/41.jpg)
Call to action Use new color fonts for emoticons AND scalable UI elements Take advantage of Geometry Realizations to improve geometry rendering performanceUse compressed image formats and maintain compression on GPU for faster load times and better resource utilization
![Page 42: Innovations in high p erformance 2D graphics with DirectX](https://reader035.vdocument.in/reader035/viewer/2022062521/568166be550346895ddac59b/html5/thumbnails/42.jpg)
ResourcesColor Fonts SampleGeometry Realization SampleD2D1_FILL_MODE enumerationBlock Compressed Images SampleJPEG YCBCR Optimizations SampleBlock Compression (MSDN).
![Page 43: Innovations in high p erformance 2D graphics with DirectX](https://reader035.vdocument.in/reader035/viewer/2022062521/568166be550346895ddac59b/html5/thumbnails/43.jpg)
Other related talks Title Session IDBuilding Games for Windows 2-047What’s new in Direct3D 11.2 3-062Massive virtual textures for games: Direct3D and Tiled Resources 4-063DirectX Graphics Debugging Tools 3-141Bringing Desktop PC Games to the Windows Store 3-190Tales from the Trenches: Developing “The Harvest” and “Gunpowder” with Unity 3-044Accelerating Windows Store Game Development with Middleware 3-187Bringing Halo: Spartan Assault to Windows tablets and mobile devices 2-049From Android or iOS: Bringing Your OpenGL ES Game to the Windows Store 3-189Cutting Edge Games on Windows Tablets 3-043Play Together! Leaderboards with Windows Azure and Multiplayer with WiFi Direct 3-051
![Page 44: Innovations in high p erformance 2D graphics with DirectX](https://reader035.vdocument.in/reader035/viewer/2022062521/568166be550346895ddac59b/html5/thumbnails/44.jpg)
Evaluate this session
Scan this QR code to evaluate this session and be automatically entered in a drawing to win a prize!
![Page 45: Innovations in high p erformance 2D graphics with DirectX](https://reader035.vdocument.in/reader035/viewer/2022062521/568166be550346895ddac59b/html5/thumbnails/45.jpg)
© 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.