Custom RandomWrite Buffer only works with decals disabled

I have a Virtual Texturing Terrain system working in the legacy rendering pipeline, which involves using Graphics.SetRandomWriteTargets during Update, outputting VirtualTexture requests to a RWBuffer during terrain rendering, and then asynchronously reading the data back to the CPU.

The system was behaving strangely after porting my shader to HDRP. It would only work correctly around terrain where holes existed.

I have now discovered that disabling decal support in my HDRP Asset makes the system work correctly again in all situations.

Does anyone know what might be causing this, and how I could make my system work with decals?
I assume this might be due to decals using RWBuffers, Clearing RandomWrite targets, or possibly something to do with a depth prepass.

Thanks for any help.

I’m pretty sure this is due to the Depth Prepass somehow… commenting out
#define SHADERPASS SHADERPASS_DEPTH_ONLY
Fixes the issue, but obviously breaks compatibility with decals.

Is there a reason why my regular shader pass wouldn’t get executed after depth only rendering?