kinda improve the loader (its worse)
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// load the speedy API functions or something like that
|
// load the speedy API functions or something like that
|
||||||
gnInstanceFunctions loadAPIFunctions(gnRenderingAPI api) {
|
gnInstanceFunctions loadAPIInstanceFunctions(gnRenderingAPI api) {
|
||||||
switch (api) {
|
switch (api) {
|
||||||
case GN_RENDERINGAPI_NONE: return (gnInstanceFunctions){ NULL };
|
case GN_RENDERINGAPI_NONE: return (gnInstanceFunctions){ NULL };
|
||||||
#ifdef GN_API_VULKAN
|
#ifdef GN_API_VULKAN
|
||||||
@@ -26,17 +26,8 @@ gnInstanceFunctions loadAPIFunctions(gnRenderingAPI api) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gnInstanceFunctions loadInstanceFunctions(loaderInfo info) {
|
gnDeviceFunctions loadAPIDeviceFunctions(gnRenderingAPI api) {
|
||||||
gnInstanceFunctions apiFunctions = loadAPIFunctions(info.api);
|
switch (api) {
|
||||||
|
|
||||||
if (info.validateIfLoaded)
|
|
||||||
return loadFunctionLoaderInstanceFunctions(&apiFunctions);
|
|
||||||
|
|
||||||
return apiFunctions;
|
|
||||||
}
|
|
||||||
|
|
||||||
gnDeviceFunctions loadDeviceFunctions(loaderInfo info) {
|
|
||||||
switch (info.api) {
|
|
||||||
case GN_RENDERINGAPI_NONE: return (gnDeviceFunctions){ NULL };
|
case GN_RENDERINGAPI_NONE: return (gnDeviceFunctions){ NULL };
|
||||||
#ifdef GN_API_VULKAN
|
#ifdef GN_API_VULKAN
|
||||||
case GN_RENDERINGAPI_VULKAN: return loadVulkanDeviceFunctions();
|
case GN_RENDERINGAPI_VULKAN: return loadVulkanDeviceFunctions();
|
||||||
@@ -54,8 +45,8 @@ gnDeviceFunctions loadDeviceFunctions(loaderInfo info) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gnCommandFunctions loadCommandFunctions(loaderInfo info) {
|
gnCommandFunctions loadAPICommandFunctions(gnRenderingAPI api) {
|
||||||
switch (info.api) {
|
switch (api) {
|
||||||
case GN_RENDERINGAPI_NONE: return (gnCommandFunctions){ NULL };
|
case GN_RENDERINGAPI_NONE: return (gnCommandFunctions){ NULL };
|
||||||
#ifdef GN_API_VULKAN
|
#ifdef GN_API_VULKAN
|
||||||
case GN_RENDERINGAPI_VULKAN: return loadVulkanCommandFunctions();
|
case GN_RENDERINGAPI_VULKAN: return loadVulkanCommandFunctions();
|
||||||
@@ -72,3 +63,26 @@ gnCommandFunctions loadCommandFunctions(loaderInfo info) {
|
|||||||
default: return (gnCommandFunctions){NULL};
|
default: return (gnCommandFunctions){NULL};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loaderLayer null_layer() {
|
||||||
|
return (loaderLayer){
|
||||||
|
.instanceFunctions = (gnInstanceFunctions){ NULL },
|
||||||
|
.deviceFunctions = (gnDeviceFunctions){ NULL },
|
||||||
|
.commandFunctions = (gnCommandFunctions){ NULL }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
loaderLayer api_loaded_layer(gnRenderingAPI api) {
|
||||||
|
return (loaderLayer){
|
||||||
|
.instanceFunctions = loadAPIInstanceFunctions(api),
|
||||||
|
.deviceFunctions = loadAPIDeviceFunctions(api),
|
||||||
|
.commandFunctions = loadAPICommandFunctions(api)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
loaderLayer loadLayer(loaderInfo info) {
|
||||||
|
if (info.layerToLoad == no_layer) return null_layer();
|
||||||
|
if (info.layerToLoad == api_layer) return api_loaded_layer(info.api);
|
||||||
|
|
||||||
|
return null_layer();
|
||||||
|
}
|
||||||
|
@@ -3,7 +3,13 @@
|
|||||||
#include "gryphn_device_functions.h"
|
#include "gryphn_device_functions.h"
|
||||||
#include "gryphn_command_functions.h"
|
#include "gryphn_command_functions.h"
|
||||||
#include "gryphn_loader_info.h"
|
#include "gryphn_loader_info.h"
|
||||||
|
#include "utils/lists/gryphn_array_list.h"
|
||||||
|
|
||||||
gnInstanceFunctions loadInstanceFunctions(loaderInfo info);
|
typedef struct loaderLayer {
|
||||||
gnDeviceFunctions loadDeviceFunctions(loaderInfo info);
|
gnInstanceFunctions instanceFunctions;
|
||||||
gnCommandFunctions loadCommandFunctions(loaderInfo info);
|
gnDeviceFunctions deviceFunctions;
|
||||||
|
gnCommandFunctions commandFunctions;
|
||||||
|
} loaderLayer;
|
||||||
|
|
||||||
|
loaderLayer loadLayer(loaderInfo info);
|
||||||
|
GN_ARRAY_LIST(loaderLayer);
|
||||||
|
@@ -1,7 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "gryphn_rendering_api.h"
|
#include "gryphn_rendering_api.h"
|
||||||
|
|
||||||
|
typedef enum toLoadLayer {
|
||||||
|
no_layer, api_layer
|
||||||
|
} toLoadLayer;
|
||||||
|
|
||||||
typedef struct loaderInfo {
|
typedef struct loaderInfo {
|
||||||
gnRenderingAPI api;
|
gnRenderingAPI api;
|
||||||
gnBool validateIfLoaded;
|
toLoadLayer layerToLoad;
|
||||||
} loaderInfo;
|
} loaderInfo;
|
||||||
|
Reference in New Issue
Block a user