PowerVR Performance Recommendations. The Golden Rules

Similar documents
PowerVR Performance Recommendations. The Golden Rules

PowerVR Performance Recommendations The Golden Rules. October 2015

PowerVR Series5. Architecture Guide for Developers

PowerVR Hardware. Architecture Overview for Developers

Edge Detection. Whitepaper

PVRHub. User Manual. Public Imagination Technologies

Navigational Data Tools. Reference Guide

Parallax Bumpmapping. Whitepaper

PVRTC & Texture Compression. User Guide

POWERVR MBX. Technology Overview

PowerVR: Getting Great Graphics Performance with the PowerVR Insider SDK. PowerVR Developer Technology

PowerVR. Performance Recommendations

Filewrap. User Manual

Mobile HW and Bandwidth

Optimizing and Profiling Unity Games for Mobile Platforms. Angelo Theodorou Senior Software Engineer, MPG Gamelab 2014, 25 th -27 th June

Shader Based Water Effects. Whitepaper

Bringing AAA graphics to mobile platforms. Niklas Smedberg Senior Engine Programmer, Epic Games

PowerVR. Performance Recommendations

Vulkan: Architecture positive How Vulkan maps to PowerVR GPUs Kevin sun Lead Developer Support Engineer, APAC PowerVR Graphics.

Profiling and Debugging Games on Mobile Platforms

LPGPU Workshop on Power-Efficient GPU and Many-core Computing (PEGPUM 2014)

PVRTC Specification and User Guide

Mali Developer Resources. Kevin Ho ARM Taiwan FAE

Tools To Get Great Graphics Performance

Mobile Performance Tools and GPU Performance Tuning. Lars M. Bishop, NVIDIA Handheld DevTech Jason Allen, NVIDIA Handheld DevTools

Using the PowerVR SDK to Optimize your Renderer

POWERVR. 3D Application Development Recommendations

More frames per second. Alex Kan and Jean-François Roy GPU Software

POWERVR MBX & SGX OpenVG Support and Resources

ARM. Mali GPU. OpenGL ES Application Optimization Guide. Version: 3.0. Copyright 2011, 2013 ARM. All rights reserved. ARM DUI 0555C (ID102813)

Architectures. Michael Doggett Department of Computer Science Lund University 2009 Tomas Akenine-Möller and Michael Doggett 1

PVRTune. Quick Start Guide for Android

Graphics Performance Optimisation. John Spitzer Director of European Developer Technology

Vulkan: Scaling to Multiple Threads. Kevin sun Lead Developer Support Engineer, APAC PowerVR Graphics

EECS 487: Interactive Computer Graphics

ARM. Mali GPU. OpenGL ES Application Optimization Guide. Version: 2.0. Copyright 2011, 2013 ARM. All rights reserved. ARM DUI 0555B (ID051413)

Achieving Console Quality Games on Mobile

Hardware-driven visibility culling

Course Recap + 3D Graphics on Mobile GPUs

Working with Metal Overview

Lecture 9: Deferred Shading. Visual Computing Systems CMU , Fall 2013

Enhancing Traditional Rasterization Graphics with Ray Tracing. October 2015

Lecture 25: Board Notes: Threads and GPUs

PFX Language Format. Specification

Analyze and Optimize Windows* Game Applications Using Intel INDE Graphics Performance Analyzers (GPA)

Deferred Rendering Due: Wednesday November 15 at 10pm

Enabling immersive gaming experiences Intro to Ray Tracing

The Bifrost GPU architecture and the ARM Mali-G71 GPU

Achieving High-performance Graphics on Mobile With the Vulkan API

PowerVR SDK & Tools. February 2017

Optimizing Games for ATI s IMAGEON Aaftab Munshi. 3D Architect ATI Research

Software Occlusion Culling

Optimizing DirectX Graphics. Richard Huddy European Developer Relations Manager

PowerVR Graphics - Latest Developments and Future Plans

Pipeline Operations. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 11

Optimizing Mobile Games with Gameloft and ARM

The PowerVR Insider SDK. PowerVR Developer Technology

Real-World Applications of Computer Arithmetic

Optimization Tips 杜博, 美国高通公司资深工程师

Enhancing Traditional Rasterization Graphics with Ray Tracing. March 2015

CS4620/5620: Lecture 14 Pipeline

