in high p erformance 2D graphics with DirectX Dan McLachlan Principal Program Manager Lead Microsoft Corporation 3191 DirectX performance improvements N ew capabilities in Windows 81 ID: 605493
Download Presentation The PPT/PDF document "Innovations" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1Slide2
Innovations in high performance 2D graphics with DirectX
Dan McLachlan
Principal Program Manager Lead
Microsoft Corporation
3-191Slide3
DirectX performance improvementsNew capabilities in Windows 8.1TextGeometryImaging
AgendaSlide4
DirectX technologies are core to Windows.Slide5
Performance demosSlide6
DirectX performance improvementsNew capabilities in Windows 8.1TextGeometryImaging
AgendaSlide7Slide8
Existing industry approachesApp 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 bitmapsSlide9
Multi-color fonts in Windows 8.1Supported through new multi-layer glyphsExtended the Windows OpenType
implementation
Still text, so everything else
just works.New system font: Segoe UI EmojiSupports the most commonly used emoji code
pointsSlide10
Color font demoDirectWrite
/ Direct2DSlide11
Enabling color – DrawTextLayout d2dContext->DrawTextLayout
(
D2D1::Point2F(x, y), m_layout.Get(),
D2D1_DRAW_TEXT_OPTIONS_CLIP
);
|
D2D1_DRAW_TEXT_OPTIONS_ENABLE_COLOR_FONTSlide12
Enabling color - DrawGlyphRun d2dContext->
DrawGlyphRun
(…,
glyphRun, … color,
…);
Slide13
Enabling color - DrawGlyphRuncolorlayers
=
dWrite
->TranslateColorGlyphRun(…, glyphRun, …);
Foreach
l
ayer in
c
olorLayers
{
d2dContext-
>
DrawGlyphRun
(…,
layer.GlyphRun
, …
l
ayer.color
, …);
}Slide14
DirectX performance improvementsNew capabilities in Windows 8.1TextGeometryImaging
AgendaSlide15
2D geometry rendering performance
Complex geometry rendering CPU bound
Existing optimization techniques have limitations
Creating bitmapsNot fully robust to rotations and scales
Bitmaps consume significant
resources
Geometry meshes
Only aliased rendering is availableSlide16
Geometry Rendering SolutionsDirectX 11.1 hardware utilizationGeometry needs to be specified with D2D1_FILL_MODE_ALTERNATE
Geometry
RealizationsSlide17
Geometry realizationsNew Direct2D Geometry class Enables amortizing generation costs over multiple framesCreates device-dependent representation
Drawing uses minimal CPU resources
Tuned for optimal GPU resource usageSlide18
Draw or f
ill geometry
Once per
frame
CPU Work
Geometry
Rendered on GPU
G
PU WorkSlide19
Create geometry realizationOnce per primitive
Geometry
Geometry Realization Object
CPU WorkSlide20
Draw g
eometry realization
Once per
frame
Geometry Realization
Rendered on GPU
G
PU WorkSlide21
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
.Slide22
Geometry realizations demoDirect2DSlide23
DirectX performance improvementsNew capabilities in Windows 8.1TextGeometry
Imaging
AgendaSlide24
Improving image effects performance
Defer rasterization as much as possible
Avoid using a
RenderTarget bitmap only onceCommandLists 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 tooSlide25
DirectX performance improvementsNew capabilities in Windows 8.1TextGeometry
Imaging
Image Compression
AgendaSlide26
Image considerations in appsLarge part of memory utilization and start up timeQuality versus space trade-offs
Direct2D supports two new compressed image formatsSlide27
Jpeg image loadingSlide28
Jpeg image loading using YCBCR d
ataSlide29
Comparison of image data for some common Windows 8 apps.Analysis of memory usage
App
JPEGs - RGBA
JPEGs
- YC
B
C
R
% 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% Slide30
Block compression formatsNative graphics hardware supportBC1 – 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 compression
MUST be a multiple of 4 in all dimensionsSlide31
Block compression
4x4 block
01
02
00
00
01
00
03
03
01
00
02
02
01
01
01
02
Color1
Color2
16 – 2bit encoded colors
EncodingSlide32
Choosing your Block compression formatBlock compression
Source
Data
Data 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
8Slide33
Cut The Rope image comparison
Startbg.jpg (Background image)
Original BGRA format (7.91MB decoded)Slide34
Cut The Rope image comparison
Startbg.jpg (Background image)
BC1 compression (0.99MB decoded)Slide35
Jpeg to BC-1
Jpeg version
1
1
Decoding does not include YC
B
C
R
optimizations
BC-1 versionSlide36
Using block compressed images
Use current authoring pipeline
Block compressed images are a runtime format
Generate them as part of your app build/packagingSlide37
How to use Block Compressed images (DDS)Slide38
Using image compressionJpeg YC
B
C
R compressionUser 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 dataSlide39
DirectX performance improvementsNew capabilities in Windows 8.1TextGeometryImaging
SummarySlide40
Leverage new Windows 8.1 features to make your apps fast and fluidSlide41
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 utilizationSlide42
ResourcesColor Fonts Sample
Geometry Realization Sample
D2D1_FILL_MODE
enumeration
Block Compressed Images Sample
JPEG YC
B
C
R
Optimizations Sample
Block
Compression (MSDN
).Slide43
Other related talks
Title
Session ID
Building Games
for Windows
2-047
What’s new in Direct3D 11.2
3
-062
Massive virtual textures for games: Direct3D and Tiled Resources
4-063
DirectX Graphics Debugging
Tools
3-141
Bringing Desktop PC Games to the Windows Store
3-190
Tales
from the Trenches: Developing “The Harvest” and “Gunpowder” with Unity
3-044
Accelerating Windows Store Game Development with Middleware
3-187
Bringing Halo: Spartan Assault to Windows tablets and mobile devices
2-049
From Android or
iOS
: Bringing Your
OpenGL ES Game to the Windows Store
3-189
Cutting Edge Games on Windows Tablets
3-043
Play Together! Leaderboards with Windows Azure
and Multiplayer with
WiFi
Direct
3-051Slide44
Evaluate this session
Scan this QR code
to evaluate this session and be automatically entered in a
drawing
to
win
a
prize!
Required Slide
*delete this box when your slide is finalized
Your MS Tag will be inserted here during the final scrub. Slide45