I have GPU Instancing enabled in my material and in the Frame Debugger when observing the DepthPass.Jobs I see different results for different Unity shaders:
With the Unity > Mobile > Diffuse shader I see an event for each mesh, and no DrawInstanced calls.
However, when I switch to the Unity Standard shader I see those events combined as DrawInstanced calls.
I’m wondering what is unique about the Standard shader? My goal is to hopefully do the same thing in my custom shader to enable DrawInstanced calls in the Depth Pass.
Sorry, I wasn’t clear. I’m creating a surface shader. My understanding was that GPU instancing works with surface shaders by default, no? I get an instanced draw call in my surface shader, I just don’t get the DepthPass.Job DrawInstanced.
hmmm. When I test this shader with GPU instancing checked DepthPass.Job goes away completely, and the Drawing is GPU Instanced without further modification:
Think I figured it out. So based on these docs: Unity - Manual: Writing Surface Shaders , if you don’t have a shadow directive like addshadow i.e. #pragma surface surf Lambert noforwardadd addshadow then the Fallback shader’s shadow directive is used. "Mobile/Diffuse" doesn’t have a directive, so it goes to it’s Fallback shader "Mobile/VertexLit" which is a fragment shader with shadow handling that is different than whatever addshadow compiles into.
When I use #pragma surface surf Lambert noforwardadd addshadow I no longer see all the DepthPass.Job calls.