Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
device,instance: Provide
load_with()
constructor for get_proc_addr …
…closure While working on a GStreamer Vulkan interop example (where GStreamer-Vulkan opens the ICD and creates most objects for us, which need to be imported in an `ash::Instance` and `ash::Device`), it wasn't feasible to construct a `vk::EntryFnV1_0` and `vk::InstanceFnV1_0` with `extern` functions while keeping object data in some global static, especially `vk::InstanceFnV1_0` which contains many more functions that are not consumed by `Instance::load()`. GStreamer provides function loaders directly on its `GstVulkanInstance` and `GstVulkanDevice` which are desired to be used rather than attempting to open the same ICD and loading the same functions by hand. The original `Device::load()` and `Instance::load()` already create a closure internally, which is exactly what we need to expose to have a single callback that can hold the `&gst_vulkan::VulkanInstance/Device` state, and respond to a char-pointer name with a function pointer. Note that this doesn't map very clearly to `Entry`, where the `load()` constructor is named `from_static_fn()` and a closure signature is equally lacking. This is due `Entry` also storing `StaticFn` for various uses, which any constructor with just a closure won't (easily) be able to replicate.
- Loading branch information