device present to surface checks
This commit is contained in:
@@ -7,6 +7,7 @@ gnReturnCode gnCreateDebugger(gnDebugger* debugger, gnInstance* instance, const
|
||||
return GN_DEBUGGER_EXISTS;
|
||||
debugger->info = info;
|
||||
debugger->instance = instance;
|
||||
instance->debugger = debugger;
|
||||
return instance->functions->_gnCreateDebugger(debugger, instance, info);
|
||||
}
|
||||
void gnDestroyDebugger(gnDebugger* debugger) {
|
||||
|
@@ -15,10 +15,14 @@ typedef struct gnFunctions_t {
|
||||
void (*_gnDestroyDebugger)(gnDebugger* debugger);
|
||||
|
||||
gnPhysicalDevice* (*_gnGetPhysicalDevices)(gnInstance* instance, uint32_t* count);
|
||||
gnBool (*_gnQueueCanPresentToSurface)(const struct gnPhysicalDevice_t device, uint32_t queueIndex, const struct gnWindowSurface_t windowSurface);
|
||||
|
||||
|
||||
gnReturnCode (*_gnCreateOutputDevoce)(gnOutputDevice* device, gnInstance* instance, struct gnOutputDeviceInfo_t deviceInfo);
|
||||
void (*_gnDestroyOutputDevice)(gnOutputDevice* device);
|
||||
|
||||
|
||||
|
||||
#ifdef GN_PLATFORM_LINUX
|
||||
#ifdef GN_WINDOW_X11
|
||||
gnReturnCode (*_gnCreateX11WindowSurface)(struct gnWindowSurface_t* windowSurface, gnInstance* instance, struct gnX11WindowSurfaceInfo_t createInfo);
|
||||
|
@@ -42,6 +42,7 @@ void gnLoadFunctions(struct gnDynamicLibrary_t* lib, struct gnFunctions_t* funct
|
||||
gnLoadDLLFunction(lib, functions->_gnCreateDebugger, "gnCreateDebuggerFn");
|
||||
gnLoadDLLFunction(lib, functions->_gnDestroyDebugger, "gnDestroyDebuggerFn");
|
||||
gnLoadDLLFunction(lib, functions->_gnGetPhysicalDevices, "gnGetPhysicalDevicesFn");
|
||||
gnLoadDLLFunction(lib, functions->_gnQueueCanPresentToSurface, "gnQueueCanPresentToSurfaceFn");
|
||||
gnLoadDLLFunction(lib, functions->_gnCreateOutputDevoce, "gnCreateOutputDeviceFn");
|
||||
gnLoadDLLFunction(lib, functions->_gnDestroyOutputDevice, "gnDestroyOutputDeviceFn");
|
||||
|
||||
|
@@ -1,5 +1,7 @@
|
||||
#include "gryphn_physical_output_device.h"
|
||||
#include "core/gryphn_platform_functions.h"
|
||||
#include "core/window_surface/gryphn_surface.h"
|
||||
#include "stdio.h"
|
||||
|
||||
gnPhysicalDevice* gnGetPhyscialDevices(gnInstance* instance, uint32_t* count) {
|
||||
gnPhysicalDevice* devices = instance->functions->_gnGetPhysicalDevices(instance, count);
|
||||
@@ -8,3 +10,18 @@ gnPhysicalDevice* gnGetPhyscialDevices(gnInstance* instance, uint32_t* count) {
|
||||
}
|
||||
return devices;
|
||||
}
|
||||
|
||||
gnBool gnQueueCanPresentToSurface(const struct gnPhysicalDevice_t device, uint32_t queueIndex, const struct gnWindowSurface_t windowSurface) {
|
||||
if (queueIndex >= device.queueProperties.queueCount) {
|
||||
device.instance->debugger->info.callback(
|
||||
GN_MESSAGE_ERROR,
|
||||
GN_DEBUG_MESSAGE_VALIDATION,
|
||||
(gnMessageData){
|
||||
.message = gnCreateString("gnQueueCanPresentToSurface queue index passed in is large then queueProperties.queueCount")
|
||||
},
|
||||
NULL
|
||||
);
|
||||
return gnFalse;
|
||||
}
|
||||
return device.instance->functions->_gnQueueCanPresentToSurface(device, queueIndex, windowSurface);
|
||||
}
|
||||
|
@@ -2,6 +2,7 @@
|
||||
#include "core/instance/gryphn_instance.h"
|
||||
|
||||
struct gnPlatformPhysicalDevice_t;
|
||||
struct gnWindowSurface_t;
|
||||
|
||||
typedef struct gnPhysicalDeviceProperties_t {
|
||||
gnString name;
|
||||
@@ -38,3 +39,4 @@ typedef struct gnPhysicalDevice_t {
|
||||
} gnPhysicalDevice;
|
||||
|
||||
gnPhysicalDevice* gnGetPhyscialDevices(gnInstance* instance, uint32_t* count);
|
||||
gnBool gnQueueCanPresentToSurface(const struct gnPhysicalDevice_t device, uint32_t queueIndex, const struct gnWindowSurface_t windowSurface);
|
||||
|
Reference in New Issue
Block a user