12

High Performance Rendering Using C# and XAML in Windows 8 1

Embed Size (px)

Citation preview

Page 1: High Performance Rendering Using C# and XAML in Windows 8 1
Page 2: High Performance Rendering Using C# and XAML in Windows 8 1

High Performance Rendering using

C# and XAML in Windows 8.1

Patrick Steger

Page 3: High Performance Rendering Using C# and XAML in Windows 8 1

Who am I?

Patrick Steger www.patchsteger.com

Twitter: @StegerPatrick

LinkedIn: www.linkedin.com/in/patricksteger

Software Engineer @ Lenovo

Contextual Computing Group

BS in Game Design and Development

Full Sail University ’06

Page 4: High Performance Rendering Using C# and XAML in Windows 8 1

High Performance Rendering

Why bother?

Different methods

Pros and Cons

Demos

Page 5: High Performance Rendering Using C# and XAML in Windows 8 1

High Performance Rendering

You have a GPU, use it!

Save the CPU for computing, not rendering!

Can save battery life

Why bother?

Page 6: High Performance Rendering Using C# and XAML in Windows 8 1

High Performance Rendering

XAML Canvas element

Pros EASY!

Lots of samples online.

Works for most things.

Did I mention EASY?

Cons Quickly changing elements render

slow.

CPU rendering can use up CPU

resources.

Children.Add is SLOW

Page 7: High Performance Rendering Using C# and XAML in Windows 8 1

High Performance Rendering

Win2D

Pros Uses GPU

Open source (on Github)

Looks to be a great long term

2D GPU solution for Windows

8+.

Don’t need to know DirectX!

Integrated well with XAML

Supported by Microsoft

Cons Relatively new

Very few samples.

HUGE pain to setup (for now).

Supported by Microsoft

Page 8: High Performance Rendering Using C# and XAML in Windows 8 1

High Performance Rendering

SharpDX

Pros Uses GPU

Open source

API is 1:1 generated off C++

DirectX SDK.

Performance loss isn’t bad

(~35%)

Great C# only DirectX library

Cons Need to know DirectX

Few samples

Possibly overkill?

Page 9: High Performance Rendering Using C# and XAML in Windows 8 1

High Performance Rendering

C#/XAML with C++ DirectX renderer

Pros Uses GPU

Fastest renderer (without using

only C++)

A very good sample to get you

started

Cons Modern (“Metro”) Interop stinks

Have to know DirectX

Possibly overkill?

Page 10: High Performance Rendering Using C# and XAML in Windows 8 1

High Performance Rendering

Demo Time!

Page 11: High Performance Rendering Using C# and XAML in Windows 8 1

Resources

http://msdn.microsoft.com/en-us/library/ms747393(v=vs.110).aspx

http://stackoverflow.com/questions/4846502/wpf-canvas-performance-children-

add-called-many-times

http://sharpdx.org/

http://channel9.msdn.com/coding4fun/blog/Sharpening-your-Metro-CXAML-

projects-with-DirectX-and-SharpDX

https://github.com/Microsoft/Win2D

http://blogs.msdn.com/b/uk_faculty_connection/archive/2014/09/05/win2d.aspx

http://blogs.windows.com/buildingapps/2014/09/05/introducing-win2d-gpu-

accelerated-2d-graphics-programming-in-the-windows-runtime/

https://code.msdn.microsoft.com/windowsapps/XAML-SwapChainPanel-00cb688b

Page 12: High Performance Rendering Using C# and XAML in Windows 8 1

Thank you for Attending!

Contact Info

Patrick Steger www.patchsteger.com

Twitter: @StegerPatrick

LinkedIn: www.linkedin.com/in/patricksteger