You copied the Doc URL to your clipboard.

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).

  • Your PATH must 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:

1.
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
2.

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


3.

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.

4.

Install your application by running:

adb install -r YourApplication.apk

5.
To enable MGD to connect to the daemon over USB, run the following command on the host:

adb forward tcp:5002 tcp:5002

6.
Launch the MGD Android Application on the host and enable the MGD Daemon by sliding the button.

Note

If you are using MGD version 4.5 or lower, the MGD Daemon does not list your application.
7.

To enable the MGD Vulkan layer, type the following commands:

adb shell

setprop debug.vulkan.layers VK_LAYER_ARM_MGD

This command instructs the Vulkan loader to load the layer with the name VK_LAYER_ARM_MGD.

8.

Launch MGD on your desktop. Click on the connect to target 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.

9.

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


Was this page helpful? Yes No