From ed9e7253e5481ecb73b471f9860fb2dc9369725a Mon Sep 17 00:00:00 2001 From: Mark Callow <2244683+MarkCallow@users.noreply.github.com> Date: Fri, 10 Jun 2022 15:55:03 -0700 Subject: [PATCH] Fix missing documentation and compile warning. (#591) --- include/ktxvulkan.h | 11 +++++++++++ lib/vk_funcs.c | 3 ++- lib/vkloader.c | 10 ++++++++-- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/include/ktxvulkan.h b/include/ktxvulkan.h index 696aba73c9..e695ee6863 100644 --- a/include/ktxvulkan.h +++ b/include/ktxvulkan.h @@ -53,6 +53,15 @@ VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSampler) extern "C" { #endif +/** + * @struct ktxVulkanFunctions + * @~English + * @brief Struct for applications to pass Vulkan function pointers to the + * ktxTexture_VkUpload functions via a ktxVulkanDeviceInfo struct. + * + * @c vkGetInstanceProcAddr and @c vkGetDeviceProcAddr should be set, others + * are optional. + */ typedef struct ktxVulkanFunctions { // These are functions pointers we need to perform our vulkan duties. PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr; @@ -91,6 +100,7 @@ typedef struct ktxVulkanFunctions { /** * @class ktxVulkanTexture + * @~English * @brief Struct for returning information about the Vulkan texture image * created by the ktxTexture_VkUpload* functions. * @@ -127,6 +137,7 @@ ktxVulkanTexture_Destruct(ktxVulkanTexture* This, VkDevice device, /** * @class ktxVulkanDeviceInfo + * @~English * @brief Struct for passing information about the Vulkan device on which * to create images to the texture image loading functions. * diff --git a/lib/vk_funcs.c b/lib/vk_funcs.c index 49e34a7bca..7ae1dc25f6 100644 --- a/lib/vk_funcs.c +++ b/lib/vk_funcs.c @@ -118,7 +118,8 @@ ktxLoadVulkanFunction(const char* pName) { return NULL; } - PFN_vkVoidFunction pfn = LoadProcAddr(ktxVulkanModuleHandle, pName); + PFN_vkVoidFunction pfn + = (PFN_vkVoidFunction)LoadProcAddr(ktxVulkanModuleHandle, pName); if (pfn == NULL) { fprintf(stderr, "Couldn't load Vulkan command: %s\n", pName); return NULL; diff --git a/lib/vkloader.c b/lib/vkloader.c index 09276153b3..3ff8823dc7 100644 --- a/lib/vkloader.c +++ b/lib/vkloader.c @@ -186,8 +186,13 @@ ktxVulkanDeviceInfo_Construct(ktxVulkanDeviceInfo* This, * Pass a valid ktxVulkanDeviceInfo* to any Vulkan KTX image loading * function to provide it with the information. * - * @param This pointer to the ktxVulkanDeviceInfo object to + * @param This pointer to the ktxVulkanDeviceInfo object to * initialize. + * @param instance handle of the Vulkan instance. If @c VK_NULL_HANDLE, + * which is not recommended, the function will attempt + * to initialize the instance-level functions via the + * platform's standard dynamic library symbol loading + * mechanisms. * @param physicalDevice handle of the Vulkan physical device. * @param device handle of the Vulkan logical device. * @param queue handle of the Vulkan queue. @@ -195,7 +200,8 @@ ktxVulkanDeviceInfo_Construct(ktxVulkanDeviceInfo* This, * @param pAllocator pointer to the allocator to use for the image * memory. If NULL, the default allocator will be used. * @param pFunctions pointer to the struct of functions to use for vulkan - * operations. + * operations. Can be NULL in which case the function + * will retrieve the proc addresses itself. * * @returns KTX_SUCCESS on success, KTX_OUT_OF_MEMORY if a command buffer could * not be allocated.