From 56d79663a2545001999a939ec982f6440d9e4639 Mon Sep 17 00:00:00 2001 From: Gregory Wells Date: Tue, 5 Aug 2025 09:12:21 -0400 Subject: [PATCH] fix some bugs on linux --- projects/apis/vulkan/src/instance/vulkan_instance.c | 3 ++- projects/apis/vulkan/src/vulkan_surface/vulkan_surface.c | 8 ++------ projects/core/src/instance/gryphn_debugger.h | 2 +- projects/loader/src/gryphn_loader.c | 2 +- projects/platform/gryphn_platform_include.h | 1 + projects/platform/platform_linux/gryphn_platform_linux.c | 5 +++-- projects/utils | 2 +- 7 files changed, 11 insertions(+), 12 deletions(-) diff --git a/projects/apis/vulkan/src/instance/vulkan_instance.c b/projects/apis/vulkan/src/instance/vulkan_instance.c index 00f3338..3e565b7 100644 --- a/projects/apis/vulkan/src/instance/vulkan_instance.c +++ b/projects/apis/vulkan/src/instance/vulkan_instance.c @@ -83,10 +83,11 @@ gnReturnCode vulkanCreateInstance(gnInstanceHandle instance, gnInstanceCreateInf #endif VkDebugUtilsMessengerCreateInfoEXT debugCreateInfo; + const char* enabledLayerNames = "VK_LAYER_KHRONOS_validation"; if (instance->enabledLayerCounts[GN_DEBUGGER_LAYER_PLATFORM] > 0) { vkStringArrayListAdd(extensions, VK_EXT_DEBUG_UTILS_EXTENSION_NAME); createInfo.enabledLayerCount = 1; - createInfo.ppEnabledLayerNames = (const char*[]){ "VK_LAYER_KHRONOS_validation" }; + createInfo.ppEnabledLayerNames = &enabledLayerNames; instance->instance->userData.debuggerCallback = instanceInfo->debuggerInfo.callback; instance->instance->userData.userData = instanceInfo->debuggerInfo.userData; diff --git a/projects/apis/vulkan/src/vulkan_surface/vulkan_surface.c b/projects/apis/vulkan/src/vulkan_surface/vulkan_surface.c index 7a8a923..784b950 100644 --- a/projects/apis/vulkan/src/vulkan_surface/vulkan_surface.c +++ b/projects/apis/vulkan/src/vulkan_surface/vulkan_surface.c @@ -2,7 +2,7 @@ #include #include "vulkan_surface.h" #include - +#include "vulkan_result_converter.h" #ifdef GN_PLATFORM_LINUX #ifdef GN_WINDOW_X11 @@ -14,11 +14,7 @@ gnReturnCode createX11WindowSurface(gnWindowSurfaceHandle windowSurface, gnInsta info.sType = VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR; info.dpy = createInfo.display; info.window = createInfo.window; - - VkResult result = vkCreateXlibSurfaceKHR(instance->instance->vk_instance, &info, NULL, &windowSurface->windowSurface->surface); - if (result != VK_SUCCESS) - return GN_FAILED_TO_ATTACH_WINDOW; - return GN_SUCCESS; + return VkResultToGnReturnCode(vkCreateXlibSurfaceKHR(instance->instance->vk_instance, &info, NULL, &windowSurface->windowSurface->surface)); } #endif diff --git a/projects/core/src/instance/gryphn_debugger.h b/projects/core/src/instance/gryphn_debugger.h index cca1829..381a520 100644 --- a/projects/core/src/instance/gryphn_debugger.h +++ b/projects/core/src/instance/gryphn_debugger.h @@ -43,7 +43,7 @@ typedef struct gnDebuggerCreateInfo { #ifdef GN_REVEAL_IMPL static inline void gnDebuggerSetErrorMessage(gnDebuggerCreateInfo debugger, gnMessageData data) { - // if (debugger == NULL) return; + if (debugger.callback == 0) return; debugger.callback( GN_MESSAGE_ERROR, GN_DEBUG_MESSAGE_VALIDATION, diff --git a/projects/loader/src/gryphn_loader.c b/projects/loader/src/gryphn_loader.c index 26915ed..b1b350d 100644 --- a/projects/loader/src/gryphn_loader.c +++ b/projects/loader/src/gryphn_loader.c @@ -23,7 +23,7 @@ gryphnInstanceFunctionLayers gryphnLoadAPILayer(gnRenderingAPI api) { case GN_RENDERINGAPI_DIRECTX11: return (gryphnInstanceFunctionLayers){}; case GN_RENDERINGAPI_DIRECTX12: return (gryphnInstanceFunctionLayers){}; #ifdef GN_API_OPENGL - // case GN_RENDERINGAPI_OPENGL: return loadOpenGLInstanceFunctions(); + case GN_RENDERINGAPI_OPENGL: return loadOpenGLAPILayer(); #endif #ifdef GN_API_METAL case GN_RENDERINGAPI_METAL: return metalLoadAPILayer(); diff --git a/projects/platform/gryphn_platform_include.h b/projects/platform/gryphn_platform_include.h index e4f0598..0289226 100644 --- a/projects/platform/gryphn_platform_include.h +++ b/projects/platform/gryphn_platform_include.h @@ -1,5 +1,6 @@ #pragma once #include +#include "utils/gryphn_bool.h" #ifdef GN_PLATFORM_LINUX #include diff --git a/projects/platform/platform_linux/gryphn_platform_linux.c b/projects/platform/platform_linux/gryphn_platform_linux.c index 6558eb6..af09d11 100644 --- a/projects/platform/platform_linux/gryphn_platform_linux.c +++ b/projects/platform/platform_linux/gryphn_platform_linux.c @@ -1,6 +1,7 @@ #ifdef GN_PLATFORM_LINUX #include "gryphn_platform_linux.h" #include "gryphn_rendering_api.h" +#include "utils/gryphn_bool.h" gnRenderingAPI renderingAPIs[3] = { GN_RENDERINGAPI_VULKAN, @@ -14,8 +15,8 @@ gnRenderingAPI* gnGetSupportedRenderingAPIs(int* count) { } gnBool gnSupportsRenderingAPI(gnRenderingAPI api) { - for (int i = 0; i < 3; i++) if (api == renderingAPIs[i]) return gnTrue; - return gnFalse; + for (int i = 0; i < 3; i++) if (api == renderingAPIs[i]) return GN_TRUE; + return GN_FALSE; } #endif diff --git a/projects/utils b/projects/utils index d7a13b1..9f98da3 160000 --- a/projects/utils +++ b/projects/utils @@ -1 +1 @@ -Subproject commit d7a13b16d1711940d35481fb3066fabff2e06944 +Subproject commit 9f98da3b31bc4a6340c5be11ca311f15d08520e6