MAXIS-mizing Darkspore*: A Case Study of Graphic Analysis and Optimizations in Maxis Deferred Renderer

Real - Time Rendering. Pipeline optimization. Michal Červeňanský Juraj Starinský

Unreal Engine 4: Mobile Graphics on ARM CPU and GPU Architecture

CS427 Multicore Architecture and Parallel Computing

Parallelizing Graphics Pipeline Execution (+ Basics of Characterizing a Rendering Workload)

Squeezing Performance out of your Game with ATI Developer Performance Tools and Optimization Techniques

Rendering Grass with Instancing in DirectX* 10

Vulkan on Mobile. Daniele Di Donato, ARM GDC 2016

How to Work on Next Gen Effects Now: Bridging DX10 and DX9. Guennadi Riguer ATI Technologies

Lecture 6: Texturing Part II: Texture Compression and GPU Latency Hiding Mechanisms. Visual Computing Systems CMU , Fall 2014

Many rendering scenarios, such as battle scenes or urban environments, require rendering of large numbers of autonomous characters.

Vulkan (including Vulkan Fast Paths)

GRAPHICS CONTROLLERS

Whiz-Bang Graphics and Media Performance for Java Platform, Micro Edition (JavaME)

Mali Demos: Behind the Pixels. Stacy Smith

Mali-400 MP: A Scalable GPU for Mobile Devices Tom Olson

GeForce4. John Montrym Henry Moreton

Bifrost - The GPU architecture for next five billion

PVR File Format. Specification

Shadows for Many Lights sounds like it might mean something, but In fact it can mean very different things, that require very different solutions.

General Purpose Computation (CAD/CAM/CAE) on the GPU (a.k.a. Topics in Manufacturing)

Pipeline Operations. CS 4620 Lecture 14

Graphics Architectures and OpenCL. Michael Doggett Department of Computer Science Lund university

Viewport 2.0 API Porting Guide for Locators

Render-To-Texture Caching. D. Sim Dietrich Jr.

RSX Best Practices. Mark Cerny, Cerny Games David Simpson, Naughty Dog Jon Olick, Naughty Dog

Optimizing Mobile Games with ARM. Solo Chang Staff Applications Engineer, ARM

X. GPU Programming. Jacobs University Visualization and Computer Graphics Lab : Advanced Graphics - Chapter X 1

Vulkan Multipass mobile deferred done right

Navigation Rendering Techniques Whitepaper

Scheduling the Graphics Pipeline on a GPU

Mali. GPU OpenVG. Application Development Guide. Copyright ARM Limited. All rights reserved. ARM DUI 0380D (ID121709)

Broken Age's Approach to Scalability. Oliver Franzke Lead Programmer, Double Fine Productions

GeForce3 OpenGL Performance. John Spitzer

Parallel Algorithms for Rendering Large 3D Models on a Graphics Cluster

Vulkan API 杨瑜, 资深工程师

Copyright Khronos Group, Page Graphic Remedy. All Rights Reserved

Grafica Computazionale: Lezione 30. Grafica Computazionale. Hiding complexity... ;) Introduction to OpenGL. lezione30 Introduction to OpenGL

DEFERRED RENDERING STEFAN MÜLLER ARISONA, ETH ZURICH SMA/

Transcription:

PowerVR Performance Recommendations Copyright Imagination Technologies Limited. All Rights Reserved. This publication contains proprietary information which is subject to change without notice and is supplied 'as is' without warranty of any kind. Imagination Technologies, the Imagination logo, PowerVR, MIPS, Meta, Ensigma and Codescape are trademarks or registered trademarks of Imagination Technologies Limited. All other logos, products, trademarks and registered trademarks are the property of their respective owners. Filename : PowerVR Performance Recommendations. Version : PowerVR SDK REL_4.0@3855898a Eternal Issue Issue Date : 15 Dec 2015 Author : Imagination Technologies Limited PowerVR Performance Recommendations 1 Revision PowerVR SDK REL_4.0@3855898a

