removing commnets and also error checking

This commit is contained in:
Greg Wells
2025-05-14 09:04:19 -04:00
parent f8a4ba22dd
commit b35daa0ca1
5 changed files with 14 additions and 49 deletions

View File

@@ -15,20 +15,6 @@ GN_EXPORT void gnDestroyInstanceFn(gnInstance& instance) {
GN_EXPORT gnReturnCode gnCreateMacOSWindowSurfaceFn(gnInstance& instance, NS::Window* window, NS::View* view) {
if (instance.instance == nullptr) instance.instance = new gnPlatformInstanceData();
instance.instance->metalContentView = view;
return GN_SUCCESS;
}
// GN_EXPORT gnReturnCode gnInstanceSetWindowFn(gnInstance& instance, GLFWwindow* window) {
// if (instance.instance == nullptr) instance.instance = new gnPlatformInstanceData();
// instance.instance->window = window;
// int width, height;
// glfwGetFramebufferSize(instance.instance->window, &width, &height);
// instance.instance->metalWindow = reinterpret_cast<NS::Window*>(glfwGetCocoaWindow(window));
// instance.instance->metalContentView = reinterpret_cast<NS::View*>(glfwGetCocoaView(window));
// return GN_SUCCESS;
// }

View File

@@ -32,36 +32,11 @@ bool checkValidationLayerSupport(gnList<gnString> layers_to_validate) {
return true;
}
// std::vector<const char*> getRequiredExtensions(bool validation_layers_required, gnInstance& instance) {
// // uint32_t glfwExtensionCount = 0;
// // const char** glfwExtensions;
// // glfwExtensions = glfwGetRequiredInstanceExtensions(&glfwExtensionCount);
// std::vector<const char*> extensions(instance.instance->extensions, instance.instance->extensions + instance.instance->extensionCount);
// if (validation_layers_required) {
// extensions.push_back(VK_EXT_DEBUG_UTILS_EXTENSION_NAME);
// }
// #ifdef GN_PLATFORM_MACOS
// extensions.push_back("VK_KHR_portability_enumeration");
// extensions.push_back("VK_EXT_metal_surface");
// #endif
// return extensions;
// }
void gnInstanceSetAppInfoFn(gnInstance& instance, gnAppInfo& info) {
if (instance.instance == nullptr) instance.instance = new gnPlatformInstanceData();
instance.AppInfo = info;
instance.instance->appInfo = {};
// instance.instance_data->appInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
// instance.instance_data->appInfo.pApplicationName = gnToCString(info.ApplicationName);
// instance.instance_data->appInfo.applicationVersion = info.ApplicationVersion;
// instance.instance_data->appInfo.pEngineName = gnToCString(info.EngineName);
// instance.instance_data->appInfo.engineVersion = info.EngineVersion;
// instance.instance_data->appInfo.apiVersion = VK_API_VERSION_1_0; // fuck ass code idk what to do with it
instance.instance->appInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
instance.instance->appInfo.pApplicationName = "Hello Triangle";
instance.instance->appInfo.applicationVersion = VK_MAKE_VERSION(1, 0, 0);

View File

@@ -11,7 +11,9 @@ GN_EXPORT gnReturnCode gnCreateX11WindowSurfaceFn(gnInstance& instance, Display*
info.dpy = display;
info.window = window;
vkCreateXlibSurfaceKHR(instance.instance->vk_instance, &info, nullptr, &instance.instance->window_surface);
VkResult result = vkCreateXlibSurfaceKHR(instance.instance->vk_instance, &info, nullptr, &instance.instance->window_surface);
if (result != VK_SUCCESS)
return gnReturnError(GN_FAILED_CREATE_WINDOW_SURFACE, result);
return GN_SUCCESS;
}
#endif
@@ -26,7 +28,9 @@ GN_EXPORT gnReturnCode gnCreateWaylandWindowSurfaceFn(gnInstance& instance, wl_d
info.surface = surface;
VkSurfaceKHR surface;
vkCreateWaylandSurfaceKHR(instance.instance->vk_instance, &info, nullptr, &instance.instance->window_surface);
VkResult result = vkCreateWaylandSurfaceKHR(instance.instance->vk_instance, &info, nullptr, &instance.instance->window_surface);
if (result != VK_SUCCESS)
return gnReturnError(GN_FAILED_CREATE_WINDOW_SURFACE, result);
return GN_SUCCESS;
}
#endif
@@ -41,11 +45,12 @@ GN_EXPORT gnReturnCode gnCreateWindowsWindowSurfaceFn(gnInstance& instance, HWND
info.hinstance = instance;
VkSurfaceKHR surface;
vkCreateWin32SurfaceKHR(instance.instance->vk_instance, &info, nullptr, &instance.instance->window_surface);
VkResult result = vkCreateWin32SurfaceKHR(instance.instance->vk_instance, &info, nullptr, &instance.instance->window_surface);
if (result != VK_SUCCESS)
return gnReturnError(GN_FAILED_CREATE_WINDOW_SURFACE, result);
return GN_SUCCESS;
}
#endif
#include "vulkan/vulkan_macos.h"
#include "vulkan/vulkan_metal.h"
#ifdef GN_PLATFORM_MACOS
@@ -62,9 +67,8 @@ GN_EXPORT gnReturnCode gnCreateMacOSWindowSurfaceFn(gnInstance& instance, NS::Wi
VkSurfaceKHR surface;
VkResult result = vkCreateMetalSurfaceEXT(instance.instance->vk_instance, &surfaceCreateInfo, nullptr, &instance.instance->window_surface);
// VkSurfaceKHR surface;
// vkCreateMacOSSurfaceMVK(instance.instance->vk_instance, &info, nullptr, &instance.instance->window_surface);
// return GN_SUCCESS;
if (result != VK_SUCCESS)
return gnReturnError(GN_FAILED_CREATE_WINDOW_SURFACE, result);
return GN_SUCCESS;
}
#endif

View File

@@ -24,7 +24,8 @@ typedef enum gnReturnMessage {
GN_FAILED_CREATE_RENDERPASS,
GN_FAILED_CREATE_INSTANCE,
GN_FAILED_TO_ATTACH_WINDOW,
GN_FAILED_TO_CREATE_IMAGE
GN_FAILED_TO_CREATE_IMAGE,
GN_FAILED_CREATE_WINDOW_SURFACE
} gnReturnMessage;
inline gnString lastReturnAPIMessage = "";

View File

@@ -1 +0,0 @@
#define GN_PLATFORM_FUNCTION(RETURN_TYPE, NAME, __ARGS__) (RETURN_TYPE (*NAME)(__ARGS__))