instance suitability functions

This commit is contained in:
Gregory Wells
2025-09-10 13:26:18 -04:00
parent 0310652abc
commit a446d6e75f
10 changed files with 36 additions and 34 deletions

View File

@@ -113,36 +113,13 @@ gnReturnCode vulkanCreateInstance(gnInstanceHandle instance, gnInstanceCreateInf
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;
gnBool vulkanIsInstanceSuitable(gnInstanceHandle instance, gnSuitableField field, gryphnInstanceFunctionLayers* next) {
switch (field) {
case GN_NON_EXISTANT_PHYSICAL_DEVICE: return GN_FALSE;
}
return GN_FALSE;
}
void vulkanDestroyInstance(gnInstanceHandle instance, gryphnInstanceFunctionLayers* next, gnAllocators* alloctors) {
if (next != NULL) { return; }

View File

@@ -17,6 +17,7 @@ typedef struct gnPlatformInstance_t {
} gnPlatformInstance;
gnReturnCode vulkanCreateInstance(gnInstanceHandle instance, gnInstanceCreateInfo* instanceInfo, gryphnInstanceFunctionLayers* next, gnAllocators* alloctors);
gnBool vulkanIsInstanceSuitable(gnInstanceHandle instance, gnSuitableField field, gryphnInstanceFunctionLayers* next);
gnReturnCode vulkanQueryDevices(gnInstanceHandle handle, uint32_t* count, gnPhysicalDeviceHandle* devices, gryphnInstanceFunctionLayers* next);
void vulkanDestroyInstance(gnInstanceHandle instance, gryphnInstanceFunctionLayers* next, gnAllocators* alloctors);