Imagination Technologies Public Contents 1. Introduction... 3 1.1. Document Overview... 3 1.2. Common Bottlenecks... 3 2.... 4 2.1. The Principle of Good Enough... 4 2.2. Understand Your Target Device... 4 2.3. Promote Calculations Up the Chain... 4 2.4. Use Verte Buffers and Indeed Geometry... 5 2.5. Batch Render State... 6 2.6. Use Teture Compression... 6 2.7. Avoid Read/Write of In-Use Buffer Objects... 7 2.7.1. CPU Framebuffer Reads... 8 2.7.2. VBO and Teture Modifications... 8 2.8. Avoid Alpha Test/Discard... 8 2.9. Prevent Redundant Framebuffer Memory Transfers... 9 3. Contact Details... 10 List of Figures Figure 1. If the user won t notice the difference, reduce the number of polygons to improve performance... 4 Figure 2. Promote calculations up the chain to reduce the number of times they are eecuted... 5 Figure 3. VBOs and IBOs... 5 Figure 4. Batch-your-draws!... 6 Figure 5. PVRTC teture compression... 7 Figure 6. Using the CPU to modify the GPU buffers can be costly... 7 Figure 7. PowerVR alpha test/discard pipeline... 8 Revision PowerVR SDK REL_4.0@3855898a 2

1. Introduction 1.1. Document Overview The following document covers key principles developers should follow in order to avoid critical performance flaws in their graphics applications. These recommendations come from the combined eperience of the PowerVR Developer Technology Support team and the developers they work with, profiling and optimising their applications and games during development. 1.2. Common Bottlenecks It is important to understand where performance is bottlenecked before attempting to optimise an application. This ensures effort isn t wasted or visual quality isn t sacrificed for minimal gains. If an optimisation is inappropriately applied to an area that isn t bottlenecking performance there may be no performance gains and, in some cases, an incorrectly applied optimisation may lead to worse performance. From the PowerVR Developer Technology team s eperience, we have derived the following list of common bottlenecks generally found in unoptimized OpenGL ES applications, as ordered from most to least common: CPU Usage. Bandwidth Usage. CPU/Graphics Core Synchronization. Fragment Shader Instructions. Geometry Upload. Teture Upload. Verte Shader Instructions. Geometry Compleity. Profiling tools are vital in this process for developers to understand what is happening in their application, the hardware it is running on, and how and where bottlenecks are occurring. The PowerVR SDK includes the profiling tools PVRTrace and PVRTune to aid development on platforms powered by PowerVR hardware. PowerVR Performance Recommendations 3 Revision PowerVR SDK REL_4.0@3855898a

Imagination Technologies Public 2. 2.1. The Principle of Good Enough This principle refers to the notion that if the viewer cannot tell the difference between differently rendered images always use the cheaper implementation". This is most commonly an issue for applications ported from desktop or console to mobile devices, where developers will use the same assets for the lower specification devices. When working with a smaller screen it is possible to greatly simplify shaders, meshes, or tetures while maintaining perceived fidelity and therefore reducing graphics core workload without compromising visuals. Figure 1. If the user won t notice the difference, reduce the number of polygons to improve performance 2.2. Understand Your Target Device Developers should seek to learn as much information about their target platforms as possible in order to understand different architectures. Manufacturers' websites for devices are a good place to look for specifications and they may also provide other helpful developer community resources. The PowerVR Graphics SDK provides architecture documents for reference: PowerVR Hardware Architecture Overview for Developers. PowerVR Series5 Architecture Guide for Developers. Even after the graphics architecture is thoroughly understood it is important to remember that other factors such as variations in CPU power, memory bandwidth and thermal load will also impact performance. 2.3. Promote Calculations Up the Chain By performing calculations earlier in the pipeline the overall number of operations can be reduced and therefore workload can be substantially reduced. Generally, in a scene, there are far fewer vertices than fragments, therefore processing per-verte instead of per-fragment would greatly reduce the number of calculations. One use case, for eample, could be to perform per-verte lighting instead of per-piel lighting. Revision PowerVR SDK REL_4.0@3855898a 4

