fixing define option to disable all KHR functions

This commit is contained in:
2024-09-12 23:38:46 +02:00
parent 6333bc667c
commit 64565bbff4

13
kvf.h
View File

@@ -276,6 +276,7 @@ typedef struct
size_t sets_pools_size;
} __KvfDevice;
#ifndef KVF_NO_KHR
typedef struct
{
VkSurfaceCapabilitiesKHR capabilities;
@@ -293,6 +294,7 @@ typedef struct
VkFormat images_format;
uint32_t images_count;
} __KvfSwapchain;
#endif
typedef struct
{
@@ -318,9 +320,11 @@ __KvfDevice* __kvf_internal_devices = NULL;
size_t __kvf_internal_devices_size = 0;
size_t __kvf_internal_devices_capacity = 0;
#ifndef KVF_NO_KHR
__KvfSwapchain* __kvf_internal_swapchains = NULL;
size_t __kvf_internal_swapchains_size = 0;
size_t __kvf_internal_swapchains_capacity = 0;
#endif
__KvfFramebuffer* __kvf_internal_framebuffers = NULL;
size_t __kvf_internal_framebuffers_size = 0;
@@ -485,6 +489,7 @@ __KvfDevice* __kvfGetKvfDeviceFromVkDevice(VkDevice device)
return NULL;
}
#ifndef KVF_NO_KHR
void __kvfAddSwapchainToArray(VkSwapchainKHR swapchain, __KvfSwapchainSupportInternal support, VkFormat format, uint32_t images_count, VkExtent2D extent)
{
KVF_ASSERT(swapchain != VK_NULL_HANDLE);
@@ -537,6 +542,7 @@ __KvfSwapchain* __kvfGetKvfSwapchainFromVkSwapchainKHR(VkSwapchainKHR swapchain)
}
return NULL;
}
#endif
void __kvfAddFramebufferToArray(VkFramebuffer framebuffer, VkExtent2D extent)
{
@@ -1137,8 +1143,8 @@ __KvfQueueFamilies __kvfFindQueueFamilies(VkPhysicalDevice physical, VkSurfaceKH
queues.compute = i;
if(queue_families[i].queueFlags & VK_QUEUE_GRAPHICS_BIT)
queues.graphics = i;
VkBool32 present_support = false;
#ifndef KVF_NO_KHR
VkBool32 present_support = false;
if(surface != VK_NULL_HANDLE)
{
vkGetPhysicalDeviceSurfaceSupportKHR(physical, i, surface, &present_support);
@@ -1147,9 +1153,12 @@ __KvfQueueFamilies __kvfFindQueueFamilies(VkPhysicalDevice physical, VkSurfaceKH
if(queues.graphics != -1 && queues.present != -1 && queues.compute != -1)
break;
}
#endif
else if(queues.graphics != -1 && queues.compute != -1)
break;
#else
if(queues.graphics != -1 && queues.compute != -1)
break;
#endif
}
KVF_FREE(queue_families);
return queues;