diff --git a/projects/apis/metal/loader/metal_extensions.m b/projects/apis/metal/loader/metal_extensions.m index 90fd02a..7ed3e36 100644 --- a/projects/apis/metal/loader/metal_extensions.m +++ b/projects/apis/metal/loader/metal_extensions.m @@ -2,6 +2,6 @@ gnBool metalIsExtensionSupported(gnExtension extension) { if (extension == GN_EXT_SYNCHRONIZATION) return gnTrue; - if (extension == GN_EXT_QUEUES) return gnTrue; + if (extension == GN_EXT_QUEUES) return gnFalse; return gnFalse; } diff --git a/projects/apis/vulkan/loader/vulkan_loader.h b/projects/apis/vulkan/loader/vulkan_loader.h index 18bca8b..478fffa 100644 --- a/projects/apis/vulkan/loader/vulkan_loader.h +++ b/projects/apis/vulkan/loader/vulkan_loader.h @@ -3,11 +3,13 @@ #include "loader/src/gryphn_device_functions.h" #include "loader/src/gryphn_command_functions.h" #include "extensions/synchronization/loader/sync_functions.h" +#include "extensions/queues/queues_functions.h" #include "core/gryphn_extensions.h" gnInstanceFunctions loadVulkanInstanceFunctions(); gnDeviceFunctions loadVulkanDeviceFunctions(); gnCommandFunctions loadVulkanCommandFunctions(); gnSyncExtFunctions loadVulkanSyncFunctions(); +gnQueueExtFunctions loadVulkanQueueFunctions(); gnBool vulkanIsExtensionSupported(gnExtension extension); diff --git a/projects/apis/vulkan/loader/vulkan_queue_loader.c b/projects/apis/vulkan/loader/vulkan_queue_loader.c new file mode 100644 index 0000000..25f29fc --- /dev/null +++ b/projects/apis/vulkan/loader/vulkan_queue_loader.c @@ -0,0 +1,8 @@ +#include "vulkan_loader.h" +#include "extensions/queues/vulkan_device_queues.h" + +gnQueueExtFunctions loadVulkanQueueFunctions() { + return (gnQueueExtFunctions) { + ._gnGetPhysicalDeviceQueueProperties = vulkanPhysicalDeviceQueueProperties + }; +} diff --git a/projects/apis/vulkan/src/extensions/queues/vulkan_device_queues.c b/projects/apis/vulkan/src/extensions/queues/vulkan_device_queues.c index 38aed06..8fcb095 100644 --- a/projects/apis/vulkan/src/extensions/queues/vulkan_device_queues.c +++ b/projects/apis/vulkan/src/extensions/queues/vulkan_device_queues.c @@ -1,5 +1,4 @@ -#include -#include "extensions/queues/gryphn_physcial_device_queue.h" +#include "vulkan_device_queues.h" gnReturnCode vulkanPhysicalDeviceQueueProperties(gnPhysicalOutputDeviceHandle device, uint32_t queueFamilyCount, gnQueueFamilyProperties* queues) { vkGetPhysicalDeviceQueueFamilyProperties(device->physicalDevice->device, &queueFamilyCount, NULL); diff --git a/projects/apis/vulkan/src/extensions/queues/vulkan_device_queues.h b/projects/apis/vulkan/src/extensions/queues/vulkan_device_queues.h new file mode 100644 index 0000000..38e6dfd --- /dev/null +++ b/projects/apis/vulkan/src/extensions/queues/vulkan_device_queues.h @@ -0,0 +1,6 @@ +#pragma once + +#include +#include + +gnReturnCode vulkanPhysicalDeviceQueueProperties(gnPhysicalOutputDeviceHandle device, uint32_t queueFamilyCount, gnQueueFamilyProperties* queues); diff --git a/projects/extensions/queues/queues_functions.h b/projects/extensions/queues/queues_functions.h new file mode 100644 index 0000000..54fe653 --- /dev/null +++ b/projects/extensions/queues/queues_functions.h @@ -0,0 +1,10 @@ +#pragma once +#include "stdint.h" +#include "utils/gryphn_error_code.h" +#include "core/src/gryphn_handles.h" + +typedef struct gnQueueFamilyProperties gnQueueFamilyProperties; + +typedef struct gnQueueExtFunctions { + gnReturnCode (*_gnGetPhysicalDeviceQueueProperties)(gnPhysicalOutputDeviceHandle device, uint32_t queueCount, gnQueueFamilyProperties* queues); +} gnQueueExtFunctions; diff --git a/projects/loader/src/gryphn_loader.c b/projects/loader/src/gryphn_loader.c index 7bbf73c..8739755 100644 --- a/projects/loader/src/gryphn_loader.c +++ b/projects/loader/src/gryphn_loader.c @@ -93,6 +93,25 @@ gnSyncExtFunctions loadAPISyncFunctions(gnRenderingAPI api) { } } +gnQueueExtFunctions loadAPIQueueFunctions(gnRenderingAPI api) { + switch (api) { + case GN_RENDERINGAPI_NONE: return (gnQueueExtFunctions){ NULL }; +#ifdef GN_API_VULKAN + case GN_RENDERINGAPI_VULKAN: return loadVulkanQueueFunctions(); +#endif + + case GN_RENDERINGAPI_SOFTWARE: return (gnQueueExtFunctions){ NULL }; + case GN_RENDERINGAPI_DIRECTX11: return (gnQueueExtFunctions){ NULL }; + case GN_RENDERINGAPI_DIRECTX12: return (gnQueueExtFunctions){ NULL }; + case GN_RENDERINGAPI_OPENGL: return (gnQueueExtFunctions){ NULL }; +#ifdef GN_API_METAL + case GN_RENDERINGAPI_METAL: return (gnQueueExtFunctions){ NULL }; +#endif + + default: return (gnQueueExtFunctions){NULL}; + } +} + loaderLayer null_layer() { return (loaderLayer){ .instanceFunctions = (gnInstanceFunctions){ NULL }, diff --git a/projects/loader/src/gryphn_loader.h b/projects/loader/src/gryphn_loader.h index bfae143..213d4f0 100644 --- a/projects/loader/src/gryphn_loader.h +++ b/projects/loader/src/gryphn_loader.h @@ -6,6 +6,7 @@ #include "utils/lists/gryphn_array_list.h" #include "extensions/synchronization/loader/sync_functions.h" +#include "extensions/queues/queues_functions.h" typedef struct loaderLayer { // idk why I sperate these info different classes, I should really shove them in one bit class @@ -16,6 +17,7 @@ typedef struct loaderLayer { gnCommandFunctions commandFunctions; gnSyncExtFunctions syncFunctions; + gnQueueExtFunctions queueFunctions; // this index is not set by loadLayer, set by gnCreateInstance, also not used for now uint32_t layerIndex;