make vulkan enable swapchain extension
This commit is contained in:
@@ -3,5 +3,6 @@
|
|||||||
typedef enum gnReturnCode {
|
typedef enum gnReturnCode {
|
||||||
GN_SUCCESS,
|
GN_SUCCESS,
|
||||||
GN_FAILED_TO_FIND_LIBARY,
|
GN_FAILED_TO_FIND_LIBARY,
|
||||||
GN_UNSUPPORTED_BACKEND
|
GN_UNSUPPORTED_BACKEND,
|
||||||
|
GN_EXTENSION_NOT_PRESENT
|
||||||
} gnReturnCode;
|
} gnReturnCode;
|
||||||
|
|||||||
@@ -1,20 +1,11 @@
|
|||||||
#include "core/gryphn_format.h"
|
|
||||||
#include "stdio.h"
|
|
||||||
#include "instance/gryphn_instance.h"
|
#include "instance/gryphn_instance.h"
|
||||||
#include "gryphn_handle.h"
|
#include "gryphn_handle.h"
|
||||||
#include "stdlib.h"
|
#include "stdlib.h"
|
||||||
#include <vulkan/vulkan_core.h>
|
#include <vulkan/vulkan_core.h>
|
||||||
#include "vulkan_functions.h"
|
#include "vulkan_functions.h"
|
||||||
|
#include "vulkan_helpers.h"
|
||||||
#include "string.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) {
|
uint32_t gnInternalIsApiSupported(gnVersion gryphnVersion) {
|
||||||
if (gryphnVersion != gnCreateVersion(1, 0, 0)) return 0;
|
if (gryphnVersion != gnCreateVersion(1, 0, 0)) return 0;
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#include "instance/gryphn_instance.h"
|
#include "instance/gryphn_instance.h"
|
||||||
#include "device/gryphn_physical_device.h"
|
#include "device/gryphn_physical_device.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include <vulkan/vulkan_core.h>
|
#include <vulkan/vulkan_core.h>
|
||||||
|
|
||||||
gnPhysicalDeviceType vulkanDeviceTypeToGryphnDeviceType(VkPhysicalDeviceType type) {
|
gnPhysicalDeviceType vulkanDeviceTypeToGryphnDeviceType(VkPhysicalDeviceType type) {
|
||||||
@@ -60,7 +61,10 @@ gnReturnCode vulkanCreateDevice(gnInstance instance, gnDeviceCreateInfo* info, g
|
|||||||
const char** extensions = malloc(sizeof(const char*) * info->enabledExtensionCount);
|
const char** extensions = malloc(sizeof(const char*) * info->enabledExtensionCount);
|
||||||
int realEnabledExtensionCount = 0;
|
int realEnabledExtensionCount = 0;
|
||||||
for (int i = 0; i < info->enabledExtensionCount; i++) {
|
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 = {
|
VkPhysicalDeviceFeatures deviceFeatures = {
|
||||||
@@ -83,7 +87,7 @@ gnReturnCode vulkanCreateDevice(gnInstance instance, gnDeviceCreateInfo* info, g
|
|||||||
device->internalData = vulkanDevice;
|
device->internalData = vulkanDevice;
|
||||||
|
|
||||||
device->dispatchTable.destroyDevice = vulkanDestroyDevice;
|
device->dispatchTable.destroyDevice = vulkanDestroyDevice;
|
||||||
|
free(extensions);
|
||||||
return vulkanCodeToGryphnCode(result);
|
return vulkanCodeToGryphnCode(result);
|
||||||
}
|
}
|
||||||
gnReturnCode vulkanDestroyDevice(gnDevice device) {
|
gnReturnCode vulkanDestroyDevice(gnDevice device) {
|
||||||
|
|||||||
@@ -1,5 +1,19 @@
|
|||||||
#include "vulkan_helpers.h"
|
#include "vulkan_helpers.h"
|
||||||
#include "core/gryphn_format.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) {
|
gnFormat vulkanFormatToGryphnFormat(VkFormat format) {
|
||||||
switch (format) {
|
switch (format) {
|
||||||
|
|||||||
Reference in New Issue
Block a user