Enabling MGD with Vulkan
This describes how to enable MGD in Unity for Vulkan.
MGD supports debugging of graphics applications developed with the high-performance Vulkan API.
To debug you applications in Vulkan, you use additional layers that you can inject into the system at runtime. MGD includes an interceptor library that you can use as a Vulkan layer.
To add layers to a Unity Android application based on Vulkan, you must copy the layer libraries into the project folder Assets/Plugins/Android/libs/armeabi-v7a.
To build a Vulkan application with MGD support, you must also copy the MGD library in the same folder.
To enable MGD for Unity with Vulkan, you require the following:
Unity 5.6 or higher.
Your Android device must have Android 4.2 or above.
The latest version of MGD from https://developer.arm.com/graphics.
Android Software Development Kit (SDK).
PATHmust include the path to the adb binary.
You must have a valid ADB connection to your target device. ADB must be able to return the ID of your device with no permission errors and you must be able to execute applications. For more information, see your Android device documentation.
Your target device must permit TCP/IP communication on port 5002.
To add MGD support to a Unity application developed with Vulkan, follow these steps:
- Locate the MGD installation folder. For example, on Windows OS the default installation path is C:\Programs Files\ARM\Mali Developer Tools\Mali Graphics Debugger vX.Y.0.
- Locate the subfolder target\android\arm\.
- That contains the MGD Android Application MGD.apk.
- To install this apk on the Android device where you want to profile your Unity game or application, type this command:
adb install -r MGD.apk
Locate the MGD library libMGD.so in the MGD installation folder, under the folder target\android\arm\rooted\armeabi-v7a\.
Make a copy of the library and rename it to libVkLayerMGD32.so.
Copy this into the Unity project folder Assets\Plugins\Android\libs\armeabi-v7a.
Figure 9-6 Copy libVkLayerMGD32.so to Unity project
In the Unity Build Settings dialog window, check the Development Build option. This instructs Unity to enable the Vulkan layer mechanism at runtime. The libVkLayerMGD32.so library is packaged into the apk independently of the state of Development Build option.
Build your apk.
Install your application by running:
adb install -r
- To enable MGD to connect to the daemon over USB, run the following command on the host:
adb forward tcp:5002 tcp:5002
- Launch the MGD Android Application on the host and enable the MGD Daemon by sliding the button.
NoteIf you are using MGD version 4.5 or lower, the MGD Daemon does not list your application.
To enable the MGD Vulkan layer, type the following commands:
setprop debug.vulkan.layers VK_LAYER_ARM_MGD
This command instructs the Vulkan loader to load the layer with the name
Launch MGD on your desktop. Click on the icon to connect to the target and start tracing. Press the perspective icon at the top right corner of the MGD window, and select Vulkan.
MGD waits for trace input.
Tap on your application on your device. The MGD Vulkan layer sends the Vulkan calls to MGD and MGD displays them.
The following image shows MGD tracing Unity with Vulkan:
Figure 9-7 MGD tracing Unity with Vulkan