From 7ff6d7e744f2b61f24bb6306ca3ab2ae84aee0af Mon Sep 17 00:00:00 2001 From: Greg Wells Date: Wed, 25 Jun 2025 20:07:44 -0400 Subject: [PATCH] not totally sure what I did --- projects/loader/src/gryphn_loader.c | 15 +++++++++++++-- .../function_loader/CMakeLists.txt | 9 +++++++++ .../function_loader/loader/function_loader.c | 11 +++++++++++ .../function_loader/loader/function_loader.h | 8 ++++++++ 4 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 projects/validation_layers/function_loader/CMakeLists.txt create mode 100644 projects/validation_layers/function_loader/loader/function_loader.c create mode 100644 projects/validation_layers/function_loader/loader/function_loader.h diff --git a/projects/loader/src/gryphn_loader.c b/projects/loader/src/gryphn_loader.c index a5fef1a..f422b3d 100644 --- a/projects/loader/src/gryphn_loader.c +++ b/projects/loader/src/gryphn_loader.c @@ -1,4 +1,5 @@ #include "gryphn_loader.h" +#include #ifdef GN_API_VULKAN #include #endif @@ -6,8 +7,9 @@ #include #endif -gnInstanceFunctions loadInstanceFunctions(loaderInfo info) { - switch (info.api) { +// load the speedy API functions or something like that +gnInstanceFunctions loadAPIFunctions(gnRenderingAPI api) { + switch (api) { case GN_RENDERINGAPI_NONE: return (gnInstanceFunctions){ NULL }; case GN_RENDERINGAPI_VULKAN: return loadVulkanInstanceFunctions(info); @@ -22,6 +24,15 @@ gnInstanceFunctions loadInstanceFunctions(loaderInfo info) { } } +gnInstanceFunctions loadInstanceFunctions(loaderInfo info) { + gnInstanceFunctions apiFunctions = loadAPIFunctions(info.api); + + if (info.validateIfLoaded) + return loadFunctionLoaderInstanceFunctions(&apiFunctions); + + return apiFunctions; +} + gnDeviceFunctions loadDeviceFunctions(loaderInfo info) { switch (info.api) { case GN_RENDERINGAPI_NONE: return (gnDeviceFunctions){ NULL }; diff --git a/projects/validation_layers/function_loader/CMakeLists.txt b/projects/validation_layers/function_loader/CMakeLists.txt new file mode 100644 index 0000000..459cca7 --- /dev/null +++ b/projects/validation_layers/function_loader/CMakeLists.txt @@ -0,0 +1,9 @@ +set(CMAKE_EXPORT_COMPILE_COMMANDS on) +project(GryphnFunctionValidator) + +file(GLOB_RECURSE SOURCE_FILES CONFIGURE_DEPENDS "src/*.c") +file(GLOB_RECURSE LOADER_FILES CONFIGURE_DEPENDS "loader/*.c") +add_library(GryphnFunctionValidator STATIC ${SOURCE_FILES} ${LOADER_FILES}) +target_include_directories(GryphnFunctionValidator PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../utils) +target_include_directories(GryphnFunctionValidator PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../) +target_include_directories(GryphnFunctionValidator PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../core/src/) diff --git a/projects/validation_layers/function_loader/loader/function_loader.c b/projects/validation_layers/function_loader/loader/function_loader.c new file mode 100644 index 0000000..aded765 --- /dev/null +++ b/projects/validation_layers/function_loader/loader/function_loader.c @@ -0,0 +1,11 @@ +#include "function_loader.h" + +gnInstanceFunctions loadFunctionLoaderInstanceFunctions(gnInstanceFunctions* callbacks) { + return *callbacks; +} +gnDeviceFunctions loadFunctionLoaderDeviceFunctions(gnDeviceFunctions* callbacks) { + return *callbacks; +} +gnCommandFunctions loadFunctionLoaderCommandFunctions(gnCommandFunctions* callbacks) { + return *callbacks; +} diff --git a/projects/validation_layers/function_loader/loader/function_loader.h b/projects/validation_layers/function_loader/loader/function_loader.h new file mode 100644 index 0000000..9834f7f --- /dev/null +++ b/projects/validation_layers/function_loader/loader/function_loader.h @@ -0,0 +1,8 @@ +#pragma once +#include "loader/src/gryphn_instance_functions.h" +#include "loader/src/gryphn_device_functions.h" +#include "loader/src/gryphn_command_functions.h" + +gnInstanceFunctions loadFunctionLoaderInstanceFunctions(gnInstanceFunctions* callbacks); +gnDeviceFunctions loadFunctionLoaderDeviceFunctions(gnDeviceFunctions* callbacks); +gnCommandFunctions loadFunctionLoaderCommandFunctions(gnCommandFunctions* callbacks);