Title 44pt Title Case Get the most out of Mobile with ... · Title 44pt Title Case Affiliations...

27
Get the most out of Mobile with Vulkan and MGD in Unity v5.6 onwards Roberto Lopez Mendez Unite Europe 2017 Amsterdam Senior Engineer 29/06/2017

Transcript of Title 44pt Title Case Get the most out of Mobile with ... · Title 44pt Title Case Affiliations...

Page 1: Title 44pt Title Case Get the most out of Mobile with ... · Title 44pt Title Case Affiliations 24pt sentence case 20pt sentence case Get the most out of Mobile with Vulkan and MGD

Title 44pt Title Case

Affiliations 24pt sentence case

20pt sentence case

Get the most out of Mobile with Vulkan and MGD in Unity v5.6 onwards

Roberto Lopez Mendez

Unite Europe 2017 Amsterdam

Senior Engineer

29/06/2017

Page 2: Title 44pt Title Case Get the most out of Mobile with ... · Title 44pt Title Case Affiliations 24pt sentence case 20pt sentence case Get the most out of Mobile with Vulkan and MGD

© ARM2017 2

Title 40pt Title Case

Bullets 24pt sentence case

Sub-bullets 20pt sentence case

Agenda

The benefits of the Vulkan graphics API

Multi-threading

Multipass

Vulkan vs OpenGL ES with Sky Force Reloaded

Mali Graphics Debugger (MGD)

Integration in Unity

Live demo

Wrap up

Page 3: Title 44pt Title Case Get the most out of Mobile with ... · Title 44pt Title Case Affiliations 24pt sentence case 20pt sentence case Get the most out of Mobile with Vulkan and MGD

© ARM 2017 3

Text 54pt Sentence Case The benefits of the Vulkan graphics API

Page 4: Title 44pt Title Case Get the most out of Mobile with ... · Title 44pt Title Case Affiliations 24pt sentence case 20pt sentence case Get the most out of Mobile with Vulkan and MGD

© ARM2017 4

Title 40pt Title Case

Bullets 24pt sentence case

Sub-bullets 20pt sentence case

Multi-threading / multicore efficiency

Created from the ground to be thread-friendly

Multi-threading widely considered in the specs

Multi-threading responsibility moved to application level

The application has better visibility

Efficient utilization of multiprocessor architecture

Lower CPU load and energy consumption

Spread work out faster to multiple cores

Able to schedule and migrate tasks between ARM ® big.LITTLETM cores according to the load

Page 5: Title 44pt Title Case Get the most out of Mobile with ... · Title 44pt Title Case Affiliations 24pt sentence case 20pt sentence case Get the most out of Mobile with Vulkan and MGD

© ARM2017 5

Title 40pt Title Case

Bullets 24pt sentence case

Sub-bullets 20pt sentence case

Multi-pass rendering

Everything is declared ahead of time in the render pass

Each sub pass can specify different outputs and they can be chained together

Very performant in tiled GPUs such as ARM Mali GPUs

Each pixel in a sub-pass can access the result of the previous sub-pass

All data can be contained on the fast on-chip memory, saving bandwidth

Example of use-cases:

Deferred rendering

Soft-particles

Tone-mapping

Page 6: Title 44pt Title Case Get the most out of Mobile with ... · Title 44pt Title Case Affiliations 24pt sentence case 20pt sentence case Get the most out of Mobile with Vulkan and MGD

© ARM2017 6

Title 40pt Title Case

Bullets 24pt sentence case

Sub-bullets 20pt sentence case

Vulkan benefits in Lofoten demo

SCENE INFO

• ~ 100 lights with shadow

maps

• 3M primitives (reduced to

500K with very efficient

occlusion culling)

• 500 draw calls

• Sun light with cascade

shadow map

• ~ 10 reflection probes

• FFT compute in ocean

rendering

• Deferred shading using

multi-pass

• 10x less load on CPU

with multithreading

Page 7: Title 44pt Title Case Get the most out of Mobile with ... · Title 44pt Title Case Affiliations 24pt sentence case 20pt sentence case Get the most out of Mobile with Vulkan and MGD

© ARM 2017 7

Text 54pt Sentence Case Sky Force Reloaded with Vulkan and Unity

Page 8: Title 44pt Title Case Get the most out of Mobile with ... · Title 44pt Title Case Affiliations 24pt sentence case 20pt sentence case Get the most out of Mobile with Vulkan and MGD

© ARM2017 8

Title 40pt Title Case

Bullets 24pt sentence case

Sub-bullets 20pt sentence case

What is Sky Force Reloaded?

Modern shoot‘em experience

Intense action, very rich graphics

Pushing CPU and GPU to the limits

Page 9: Title 44pt Title Case Get the most out of Mobile with ... · Title 44pt Title Case Affiliations 24pt sentence case 20pt sentence case Get the most out of Mobile with Vulkan and MGD

© ARM2017 9

Title 40pt Title Case

Bullets 24pt sentence case

Sub-bullets 20pt sentence case

Trailer - Sky Force Reloaded

https://www.youtube.com/watch?v=broXSmOMgxw

