fix a lot of things

This commit is contained in:
Gregory Wells
2025-08-03 10:27:30 -04:00
parent 8a0ed5e7be
commit 9d0f42731b
9 changed files with 38 additions and 25 deletions

View File

@@ -5,11 +5,15 @@
#include "extensions/sync_functions.h"
#include "extensions/queue_functions.h"
gryphnInstanceFunctionLayers checkerLoadInstanceFunctions() {
return (gryphnInstanceFunctionLayers) {
.createInstance = { checkCreateInstance, NULL },
.destroyInstance = { checkDestroyInstance, NULL }
};
}
gnInstanceFunctions loadFunctionLoaderInstanceFunctions() {
return (gnInstanceFunctions){
._gnCreateInstance = checkCreateInstance,
._gnDestroyInstance = checkDestroyInstance,
._gnGetPhysicalDevices = checkGetPhysicalDevices,
._gnPhysicalDeviceCanPresentToSurface = checkCanDevicePresent,

View File

@@ -4,12 +4,23 @@
#include "core/src/output_device/gryphn_output_device.h"
#include "core/src/window_surface/gryphn_surface.h"
gnReturnCode checkCreateInstance(gnInstanceHandle instance, gnInstanceCreateInfo* info) {
CHECK_FUNCTION_WITH_RETURN_CODE(instance, _gnCreateInstance, instanceFunctions, instance, info);
gnReturnCode checkCreateInstance(gnInstanceHandle instance, gnInstanceCreateInfo* info, gryphnFunctionLayer* next) {
if (next->function == NULL) {
gnDebuggerSetErrorMessage(instance->debugger, (gnMessageData){
.message = gnCreateString("Failed to load gnCreateInstance this indicates a bug within gryphn")
});
return GN_FAILED_TO_LOAD_FUNCTION;
}
return (*(PFN_gnCreateInstance*)next->function)(instance, info, next->next);
}
void checkDestroyInstance(gnInstance instance) {
CHECK_VOID_FUNCTION(instance, _gnDestroyInstance, instanceFunctions, instance);
void checkDestroyInstance(gnInstanceHandle instance, gryphnFunctionLayer* next) {
if (next->function == NULL) {
gnDebuggerSetErrorMessage(instance->debugger, (gnMessageData){
.message = gnCreateString("Failed to load gnDestroyInstance this indicates a bug within gryphn")
});
}
(*(PFN_gnDestroyInstance*)next->function)(instance, next->next);
}
gnPhysicalDevice* checkGetPhysicalDevices(gnInstanceHandle instance, uint32_t* count) {
@@ -19,11 +30,11 @@ gnBool checkCanDevicePresent(gnPhysicalDevice device, gnWindowSurfaceHandle wind
CHECK_RETURNED_FUNCTION(device->instance, _gnPhysicalDeviceCanPresentToSurface, instanceFunctions, GN_FALSE, device, windowSurface);
}
gnReturnCode checkCreateOutputDevice(gnOutputDeviceHandle device, gnInstanceHandle instance, gnOutputDeviceInfo deviceInfo) {
CHECK_FUNCTION_WITH_RETURN_CODE(instance, _gnCreateOutputDevice, instanceFunctions, device, instance, deviceInfo);
gnReturnCode checkCreateOutputDevice(gnInstanceHandle instance, gnOutputDeviceHandle device, gnOutputDeviceInfo deviceInfo) {
CHECK_FUNCTION_WITH_RETURN_CODE(instance, _gnCreateOutputDevice, instanceFunctions, instance, device, deviceInfo);
}
void checkDestroyOutputDevice(gnOutputDeviceHandle device) {
CHECK_VOID_FUNCTION(device->instance, _gnDestroyOutputDevice, instanceFunctions, device);
void checkDestroyOutputDevice(gnInstanceHandle instance, gnOutputDeviceHandle device) {
CHECK_VOID_FUNCTION(device->instance, _gnDestroyOutputDevice, instanceFunctions, instance, device);
}
#ifdef GN_PLATFORM_MACOS

View File

@@ -2,14 +2,14 @@
#include "core/src/instance/gryphn_instance.h"
#include <core/src/window_surface/gryphn_surface_create_functions.h>
gnReturnCode checkCreateInstance(gnInstanceHandle instance, gnInstanceCreateInfo* info);
void checkDestroyInstance(gnInstance instance);
gnReturnCode checkCreateInstance(gnInstanceHandle instance, gnInstanceCreateInfo* info, gryphnFunctionLayer* next);
void checkDestroyInstance(gnInstanceHandle instance, gryphnFunctionLayer* next);
gnPhysicalDevice* checkGetPhysicalDevices(gnInstanceHandle instance, uint32_t* count);
gnBool checkCanDevicePresent(gnPhysicalDevice device, gnWindowSurfaceHandle windowSurface);
gnReturnCode checkCreateOutputDevice(gnOutputDeviceHandle device, gnInstanceHandle instance, gnOutputDeviceInfo deviceInfo);
void checkDestroyOutputDevice(gnOutputDeviceHandle device);
gnReturnCode checkCreateOutputDevice(gnInstanceHandle instance, gnOutputDeviceHandle device, gnOutputDeviceInfo deviceInfo);
void checkDestroyOutputDevice(gnInstanceHandle instance, gnOutputDeviceHandle device);
#ifdef GN_PLATFORM_MACOS
gnReturnCode checkCreateSurfaceMacOS(gnWindowSurfaceHandle windowSurface, gnInstanceHandle instance, gnMacOSWindowSurfaceInfo createInfo);