Device type
This commit is contained in:
@@ -11,9 +11,16 @@ gnPhysicalDevice* gnGetPhysicalDevicesFn(gnInstance* instance, uint32_t* deviceC
|
||||
devicesList[i].physicalDevice = malloc(sizeof(gnPlatformPhysicalDevice));
|
||||
devicesList[i].physicalDevice->device = [devices objectAtIndex:0];
|
||||
|
||||
|
||||
id<MTLDevice> device = [devices objectAtIndex:0];
|
||||
devicesList[i].properties.name = gnCreateString([[device name] cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
|
||||
MTLDeviceLocation deviceLocation = device.locationNumber;
|
||||
if (deviceLocation == MTLDeviceLocationBuiltIn)
|
||||
devicesList[i].properties.deviceType = GN_INTEGRATED_DEVICE;
|
||||
else if (deviceLocation == MTLDeviceLocationSlot)
|
||||
devicesList[i].properties.deviceType = GN_DEDICATED_DEVICE;
|
||||
else if (deviceLocation == MTLDeviceLocationExternal)
|
||||
devicesList[i].properties.deviceType = GN_EXTERNAL_DEVICE;
|
||||
|
||||
// below I am going to fake that there is one queue that can support graphics, compute, and transfer queues
|
||||
devicesList[i].queueProperties.queueProperties = malloc(sizeof(gnQueueProperties));
|
||||
|
@@ -19,6 +19,14 @@ gnPhysicalDevice* gnGetPhysicalDevicesFn(gnInstance* instance, uint32_t* deviceC
|
||||
VkPhysicalDeviceProperties deviceProperties;
|
||||
vkGetPhysicalDeviceProperties(physicalDevices[i], &deviceProperties);
|
||||
outputDevices[i].properties.name = gnCreateString(deviceProperties.deviceName);
|
||||
switch(deviceProperties.deviceType) {
|
||||
case VK_PHYSICAL_DEVICE_TYPE_OTHER: outputDevices[i].properties.deviceType = GN_EXTERNAL_DEVICE;
|
||||
case VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU: outputDevices[i].properties.deviceType = GN_INTEGRATED_DEVICE;
|
||||
case VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU: outputDevices[i].properties.deviceType = GN_DEDICATED_DEVICE;
|
||||
case VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU: outputDevices[i].properties.deviceType = GN_INTEGRATED_DEVICE;
|
||||
case VK_PHYSICAL_DEVICE_TYPE_CPU: outputDevices[i].properties.deviceType = GN_INTEGRATED_DEVICE;
|
||||
case VK_PHYSICAL_DEVICE_TYPE_MAX_ENUM: outputDevices[i].properties.deviceType = GN_INTEGRATED_DEVICE;
|
||||
}
|
||||
|
||||
vkGetPhysicalDeviceQueueFamilyProperties(physicalDevices[i], &outputDevices[i].queueProperties.queueCount, NULL);
|
||||
|
||||
|
@@ -4,12 +4,17 @@
|
||||
struct gnPlatformPhysicalDevice_t;
|
||||
struct gnWindowSurface_t;
|
||||
|
||||
typedef enum gnDeviceType_e {
|
||||
GN_DEDICATED_DEVICE, GN_INTEGRATED_DEVICE, GN_EXTERNAL_DEVICE
|
||||
} gnDeviceType;
|
||||
|
||||
typedef struct gnPhysicalDeviceProperties_t {
|
||||
gnString name;
|
||||
gnDeviceType deviceType;
|
||||
} gnPhysicalDeviceProperties;
|
||||
|
||||
typedef struct gnPhysicalDeviceFeatures_t {
|
||||
// no freatures
|
||||
|
||||
} gnPhysicalDeviceFeatures;
|
||||
|
||||
typedef enum gnQueueTypeFlags_e {
|
||||
|
Reference in New Issue
Block a user