Page 10: Title 44pt Title Case Get the most out of Mobile with ... · Title 44pt Title Case Affiliations 24pt sentence case 20pt sentence case Get the most out of Mobile with Vulkan and MGD

© ARM2017 10

Title 40pt Title Case

Bullets 24pt sentence case

Sub-bullets 20pt sentence case

Performance issues in Sky Force Reloaded

Performance issues on OpenGL ES

Even on high-end devices it was not possible to maintain 60 FPS all of the time

Fill rate was not the bottleneck

Up to 1000 draw calls per frame

CPU was spending a lot of time preparing data for GPU

Page 11: Title 44pt Title Case Get the most out of Mobile with ... · Title 44pt Title Case Affiliations 24pt sentence case 20pt sentence case Get the most out of Mobile with Vulkan and MGD

© ARM2017 11

Title 40pt Title Case

Bullets 24pt sentence case

Sub-bullets 20pt sentence case

Performance benchmark

Draw calls are expensive

OpenGL ES driver is not optimal

Perhaps Vulkan can help?

Vulkan is supported by Unity!

Page 12: Title 44pt Title Case Get the most out of Mobile with ... · Title 44pt Title Case Affiliations 24pt sentence case 20pt sentence case Get the most out of Mobile with Vulkan and MGD

© ARM2017 12

Title 40pt Title Case

Bullets 24pt sentence case

Sub-bullets 20pt sentence case

Sky Force Reloaded: Vulkan vs OpenGL ES

Best case 21% faster

using Vulkan.

On average 15%

faster using Vulkan.

Page 13: Title 44pt Title Case Get the most out of Mobile with ... · Title 44pt Title Case Affiliations 24pt sentence case 20pt sentence case Get the most out of Mobile with Vulkan and MGD

© ARM2017 13

Title 40pt Title Case

Bullets 24pt sentence case

Sub-bullets 20pt sentence case

Sky Force Reloaded: Increased workload

Best case 82% faster

using Vulkan.

On average 32%

faster using Vulkan.

Page 14: Title 44pt Title Case Get the most out of Mobile with ... · Title 44pt Title Case Affiliations 24pt sentence case 20pt sentence case Get the most out of Mobile with Vulkan and MGD

© ARM2017 14

Title 40pt Title Case

Bullets 24pt sentence case

Sub-bullets 20pt sentence case

Extra power enabled by Vulkan

More content

Add more particle, objects or animations

Keep the same FPS with richer graphics

Page 15: Title 44pt Title Case Get the most out of Mobile with ... · Title 44pt Title Case Affiliations 24pt sentence case 20pt sentence case Get the most out of Mobile with Vulkan and MGD

© ARM2017 15

Title 40pt Title Case

Bullets 24pt sentence case

Sub-bullets 20pt sentence case

Vulkan vs OpenGL ES - performance comparison

https://www.youtube.com/watch?v=VCSkp-QZ37M

Page 16: Title 44pt Title Case Get the most out of Mobile with ... · Title 44pt Title Case Affiliations 24pt sentence case 20pt sentence case Get the most out of Mobile with Vulkan and MGD

© ARM2017 16

Title 40pt Title Case

Bullets 24pt sentence case

Sub-bullets 20pt sentence case

Power consumption test

Power consumption is a problem

Players were not happy

Console-like quality games consume a lot of power

Can Vulkan help?

Page 17: Title 44pt Title Case Get the most out of Mobile with ... · Title 44pt Title Case Affiliations 24pt sentence case 20pt sentence case Get the most out of Mobile with Vulkan and MGD

© ARM2017 17

Title 40pt Title Case

Bullets 24pt sentence case

Sub-bullets 20pt sentence case

Vulkan vs OpenGL ES: 10-12% extra playtime!

https://www.youtube.com/watch?v=WI7nXq8oozw

Page 18: Title 44pt Title Case Get the most out of Mobile with ... · Title 44pt Title Case Affiliations 24pt sentence case 20pt sentence case Get the most out of Mobile with Vulkan and MGD

© ARM2017 18

Title 40pt Title Case

Bullets 24pt sentence case

Sub-bullets 20pt sentence case

Power consumption test

Vulkan consumed 10 to 12% less power in the game

Majority of savings come from the CPU

Extra minutes of playtime with Vulkan!

Page 19: Title 44pt Title Case Get the most out of Mobile with ... · Title 44pt Title Case Affiliations 24pt sentence case 20pt sentence case Get the most out of Mobile with Vulkan and MGD

© ARM2017 19

Title 40pt Title Case

Bullets 24pt sentence case

Sub-bullets 20pt sentence case

Summary

Great to use “out of the box”

Improves your FPS

Adds some extra minutes of playtime

You can add some more graphics and make your game look better

Page 20: Title 44pt Title Case Get the most out of Mobile with ... · Title 44pt Title Case Affiliations 24pt sentence case 20pt sentence case Get the most out of Mobile with Vulkan and MGD

© ARM 2017 20

Text 54pt Sentence Case Mali Graphics Debugger (MGD) integration in Unity

