Android device not support GPU instancing. Immediate mode Using Draw.Command throw error

Avatar
  • updated
  • Under Review

I was expecting the GPU instancing Draw command will still draw something if device not support instancing.

It did not draw anything and only an error was throw on Android device say instancing is not supported on this device.

So I have to manually check if device support instancing or not.

if(SystemInfo.supportsInstancing)
using (Draw.Command(cam))
{
Drawing();
}
else Drawing();

I suggest the package add some documents so other people can avoid it.

Or better Draw.Command() handle non gpu-instancing device internally.

https://docs.unity3d.com/ScriptReference/SystemInfo-supportsInstancing.html

Note: this also happen to some specific newer devices. Not old android Android.

I do not have specific data but you could expect around 10% users on country like Brazil have good android Device but still not support GPU instancing.

Reporting a bug? please specify Unity version:
2020.4
Reporting a bug? please specify Shapes version:
latest
Reporting a bug? please specify Render Pipeline:
Built-in render pipeline
Avatar
Freya Holmér creator
  • Under Review

I'm not sure if this is something I should error handle on my end, I feel like this is a bit of a borderline case. I'll think about it!

Avatar
Thomas Brown

Just wanted to follow up this thread with a bit more detail as I thought it might be helpful :). It also appears to be happening on my end as well, although this could be a separate issue altogether. Additional Unity context here.

I'll go ahead and implement the solution above in the meantime. I would also be happy to provide more info if necessary.

Avatar
Thomas Brown

After taking a stab at solving this my own way, I came up with this solution. Just in case anyone else stumbles upon this thread and has the same issue.

I add the below code to my GameStartState which is some of the first code that executes in my game.

#if !UNITY_EDITOR
//disable shapes gpu instancing mode if platform doesn't support it
ShapesConfig.Instance.useImmediateModeInstancing = SystemInfo.supportsInstancing;
#endif


Because ShapesConfig is a ScriptableObject I add the !UNITY_EDITOR preprocessor directive to ensure it doesn't keep getting changed and show up in my version control.