check functions for new API

This commit is contained in:
Gregory Wells
2025-09-19 09:29:55 -04:00
parent 427f0ee5b1
commit 3066f7c2bd
3 changed files with 44 additions and 3 deletions

View File

@@ -11,6 +11,9 @@ gryphnInstanceFunctionLayers checkerLoadInstanceFunctions(void) {
.isSuitable = checkIsInstanceSuitable, .isSuitable = checkIsInstanceSuitable,
.queryDevices = checkQueryDevices, .queryDevices = checkQueryDevices,
.destroyInstance = checkDestroyInstance, .destroyInstance = checkDestroyInstance,
.getPhysicalDeviceProperties = checkQueryPhysicalDeviceProperties,
.getPhysicalDeviceFeatures = checkQueryPhysicalDeviceFeatures,
.getPhysicalDeviceLimits = checkQueryPhysicalDeviceLimits,
.next = GN_NULL_HANDLE .next = GN_NULL_HANDLE
}; };
} }

View File

@@ -27,7 +27,7 @@ void checkDestroyInstance(gnInstanceHandle instance, gryphnInstanceFunctionLayer
gnBool checkIsInstanceSuitable(gnInstanceHandle instance, gnSuitableField field, gryphnInstanceFunctionLayers* next) { gnBool checkIsInstanceSuitable(gnInstanceHandle instance, gnSuitableField field, gryphnInstanceFunctionLayers* next) {
if (next == NULL || next->isSuitable == NULL) { if (next == NULL || next->isSuitable == NULL) {
gnDebuggerSetErrorMessage(instance->debugger, (gnMessageData){ gnDebuggerSetErrorMessage(instance->debugger, (gnMessageData){
.message = gnCreateString("Failed to load gnCreateInstance this indicates a bug within gryphn") .message = gnCreateString("Failed to load gnIsInstanceSuitable this indicates a bug within gryphn")
}); });
return GN_FAILED_TO_LOAD_FUNCTION; return GN_FAILED_TO_LOAD_FUNCTION;
} }
@@ -37,12 +37,46 @@ gnBool checkIsInstanceSuitable(gnInstanceHandle instance, gnSuitableField field,
gnReturnCode checkQueryDevices(gnInstanceHandle instance, uint32_t* count, gnPhysicalDeviceHandle* devices, gryphnInstanceFunctionLayers* next) { gnReturnCode checkQueryDevices(gnInstanceHandle instance, uint32_t* count, gnPhysicalDeviceHandle* devices, gryphnInstanceFunctionLayers* next) {
if (next == NULL || next->queryDevices == NULL) { if (next == NULL || next->queryDevices == NULL) {
gnDebuggerSetErrorMessage(instance->debugger, (gnMessageData){ gnDebuggerSetErrorMessage(instance->debugger, (gnMessageData){
.message = gnCreateString("Failed to load gnCreateInstance this indicates a bug within gryphn") .message = gnCreateString("Failed to load gnQueryDevices this indicates a bug within gryphn")
}); });
return GN_FAILED_TO_LOAD_FUNCTION; return GN_FAILED_TO_LOAD_FUNCTION;
} }
return next->queryDevices(instance, count, devices, next->next); return next->queryDevices(instance, count, devices, next->next);
} }
gnPhysicalDeviceProperties checkQueryPhysicalDeviceProperties(gnInstanceHandle instance, gnPhysicalDeviceHandle device, gryphnInstanceFunctionLayers* next) {
if (next == NULL || next->getPhysicalDeviceProperties == NULL) {
gnDebuggerSetErrorMessage(instance->debugger, (gnMessageData){
.message = gnCreateString("Failed to load gnQueryPhysicalDeviceProperties this indicates a bug within gryphn")
});
return (gnPhysicalDeviceProperties){
.deviceID = -1,
.deviceName = gnCreateString("Invalid device"),
.deviceType = GN_PHYSICAL_DEVICE_TYPE_FAKED_GPU,
.driverVersion = -1
};
}
return next->getPhysicalDeviceProperties(instance, device, next->next);
}
gnPhysicalDeviceFeatures checkQueryPhysicalDeviceFeatures(gnInstanceHandle instance, gnPhysicalDeviceHandle device, gryphnInstanceFunctionLayers* next) {
if (next == NULL || next->getPhysicalDeviceFeatures == NULL) {
gnDebuggerSetErrorMessage(instance->debugger, (gnMessageData){
.message = gnCreateString("Failed to load gnQueryPhysicalDeviceFeatures this indicates a bug within gryphn")
});
return (gnPhysicalDeviceFeatures){};
}
return next->getPhysicalDeviceFeatures(instance, device, next->next);
}
gnPhysicalDeviceLimits checkQueryPhysicalDeviceLimits(gnInstanceHandle instance, gnPhysicalDeviceHandle device, gryphnInstanceFunctionLayers* next) {
if (next == NULL || next->getPhysicalDeviceLimits == NULL) {
gnDebuggerSetErrorMessage(instance->debugger, (gnMessageData){
.message = gnCreateString("Failed to load gnQueryPhysicalDeviceLimits this indicates a bug within gryphn")
});
return (gnPhysicalDeviceLimits){};
}
return next->getPhysicalDeviceLimits(instance, device, next->next);
}
gnBool checkCanDevicePresent(gnPhysicalDevice device, gnWindowSurfaceHandle windowSurface) { gnBool checkCanDevicePresent(gnPhysicalDevice device, gnWindowSurfaceHandle windowSurface) {
CHECK_RETURNED_FUNCTION(device->instance, _gnPhysicalDeviceCanPresentToSurface, instanceFunctions, GN_FALSE, device, windowSurface); CHECK_RETURNED_FUNCTION(device->instance, _gnPhysicalDeviceCanPresentToSurface, instanceFunctions, GN_FALSE, device, windowSurface);
} }

View File

@@ -7,8 +7,12 @@ gnBool checkIsInstanceSuitable(gnInstanceHandle instance, gnSuitableField field,
gnReturnCode checkQueryDevices(gnInstanceHandle instance, uint32_t* count, gnPhysicalDeviceHandle* devices, gryphnInstanceFunctionLayers* next); gnReturnCode checkQueryDevices(gnInstanceHandle instance, uint32_t* count, gnPhysicalDeviceHandle* devices, gryphnInstanceFunctionLayers* next);
void checkDestroyInstance(gnInstanceHandle instance, gryphnInstanceFunctionLayers* next, gnAllocators* alloctors); void checkDestroyInstance(gnInstanceHandle instance, gryphnInstanceFunctionLayers* next, gnAllocators* alloctors);
gnBool checkCanDevicePresent(gnPhysicalDevice device, gnWindowSurfaceHandle windowSurface); gnPhysicalDeviceProperties checkQueryPhysicalDeviceProperties(gnInstanceHandle instance, gnPhysicalDeviceHandle device, gryphnInstanceFunctionLayers* next);
gnPhysicalDeviceFeatures checkQueryPhysicalDeviceFeatures(gnInstanceHandle instance, gnPhysicalDeviceHandle device, gryphnInstanceFunctionLayers* next);
gnPhysicalDeviceLimits checkQueryPhysicalDeviceLimits(gnInstanceHandle instance, gnPhysicalDeviceHandle device, gryphnInstanceFunctionLayers* next);
// old ahh functions (currently working on removing)
gnBool checkCanDevicePresent(gnPhysicalDevice device, gnWindowSurfaceHandle windowSurface);
gnReturnCode checkCreateOutputDevice(gnInstanceHandle instance, gnOutputDeviceHandle device, gnOutputDeviceInfo deviceInfo); gnReturnCode checkCreateOutputDevice(gnInstanceHandle instance, gnOutputDeviceHandle device, gnOutputDeviceInfo deviceInfo);
void checkDestroyOutputDevice(gnOutputDeviceHandle device); void checkDestroyOutputDevice(gnOutputDeviceHandle device);