unity* Optimization Guide for the intel® ®x86 platform: part 1th

Source: Internet
Author: User
Tags home screen turbo boost

Original address

Catalogue
    • Tools
    • Unity Analyzer
    • GPA System Analyzer
    • GPA Frame Analyzer

To get the most out of the x86 platform, you can perform multiple performance optimizations in your project to maximize performance. In this guide, we will showcase the many tools and features in the unity* software to help you enhance the performance of your Unity project. We'll show you how to handle texture quality, batching, standard compression, light baking, and HDR effects.

At the end of this guide, you'll be able to learn about performance issues and their causes, key optimizations, and ways to help develop good games in Unity. Let's start with a look at the tools that help you easily identify potential hotspots in your app.

Tools

In this guide, we will explore three main tools: Unity Analyzer, GPA System Analyzer, and GPA frame Analyzer. Each tool has its own powerful game development capabilities. If you can combine all three tools, you'll have significant results in game simplification and optimization.


Figure 1. Unity Analyzer Home Screen

Unity Analyzer

The Unity Analyzer (Figure 1) is an extremely powerful tool in unity that helps you identify problems with various subsystems in your project. The parser Graphics section has a different sub-parser, which displays metrics for specific hardware. The currently available sub-analyzers contain metrics such as CPU usage, GPU usage, rendering, memory, audio, physics, and 2D physics. Each sub-parser can be further divided into related component parts, which can be separated to gain insight into the details. For example, CPU usage includes rendering, scripting, physics, garbage collector, vertical synchronization, and other parts.

Below the graphics section is the Overview window, where you can see a list of metrics, including timing information and memory allocations for various Unity subsystems. Everything from rendering to garbage collection is shown here, and it's a good idea to check the most time-consuming part of your application. Clicking any part of the graph pauses the parser update, allowing you to study the highlighted frames.

The Unity Analyzer can be connected to a running app in an editor or standalone widget. To get the most accurate timing to avoid the editor overhead, it is recommended that you connect to individual artifacts from time to times. Click on the ' Active Profiler ' button at the top of the window to select from the available instances of ' Android Player ' and any content on the network to detect available instances via ADB (Android Debug Bridge).

Another option is an "in-depth analysis" app. It is not recommended to use this option for general purposes because it actually uses all of the single code, which can result in a large amount of analysis overhead. Fortunately, Unity has the ability to directly use any piece of code that interests you. Figure 2 shows how to take advantage of the code so that whatever label you provide, it will appear on the parser:


Figure 2. set up a code snippet for use in Profiler

GPA System Analyzer


Figure 3. GPA System Analyzer Live View

intel® Graphics Performance Analyzer (intel® ®gpa) is a set of graphical analysis and optimization tools to help game developers speed up the running of games and other graphics-intensive applications. Intel ®gpa provides a wide range of features that enable developers to drill down into the graphical API calls to determine the cause of the major performance issues. Many of the experiments and metrics presented in this guide are from Intel ®gpa. Intel® ®gpa enables you to study the graphics workloads of directx* applications on Windows * and OpenGL es* applications on some intel® processor systems running on Android. While it is not possible to directly monitor opengl* API calls, you can still use the GPA System Profiler to study GPU and CPU metrics while the OpenGL game is running. Regardless of the graphics API, you can use the GPA Platform Analyzer to view detailed CPU load, including any OpenCL™ activity. For more details, Intel ®gpa can provide you with an API to add your own tools. GPA toolset for Android and desktop, for more information and download intel® ®gpa, please login: www.intel.com/software/GPA/

The first step is to use Intel ®gpa to collect real-time performance information. intel® ®gpa has two different real-time data display modes (shown above): head-up Display (HUD) running at the top of the app, and System analyzer that connects to the test system over the network. Both tools can display metrics, CPU utilization, and system power from DirectX pipelines (OpenGL ES pipelines on some intel® processors). You can also get a lot of GPU hardware metrics on supported intel® processor graphics systems. The HUD and System Analyzer provide simple experiments that can help you quickly detect performance issues. See the Intel GPA documentation for more details on HUD and System Analyzer features and functionality.


Figure 4. GPA System Analyzer backup HUD

