CreateCommittedResourceWithTag performance issue

What could cause CreateCommittedResourceWithTag to sometimes take a considerable amount of time?

@richardkettlewell Do you have any ideas?

I’ve asked the D3D12 team, and they have said that it is falling back to a slow path because more than 1MB of scratch memory is being requested.

This allocation is for all of the vertices of all visible particles for a given frame.
I’ve had confirmation that this will happen on every frame that requires > 1MB, which defeats the purpose of what is supposed to be a fast path for D3D12!

The team have recommended that you submit a bug for this, so they can look into improving it!

Thank you for your help! I discovered that the issue was related to a particle system I was using with custom meshes and GPU instancing.

However, the shader assigned to this particle system doesn’t support GPU instancing, which seems to cause it to fall back to copying the custom mesh data into an internal vertex stream. Switching to the particles shader that comes with URP resolved the issue for me.

I find it odd that shaders created with ShaderGraph do have a “GPU Instancing” checkbox, but apparently don’t support GPU instancing with particles, but that’s probably a separate topic entirely. :man_shrugging:

Ah, yes, CPU-instanced mesh particles would indeed cause a lot of vertex memory usage, and terrible performance too.

The unintuitive UI is caused by the 2 separate instancing implementations we have. The more common one, used by ShaderGraph and Meshes and Graphics.DrawInstanced (etc) uses constant buffers for the instance data, which didn’t seem suitable for particle systems, due to the 64kb size limit. So I opted for a bespoke instancing implementation using StructuredBuffers for the instance data, which performs better, but has more restrictive platform support, and doesn’t integrate well with the other instancing UI in Unity.