diff --git a/projects/validation_layers/function_loader/loader/function_loader.c b/projects/validation_layers/function_loader/loader/function_loader.c index 517aec1..c629be5 100644 --- a/projects/validation_layers/function_loader/loader/function_loader.c +++ b/projects/validation_layers/function_loader/loader/function_loader.c @@ -11,6 +11,9 @@ gryphnInstanceFunctionLayers checkerLoadInstanceFunctions(void) { .isSuitable = checkIsInstanceSuitable, .queryDevices = checkQueryDevices, .destroyInstance = checkDestroyInstance, + .getPhysicalDeviceProperties = checkQueryPhysicalDeviceProperties, + .getPhysicalDeviceFeatures = checkQueryPhysicalDeviceFeatures, + .getPhysicalDeviceLimits = checkQueryPhysicalDeviceLimits, .next = GN_NULL_HANDLE }; } diff --git a/projects/validation_layers/function_loader/src/instance_functions.c b/projects/validation_layers/function_loader/src/instance_functions.c index 4f8d346..f2a1e92 100644 --- a/projects/validation_layers/function_loader/src/instance_functions.c +++ b/projects/validation_layers/function_loader/src/instance_functions.c @@ -27,7 +27,7 @@ void checkDestroyInstance(gnInstanceHandle instance, gryphnInstanceFunctionLayer 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") + .message = gnCreateString("Failed to load gnIsInstanceSuitable this indicates a bug within gryphn") }); 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) { if (next == NULL || next->queryDevices == NULL) { 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 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) { CHECK_RETURNED_FUNCTION(device->instance, _gnPhysicalDeviceCanPresentToSurface, instanceFunctions, GN_FALSE, device, windowSurface); } diff --git a/projects/validation_layers/function_loader/src/instance_functions.h b/projects/validation_layers/function_loader/src/instance_functions.h index 3e2b58d..5f7bf77 100644 --- a/projects/validation_layers/function_loader/src/instance_functions.h +++ b/projects/validation_layers/function_loader/src/instance_functions.h @@ -7,8 +7,12 @@ gnBool checkIsInstanceSuitable(gnInstanceHandle instance, gnSuitableField field, gnReturnCode checkQueryDevices(gnInstanceHandle instance, uint32_t* count, gnPhysicalDeviceHandle* devices, gryphnInstanceFunctionLayers* next); 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); void checkDestroyOutputDevice(gnOutputDeviceHandle device);