DrawProcedural and DepthBuffer Effects

Hi there.

I am generating a lot of particles in a compute shader and I want to apply Screen Space Ambient Occlusion with an Image Effect Script.
Am I right, that with DrawProcedural nothing is written into the Depthbuffer? So the SSAO shader is not working! I also tried to enable ZWrite, but this had no effect. I also couldn’t find an DepthBuffer Image in the Frame Debugger.
I found out, that since Unity 5.1 there is a new functionality, called CommandBuffers. Could they help me somehow to get the particles also rendered into the DepthBuffer, that I can use it to do some Image Effects like SSAO?
If yes, could you tell me in a few steps how to do it?

Thank you in advance!

Tarek

I already tried this, but I just get a blank screen.

CommandBuffer commandBuffer = new CommandBuffer();
Camera cam = this.GetComponent<Camera>();

// pseudo
CommandBuffer argsBuffer =  { 6, 1000, 0, 0 }

void OnRenderObject()
{
        //material.SetPass(0);
        //Graphics.DrawProcedural(MeshTopology.Triangles, 6, particleCount);
  
        commandBuffer.Clear();
   
        commandBuffer.DrawProceduralIndirect(Matrix4x4.identity, material, 0, MeshTopology.Triangles, argsBuffer);
        cam.AddCommandBuffer(CameraEvent.BeforeDepthTexture, commandBuffer);
}

If I put it later in the rendering pipeline, I see all the particles, but that doesn’t help me, because I want to draw into the depthbuffer.