Pre-Baked Calculation On CPU Calculation Improved Graphics Core Performance Verte Shader Fragment Shader Figure 2. Promote calculations up the chain to reduce the number of times they are eecuted It is also possible to consider moving calculations off the Graphics Core altogether. Though the Graphics Core may be able to perform operations far more rapidly than the CPU can, it would be even faster for the CPU to perform an operation just once instead of the allowing the operation to be performed for many vertices on the Graphics Core. To take the concept even further, consider performing calculations offline, baking values into the scene, effectively replacing epensive run-time calculations with a simple lookup. For eample, replacing real-time lighting with lightmaps for static objects in a scene, such as terrain, buildings and trees, can be a particularly effective compromise substantially improving performance and, in many cases, providing higher quality lighting than would be possible to calculate at run-time. 2.4. Use Verte Buffers and Indeed Geometry Verte Buffer Objects (VBOs) enable the graphics driver to cache verte data attributes, such as teture coordinates (for mapping 2D images to the mesh) and model-space position. For static objects (those whose verte attributes changes infrequently, if at all), VBOs improve performance as the cached data can be reused to render many frames. Verte Buffer Inde Buffer Figure 3. VBOs and IBOs PowerVR Performance Recommendations 5 Revision PowerVR SDK REL_4.0@3855898a

Imagination Technologies Public In the eample above, an IBO (Inde Buffer Object) is used in conjunction with a VBO. Inde buffers define the order in which elements of a verte buffer should be accessed to represent the triangles in a mesh. IBOs improve performance and reduce the storage space requirements of comple mesh data as verte attributes are written to the VBO once then referenced as many times as required to represent the triangles surrounding that verte position. PowerVR hardware is optimized for indeed triangle lists. For finely-tuned performance, verte and inde buffers should be sorted to improve cache efficiency when the data is accessed by the GPU. Our 3D scene eporter and converter tool, PVRGeoPOD, automatically applies sorting to mesh data when generating POD (PowerVR object data) files. 2.5. Batch Render State Modifying the GL state machine incurs CPU overhead in the graphics driver, as changes need to be interpreted and converted into tasks that can be issued to the Graphics Core. To reduce this overhead, you must minimise the number of API calls and state changes made by your application. Setup Draw Call Setup Draw Call Setup Draw Call Setup Draw Call Versus Setup Batch Your Draw Calls Figure 4. Batch-your-draws! For geometry data, combine as many meshes into a single draw call as possible. An eample use case: Meshes for seats on a train have static position and orientation relative to one another and use the same render state, the seats and the train could all be combined into a single mesh. Now to draw the train interior, several draw calls have merged into a single call. With the Hidden Surface Removal (HSR) feature on PowerVR hardware it is not necessary to submit geometry in depth order to reduce overdraw. By freeing applications from this restriction they can focus on sorting draws by render state, ensuring state changes are minimised. Similarly to geometry data, it is possible to combine several tetures into a single bindable object by using teture atlases or teture arrays (where available). Tetures can then be applied per-object with the appropriate shader uniforms. As discussed in Avoid Read/Write of In-Use Buffer Objects, modifying buffer data may stall the graphics pipeline or increase the amount of memory allocated by the graphics driver. When batching draws together, it is important to consider the update frequency of buffers. For eample, you should batch spatially coherent objects with static verte data into one VBO, objects with dynamic data (e.g. soft body objects like cloth) into another. 2.6. Use Teture Compression In some instances it is worth considering the balance between teture size and teture compression. It may be possible to use a larger teture and a low-bitrate compression scheme and achieve a better balance of bandwidth savings and acceptable image quality. Revision PowerVR SDK REL_4.0@3855898a 6

Original PVRTC1 4bpp DXT PVRTC1 2bpp Figure 5. PVRTC teture compression Teture compression (not to be confused with image file compression) minimises the runtime memory footprint of your tetures. This provides several performance benefits; primarily reducing the amount of system memory bandwidth consumed sending data to the Graphics Core. PVRTC and PVRTCII are PowerVR specific compression technologies and will achieve best performance on the hardware, consuming as little as 2 bits per piel. Depending on the PowerVR generation and graphics API you are targeting, additional compressed teture formats may be supported, for eample ASTC. 2.7. Avoid Read/Write of In-Use Buffer Objects Graphics applications achieve the best performance when the CPU and Graphics Core tasks run in parallel. PowerVR Graphics Cores also operate most efficiently when the verte processing tasks of one frame are processed in parallel to the fragment colouring tasks of previous frames. When an application issues a command that causes the CPU to interrupt the GPU, it can significantly reduce performance. Frame 0 Frame 1 Frame 2 Geometry Submission In Progress Verte Processing In Progress Lifespan Fragment Processing In Progress Figure 6. Using the CPU to modify the GPU buffers can be costly PowerVR Performance Recommendations 7 Revision PowerVR SDK REL_4.0@3855898a

