Descriptor Tracking Validation

Hey all,

I’ve set up some code to track what resources are set on any given

VkDescriptorSet

.
For the project that I’m working on right now, knowing at any given time what resources are set on

VkDescriptorSets

is pretty critical.
I’m fairly certain that I’ve got the code correct…but there’s a fair amount of logic to handle immutable samplers from

VkDescriptorSetLayouts

, binding arrays, binding rollover, etc. so I’m trying to think of ways to get this piece of code under test.

At the moment I’m updating the

VkDescriptorSets

then destroying the resources referenced so the validation layer will spit out a message that I can parse to confirm that the bindings would have been correct had the resource not been destroyed.
I’m not done setting this up yet.

Does anyone have any great ideas for validating the contents of

VkDescriptorSets

? Performance doesn’t matter.

Thanks

Well, I got it working…

I’m calling vkUpdateDescriptorSets() then destroying resources and calling vkUpdateDescriptorSets() again with copies to an empty VkDescriptorSet, then parsing the error message from the validation layer.

Now I’ve got a follow up question…short of creating a custom version of the validation layer, does anyone know of any way to query its state without triggering an error?

Thanks

Vulkan is a system where information generally travels in one direction: from the application to the device. If you set some state into the device, the expectation is that you know what that state is.

Vulkan devices do not store the contents of a descriptor set in a way that would make it convenient (or perhaps even possible) to introspect their contents. This is largely true of all device objects: the number of memory objects you’ve allocated, the state set into a pipeline, etc. None of that is cached by the device.

If you need to introspect a device object like this, the proper way to handle it is to write a wrapper interface that stores which objects are being used by which descriptor sets. So instead of calling vkUpdateDescriptorSet, you would call your wrapper function, which would walk the descriptor set changes and store any object relationships being set or broken.

For sure…that is in fact what I’m doing…I don’t expect the core Vulkan API to provide me with VkDescriptorSet state.
I’m trying to validate that I got all the logic correct to track descriptor changes.
This validation runs with other unit and integration tests, so I’m not overly concerned with performance…running the validation layer is fine in that regard.
The validation layer has to keep track of descriptor changes to do its validation…what I’d really like is to have a way to query the validation layer for the state of a VkDescriptorSet without having to trigger errors and parse the resulting message.
Fwiw, I’ll probably fork the validation layer and expose some functionality to let me do just that…I was just wondering if anyone was aware of a preexisting way of getting this info from the validation layer (or any other layer).

Thanks