gnPhysicalDevice -> gnPhysicalOutputDeviceHandle (alias avail)
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
|
||||
gnReturnCode createMetalOutputDevice(gnOutputDeviceHandle outputDevice, gnInstanceHandle instance, gnOutputDeviceInfo deviceInfo) {
|
||||
outputDevice->outputDevice = malloc(sizeof(gnPlatformOutputDevice));
|
||||
outputDevice->outputDevice->device = deviceInfo.physicalDevice.physicalDevice->device.retain;
|
||||
outputDevice->outputDevice->device = deviceInfo.physicalDevice->physicalDevice->device.retain;
|
||||
outputDevice->outputDevice->transferQueue = outputDevice->outputDevice->device.newCommandQueue;
|
||||
return GN_SUCCESS;
|
||||
}
|
||||
|
@@ -8,38 +8,38 @@ gnPhysicalDevice* getMetalDevices(gnInstanceHandle instance, uint32_t* deviceCou
|
||||
*deviceCount = [devices count];
|
||||
gnPhysicalDevice* devicesList = (gnPhysicalDevice*)malloc(sizeof(gnPhysicalDevice) * *deviceCount);
|
||||
for (int i = 0; i < *deviceCount; i++) {
|
||||
devicesList[i].physicalDevice = malloc(sizeof(gnPlatformPhysicalDevice));
|
||||
devicesList[i].physicalDevice->device = [devices objectAtIndex:0];
|
||||
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]);
|
||||
devicesList[i]->properties.name = gnCreateString([[device name] cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
MTLDeviceLocation deviceLocation = device.locationNumber;
|
||||
if (deviceLocation == MTLDeviceLocationBuiltIn)
|
||||
devicesList[i].properties.deviceType = GN_INTEGRATED_DEVICE;
|
||||
devicesList[i]->properties.deviceType = GN_INTEGRATED_DEVICE;
|
||||
else if (deviceLocation == MTLDeviceLocationSlot)
|
||||
devicesList[i].properties.deviceType = GN_DEDICATED_DEVICE;
|
||||
devicesList[i]->properties.deviceType = GN_DEDICATED_DEVICE;
|
||||
else if (deviceLocation == MTLDeviceLocationExternal)
|
||||
devicesList[i].properties.deviceType = GN_EXTERNAL_DEVICE;
|
||||
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.queueCount = 1;
|
||||
devicesList[i].queueProperties.queueProperties = malloc(sizeof(gnQueueProperties));
|
||||
devicesList[i].queueProperties.queueProperties[0] = (gnQueueProperties){
|
||||
devicesList[i]->queueProperties.queueCount = 1;
|
||||
devicesList[i]->queueProperties.queueProperties = malloc(sizeof(gnQueueProperties));
|
||||
devicesList[i]->queueProperties.queueProperties[0] = (gnQueueProperties){
|
||||
.queueCount = 1,
|
||||
.queueType = GN_QUEUE_GRAPHICS | GN_QUEUE_COMPUTE | GN_QUEUE_TRANSFER
|
||||
};
|
||||
|
||||
if ([device supportsTextureSampleCount:1]) { devicesList[i].features.maxColorSamples |= GN_SAMPLE_BIT_1; }
|
||||
if ([device supportsTextureSampleCount:2]) { devicesList[i].features.maxColorSamples |= GN_SAMPLE_BIT_2; }
|
||||
if ([device supportsTextureSampleCount:4]) { devicesList[i].features.maxColorSamples |= GN_SAMPLE_BIT_4; }
|
||||
if ([device supportsTextureSampleCount:8]) { devicesList[i].features.maxColorSamples |= GN_SAMPLE_BIT_8; }
|
||||
if ([device supportsTextureSampleCount:16]) { devicesList[i].features.maxColorSamples |= GN_SAMPLE_BIT_16; }
|
||||
if ([device supportsTextureSampleCount:32]) { devicesList[i].features.maxColorSamples |= GN_SAMPLE_BIT_32; }
|
||||
devicesList[i].features.maxDepthSamples = devicesList[i].features.maxColorSamples;
|
||||
if ([device supportsTextureSampleCount:1]) { devicesList[i]->features.maxColorSamples |= GN_SAMPLE_BIT_1; }
|
||||
if ([device supportsTextureSampleCount:2]) { devicesList[i]->features.maxColorSamples |= GN_SAMPLE_BIT_2; }
|
||||
if ([device supportsTextureSampleCount:4]) { devicesList[i]->features.maxColorSamples |= GN_SAMPLE_BIT_4; }
|
||||
if ([device supportsTextureSampleCount:8]) { devicesList[i]->features.maxColorSamples |= GN_SAMPLE_BIT_8; }
|
||||
if ([device supportsTextureSampleCount:16]) { devicesList[i]->features.maxColorSamples |= GN_SAMPLE_BIT_16; }
|
||||
if ([device supportsTextureSampleCount:32]) { devicesList[i]->features.maxColorSamples |= GN_SAMPLE_BIT_32; }
|
||||
devicesList[i]->features.maxDepthSamples = devicesList[i]->features.maxColorSamples;
|
||||
|
||||
devicesList[i].features.maxMemoryAllocations = 0x40000000;
|
||||
devicesList[i].features.maxPushConstantSize = 4096;
|
||||
devicesList[i]->features.maxMemoryAllocations = 0x40000000;
|
||||
devicesList[i]->features.maxPushConstantSize = 4096;
|
||||
}
|
||||
[devices release];
|
||||
return devicesList;
|
||||
|
@@ -47,7 +47,7 @@ gnReturnCode VkCreateBuffer(
|
||||
VkMemoryAllocateInfo memoryAllocateInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,
|
||||
.allocationSize = bufferRequirements.size,
|
||||
.memoryTypeIndex = VkMemoryIndex(device->physicalDevice.physicalDevice->device, bufferRequirements.memoryTypeBits, flags, &foundMemory)
|
||||
.memoryTypeIndex = VkMemoryIndex(device->physicalDevice->physicalDevice->device, bufferRequirements.memoryTypeBits, flags, &foundMemory)
|
||||
};
|
||||
if (!foundMemory) return GN_FAILED_TO_ALLOCATE_MEMORY;
|
||||
|
||||
|
@@ -28,7 +28,7 @@ gnReturnCode createOutputDevice(gnOutputDeviceHandle outputDevice, gnInstanceHan
|
||||
.pQueueCreateInfos = queueCreateInfos,
|
||||
.pEnabledFeatures = &deviceFeatures
|
||||
};
|
||||
deviceCreateInfo.ppEnabledExtensionNames = vkGetGryphnDeviceExtensions(&deviceCreateInfo.enabledExtensionCount, deviceInfo.physicalDevice.physicalDevice->device);
|
||||
deviceCreateInfo.ppEnabledExtensionNames = vkGetGryphnDeviceExtensions(&deviceCreateInfo.enabledExtensionCount, deviceInfo.physicalDevice->physicalDevice->device);
|
||||
|
||||
outputDevice->outputDevice->enabledOversizedDescriptorPools = gnFalse;
|
||||
for (int i = 0; i < deviceCreateInfo.enabledExtensionCount; i++)
|
||||
@@ -42,7 +42,7 @@ gnReturnCode createOutputDevice(gnOutputDeviceHandle outputDevice, gnInstanceHan
|
||||
deviceCreateInfo.ppEnabledLayerNames = validation_layers;
|
||||
}
|
||||
|
||||
if (vkCreateDevice(deviceInfo.physicalDevice.physicalDevice->device, &deviceCreateInfo, NULL, &outputDevice->outputDevice->device) != VK_SUCCESS)
|
||||
if (vkCreateDevice(deviceInfo.physicalDevice->physicalDevice->device, &deviceCreateInfo, NULL, &outputDevice->outputDevice->device) != VK_SUCCESS)
|
||||
return GN_FAILED_TO_CREATE_DEVICE;
|
||||
|
||||
outputDevice->outputDevice->queues = malloc(sizeof(VkQueue) * deviceInfo.queueInfoCount);
|
||||
@@ -52,14 +52,14 @@ gnReturnCode createOutputDevice(gnOutputDeviceHandle outputDevice, gnInstanceHan
|
||||
|
||||
uint32_t queueCount = 0;
|
||||
vkGetPhysicalDeviceQueueFamilyProperties(
|
||||
deviceInfo.physicalDevice.physicalDevice->device,
|
||||
deviceInfo.physicalDevice->physicalDevice->device,
|
||||
&queueCount,
|
||||
NULL
|
||||
);
|
||||
|
||||
VkQueueFamilyProperties* queueFamilies = malloc(sizeof(VkQueueFamilyProperties) * queueCount);
|
||||
vkGetPhysicalDeviceQueueFamilyProperties(
|
||||
deviceInfo.physicalDevice.physicalDevice->device,
|
||||
deviceInfo.physicalDevice->physicalDevice->device,
|
||||
&queueCount,
|
||||
queueFamilies
|
||||
);
|
||||
|
@@ -41,52 +41,52 @@ gnPhysicalDevice* getPhysicalDevices(gnInstanceHandle instance, uint32_t* device
|
||||
gnPhysicalDevice* outputDevices = (gnPhysicalDevice*)malloc(sizeof(gnPhysicalDevice) * *deviceCount);
|
||||
|
||||
for (int i = 0; i < *deviceCount; i++) {
|
||||
outputDevices[i].physicalDevice = malloc(sizeof(struct gnPlatformPhysicalDevice_t));
|
||||
outputDevices[i].physicalDevice->device = physicalDevices[i];
|
||||
outputDevices[i]->physicalDevice = malloc(sizeof(struct gnPlatformPhysicalDevice_t));
|
||||
outputDevices[i]->physicalDevice->device = physicalDevices[i];
|
||||
|
||||
VkPhysicalDeviceProperties deviceProperties;
|
||||
vkGetPhysicalDeviceProperties(physicalDevices[i], &deviceProperties);
|
||||
outputDevices[i].properties.name = gnCreateString(deviceProperties.deviceName);
|
||||
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;
|
||||
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);
|
||||
vkGetPhysicalDeviceQueueFamilyProperties(physicalDevices[i], &outputDevices[i]->queueProperties.queueCount, NULL);
|
||||
|
||||
VkQueueFamilyProperties* queueFamilies = malloc(sizeof(VkQueueFamilyProperties) * outputDevices[i].queueProperties.queueCount);
|
||||
outputDevices[i].queueProperties.queueProperties = malloc(sizeof(gnQueueProperties) * outputDevices[i].queueProperties.queueCount);
|
||||
vkGetPhysicalDeviceQueueFamilyProperties(physicalDevices[i], &outputDevices[i].queueProperties.queueCount, queueFamilies);
|
||||
for (int c = 0; c < outputDevices[i].queueProperties.queueCount; c++) {
|
||||
outputDevices[i].queueProperties.queueProperties[i].queueCount = queueFamilies[i].queueCount;
|
||||
VkQueueFamilyProperties* queueFamilies = malloc(sizeof(VkQueueFamilyProperties) * outputDevices[i]->queueProperties.queueCount);
|
||||
outputDevices[i]->queueProperties.queueProperties = malloc(sizeof(gnQueueProperties) * outputDevices[i]->queueProperties.queueCount);
|
||||
vkGetPhysicalDeviceQueueFamilyProperties(physicalDevices[i], &outputDevices[i]->queueProperties.queueCount, queueFamilies);
|
||||
for (int c = 0; c < outputDevices[i]->queueProperties.queueCount; c++) {
|
||||
outputDevices[i]->queueProperties.queueProperties[i].queueCount = queueFamilies[i].queueCount;
|
||||
|
||||
gnQueueTypeFlags finalQueueType = 0;
|
||||
if (queueFamilies[i].queueFlags & VK_QUEUE_GRAPHICS_BIT) finalQueueType |= GN_QUEUE_GRAPHICS;
|
||||
if (queueFamilies[i].queueFlags & VK_QUEUE_COMPUTE_BIT) finalQueueType |= GN_QUEUE_COMPUTE;
|
||||
if (queueFamilies[i].queueFlags & VK_QUEUE_TRANSFER_BIT) finalQueueType |= GN_QUEUE_TRANSFER;
|
||||
if (queueFamilies[i].queueFlags & VK_QUEUE_SPARSE_BINDING_BIT) finalQueueType |= GN_QUEUE_SPARSE_BINDING;
|
||||
outputDevices[i].queueProperties.queueProperties[i].queueType = finalQueueType;
|
||||
outputDevices[i]->queueProperties.queueProperties[i].queueType = finalQueueType;
|
||||
}
|
||||
|
||||
VkPhysicalDeviceProperties physicalDeviceProperties;
|
||||
vkGetPhysicalDeviceProperties(physicalDevices[i], &physicalDeviceProperties);
|
||||
outputDevices[i].features.maxColorSamples = vkSampleCountToGryphn(physicalDeviceProperties.limits.framebufferColorSampleCounts);
|
||||
outputDevices[i].features.maxDepthSamples = vkSampleCountToGryphn(physicalDeviceProperties.limits.framebufferDepthSampleCounts);
|
||||
outputDevices[i].features.maxMemoryAllocations = physicalDeviceProperties.limits.maxMemoryAllocationCount;
|
||||
outputDevices[i].features.maxPushConstantSize = physicalDeviceProperties.limits.maxPushConstantsSize;
|
||||
outputDevices[i]->features.maxColorSamples = vkSampleCountToGryphn(physicalDeviceProperties.limits.framebufferColorSampleCounts);
|
||||
outputDevices[i]->features.maxDepthSamples = vkSampleCountToGryphn(physicalDeviceProperties.limits.framebufferDepthSampleCounts);
|
||||
outputDevices[i]->features.maxMemoryAllocations = physicalDeviceProperties.limits.maxMemoryAllocationCount;
|
||||
outputDevices[i]->features.maxPushConstantSize = physicalDeviceProperties.limits.maxPushConstantsSize;
|
||||
}
|
||||
free(physicalDevices);
|
||||
|
||||
return outputDevices;
|
||||
}
|
||||
|
||||
gnBool queueCanPresentToSurface(const gnPhysicalDevice device, uint32_t queueIndex, gnWindowSurfaceHandle windowSurface) {
|
||||
gnBool queueCanPresentToSurface(gnPhysicalDevice device, uint32_t queueIndex, gnWindowSurfaceHandle windowSurface) {
|
||||
VkBool32 supportsPresent = VK_FALSE;
|
||||
vkGetPhysicalDeviceSurfaceSupportKHR(device.physicalDevice->device, queueIndex, windowSurface->windowSurface->surface, &supportsPresent);
|
||||
vkGetPhysicalDeviceSurfaceSupportKHR(device->physicalDevice->device, queueIndex, windowSurface->windowSurface->surface, &supportsPresent);
|
||||
if (supportsPresent)
|
||||
return gnTrue;
|
||||
return gnFalse;
|
||||
|
@@ -9,7 +9,7 @@
|
||||
gnReturnCode createPresentationQueue(gnPresentationQueueHandle presentationQueue, const gnDevice device, gnPresentationQueueInfo presentationInfo) {
|
||||
presentationQueue->presentationQueue = malloc(sizeof(struct gnPlatformPresentationQueue_t));
|
||||
|
||||
vkSwapchainSupportDetails details = vkGetSwapchainSupport(device->physicalDevice.physicalDevice->device, presentationInfo.surface->windowSurface->surface);
|
||||
vkSwapchainSupportDetails details = vkGetSwapchainSupport(device->physicalDevice->physicalDevice->device, presentationInfo.surface->windowSurface->surface);
|
||||
VkFormat convertedFormat = vkGryphnFormatToVulkanFormat(presentationInfo.format.format);
|
||||
VkColorSpaceKHR convertedColorSpace = vkGryphnColorSpaceToVulkanColorSpace(presentationInfo.format.colorSpace);
|
||||
|
||||
|
@@ -182,7 +182,7 @@ gnReturnCode createTexture(gnTexture texture, gnDevice device, const gnTextureIn
|
||||
VkMemoryAllocateInfo allocInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,
|
||||
.allocationSize = memRequirements.size,
|
||||
.memoryTypeIndex = VkMemoryIndex(device->physicalDevice.physicalDevice->device, memRequirements.memoryTypeBits, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, &foundMemory)
|
||||
.memoryTypeIndex = VkMemoryIndex(device->physicalDevice->physicalDevice->device, memRequirements.memoryTypeBits, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, &foundMemory)
|
||||
};
|
||||
if (!foundMemory) return GN_FAILED_TO_ALLOCATE_MEMORY;
|
||||
|
||||
@@ -210,7 +210,7 @@ gnReturnCode createTexture(gnTexture texture, gnDevice device, const gnTextureIn
|
||||
return GN_FAILED_TO_CREATE_IMAGE_VIEW;
|
||||
|
||||
VkPhysicalDeviceProperties properties = {};
|
||||
vkGetPhysicalDeviceProperties(device->physicalDevice.physicalDevice->device, &properties);
|
||||
vkGetPhysicalDeviceProperties(device->physicalDevice->physicalDevice->device, &properties);
|
||||
|
||||
VkSamplerCreateInfo samplerInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO,
|
||||
|
@@ -65,12 +65,12 @@ gnSurfaceFormat* vkGetSurfaceFormats(
|
||||
) {
|
||||
gnSurfaceFormat* formats = NULL;
|
||||
|
||||
vkGetPhysicalDeviceSurfaceFormatsKHR(device.physicalDevice->device, windowSurface->windowSurface->surface, formatCount, NULL);
|
||||
vkGetPhysicalDeviceSurfaceFormatsKHR(device->physicalDevice->device, windowSurface->windowSurface->surface, formatCount, NULL);
|
||||
formats = malloc(sizeof(gnSurfaceFormat) * *formatCount);
|
||||
VkSurfaceFormatKHR* vkFormats = malloc(sizeof(VkSurfaceFormatKHR) * *formatCount);;
|
||||
|
||||
if (*formatCount > 0) {
|
||||
vkGetPhysicalDeviceSurfaceFormatsKHR(device.physicalDevice->device, windowSurface->windowSurface->surface, formatCount, vkFormats);
|
||||
vkGetPhysicalDeviceSurfaceFormatsKHR(device->physicalDevice->device, windowSurface->windowSurface->surface, formatCount, vkFormats);
|
||||
for (int i = 0; i < *formatCount; i++) {
|
||||
switch (vkFormats[i].format) {
|
||||
case VK_FORMAT_B8G8R8A8_SRGB: { formats[i].format = GN_FORMAT_BGRA8_SRGB; break; }
|
||||
@@ -95,7 +95,7 @@ gnSurfaceDetails getSurfaceDetails(
|
||||
surfaceDetails.formats = vkGetSurfaceFormats(windowSurface, device, &surfaceDetails.formatCount);
|
||||
|
||||
VkSurfaceCapabilitiesKHR details;
|
||||
vkGetPhysicalDeviceSurfaceCapabilitiesKHR(device.physicalDevice->device, windowSurface->windowSurface->surface, &details);
|
||||
vkGetPhysicalDeviceSurfaceCapabilitiesKHR(device->physicalDevice->device, windowSurface->windowSurface->surface, &details);
|
||||
|
||||
surfaceDetails.minImageCount = details.minImageCount;
|
||||
surfaceDetails.maxImageCount = details.maxImageCount;
|
||||
|
@@ -16,6 +16,8 @@ GN_HANDLE(gnWindowSurface);
|
||||
GN_HANDLE(gnPresentationQueue);
|
||||
GN_HANDLE(gnTexture);
|
||||
GN_HANDLE(gnRenderPassDescriptor);
|
||||
GN_HANDLE(gnPhysicalOutputDevice);
|
||||
GN_HANDLE_ALIAS(gnPhysicalOutputDevice, gnPhysicalDevice);
|
||||
GN_HANDLE(gnOutputDevice);
|
||||
GN_HANDLE_ALIAS(gnOutputDevice, gnDevice);
|
||||
GN_HANDLE(gnShaderModule);
|
||||
|
@@ -1,11 +1,10 @@
|
||||
#include "gryphn_physical_output_device.h"
|
||||
#include "instance/gryphn_instance.h"
|
||||
|
||||
gnPhysicalDevice* gnGetPhyscialDevices(gnInstanceHandle instance, uint32_t* count) {
|
||||
gnPhysicalDevice* devices = instance->callingLayer->instanceFunctions._gnGetPhysicalDevices(instance, count);
|
||||
for (int i = 0; i < *count; i++) {
|
||||
devices[i].instance = instance;
|
||||
}
|
||||
gnPhysicalOutputDeviceHandle* gnGetPhyscialDevices(gnInstanceHandle instance, uint32_t* count) {
|
||||
gnPhysicalOutputDeviceHandle* devices = instance->callingLayer->instanceFunctions._gnGetPhysicalDevices(instance, count);
|
||||
for (int i = 0; i < *count; i++)
|
||||
devices[i]->instance = instance;
|
||||
return devices;
|
||||
}
|
||||
|
||||
@@ -18,19 +17,19 @@ gnBool gnQueueCanPresentToSurface(const gnPhysicalDevice device, uint32_t queueI
|
||||
// );
|
||||
// return gnFalse;
|
||||
// }
|
||||
return device.instance->callingLayer->instanceFunctions._gnQueueCanPresentToSurface(device, queueIndex, windowSurface);
|
||||
return device->instance->callingLayer->instanceFunctions._gnQueueCanPresentToSurface(device, queueIndex, windowSurface);
|
||||
}
|
||||
|
||||
gnBool gnHasGraphicsQueue(const gnPhysicalDevice device) {
|
||||
for (int i = 0; i < device.queueProperties.queueCount; i++) {
|
||||
if ((device.queueProperties.queueProperties[i].queueType & GN_QUEUE_GRAPHICS) == GN_QUEUE_GRAPHICS) {
|
||||
gnBool gnHasGraphicsQueue(gnPhysicalDevice device) {
|
||||
for (int i = 0; i < device->queueProperties.queueCount; i++) {
|
||||
if ((device->queueProperties.queueProperties[i].queueType & GN_QUEUE_GRAPHICS) == GN_QUEUE_GRAPHICS) {
|
||||
return gnTrue;
|
||||
}
|
||||
}
|
||||
return gnFalse;
|
||||
}
|
||||
gnBool gnHasPresentQueue(const gnPhysicalDevice device, gnWindowSurfaceHandle windowSurface) {
|
||||
for (int i = 0; i < device.queueProperties.queueCount; i++) {
|
||||
gnBool gnHasPresentQueue(gnPhysicalDevice device, gnWindowSurfaceHandle windowSurface) {
|
||||
for (int i = 0; i < device->queueProperties.queueCount; i++) {
|
||||
if (gnQueueCanPresentToSurface(device, i, windowSurface)) {
|
||||
return gnTrue;
|
||||
}
|
||||
@@ -38,17 +37,17 @@ gnBool gnHasPresentQueue(const gnPhysicalDevice device, gnWindowSurfaceHandle wi
|
||||
return gnFalse;
|
||||
}
|
||||
|
||||
int gnGetGraphicsQueueIndex(const gnPhysicalDevice device) {
|
||||
for (int i = 0; i < device.queueProperties.queueCount; i++) {
|
||||
if ((device.queueProperties.queueProperties[i].queueType & GN_QUEUE_GRAPHICS) == GN_QUEUE_GRAPHICS) {
|
||||
int gnGetGraphicsQueueIndex(gnPhysicalDevice device) {
|
||||
for (int i = 0; i < device->queueProperties.queueCount; i++) {
|
||||
if ((device->queueProperties.queueProperties[i].queueType & GN_QUEUE_GRAPHICS) == GN_QUEUE_GRAPHICS) {
|
||||
return i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
int gnGetPresentQueueIndex(const gnPhysicalDevice device, gnWindowSurfaceHandle windowSurface) {
|
||||
for (int i = 0; i < device.queueProperties.queueCount; i++) {
|
||||
int gnGetPresentQueueIndex(gnPhysicalDevice device, gnWindowSurfaceHandle windowSurface) {
|
||||
for (int i = 0; i < device->queueProperties.queueCount; i++) {
|
||||
if (gnQueueCanPresentToSurface(device, i, windowSurface)) {
|
||||
return i;
|
||||
break;
|
||||
|
@@ -45,20 +45,22 @@ typedef struct gnPhysicalDeviceQueueProperties {
|
||||
gnQueueProperties* queueProperties;
|
||||
} gnPhysicalDeviceQueueProperties;
|
||||
|
||||
typedef struct gnPhysicalDevice {
|
||||
#ifdef GN_REVEAL_IMPL
|
||||
typedef struct gnPhysicalOutputDevice_t {
|
||||
struct gnPlatformPhysicalDevice_t* physicalDevice;
|
||||
gnPhysicalDeviceProperties properties;
|
||||
gnPhysicalDeviceFeatures features;
|
||||
gnPhysicalDeviceQueueProperties queueProperties;
|
||||
|
||||
gnInstanceHandle instance;
|
||||
} gnPhysicalDevice;
|
||||
} gnPhysicalOutputDevice_t;
|
||||
#endif
|
||||
|
||||
gnPhysicalDevice* gnGetPhyscialDevices(gnInstanceHandle instance, uint32_t* count);
|
||||
gnBool gnQueueCanPresentToSurface(const gnPhysicalDevice device, uint32_t queueIndex, gnWindowSurfaceHandle windowSurface);
|
||||
gnPhysicalOutputDeviceHandle* gnGetPhyscialDevices(gnInstanceHandle instance, uint32_t* count);
|
||||
gnBool gnQueueCanPresentToSurface(gnPhysicalOutputDeviceHandle device, uint32_t queueIndex, gnWindowSurfaceHandle windowSurface);
|
||||
|
||||
gnBool gnHasGraphicsQueue(const gnPhysicalDevice device);
|
||||
gnBool gnHasPresentQueue(const gnPhysicalDevice device, gnWindowSurfaceHandle windowSurface);
|
||||
gnBool gnHasGraphicsQueue(gnPhysicalOutputDeviceHandle device);
|
||||
gnBool gnHasPresentQueue(gnPhysicalOutputDeviceHandle device, gnWindowSurfaceHandle windowSurface);
|
||||
|
||||
int gnGetGraphicsQueueIndex(const gnPhysicalDevice device);
|
||||
int gnGetPresentQueueIndex(const gnPhysicalDevice device, gnWindowSurfaceHandle windowSurface);
|
||||
int gnGetGraphicsQueueIndex(gnPhysicalOutputDeviceHandle device);
|
||||
int gnGetPresentQueueIndex(gnPhysicalOutputDeviceHandle device, gnWindowSurfaceHandle windowSurface);
|
||||
|
@@ -5,7 +5,6 @@
|
||||
#include "gryphn_handles.h"
|
||||
|
||||
typedef struct gnInstanceInfo gnInstanceInfo;
|
||||
typedef struct gnPhysicalDevice gnPhysicalDevice;
|
||||
typedef struct gnSurfaceDetails gnSurfaceDetails;
|
||||
typedef struct gnOutputDeviceInfo gnOutputDeviceInfo;
|
||||
|
||||
@@ -24,7 +23,7 @@ typedef struct gnInstanceFunctions {
|
||||
void (*_gnDestroyInstance)(gnInstanceHandle instance);
|
||||
|
||||
gnPhysicalDevice* (*_gnGetPhysicalDevices)(gnInstanceHandle instance, uint32_t* count);
|
||||
gnBool (*_gnQueueCanPresentToSurface)(const gnPhysicalDevice device, uint32_t queueIndex, const gnWindowSurfaceHandle windowSurface);
|
||||
gnBool (*_gnQueueCanPresentToSurface)(gnPhysicalDevice device, uint32_t queueIndex, gnWindowSurfaceHandle windowSurface);
|
||||
|
||||
gnReturnCode (*_gnCreateOutputDevice)(gnOutputDeviceHandle device, gnInstanceHandle instance, gnOutputDeviceInfo deviceInfo);
|
||||
void (*_gnDestroyOutputDevice)(gnOutputDeviceHandle device);
|
||||
|
@@ -15,8 +15,8 @@ void checkDestroyInstance(gnInstance instance) {
|
||||
gnPhysicalDevice* checkGetPhysicalDevices(gnInstanceHandle instance, uint32_t* count) {
|
||||
CHECK_RETURNED_FUNCTION(instance, _gnGetPhysicalDevices, instanceFunctions, NULL, instance, count);
|
||||
}
|
||||
gnBool checkQueueCanPresentToSurface(const gnPhysicalDevice device, uint32_t queueIndex, const gnWindowSurfaceHandle windowSurface) {
|
||||
CHECK_RETURNED_FUNCTION(device.instance, _gnQueueCanPresentToSurface, instanceFunctions, gnFalse, device, queueIndex, windowSurface);
|
||||
gnBool checkQueueCanPresentToSurface(gnPhysicalDevice device, uint32_t queueIndex, const gnWindowSurfaceHandle windowSurface) {
|
||||
CHECK_RETURNED_FUNCTION(device->instance, _gnQueueCanPresentToSurface, instanceFunctions, gnFalse, device, queueIndex, windowSurface);
|
||||
}
|
||||
|
||||
gnReturnCode checkCreateOutputDevice(gnOutputDeviceHandle device, gnInstanceHandle instance, gnOutputDeviceInfo deviceInfo) {
|
||||
|
Reference in New Issue
Block a user