fix some bugs on linux

This commit is contained in:
Gregory Wells
2025-08-05 09:12:21 -04:00
parent dd5f1485d9
commit 56d79663a2
7 changed files with 11 additions and 12 deletions

View File

@@ -83,10 +83,11 @@ gnReturnCode vulkanCreateInstance(gnInstanceHandle instance, gnInstanceCreateInf
#endif #endif
VkDebugUtilsMessengerCreateInfoEXT debugCreateInfo; VkDebugUtilsMessengerCreateInfoEXT debugCreateInfo;
const char* enabledLayerNames = "VK_LAYER_KHRONOS_validation";
if (instance->enabledLayerCounts[GN_DEBUGGER_LAYER_PLATFORM] > 0) { if (instance->enabledLayerCounts[GN_DEBUGGER_LAYER_PLATFORM] > 0) {
vkStringArrayListAdd(extensions, VK_EXT_DEBUG_UTILS_EXTENSION_NAME); vkStringArrayListAdd(extensions, VK_EXT_DEBUG_UTILS_EXTENSION_NAME);
createInfo.enabledLayerCount = 1; createInfo.enabledLayerCount = 1;
createInfo.ppEnabledLayerNames = (const char*[]){ "VK_LAYER_KHRONOS_validation" }; createInfo.ppEnabledLayerNames = &enabledLayerNames;
instance->instance->userData.debuggerCallback = instanceInfo->debuggerInfo.callback; instance->instance->userData.debuggerCallback = instanceInfo->debuggerInfo.callback;
instance->instance->userData.userData = instanceInfo->debuggerInfo.userData; instance->instance->userData.userData = instanceInfo->debuggerInfo.userData;

View File

@@ -2,7 +2,7 @@
#include <instance/vulkan_instance.h> #include <instance/vulkan_instance.h>
#include "vulkan_surface.h" #include "vulkan_surface.h"
#include <output_device/vulkan_physical_device.h> #include <output_device/vulkan_physical_device.h>
#include "vulkan_result_converter.h"
#ifdef GN_PLATFORM_LINUX #ifdef GN_PLATFORM_LINUX
#ifdef GN_WINDOW_X11 #ifdef GN_WINDOW_X11
@@ -14,11 +14,7 @@ gnReturnCode createX11WindowSurface(gnWindowSurfaceHandle windowSurface, gnInsta
info.sType = VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR; info.sType = VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR;
info.dpy = createInfo.display; info.dpy = createInfo.display;
info.window = createInfo.window; info.window = createInfo.window;
return VkResultToGnReturnCode(vkCreateXlibSurfaceKHR(instance->instance->vk_instance, &info, NULL, &windowSurface->windowSurface->surface));
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;
} }
#endif #endif

View File

@@ -43,7 +43,7 @@ typedef struct gnDebuggerCreateInfo {
#ifdef GN_REVEAL_IMPL #ifdef GN_REVEAL_IMPL
static inline void gnDebuggerSetErrorMessage(gnDebuggerCreateInfo debugger, gnMessageData data) { static inline void gnDebuggerSetErrorMessage(gnDebuggerCreateInfo debugger, gnMessageData data) {
// if (debugger == NULL) return; if (debugger.callback == 0) return;
debugger.callback( debugger.callback(
GN_MESSAGE_ERROR, GN_MESSAGE_ERROR,
GN_DEBUG_MESSAGE_VALIDATION, GN_DEBUG_MESSAGE_VALIDATION,

View File

@@ -23,7 +23,7 @@ gryphnInstanceFunctionLayers gryphnLoadAPILayer(gnRenderingAPI api) {
case GN_RENDERINGAPI_DIRECTX11: return (gryphnInstanceFunctionLayers){}; case GN_RENDERINGAPI_DIRECTX11: return (gryphnInstanceFunctionLayers){};
case GN_RENDERINGAPI_DIRECTX12: return (gryphnInstanceFunctionLayers){}; case GN_RENDERINGAPI_DIRECTX12: return (gryphnInstanceFunctionLayers){};
#ifdef GN_API_OPENGL #ifdef GN_API_OPENGL
// case GN_RENDERINGAPI_OPENGL: return loadOpenGLInstanceFunctions(); case GN_RENDERINGAPI_OPENGL: return loadOpenGLAPILayer();
#endif #endif
#ifdef GN_API_METAL #ifdef GN_API_METAL
case GN_RENDERINGAPI_METAL: return metalLoadAPILayer(); case GN_RENDERINGAPI_METAL: return metalLoadAPILayer();

View File

@@ -1,5 +1,6 @@
#pragma once #pragma once
#include <gryphn_rendering_api.h> #include <gryphn_rendering_api.h>
#include "utils/gryphn_bool.h"
#ifdef GN_PLATFORM_LINUX #ifdef GN_PLATFORM_LINUX
#include <platform_linux/gryphn_platform_linux.h> #include <platform_linux/gryphn_platform_linux.h>

View File

@@ -1,6 +1,7 @@
#ifdef GN_PLATFORM_LINUX #ifdef GN_PLATFORM_LINUX
#include "gryphn_platform_linux.h" #include "gryphn_platform_linux.h"
#include "gryphn_rendering_api.h" #include "gryphn_rendering_api.h"
#include "utils/gryphn_bool.h"
gnRenderingAPI renderingAPIs[3] = { gnRenderingAPI renderingAPIs[3] = {
GN_RENDERINGAPI_VULKAN, GN_RENDERINGAPI_VULKAN,
@@ -14,8 +15,8 @@ gnRenderingAPI* gnGetSupportedRenderingAPIs(int* count) {
} }
gnBool gnSupportsRenderingAPI(gnRenderingAPI api) { gnBool gnSupportsRenderingAPI(gnRenderingAPI api) {
for (int i = 0; i < 3; i++) if (api == renderingAPIs[i]) return gnTrue; for (int i = 0; i < 3; i++) if (api == renderingAPIs[i]) return GN_TRUE;
return gnFalse; return GN_FALSE;
} }
#endif #endif