instance suitability functions
This commit is contained in:
@@ -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,
|
||||
|
@@ -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){
|
||||
|
@@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user