mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2024-10-14 16:32:17 +00:00
Merge pull request #875 from asuessenbach/readme
Correct documentation on DispatchLoaderDynamic
This commit is contained in:
commit
ea3af733ed
15
README.md
15
README.md
@ -430,16 +430,17 @@ By default, `VULKAN_HPP_ASSERT_ON_RESULT` will be used for checking results when
|
||||
|
||||
### Extensions / Per Device function pointers
|
||||
|
||||
The Vulkan loader exposes only the Vulkan core functions and a limited number of extensions. To use Vulkan-Hpp with extensions it's required to have either a library which provides stubs to all used Vulkan
|
||||
functions or to tell Vulkan-Hpp to dispatch those functions pointers. Vulkan-Hpp provides a per-function dispatch mechanism by accepting a dispatch class as last parameter in each function call. The dispatch
|
||||
class must provide a callable type for each used Vulkan function. Vulkan-Hpp provides one implementation, ```DispatchLoaderDynamic```, which fetches all function pointers known to the library.
|
||||
The Vulkan loader exposes only the Vulkan core functions and a limited number of extensions. To use Vulkan-Hpp with extensions it's required to have either a library which provides stubs to all used Vulkan functions or to tell Vulkan-Hpp to dispatch those functions pointers. Vulkan-Hpp provides a per-function dispatch mechanism by accepting a dispatch class as last parameter in each function call. The dispatch class must provide a callable type for each used Vulkan function. Vulkan-Hpp provides one implementation, ```DispatchLoaderDynamic```, which fetches all function pointers known to the library.
|
||||
|
||||
```c++
|
||||
// This dispatch class will fetch all function pointers through the passed instance
|
||||
vk::DispatchLoaderDynamic dldi(instance);
|
||||
// Providing a function pointer resolving vkGetInstanceProcAddr, just the few functions not depending an an instance or a device are fetched
|
||||
vk::DispatchLoaderDynamic dld( getInstanceProcAddr );
|
||||
|
||||
// This dispatch class will fetch function pointers for the passed device if possible, else for the passed instance
|
||||
vk::DispatchLoaderDynamic dldid(instance, device);
|
||||
// Providing an already created VkInstance and a function pointer resolving vkGetInstanceProcAddr, all functions are fetched
|
||||
vk::DispatchLoaderDynamic dldi( instance, getInstanceProcAddr );
|
||||
|
||||
// Providing also an already created VkDevice and optionally a function pointer resolving vkGetDeviceProcAddr, all functions are fetched as well, but now device-specific functions are fetched via vkDeviceGetProcAddr.
|
||||
vk::DispatchLoaderDynamic dldid( instance, getInstanceProcAddr, device );
|
||||
|
||||
// Pass dispatch class to function call as last parameter
|
||||
device.getQueue(graphics_queue_family_index, 0, &graphics_queue, dldid);
|
||||
|
Loading…
Reference in New Issue
Block a user