DrawMeshInstancedIndirect not working on specific GPUs (Mali) - 2019.4.36f1

For our game we’re seeing issues with DrawMeshInstancedIndirect not working on specific GPUs - mainly OpenGLES3. We had two devices - Galaxy S21 - two model numbers.

SM-G991B/DS - doesn’t work - only one instance gets rendered, it seems like the positions aren’t translating, it has a GPU of Mali-G78 MP14
SM-G991U - it has a GPU of Adreno 660. This device along with many other android devices that support OpenGLES3.0 works just fine (Pixel 3a, Pixel4, and more)

We have confirmed the same behavior on this sample project here (build an apk from it to reproduce it): GitHub - Bagoum/Unity-DrawMeshInstancedIndirect

We also have built an apk, located here: https://drive.google.com/file/d/1TbSN8MuaoaiElDoVUwfCfcrz__1g11QO/view

On devices that work fine, you should see multiple F’s with different positions and rotations, on devices that don’t work correctly, you will only see one F (this is assuming that there are many F’s but all are drawn in same position / rotation).

We are using Unity 2019.4.36f1 (latest LTS) - I was hoping that this would fix it (fixed in 2019.4.36f1) - Unity Issue Tracker - [Android][ShaderGraph] Shader is not rendered on Android when it has normalized Vector3 Nodes that control objects position but it still reproduces on that specific Mali GPU

Graphics API is set to OpenGLES3 for this scenario

Any help or direction would be greatly appreciated.

1 Like

Bump - anyone else sees this or from anyone at Unity chime in?

  1. Mali sucks.
  2. It is probably because you are trying to use a Structured buffer in the vertex shader. I think most or all Mali GPUs do not support this on GL ES. Although many of them do support it on Vulkan. You can check though here : Unity - Scripting API: SystemInfo.maxComputeBufferInputsVertex If that returns 0 on your device, it means it isn’t supported, at least on that graphics API.

Your other option is to instead write the values you need to a render texture instead of a compute buffer. The vertex shader should support at least reading values from there.

2 Likes

for mali gpu did you confirm its working with vulkan api?

it did work with the vulkan api but wasn’t the ideal situation. We ended up scrapping DMII approach and relied on dynamic batching instead (made smaller textures and smaller meshes)

1 Like