I am curious about the best way to update shadow maps in real-time. Since a texture may be in use when it is being rendered to, just like swap chain images, a more sophisticated design is needed than the simple render-to-texture I used for OpenGL shadowmaps.
I can think of two ways to go about this:
Keep a sort of “swap chain” of shadow maps going. Of course we don’t want to double all our texture memory, so it would be best to store out-of-use shadow maps / buffers in a pool and retrieve a free one from the pool when it is needed.
Render to a buffer and then use a vkCmdCopyTexture() call to copy the results to the displayed shadow map.
Performance is my main concern. Any tips on the best approach here? Is there a simpler way?