finish queryDevices function
This commit is contained in:
@@ -8,5 +8,5 @@ typedef struct gnPlatformInstance_t {
|
|||||||
} gnPlatformInstance;
|
} gnPlatformInstance;
|
||||||
|
|
||||||
gnReturnCode metalCreateInstance(gnInstanceHandle instance, gnInstanceCreateInfo* instanceInfo, gryphnInstanceFunctionLayers* next, gnAllocators* allocators);
|
gnReturnCode metalCreateInstance(gnInstanceHandle instance, gnInstanceCreateInfo* instanceInfo, gryphnInstanceFunctionLayers* next, gnAllocators* allocators);
|
||||||
gnReturnCode metalQueryDevices(gnInstanceHandle instance, uint32_t* count, gnPhysicalDeviceHandle* devices);
|
gnReturnCode metalQueryDevices(gnInstanceHandle instance, uint32_t* count, gnPhysicalDeviceHandle* devices, gryphnInstanceFunctionLayers* next);
|
||||||
void metalDestroyInstance(gnInstance instance, gryphnInstanceFunctionLayers* next, gnAllocators* allocators);
|
void metalDestroyInstance(gnInstance instance, gryphnInstanceFunctionLayers* next, gnAllocators* allocators);
|
||||||
|
@@ -8,7 +8,7 @@ gnReturnCode metalCreateInstance(gnInstanceHandle instance, gnInstanceCreateInfo
|
|||||||
instance->instance = allocators->malloc(sizeof(gnPlatformInstance), allocators->userData);
|
instance->instance = allocators->malloc(sizeof(gnPlatformInstance), allocators->userData);
|
||||||
return GN_SUCCESS;
|
return GN_SUCCESS;
|
||||||
}
|
}
|
||||||
gnReturnCode metalQueryDevices(gnInstanceHandle instance, uint32_t* count, gnPhysicalDeviceHandle* devices) {
|
gnReturnCode metalQueryDevices(gnInstanceHandle instance, uint32_t* count, gnPhysicalDeviceHandle* devices, gryphnInstanceFunctionLayers* next) {
|
||||||
if (instance == GN_NULL_HANDLE) return NULL;
|
if (instance == GN_NULL_HANDLE) return NULL;
|
||||||
NSArray *metalDevices = MTLCopyAllDevices();
|
NSArray *metalDevices = MTLCopyAllDevices();
|
||||||
*count = (uint32_t)[metalDevices count];
|
*count = (uint32_t)[metalDevices count];
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
#include "vulkan_instance.h"
|
#include "vulkan_instance.h"
|
||||||
|
// #include "output_device/vulkan_physical_device.h"
|
||||||
#include "vulkan_result_converter.h"
|
#include "vulkan_result_converter.h"
|
||||||
GN_ARRAY_LIST_DEFINITION(vkString)
|
GN_ARRAY_LIST_DEFINITION(vkString)
|
||||||
|
|
||||||
@@ -109,6 +110,40 @@ gnReturnCode vulkanCreateInstance(gnInstanceHandle instance, gnInstanceCreateInf
|
|||||||
return VkResultToGnReturnCode(vkCreateInstance(&createInfo, NULL, &instance->instance->vk_instance));
|
return VkResultToGnReturnCode(vkCreateInstance(&createInfo, NULL, &instance->instance->vk_instance));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gnReturnCode vulkanQueryDevices(gnInstanceHandle handle, uint32_t* count, gnPhysicalDeviceHandle* devices, gryphnInstanceFunctionLayers* next) {
|
||||||
|
return VkResultToGnReturnCode(vkEnumeratePhysicalDevices(handle->instance->vk_instance, count, NULL));
|
||||||
|
}
|
||||||
|
// for (uint32_t i = 0; i < *count; i++) {
|
||||||
|
// outputDevices[i] = (uint64_t)malloc(sizeof(vulkanPhysicalDevice));
|
||||||
|
// vulkanPhysicalDevice* device = (vulkanPhysicalDevice*)outputDevices[i];
|
||||||
|
// device->device = physicalDevices[i];
|
||||||
|
|
||||||
|
// VkPhysicalDeviceProperties deviceProperties;
|
||||||
|
// vkGetPhysicalDeviceProperties(physicalDevices[i], &deviceProperties);
|
||||||
|
// device->properties.name = gnCreateString(deviceProperties.deviceName);
|
||||||
|
// switch(deviceProperties.deviceType) {
|
||||||
|
// case VK_PHYSICAL_DEVICE_TYPE_OTHER: device->properties.deviceType = GN_EXTERNAL_DEVICE;
|
||||||
|
// case VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU: device->properties.deviceType = GN_INTEGRATED_DEVICE;
|
||||||
|
// case VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU: device->properties.deviceType = GN_DEDICATED_DEVICE;
|
||||||
|
// case VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU: device->properties.deviceType = GN_INTEGRATED_DEVICE;
|
||||||
|
// case VK_PHYSICAL_DEVICE_TYPE_CPU: device->properties.deviceType = GN_INTEGRATED_DEVICE;
|
||||||
|
// case VK_PHYSICAL_DEVICE_TYPE_MAX_ENUM: device->properties.deviceType = GN_INTEGRATED_DEVICE;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if (handle->enabledExtensions[GN_EXT_QUEUES] == GN_FALSE)
|
||||||
|
// vulkanLoadNeededQueues(outputDevices[i]);
|
||||||
|
|
||||||
|
|
||||||
|
// VkPhysicalDeviceProperties physicalDeviceProperties;
|
||||||
|
// vkGetPhysicalDeviceProperties(physicalDevices[i], &physicalDeviceProperties);
|
||||||
|
// device->features.maxColorSamples = vkSampleCountToGryphn(physicalDeviceProperties.limits.framebufferColorSampleCounts);
|
||||||
|
// device->features.maxDepthSamples = vkSampleCountToGryphn(physicalDeviceProperties.limits.framebufferDepthSampleCounts);
|
||||||
|
// device->features.maxMemoryAllocations = physicalDeviceProperties.limits.maxMemoryAllocationCount;
|
||||||
|
// device->features.maxPushConstantSize = physicalDeviceProperties.limits.maxPushConstantsSize;
|
||||||
|
// }
|
||||||
|
// free(physicalDevices);
|
||||||
|
// return outputDevices;
|
||||||
|
|
||||||
void vulkanDestroyInstance(gnInstanceHandle instance, gryphnInstanceFunctionLayers* next, gnAllocators* alloctors) {
|
void vulkanDestroyInstance(gnInstanceHandle instance, gryphnInstanceFunctionLayers* next, gnAllocators* alloctors) {
|
||||||
if (next != NULL) { return; }
|
if (next != NULL) { return; }
|
||||||
vkDestroyInstance(instance->instance->vk_instance, NULL);
|
vkDestroyInstance(instance->instance->vk_instance, NULL);
|
||||||
|
@@ -4,6 +4,8 @@
|
|||||||
#include "utils/lists/gryphn_array_list.h"
|
#include "utils/lists/gryphn_array_list.h"
|
||||||
#include "loader/src/gryphn_instance_functions.h"
|
#include "loader/src/gryphn_instance_functions.h"
|
||||||
|
|
||||||
|
void vulkanLoadNeededQueues(gnPhysicalDevice physicalDevice);
|
||||||
|
|
||||||
typedef struct vkUserData {
|
typedef struct vkUserData {
|
||||||
gnDebuggerCallback debuggerCallback;
|
gnDebuggerCallback debuggerCallback;
|
||||||
void* userData;
|
void* userData;
|
||||||
@@ -15,6 +17,7 @@ typedef struct gnPlatformInstance_t {
|
|||||||
} gnPlatformInstance;
|
} gnPlatformInstance;
|
||||||
|
|
||||||
gnReturnCode vulkanCreateInstance(gnInstanceHandle instance, gnInstanceCreateInfo* instanceInfo, gryphnInstanceFunctionLayers* next, gnAllocators* alloctors);
|
gnReturnCode vulkanCreateInstance(gnInstanceHandle instance, gnInstanceCreateInfo* instanceInfo, gryphnInstanceFunctionLayers* next, gnAllocators* alloctors);
|
||||||
|
gnReturnCode vulkanQueryDevices(gnInstanceHandle handle, uint32_t* count, gnPhysicalDeviceHandle* devices, gryphnInstanceFunctionLayers* next);
|
||||||
void vulkanDestroyInstance(gnInstanceHandle instance, gryphnInstanceFunctionLayers* next, gnAllocators* alloctors);
|
void vulkanDestroyInstance(gnInstanceHandle instance, gryphnInstanceFunctionLayers* next, gnAllocators* alloctors);
|
||||||
|
|
||||||
typedef const char* vkString;
|
typedef const char* vkString;
|
||||||
|
@@ -21,7 +21,7 @@ typedef struct gnOutputDeviceInfo gnOutputDeviceInfo;
|
|||||||
|
|
||||||
typedef struct gryphnInstanceFunctionLayers gryphnInstanceFunctionLayers;
|
typedef struct gryphnInstanceFunctionLayers gryphnInstanceFunctionLayers;
|
||||||
typedef gnReturnCode (*PFN_gnCreateInstance)(gnInstanceHandle, gnInstanceCreateInfo*, gryphnInstanceFunctionLayers*, gnAllocators*);
|
typedef gnReturnCode (*PFN_gnCreateInstance)(gnInstanceHandle, gnInstanceCreateInfo*, gryphnInstanceFunctionLayers*, gnAllocators*);
|
||||||
typedef gnReturnCode (*PFN_gnInstanceQueryDevices)(gnInstanceHandle, uint32_t*, gnPhysicalDeviceHandle*);
|
typedef gnReturnCode (*PFN_gnInstanceQueryDevices)(gnInstanceHandle, uint32_t*, gnPhysicalDeviceHandle*, gryphnInstanceFunctionLayers*);
|
||||||
typedef void (*PFN_gnDestroyInstance)(gnInstanceHandle, gryphnInstanceFunctionLayers*, gnAllocators*);
|
typedef void (*PFN_gnDestroyInstance)(gnInstanceHandle, gryphnInstanceFunctionLayers*, gnAllocators*);
|
||||||
|
|
||||||
typedef struct gnInstanceFunctions {
|
typedef struct gnInstanceFunctions {
|
||||||
|
@@ -24,8 +24,14 @@ void checkDestroyInstance(gnInstanceHandle instance, gryphnInstanceFunctionLayer
|
|||||||
next->destroyInstance(instance, next->next, alloctors);
|
next->destroyInstance(instance, next->next, alloctors);
|
||||||
}
|
}
|
||||||
|
|
||||||
gnPhysicalDevice* checkGetPhysicalDevices(gnInstanceHandle instance, uint32_t* count) {
|
gnReturnCode checkQueryDevices(gnInstanceHandle instance, uint32_t* count, gnPhysicalDeviceHandle* devices, gryphnInstanceFunctionLayers* next) {
|
||||||
CHECK_RETURNED_FUNCTION(instance, _gnGetPhysicalDevices, instanceFunctions, NULL, instance, count);
|
if (next == NULL || next->queryDevices == 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->queryDevices(instance, count, devices, 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);
|
||||||
|
@@ -3,9 +3,9 @@
|
|||||||
#include <core/src/window_surface/gryphn_surface_create_functions.h>
|
#include <core/src/window_surface/gryphn_surface_create_functions.h>
|
||||||
|
|
||||||
gnReturnCode checkCreateInstance(gnInstanceHandle instance, gnInstanceCreateInfo* info, gryphnInstanceFunctionLayers* next, gnAllocators* alloctors);
|
gnReturnCode checkCreateInstance(gnInstanceHandle instance, gnInstanceCreateInfo* info, gryphnInstanceFunctionLayers* next, gnAllocators* alloctors);
|
||||||
|
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);
|
||||||
|
|
||||||
gnPhysicalDevice* checkGetPhysicalDevices(gnInstanceHandle instance, uint32_t* count);
|
|
||||||
gnBool checkCanDevicePresent(gnPhysicalDevice device, gnWindowSurfaceHandle windowSurface);
|
gnBool checkCanDevicePresent(gnPhysicalDevice device, gnWindowSurfaceHandle windowSurface);
|
||||||
|
|
||||||
gnReturnCode checkCreateOutputDevice(gnInstanceHandle instance, gnOutputDeviceHandle device, gnOutputDeviceInfo deviceInfo);
|
gnReturnCode checkCreateOutputDevice(gnInstanceHandle instance, gnOutputDeviceHandle device, gnOutputDeviceInfo deviceInfo);
|
||||||
|
Reference in New Issue
Block a user