Upload
others
View
7
Download
0
Embed Size (px)
Citation preview
Mobile Game Optimization with Vulkan and Unity Adaptive Performance
Powered by Samsung GameSDK
Presented by Samsung and Unity
Vulkan Optimization
GameDev Engineer
Samsung Electronics
Samsung
Adaptive Performance
David Berger
Software Developer
Unity Technologies
GameSDK
GameDev Engineer
Samsung Electronics
GameDevGALAXY GAMEDEV
What Samsung did…
• Helping developers with adoption of new technologies
GameDev
Team GameDev
•→
•→
•→
•→
•→
Engine/Game
GPU Driver
GameEngines
DeveloperSupport
Tools & SDKs
Vulkan Grahpics API
• Way of Developing High Fidelity Android Games
Vulkan Grahpics API
•
•
•
•
Application
OpenGL Driver
GPU
Vulkan Driver
GPU
Application
Vulkan
FINAL FANTASY XV POCKET EDITIONSquare Enix / Summertime Studio
• GameEngine Optimize
• Contents Optimize
• Trouble Support
• Pipeline Barrier Optimize
• Pending RenderPass
• Primitive Buffer
Before After
42 FPS 60 FPS
S8 Mali — Within Sustainable Power
• GameEngine Optimize
• Contents Optimize
• Trouble Support
• Pipeline Barrier Optimize
• Pending RenderPass
• Primitive Buffer
FINAL FANTASY XV POCKET EDITIONSquare Enix / Summertime Studio
Before After
42 FPS 60 FPS
S8 Mali — Within Sustainable Power
• GameEngine Optimize
• Contents Optimize
• Trouble Support
• Pipeline Barrier Optimize
• Pending RenderPass
• Primitive Buffer
FINAL FANTASY XV POCKET EDITIONSquare Enix / Summertime Studio
Before After
42 FPS 60 FPS
S8 Mali — Within Sustainable Power
FINAL FANTASY XV POCKET EDITIONSquare Enix / Summertime Studio
Vertex Shader
…
Fragment Shader
SRC VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT
DST VK_PIPELINE_STAGE_VERTEX_SHADER_BIT VK_PIPELINE_STAGE_VERTEX_INPUT_BIT
Pipeline Barrier, Wait - !
Vertex Shader
…
Fragment Shader
Vertex Shader
…
Fragment Shader
• Pipeline Barrier Optimize
FINAL FANTASY XV POCKET EDITIONSquare Enix / Summertime Studio
• Vulkan with proper barriers
• Vulkan with wrong barriers
• GameEngine Optimize
• Contents Optimize
• Trouble Support
• Pipeline Barrier Optimize
• Pending RenderPass
• Primitive Buffer
FINAL FANTASY XV POCKET EDITIONSquare Enix / Summertime Studio
Before After
42 FPS 60 FPS
S8 Mali — Within Sustainable Power
FINAL FANTASY XV POCKET EDITIONSquare Enix / Summertime Studio
• Pending RenderPass
Hundred SoulHOUND 13
• Bloom Optimize
• RenderPass Load/Store Optimize
• Paging Allocate Buffer
• Batching UpdateDescriptorSet
• Shader Module Cache
Before After
41 FPS 52 FPS
Note9 Adreno — Within Sustainable Power
Hundred SoulHOUND 13
• Bloom Optimize
• RenderPass Load/Store Optimize
• Paging Allocate Buffer
• Batching UpdateDescriptorSet
• Shader Module Cache
Before After
41 FPS 52 FPS
Note9 Adreno — Within Sustainable Power
Hundred SoulHOUND 13
• Bloom Optimize
• RenderPass Load/Store Optimize
• Paging Allocate Buffer
• Batching UpdateDescriptorSet
• Shader Module Cache
Before After
41 FPS 52 FPS
Note9 Adreno — Within Sustainable Power
Hundred SoulHOUND 13
• RenderPass Load/Store Optimize
https://community.arm.com/developer/tools-software/graphics/b/blog/posts/the-mali-gpu-an-abstract-machine-part-4---the-bifrost-shader-core
Honor of KingsTencent Timi Studio – L1
• Single Scratch Buffer
• Low Priority Destroy Thread
• Batching UpdateDescriptorSet
• RenderPass Load/Store Optimize
• Shader Module Cache
Before After
41 FPS 53 FPS
S7 Adreno — Within Sustainable Power
• Single Scratch Buffer
• Low Priority Destroy Thread
• Batching UpdateDescriptorSet
• RenderPass Load/Store Optimize
• Shader Module Cache
Before After
41 FPS 53 FPS
S7 Adreno — Within Sustainable Power
Honor of KingsTencent Timi Studio – L1
Honor of KingsTencent Timi Studio – L1
• Only recreate during 1st loading
• 100% hit rate during playingoffset offset offset
Free Memory
Not enough memory
Larger buffer
Honor of KingsTencent Timi Studio – L1
• Single Scratch Buffer
• Low Priority Destroy Thread
• Batching UpdateDescriptorSet
• RenderPass Load/Store Optimize
• Shader Module Cache
Before After
41 FPS 53 FPS
S7 Adreno — Within Sustainable Power
Honor of KingsTencent Timi Studio – L1
• Single Scratch Buffer
• Low Priority Destroy Thread
• Batching UpdateDescriptorSet
• RenderPass Load/Store Optimize
• Shader Module Cache
Before After
41 FPS 53 FPS
S7 Adreno — Within Sustainable Power
Honor of KingsTencent Timi Studio – L1
● 매 draw 마다 UpdateDescriptorSets호출● Texture, Buffer, Buffer Offset, Buffer View 변경을위해호출
vkUpdateDescriptorSets
vkCmdDraw
vkUpdateDescriptorSets
vkCmdDraw
...
vkQueueSummit
Honor of Kings – The King’s ExpeditionTencent Timi Studio – L1
• Threaded queue present
• VB, IB binding optimization
• Direct buffer access
• Cache optimization
• Async texture load
• Single buffer for image upload
Before After
49 FPS 59 FPS
Note8 Mali — Within Sustainable Power
Honor of Kings – The King’s ExpeditionTencent Timi Studio – L1
• Threaded queue present
• VB, IB binding optimization
• Direct buffer access
• Cache optimization
• Async texture load
• Single buffer for image upload
Before After
49 FPS 59 FPS
Note8 Mali — Within Sustainable Power
Honor of Kings – The King’s ExpeditionTencent Timi Studio – L1
• Threaded queue present
– Run thread for vkQueuePresent()
Honor of Kings – The King’s ExpeditionTencent Timi Studio – L1
• Threaded queue present
• VB, IB binding optimization
• Direct buffer access
• Cache optimization
• Async texture load
• Single buffer for image upload
Before After
49 FPS 59 FPS
Note8 Mali — Within Sustainable Power
Honor of Kings – The King’s ExpeditionTencent Timi Studio – L1
Skip binding buffers, just draw with bound
buffers from previous draw call.
Honor of Kings – The King’s ExpeditionTencent Timi Studio – L1
• Threaded queue present
• VB, IB binding optimization
• Direct buffer access
• Cache optimization
• Async texture load
• Single buffer for image upload
Before After
49 FPS 59 FPS
Note8 Mali — Within Sustainable Power
Honor of Kings – The King’s ExpeditionTencent Timi Studio – L1
• Direct Buffer Access
Data(vertex, index,
uniform…)
Main Thread
Temp Buffercopyupload
Render Thread
Real Buffer
Before
Data(vertex, index,
uniform…)
Main Thread
upload
Render Thread
Real Buffersync
After
Honor of Kings – The King’s ExpeditionTencent Timi Studio – L1
• Threaded queue present
• VB, IB binding optimization
• Direct buffer access
• Cache optimization
• Async texture load
• Single buffer for image upload
Before After
49 FPS 59 FPS
Note8 Mali — Within Sustainable Power
Collaboration Titles
• 2017 GameLoft, Asphalt 8
• 2017 Cornfox&Bros, Oceanhorn: Monster of Uncharted Seas
• 2017 Deep Silver, Galaxy On Fire 3: Manticore!
• 2017 Digital Legends Entertainment, Afterpulse
• 2017 First Touch Games, Score! Hero / Dream League Soccer
• 2018 Tencent, Honor of Kings
• 2018 Pearl Abyss, BlackDesert Mobile
• 2018 Epic Games, Fortnite Battle Royale
• 2018 Amazon Lumberyard, Bistro
• 2019 Moai Games, TRAHA
• 2019 PUBG corporation / Tencent, PUBG MOBILE
• 2019 Tencent, QQ Speed
• 2016 Epic Games, ProtoStar Galaxy S7 Collaboration
• 2016 NetGames, HIT
• 2016 Super Evil MegaCorp, VainGlory
• 2017 433, HeroDC
• 2017 Netmarble, Lineage 2: Revolution
• 2017 Nexon, AxE
• 2017 XL Games, Archeage: Begins
• 2017 Action Square, Blade II
• 2017 Hound13, HundredSoul
• 2017 Square Enix, FinalFantasy XV Pocket Edition
• 2017 Croteam, Talos Principle
• 2017 Roblox Corporation, Roblox
• 2017 Doragon Entertainment, Danmaku Unlimited 3
Samsung GameSDK
Presented by Junsik Kong
Samsung Galaxy GameDev
Limitation of Mobile
—
– No active cooling system
– Performance Throttling
—
– Limitation of battery
– Use more Power than necessary
— Developer can’t control
FPS
Core Freq
Temperature After Throttling
43
GameApplicationunity
Galaxy GameSDK
44
Thermal Throttling
40 fps @ end
60 fps @ start
Throttling ?
45
— Performance drops and shakes
Thermal Throttling
— onHighTempWarning(int warningLevel)
warningLevel 0 warningLevel 1 warningLevel 2
Throttling46
Thermal Throttling
— getTempLevel(), getCPU/GPUJTLevel(), getSkinTempLevel()
01
23
45
6 7
47
Thermal Throttling
— Now you can do !
– Thermal Throttling 시점예측가능
– Thermal Throttling 방지
– Adjust Target FPS, Quality or etc!
50 fps steady
48
Power control
CPU Freq
GPU Freq
— Frequency over reat
49
Power control
— setLevelWithScene(String scene, int cpuLevel, int gpuLevel)
CPU Freq
GPU Freq
Level 2
Level 1
50
Bottleneck Check
— Power level
Target FPS 30
@FPS 28
setlevel….(1,1)
setlevel….(2 ,1)
setlevel….(1 ,2)
51
Bottleneck Check
— getGpuFrameTime()
– #n frame’s GpuFrameTime
GPU Bottleneck! GPU Level 증가
16.00 ms10.23ms
#n frame Time
#n gpuframeTime
52
Goal #1 Balancing Quality & Performance
40 fps @ end
60 fps @ start
50 fps steady
53
—
Goal #2 Controlling Power Budge
—
CPU Freq
GPU Freq
Level 2
Level 1
54
Goal #3 Maximizing Peformance
—
–
setlevel….(1,1)55
16.00 ms10.23ms
#n frame Time
#n gpuframeTime
setlevel….(2 ,1)
setlevel….(1 ,2)
55
Adaptive Performance in Megacity
56
Presented by David BergerUnity Technologies
Adaptive Performance
Get device performance status and thermal trends
Proactively adjust performance and quality settings on the fly
Smoother Gameplay
58
59
8MTriangles
6MEntities
2KCars
60
30FPS - stable over time
61
30
15
200 Time [m]
Framerate
62
Adaptive Performance
• Start with Low CPU/GPU levels (Menu->Level)
– Increase levels for CPU or GPU bottleneck respectively
– Keeps energy consumption low
• Not hitting target frame rate
– Decrease the LOD bias
– Decreases GFX load (triangles, memory, draw calls)
• Decrease target framerate when close to throttling
63
30
15
200 10
Time [m]
64
Adaptive Performance: How it works
1-Add the package
66
Adaptive Performance: How it works
2-Register to OnThermalEvent, Set initial target level
67
Adaptive Performance: How it works
3-Manage your quality settings when Thermal status changes
68
Adaptive Performance: How it works
4-You can subscribe to Performance bottleneck events
69
Adaptive Performance: How it works
4-You can subscribe to performance bottleneck events
70
Adaptive Performance Preview
available now!
71
Adaptive Performance Blost Posthttps://blogs.unity3d.com/2019/04/01/higher-fidelity-and-smoother-
frame-rates-with-adaptive-performance/
72
73
Roadmap
• Preview
• 2019.1+
• Verified
• 2019.3
• Future
• 2019.3+
74