Page 21: Title 44pt Title Case Get the most out of Mobile with ... · Title 44pt Title Case Affiliations 24pt sentence case 20pt sentence case Get the most out of Mobile with Vulkan and MGD

© ARM2017 21

Title 40pt Title Case

Bullets 24pt sentence case

Sub-bullets 20pt sentence case

Mali Graphics Debugger (MGD)

Draw-call by Draw-call stepping

To identify draw call related issues, redundant draw calls and other opportunities to optimize

Texture View

Visualize an application’s texture usage, to identify opportunities to compress textures or

change formats

Shader Statistics

Understand which vertex and fragment shaders are the most expensive with cycle

count reporting

Vertex Attribute / Uniform View

See vertex data and index buffers

State View

Full visibility of graphics state and tracking of state changes

Dynamic Optimization Advice

Highlighting of common API misusage and dynamic performance improvement advice

Download MGD for free at developer.arm.com

Page 22: Title 44pt Title Case Get the most out of Mobile with ... · Title 44pt Title Case Affiliations 24pt sentence case 20pt sentence case Get the most out of Mobile with Vulkan and MGD

© ARM2017 22

Title 40pt Title Case

Bullets 24pt sentence case

Sub-bullets 20pt sentence case

Mali Graphics Debugger Vulkan

adb install -r MGD.apk

adb install -r MGD.apk

OpenGL ES

Assets/Plugins/Android/libs/armeabi-v7a/

libVkLayerMGD32.so

Page 23: Title 44pt Title Case Get the most out of Mobile with ... · Title 44pt Title Case Affiliations 24pt sentence case 20pt sentence case Get the most out of Mobile with Vulkan and MGD

© ARM 2017 23

Text 54pt Sentence Case Live demo: debugging Unity application with MGD

Page 24: Title 44pt Title Case Get the most out of Mobile with ... · Title 44pt Title Case Affiliations 24pt sentence case 20pt sentence case Get the most out of Mobile with Vulkan and MGD

© ARM2017 24

Title 40pt Title Case

Bullets 24pt sentence case

Sub-bullets 20pt sentence case

Wrap Up

APPLICATION

Single threaded/context

ARM Mali GPU

DRIVER

Context management

Memory management

Error management

GLSL compiler

CPU overhead

APPLICATION

Memory management

Thread management

Multi-threaded command

buffers

SPIR-V shader pre-

compilation

ARM Mali GPU

DRIVER

Very Light Driver

Lower overall power

consumption

VULKAN BENEFITS

• Portability across multiple platforms

• Native thread friendly

• Efficient utilization of multiprocessor

architecture

• Lower CPU load

• Reduced energy consumption

• Extra benefits for mobile platform and tiling

architectures such as ARM Mali GPUs

• Pixel access to result of previous sub-pass

• Data contained on fast on-chip memory

• Memory bandwidth saving

• Loadable validation and debug layers

Mali Graphics Debugger

Page 25: Title 44pt Title Case Get the most out of Mobile with ... · Title 44pt Title Case Affiliations 24pt sentence case 20pt sentence case Get the most out of Mobile with Vulkan and MGD

© ARM2017 25

Title 40pt Title Case

Bullets 24pt sentence case

Sub-bullets 20pt sentence case

Add Vulkan to the list of Graphics API – improve performance, battery last longer

Upgrade to Unity 5.6 – very easy to use MGD as it is integrated into Unity

Takeaways

Page 26: Title 44pt Title Case Get the most out of Mobile with ... · Title 44pt Title Case Affiliations 24pt sentence case 20pt sentence case Get the most out of Mobile with Vulkan and MGD

The trademarks featured in this presentation are registered and/or unregistered trademarks of ARM Limited (or its

subsidiaries) in the EU and/or elsewhere. All rights reserved. All other marks featured may be trademarks of their

respective owners.

Copyright © 2017 ARM Limited

Thank you

Questions

Page 27: Title 44pt Title Case Get the most out of Mobile with ... · Title 44pt Title Case Affiliations 24pt sentence case 20pt sentence case Get the most out of Mobile with Vulkan and MGD

© ARM2017 27

Title 40pt Title Case

Bullets 24pt sentence case

Sub-bullets 20pt sentence case

Find out more info about the topics of this talk at: • https://www.youtube.com/watch?v=VCSkp-QZ37M

• https://www.youtube.com/watch?v=WI7nXq8oozw

• https://community.arm.com/graphics/b/blog/posts/mgd-integration-in-unity

• https://developer.arm.com/products/software-development-tools/graphics-development-tools/mali-graphics-debugger

• https://developer.arm.com/products/software-development-tools/ds-5-development-studio/resources/ds-5-media-

articles/2017/04/mali-graphics-debugger-introduction-part-1

• https://developer.arm.com/products/software-development-tools/ds-5-development-studio/resources/ds-5-media-

articles/2017/04/mali-graphics-debugger-introduction-part-2

• http://malideveloper.arm.com/armunityguide

• https://developer.arm.com/graphics/unity/unity-engine-tutorials

• https://developer.arm.com/graphics/vulkan/vulkan-tutorials

To find out more….