11.29.2016

Building an Unreal Engine Application with Mali Graphics Debugger Support

By Thomas Poulet ARM Mali Graphics

ARM Mali Graphics Debugger (MGD) allows developers to trace Vulkan, OpenGL ES, EGL and OpenCL API calls in their application to understand their effect frame-by-frame and to help identify possible bottlenecks in the code. This blog explains how developers can add support for MGD on a non-rooted device, to their Unreal Engine application.

blogAssets%2F2016%2FNovember+2016%2FNOV29_ARMMaliGraphicsDebugger%2F770_Epic_Citadel_with_MGD-770x458-3e605439d65d30668f907945b9bf8cebf1fb64c9

The plan we are going to follow is very simple:

  • Add the interceptor library to the build system
  • Edit the activity to load the interceptor library
  • Install the MGD Daemon application on the target device

 

For our first step, we will need to download a version of Unreal Engine from the sources available on GitHub. For more information on this step, please see Epic’s guide.
 
Once you have a working copy of the engine, we can focus on getting MGD working. You will first need to locate the android-non-root folder in your MGD installation directory, and your Unreal Engine installation folder (where you cloned the repository). Copy the android-non-root folder to Engine\Build\Android\Java\.
 
Next, we will need to change the Android makefile to ensure that the interceptor is properly packaged inside the engine build. For this, edit the Android.mk file under “Engine/Build/Android/Java/jni/”  add this line at the end, include $(LOCAL_PATH)/../android-non-root/MGD.mk. It should look like this:

 


blogAssets%2F2016%2FNovember+2016%2FNOV29_ARMMaliGraphicsDebugger%2FARM_Mali_Text_1-770x150-a2c6cc3438321dfcd31c52c69ec7273da9bb546b
 
We will now specify to the main game activity that it needs to load the MGD library, locate GameActivity.java inside Engine\Build\Android\Java\src\com\epicgames\ue4\ and edit the onCreate function to look like so:

blogAssets%2F2016%2FNovember+2016%2FNOV29_ARMMaliGraphicsDebugger%2FARM_Mali_Text_2-770x248-ca951201784e122b7b7420b4acde4247a305eef6
 
Engine-wise we are all set, we will now prepare our device. Install the MGD daemon on the target phone using the following command whilst being in the android-non-root folder:

blogAssets%2F2016%2FNovember+2016%2FNOV29_ARMMaliGraphicsDebugger%2FARM_Mali_Text_3-770x23-1e353d47e3c9672b132dea3ac9e6a2e11c4e3b0c
 
Now before running your app you will need to run this command from the host PC (please ensure that the device is visible by running adb devices first):

blogAssets%2F2016%2FNovember+2016%2FNOV29_ARMMaliGraphicsDebugger%2FARM_Mali_Text_4-770x22-cce33de0cd6aee4c96edacbde4d48d5e42f9e2db
 
Run the MGD daemon application on the target phone and activate the daemon itself:

blogAssets%2F2016%2FNovember+2016%2FNOV29_ARMMaliGraphicsDebugger%2FARM_Mali_Text_5-770x248-c7923709ea768477e70cc401e0cd36278b4d2d4b

At that point you can connect it to MGD on the host PC, start your application and begin debugging it. Please refer to the MGD manual for more in-depth information on how to use it.

Following these steps you should be able to use MGD with Unreal applications on any Mali-based platform. To learn more or ask a question, please contact the ARM Mali graphics Connected Community.

blogAssets%2F2016%2FNovember+2016%2FNOV29_ARMMaliGraphicsDebugger%2Fcitadel-frame-analysis3-scaled1-0613777c5147b6b1d93338d7e77e85bdaa8c942d

Recent Posts

Get Set for the Summer #ue4jam!

Get ready to buckle down and put your development skills to the test! Ne

...

Unreal Developers Shine at Develop:Brighton 2018

Numerous developers displayed their titles in the Unreal Networking Lounge ...

Unreal Powers On-the-Fly Compositing with Handheld Camera

Going beyond green screens: ARwall’s rear-projection system provides in-cam...