GPU Instancing not working properly with HDRP

Hello, fellow Unity users.
I am working on a VR simulation using the HDRP (I know is not the appropiate pipeline, but our target hardware is very high-end, and URP limitations are a problem), and, of course, I have numerous performance issues.
After doing some works of optimization, I have arrived to a curious situation.

My scene consist in a concert stage. Right now, I have this not-too-fancy low-res seat model populating all the scene.

This makes the draw calls increase to:

Of course, being the same model with the same material, I enable GPU instancing to reduce draw calls.
My surprise? To see that the number doesn’t change at all:

If I go to the Frame Debugger, I see the same draw calls:

Static Batching doesn’t help too much, too (yes, it is deactivated to not override GPU instancing).

The draw call incresing is not too much in this case, but when I start adding models and detail to the scenery, instancing not working makes the performance drop exponentially.
I have seen numerous users complaining about GPU instancing being a little erratic. Sadly, documentation and info about the HDRP is scarce and messy.
For (duh) instance, I read about the SRP batcher interfering with GPU instancing in one forum, but I found (through code, because the checkbox isn’t anymore :() that the Batcher is disabled by default.

So: any clue of what is happening? Is GPU instancing even compatible with VR? Is really an engine issue, or is that I am losing something important?

I will be grateful about some doc/advanced tutorial on how to interpret the Frame Debugger, as it seems a very powerful tool, but right now is very cryptic and difficult to read.

Edit: Well, NOW, for a reason I still don’t comprehend, instancing works when SRP Batcher is disabled.
This HDRP mess is driving me crazy

2 Likes

Hi!
By design, enabling SRP Batcher automatically bypass our generic GPU instancing. (because it’s faster for common case). If you want to check performance for various configurations ( SRP batcher ON/OFF, GPU Instancing ON/OFF, Static Batching ON/OFF), please use SRPBatcherBenchmark/Assets/Scripts/SRPBatcherProfiler.cs at master · Unity-Technologies/SRPBatcherBenchmark · GitHub
This script display CPU rendering time metrics, and you can compare these numbers in your dedicated scene.
If your scene use exactly the same material for all the chairs, and have no lightmaps and no light probes, then maybe GPU instancing could still be a win. Just switch off SRP batcher to test ( and look at CPU metrics numbers with SRPBatcherProfiler.cs )
If you see anything suspicious, you can post screenshot with SRPBatcherProfiler.cs numbers displayed with or without SRP Batcher, and with or without static batching.

3 Likes

Thank you for your response.
Optimizing the scene has been a pain for me, since HDRP is still very young. Probably I will start a thread about this.

Hi,

I use the HDRP Lit shader and enabled GPU instancing for objects copied and scaled - rotated around, but the batches are still enormous (like 3000) and "saved by batching’ metric reports a minus -2000, is this meaning the batching is working ?

In a new chapter of “thing Unity do but don’t tell you”:
GPU instancing is disabled by default in HDRP. Yes, even if you have that checkbox marked. If you have negative numbers like yours, batching is not working.
Why? Because they are implementing a new batcher, the SRP batcher, that works even with different materials, and disables GPU instancing automatically.
If you want to disable SRP batcher and compare its benefits with GPU instancing, I suggest you to download:
https://github.com/Unity-Technologi…b/master/Assets/Scripts/SRPBatcherProfiler.cs
For me, SRP worked very fine, since I am using a lot of different materials.

2 Likes