To add an indicator value to the analysis, simply drag it from the left column to the main graphics area. These tools are capable of running on arm* devices, but do not have all the metrics on intel® processor-based hardware. For more information, see the Windows and OS X GPA Tutorials. The following sets of metrics are available on intel® hardware:

    • Cpu
    • Device IO
    • Execution Unit
    • Fragment shader
    • Gpu
    • Input-Assembler
    • Memory
    • Opengl/dx
      • Status indicators
    • Output-synthesizer
    • Power
    • Grating Device
    • Vertex shader

In terms of CPU bottlenecks, you may find that the Platform Analyzer is available for DirectX and OpenGL. It shows traces of the captured CPU activity. If you want to add tools to your code, you can associate individual tasks that run on the CPU and observe their processes, drivers, and GPUs through DirectX. To help you identify bottlenecks, the GPU contains a "State overlay" section (Figure 5) that allows you to experiment to check frame rate fluctuations under changing conditions. Several examples:


Figure 5. available Overrides

    • Texture 2x2
      • Extracting data from high-resolution textures is expensive. This replaces all the textures used in the scene with 2x2 textures. The significant performance changes caused by checking this option show that you can reduce the size of some textures to increase the frame rate.
    • Empty hardware
      • This will simulate an infinitely fast GPU. If this increases the frame rate, your code may be tied to the driver or CPU.
    • Disable Draw Calls
      • This will simulate a very fast driver, and if the frame rate floats, your code might be bound to the driver.
    • A simple fragment shader
      • This replaces all shaders with a very simple fragment shader. Floating may indicate that the shader should be optimized for performance gains.

Below the experimental section is the Platform settings slider. This feature allows you to run the CPU at different frequencies. This can help identify bottlenecks, even if your game/app is running at maximum frame rate on any test device. This can also be used to verify that your game/app can run on a wide range of devices. Another big use of the CPU frequency slider is to force specific frequencies to prevent the test results from being skewed by technologies such as intel® Turbo boost.

Finally, you can capture the frame by tapping the camera icon at the top of the window. The system analyzer then records every detail (state change, time, texture, and so on) used to make the game/app single frame. You can use the Frame Analyzer tool to open a file that stores this information for in-depth research.

GPA Frame Analyzer


Figure 6. GPA Frame Analyzer displays change records and related frame information

The Frame Analyzer tool (Figure 5) enables you to turn on single frame capture. The captured frames will contain records of all state changes, resources, timing information, and so on. The graph at the top of the window shows each draw call recorded in the frame. For ease of visualization, these draw calls are separated by the render target. The X and Y values in the graph can be changed by the drop-down menu at the top left. The left side is a separate render target list. The lower left shows a preview of the currently highlighted draw calls and how they appear on the frame. You can customize the view with a variety of options, including highlighting the plotted pixels or keeping them healthy. You can also choose to adjust how the unselected objects affect the preview (hidden or not hidden). The lower-right corner is a set of tabs that provide more insight into the currently selected draw call, including:

    • Frame Overview
      • Timing/Status values broken down by stages in GPU pipelines that target the entire frame


Figure 7. report values in the Frame overview section

    • More information
      • Timed/state values broken down by stages in the GPU pipeline for the currently selected draw call in the graphics/tree
    • Textures (8)
      • List of currently bound textures
      • The left column below the Textures tab can be used to verify compression, formatting, MIP layers, and so on.


Figure 8. A few views of the texture used for drawing calls

    • State
      • State settings for the selected draw call
      • can be edited to see the effect on the preview and timing of the render target
    • Coloring device
      • This section will introduce you to the shader used for the selected draw call.
      • You can edit the shader code and see how these changes visually affect the scene preview. Shader code changes are also reflected in timing changes, so you can see how many specific optimizations are affecting frame time.


      • Figure 9. edit shader to output hard-coded green values, and draw calls faster 57.7%
    • Experiment
      • Similar to the experimental part of the System analyzer, but can be used as a draw call.
        Figure 10. The experiment shows how replacing a 2x2 texture can speed up the draw call by 5.9%. On the Details tab, you can see changes to points on the graphics pipeline.
    • Geometric
      • This tab shows the geometric data in the window for the selected draw call.

        Figure 11. View the geometry model in the Geometry tab
    • API Log
      • Displays all API calls for the selected draw call. This can be helpful for tracking unnecessary state changes that may affect performance.

Please continue reading part 2nd of this article:
unity* Optimization Guide for the intel® ®x86 platform: part 2nd

unity* Optimization Guide for the intel® ®x86 platform: part 1th

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.