not totally sure what I did

This commit is contained in:
Greg Wells
2025-06-25 20:07:44 -04:00
parent dee0822779
commit 7ff6d7e744
4 changed files with 41 additions and 2 deletions

View File

@@ -1,4 +1,5 @@
#include "gryphn_loader.h"
#include <validation_layers/function_loader/loader/function_loader.h>
#ifdef GN_API_VULKAN
#include <apis/vulkan/loader/vulkan_loader.h>
#endif
@@ -6,8 +7,9 @@
#include <apis/metal/loader/metal_loader.h>
#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 };

View File

@@ -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/)

View File

@@ -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;
}

View File

@@ -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);