instance suitability functions

This commit is contained in:
Gregory Wells
2025-09-10 13:26:18 -04:00
parent 0310652abc
commit a446d6e75f
10 changed files with 36 additions and 34 deletions

View File

@@ -8,13 +8,15 @@
gryphnInstanceFunctionLayers checkerLoadInstanceFunctions(void) {
return (gryphnInstanceFunctionLayers) {
.createInstance = checkCreateInstance,
.destroyInstance = checkDestroyInstance
.isSuitable = checkIsInstanceSuitable,
.queryDevices = checkQueryDevices,
.destroyInstance = checkDestroyInstance,
.next = GN_NULL_HANDLE
};
}
gnInstanceFunctions loadFunctionLoaderInstanceFunctions(void) {
return (gnInstanceFunctions){
._gnGetPhysicalDevices = checkGetPhysicalDevices,
._gnPhysicalDeviceCanPresentToSurface = checkCanDevicePresent,
._gnCreateOutputDevice = checkCreateOutputDevice,

View File

@@ -24,6 +24,16 @@ void checkDestroyInstance(gnInstanceHandle instance, gryphnInstanceFunctionLayer
next->destroyInstance(instance, next->next, alloctors);
}
gnBool checkIsInstanceSuitable(gnInstanceHandle instance, gnSuitableField field, gryphnInstanceFunctionLayers* next) {
if (next == NULL || next->isSuitable == NULL) {
gnDebuggerSetErrorMessage(instance->debugger, (gnMessageData){
.message = gnCreateString("Failed to load gnCreateInstance this indicates a bug within gryphn")
});
return GN_FAILED_TO_LOAD_FUNCTION;
}
return next->isSuitable(instance, field, next);
}
gnReturnCode checkQueryDevices(gnInstanceHandle instance, uint32_t* count, gnPhysicalDeviceHandle* devices, gryphnInstanceFunctionLayers* next) {
if (next == NULL || next->queryDevices == NULL) {
gnDebuggerSetErrorMessage(instance->debugger, (gnMessageData){

View File

@@ -3,6 +3,7 @@
#include <core/src/window_surface/gryphn_surface_create_functions.h>
gnReturnCode checkCreateInstance(gnInstanceHandle instance, gnInstanceCreateInfo* info, gryphnInstanceFunctionLayers* next, gnAllocators* alloctors);
gnBool checkIsInstanceSuitable(gnInstanceHandle instance, gnSuitableField field, gryphnInstanceFunctionLayers* next);
gnReturnCode checkQueryDevices(gnInstanceHandle instance, uint32_t* count, gnPhysicalDeviceHandle* devices, gryphnInstanceFunctionLayers* next);
void checkDestroyInstance(gnInstanceHandle instance, gryphnInstanceFunctionLayers* next, gnAllocators* alloctors);