Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions include/ktxvulkan.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
*
Expand Down Expand Up @@ -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.
*
Expand Down
3 changes: 2 additions & 1 deletion lib/vk_funcs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 8 additions & 2 deletions lib/vkloader.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,16 +186,22 @@ 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.
* @param cmdPool handle of the Vulkan command pool.
* @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.
Expand Down