Finding out whether OpenGL objects cannot be deleted due to dangling reference

There are other possible explanations.

What GPU and GPU driver is this?

Why I ask:

If memory serves, you’re porting an OpenGL ES engine to Vulkan. In OpenGL ES (and likely OpenGL), one of the things the driver does to avoid synchronization and maximize throughput is “ghost” textures and possibly buffer objects as well, depending on the driver (see links below for related reading).

This can, for example, happen when uploading new texel contents for a GPU texture from the CPU draw thread. If there is still a draw in the pipeline which will need to read from the old texture contents before your update, the driver has a choice:

  • block your CPU app until the GPU/driver catches up,
  • serialize the texels into the command-buffer (if supported) and update the texture later, or
  • ghost the texture (aka “resource renaming” aka “multibuffering”).

I know for sure that some OpenGL ES drivers on mobile do this, and I’d be surprised if desktop drivers didn’t do it too. The thing with mobile is though, the GPU RAM sizes are much smaller typically and the access speed is much lower. So it’s much easier to blow out all of your memory with the GPU driver ghosting textures all over the place that you didn’t know about. I’ve done this myself, and at the time I recall being completely surprised initially at what was really going on under-the-covers in the driver. But when you stop and think about it, it makes perfect sense why it happens.

With Vulkan by contrast, the driver washes its hands of all of this ghosting nonsense. If your application wants ghosting/multibuffering behavior for performance, your application has to implement it. And because it knows what’s going on, it can frequently do it much more efficiently.

https://www.imgtec.com/blog/how-to-improve-your-renderer-on-powervr-based-platforms/