make vulkan enable swapchain extension

This commit is contained in:
Gregory Wells
2026-05-25 12:37:52 -04:00
parent dd3c50be07
commit 587f3cd224
4 changed files with 23 additions and 13 deletions
+2 -1
View File
@@ -3,5 +3,6 @@
typedef enum gnReturnCode {
GN_SUCCESS,
GN_FAILED_TO_FIND_LIBARY,
GN_UNSUPPORTED_BACKEND
GN_UNSUPPORTED_BACKEND,
GN_EXTENSION_NOT_PRESENT
} gnReturnCode;
+1 -10
View File
@@ -1,20 +1,11 @@
#include "core/gryphn_format.h"
#include "stdio.h"
#include "instance/gryphn_instance.h"
#include "gryphn_handle.h"
#include "stdlib.h"
#include <vulkan/vulkan_core.h>
#include "vulkan_functions.h"
#include "vulkan_helpers.h"
#include "string.h"
gnReturnCode vulkanCodeToGryphnCode(VkResult result) {
if (result != VK_SUCCESS) {
printf("Unknown instance fail mr gregory please diagnose this: %u", result);
return GN_FAILED_TO_FIND_LIBARY;
}
return GN_SUCCESS;
}
uint32_t gnInternalIsApiSupported(gnVersion gryphnVersion) {
if (gryphnVersion != gnCreateVersion(1, 0, 0)) return 0;
+6 -2
View File
@@ -5,6 +5,7 @@
#include "instance/gryphn_instance.h"
#include "device/gryphn_physical_device.h"
#include <string.h>
#include <stdio.h>
#include <vulkan/vulkan_core.h>
gnPhysicalDeviceType vulkanDeviceTypeToGryphnDeviceType(VkPhysicalDeviceType type) {
@@ -60,7 +61,10 @@ gnReturnCode vulkanCreateDevice(gnInstance instance, gnDeviceCreateInfo* info, g
const char** extensions = malloc(sizeof(const char*) * info->enabledExtensionCount);
int realEnabledExtensionCount = 0;
for (int i = 0; i < info->enabledExtensionCount; i++) {
// zero supported vulkan extensions right now
if (strcmp(info->enabledExtensions[i], "GN_EXT_swapchain") == 0) {
extensions[realEnabledExtensionCount] = VK_KHR_SWAPCHAIN_EXTENSION_NAME;
realEnabledExtensionCount++;
}
}
VkPhysicalDeviceFeatures deviceFeatures = {
@@ -83,7 +87,7 @@ gnReturnCode vulkanCreateDevice(gnInstance instance, gnDeviceCreateInfo* info, g
device->internalData = vulkanDevice;
device->dispatchTable.destroyDevice = vulkanDestroyDevice;
free(extensions);
return vulkanCodeToGryphnCode(result);
}
gnReturnCode vulkanDestroyDevice(gnDevice device) {
@@ -1,5 +1,19 @@
#include "vulkan_helpers.h"
#include "core/gryphn_format.h"
#include "gryphn_return_code.h"
#include "stdio.h"
#include <vulkan/vulkan_core.h>
gnReturnCode vulkanCodeToGryphnCode(VkResult result) {
switch(result) {
default: {
printf("Unknown instance fail mr gregory please diagnose this: %d\n", result);
return GN_UNSUPPORTED_BACKEND;
}
case VK_SUCCESS: return GN_SUCCESS;
case VK_ERROR_EXTENSION_NOT_PRESENT: return GN_EXTENSION_NOT_PRESENT;
}
}
gnFormat vulkanFormatToGryphnFormat(VkFormat format) {
switch (format) {