Imagination Technologies Public 2.7.1. CPU Framebuffer Reads Accessing the contents of a framebuffer attachment from the CPU is a common cause of slow performance. When such an operation is issued, the calling application s CPU thread must stall until the GPU render has completed. Once the render is complete, the CPU can begin reading data from the attachment. During this time the Graphics Core will not have write access to that attachment which can cause the Graphics Core to stall subsequent renders to that framebuffer. Due to the severe cost these operations should only be used when absolutely necessary, for eample to capture a screenshot of a game when a player requests one. 2.7.2. VBO and Teture Modifications Modifying in-flight VBOs and tetures has a cost. As GPUs tend to have at least one frame of latency to ensure they are well occupied with work, altering a buffer required by an outstanding render will give the graphics driver two options: 1. Stall in the buffer modifying API call until the outstanding render completes. 2. Allocate a temporary buffer for the new data so the buffer modifying API call can complete without stalling the CPU thread. As tetures are generally accessed during fragment shading, much later in the graphics pipeline than verte attributes, the cost of a graphics driver stalling a teture modification is higher than modifying a VBO. Avoiding stalls entirely by creating temporary buffer stores (a.k.a. ghosting) is good for performance, but it may not be desirable for applications that are already running out of buffer storage space. The stalling and ghosting behaviour of PowerVR varies between GPU and driver versions. For optimal performance, you should only modify VBOs and tetures when absolutely necessary. If buffers must be modified, you should use application-side circular buffering so that the GPU can read from one buffer object while the application s CPU thread writes to another. 2.8. Avoid Alpha Test/Discard When an alpha tested primitive is submitted, early depth testing - such as PowerVR s Hidden Surface Removal (HSR) - can discard fragments that are occluded by fragments closer to the camera. Unlike opaque primitives that would also perform depth writes at this pipeline stage, alpha tested primitives cannot write data to the depth buffer until the fragment shader has eecuted and fragment visibility is known. These deferred depth writes can impact performance, as subsequent primitives cannot be processed until the depth buffers are updated with the alpha tested primitive s values. ISP TSP Shader - Discard ISP Figure 7. PowerVR alpha test/discard pipeline For optimal performance, consider alpha blending instead of alpha test to avoid costly deferred depth write operations. To ensure HSR removes as much overdraw as possible, you should also submit your draws in the following order: opaque, alpha-tested, blended. Revision PowerVR SDK REL_4.0@3855898a 8

2.9. Prevent Redundant Framebuffer Memory Transfers System memory bandwidth accesses use more power than any other GPU operation. Keeping memory accesses to a minimum will reduce the chances of your application being memory bandwidth bound and will also reduce the power consumption of your app. On tile based architectures, OpenGL ES requires the previous framebuffer attachments to be uploaded to each tile at the start of a render and all framebuffer attachment data to be written to system memory at the end of the render. In many cases these memory transfer operations are redundant. Most applications need to generate a colour image at the end of the render, but have no need to preserve depth and stencil data between frames. Even fewer applications have a genuine need to upload the contents of the colour buffer s previous contents at the start of a new frame. If the data previously written to framebuffer attachments is not required, you can call glclear at the start of the render to prevent the data being uploaded to the tiles. The gldiscardframebufferext or glinvalidateframebuffer commands enable your application to inform the graphics driver when buffers should not be written from tile memory to system memory, for eample depth and stencil data. PowerVR Performance Recommendations 9 Revision PowerVR SDK REL_4.0@3855898a

Imagination Technologies Public 3. Contact Details For further support, visit our forum: http://forum.imgtec.com Or file a ticket in our support system: https://pvrsupport.imgtec.com To learn more about our PowerVR Graphics SDK and Insider programme, please visit: http://www.powervrinsider.com For general enquiries, please visit our website: http://imgtec.com/corporate/contactus.asp Revision PowerVR SDK REL_4.0@3855898a 10

Imagination Technologies, the Imagination Technologies logo, AMA, Codescape, Ensigma, IMGworks, I2P, PowerVR, PURE, PURE Digital, MeOS, Meta, MBX, MTX, PDP, SGX, UCC, USSE, VXD and VXE are trademarks or registered trademarks of Imagination Technologies Limited. All other logos, products, trademarks and registered trademarks are the property of their respective owners. PowerVR Performance Recommendations 11 Revision PowerVR SDK REL_4.0@3855898a