clamp re-queried extension count in enumeration helpers#1943
Conversation
|
Author aizu-m not on autobuild list. Waiting for curator authorization before starting CI build. |
1 similar comment
|
Author aizu-m not on autobuild list. Waiting for curator authorization before starting CI build. |
|
CI Vulkan-Loader build queued with queue ID 13074. |
charles-lunarg
left a comment
There was a problem hiding this comment.
All of these two call patterns remind me why I appreciate the helper function I added to vulkaninfo. It takes a function pointer, arguments, and optional default value, then returns (in a std::vector) the contents. Granted its C++ but if the intervening logic wasn't as extensive I'd try to abstract the 2 call pattern here too.
|
CI Vulkan-Loader build # 3576 running. |
|
CI Vulkan-Loader build # 3576 passed. |
|
Agreed, the two-call pattern is all over the loader. I did look at folding it into a helper while doing this, but each site does something different between the two calls (filter, dedup against the existing list, copy into different structs), so a generic C version would need a callback and wouldn't save much over what's there. The uniform bodies are what let the vulkaninfo helper stay clean. |
Tracing the device extension enumeration helpers for the misbehaving-driver case the recent *2KHR clamps covered, the same shape turns up in the plain enumeration paths that fill a loader-internal scratch array.
Clamped each loop to the snapshotted allocated count, same idea as the emulation terminators. Six sites: loader_add_instance_extensions, loader_add_device_extensions and check_physical_device_extensions_for_driver_properties_extension in loader.c, terminator_GetPhysicalDeviceToolPropertiesEXT in extension_manual.c, and the two PCI-bus checks in loader_linux.c.