[Solved] You are adding vkCmdPipelineBarrier() to VkCommandBuffer that is invalid because bound VkDeviceMemory was destroyed

I’m sometimes getting this validation error when rendering a post-processing effect after a window resize occurs. I can’t find any connection between the post-processing effect’s framebuffer and the rendering framebuffer. This is happening during a layout transition of the texture I am rendering to.

Validation Error: [ UNASSIGNED-CoreValidation-DrawState-InvalidCommandBuffer-VkDeviceMemory ] Object 0: handle = 0x167ecba8280, type = VK_OBJECT_TYPE_COMMAND_BUFFER; Object 1: handle = 0xf843070000000238, type = VK_OBJECT_TYPE_DEVICE_MEMORY; | MessageID = 0xf8bccee3 | You are adding vkCmdPipelineBarrier() to VkCommandBuffer 0x167ecba8280[] that is invalid because bound VkDeviceMemory 0xf843070000000238[] was destroyed.

Any clues what might be going on? I am looking through the program in the debugger and I don’t see anything that could be considered abnormal. It appears the error is saying the memory associated with a texture has been deleted, but this makes no sense to me. Or maybe it is saying the command buffer is invalid because some type of memory somewhere else was destroyed? I don’t understand.

Make a VK_LAYER_LUNARG_api_dump and filter it to the objects the error speaks of. Should make it clear.

When I enable this feature the error no longer occurs, so I can’t use it to debug the error. Also, no 3D objects rendering appears on the screen.

I have traced the problem to a texture being deleted while it is still “bound” in a descriptor set. Not solved but now I know what is wrong.

Okay, problem is fixed now and my texture deletion is improved.