Best way to clear a framebuffer image without drawing? So I have a framebuffer image which later acts as input to a compute shader, and some frames there is geometry drawn to the framebuffer, but some frames this is not necessary.

The thing is, in my current process, when I don't draw anything to that framebuffer, the image contents are undefined which leads to incorrect output of my compute shader.  So on frames where there is no geometry drawn, I would like to simply clear the framebuffer.

In OpenGL this would be easy: glClearColor(...) but so far I have not been able to get it working on Vulkan.

I have tried just doing an empty renderpass: i.e: vkCmdBeginRenderPass/vkCmdEndRenderpass with the correct clear values defined in the VkRenderPassBeginInfo struct.

I have also tried doing a renderpass with only vkCmdClearAttachments between the bein/end commands.

So far I haven't had any luck.  What's the best way to accomplish this?
You are looking for vkCmdClearColorImage, 

It does exactly what it says on the tin, it clears an image to a specified color. This command uses the Transfer stage as far as barriers are concerned. You will need to add one between the clear and the vkCmdDispatch.

There is also a vkCmdClearDepthStencilImage if you need it.