Traverse-Research/rspirv-reflect

BTreeMap instead of HashMap for returned descriptor sets?

Closed this issue · 2 comments

Reflection::get_descriptor_sets returns a HashMap keyed by desc set and binding.

We found that creating descriptor set layouts by just directly iterating these maps randomly created descriptor sets that both the Vulkan Validation layers and the NV driver on the 10xx generation found quite incompatible, even though the binding indices were the same, just the order of the descriptors in the array were different due to the randomized iteration order of the hashmaps. This led to wacky bugs and validation errors.

This might be a bug in both the driver and validation layers, really, but better safe than sorry. If these were returned as BTreeMaps instead, which are inherently ordered, this wouldn't have happened.

@hrydgard that's a perfect suggestion, and "stupid' of me to not store ordered items in an unordered map in the first place!

Not stupid at all, a quite hard-to-foresee consequence! But I think BTreeMaps would indeed be an improvement here.