Building an Unreal Engine Application with Mali Graphics Debugger Support
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.
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:
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:
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:
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):
Run the MGD daemon application on the target phone and activate the daemon itself:
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.