4

Whenever an object in Vulkan is destroyed, and the VK_LAYER_LUNARG_object_tracker layer is enabled, and a debug report is installed, it will report the destroy call and give the total number of objects remaining via the callback. Eg:

INFO: [OBJTRACK]: OBJ_STAT Destroy VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_POOL_EXT obj 0xcf43130 (217 total objs remain & 1 VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_POOL_EXT objs).

Is there some way to get information about the objects that are still allocated?

Edit: Inspecting the source of the object_tracker layer (https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers/blob/master/layers/object_tracker.h), it seems that there is a prototype for objTrackGetObjectsOfTypeCount, but they don't seem like they have implementations anywhere. Is this function somehow accessible?

MuertoExcobito
  • 9,741
  • 2
  • 37
  • 78
  • I guess you could create your own layer or simply keep track of them in your own application. – tambre Mar 03 '16 at 19:24
  • Sure, but, I would like to know if there is such functionality built-in (eg. something similar to DXGI::ReportLiveObjects - https://msdn.microsoft.com/en-us/library/windows/desktop/hh780352.aspx) . Obviously, the object_tracker knows how many of each type there are already - I would like to know if there's somewhat to extract that. – MuertoExcobito Mar 03 '16 at 19:45
  • I guess you can implement your own VkAllocatorCallback (as a Singleton), and put some counters over there (perhaps mapping object name to counter). I wrote a naive implementation of VkAllocationCallback using malloc()/free() [here](http://stackoverflow.com/questions/36944492/vulkans-vkallocationcallbacks-implemented-with-malloc-free/36973346#36973346), with testing code [Here](https://github.com/AlessandroBorges/Bor_Vulkan/blob/master/Vulkan/Proto/cube.c). – Alex Byrth Jul 12 '16 at 16:35

1 Answers1

4

Vulkan is built with minimal driver overhead, so driver does as little as possible and there is no such built-in functionality. Only way to get info about existing objects is to either keep track of the objects yourself or write a layer to do it for you.

There don't seem to be any existing layers, which such functionality. For writing a validation layer, you might want to take a look at the existing Vulkan validation layers.

tambre
  • 4,625
  • 4
  • 42
  • 55
  • It doesn't have to be built into 'vanilla' Vulkan itself (eg. it could be available as a part of the object_tracker layer). It seems that there is at least the idea that such a thing should be available (see my edit), but either I don't know how to access it, or it isn't available (yet). – MuertoExcobito Mar 04 '16 at 18:56
  • @MuertoExcobito I have edited my answer to clarify that there are no known such implementations. I'm afraid also that the layer internal functions are only that - for internal use. You may want to contact or create an issue on their Github repository and see if they would be willing to implement such functionality somehow. – tambre Mar 05 '16 at 10:14