start using the dispatcher
This commit is contained in:
@@ -14,24 +14,27 @@
|
||||
#include "core/src/instance/gryphn_instance.h"
|
||||
|
||||
// load the speedy API functions or something like that
|
||||
gnInstanceFunctions loadAPIInstanceFunctions(gnRenderingAPI api) {
|
||||
dispatcher_bool loadAPIInstanceFunctions(dispatcher_layer* layer) {
|
||||
gnRenderingAPI api = *(gnRenderingAPI*)layer->userData;
|
||||
gnInstanceFunctions* funcs = (gnInstanceFunctions*)layer->function_array;
|
||||
switch (api) {
|
||||
case GN_RENDERINGAPI_NONE: return (gnInstanceFunctions){ NULL };
|
||||
case GN_RENDERINGAPI_NONE: *funcs = (gnInstanceFunctions){ NULL };
|
||||
#ifdef GN_API_VULKAN
|
||||
case GN_RENDERINGAPI_VULKAN: return loadVulkanInstanceFunctions();
|
||||
case GN_RENDERINGAPI_VULKAN: *funcs = loadVulkanInstanceFunctions();
|
||||
#endif
|
||||
|
||||
case GN_RENDERINGAPI_SOFTWARE: return (gnInstanceFunctions){ NULL };
|
||||
case GN_RENDERINGAPI_DIRECTX11: return (gnInstanceFunctions){ NULL };
|
||||
case GN_RENDERINGAPI_DIRECTX12: return (gnInstanceFunctions){ NULL };
|
||||
case GN_RENDERINGAPI_SOFTWARE: *funcs = (gnInstanceFunctions){ NULL };
|
||||
case GN_RENDERINGAPI_DIRECTX11: *funcs = (gnInstanceFunctions){ NULL };
|
||||
case GN_RENDERINGAPI_DIRECTX12: *funcs = (gnInstanceFunctions){ NULL };
|
||||
#ifdef GN_API_OPENGL
|
||||
case GN_RENDERINGAPI_OPENGL: return loadOpenGLInstanceFunctions();
|
||||
case GN_RENDERINGAPI_OPENGL: *funcs = loadOpenGLInstanceFunctions();
|
||||
#endif
|
||||
#ifdef GN_API_METAL
|
||||
case GN_RENDERINGAPI_METAL: return loadMetalInstanceFunctions();
|
||||
case GN_RENDERINGAPI_METAL: *funcs = loadMetalInstanceFunctions();
|
||||
#endif
|
||||
default: return (gnInstanceFunctions){NULL};
|
||||
default: *funcs = (gnInstanceFunctions){NULL};
|
||||
}
|
||||
return dispatcher_true;
|
||||
}
|
||||
|
||||
gnDeviceFunctions loadAPIDeviceFunctions(gnRenderingAPI api) {
|
||||
@@ -113,7 +116,6 @@ gnQueueExtFunctions loadAPIQueueFunctions(gnRenderingAPI api) {
|
||||
|
||||
loaderLayer null_layer() {
|
||||
return (loaderLayer){
|
||||
.instanceFunctions = (gnInstanceFunctions){ NULL },
|
||||
.deviceFunctions = (gnDeviceFunctions){ NULL },
|
||||
.commandFunctions = (gnCommandFunctions){ NULL }
|
||||
};
|
||||
@@ -121,7 +123,6 @@ loaderLayer null_layer() {
|
||||
|
||||
loaderLayer api_loaded_layer(gnRenderingAPI api) {
|
||||
return (loaderLayer){
|
||||
.instanceFunctions = loadAPIInstanceFunctions(api),
|
||||
.deviceFunctions = loadAPIDeviceFunctions(api),
|
||||
.commandFunctions = loadAPICommandFunctions(api),
|
||||
};
|
||||
@@ -129,7 +130,6 @@ loaderLayer api_loaded_layer(gnRenderingAPI api) {
|
||||
|
||||
loaderLayer function_check_layer() {
|
||||
return (loaderLayer){
|
||||
.instanceFunctions = loadFunctionLoaderInstanceFunctions(),
|
||||
.deviceFunctions = loadFunctionLoaderDeviceFunctions(),
|
||||
.commandFunctions = loadFunctionLoaderCommandFunctions(),
|
||||
|
||||
|
Reference in New Issue
Block a user