diff --git a/CMakeLists.txt b/CMakeLists.txt index ff59e77..53d48ca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,6 +39,7 @@ if(APPLE) endif() if(UNIX AND NOT APPLE) add_compile_definitions(GN_PLATFORM_LINUX) + add_compile_definitions(GN_WINDOW_X11) add_subdirectory(rendering_api/vulkan/) endif() diff --git a/include/gryphn/gryphn.h b/include/gryphn/gryphn.h index dc6dfe2..9dc4b59 100644 --- a/include/gryphn/gryphn.h +++ b/include/gryphn/gryphn.h @@ -5,7 +5,6 @@ #include #include #include -#include #include #include #include diff --git a/include/gryphn/gryphn_platform.h b/include/gryphn/gryphn_platform.h index 924242d..a305056 100644 --- a/include/gryphn/gryphn_platform.h +++ b/include/gryphn/gryphn_platform.h @@ -1,2 +1,3 @@ #pragma once #include +#include diff --git a/rendering_api/vulkan/src/instance/vulkan_instance.c b/rendering_api/vulkan/src/instance/vulkan_instance.c index bbb1675..df88749 100644 --- a/rendering_api/vulkan/src/instance/vulkan_instance.c +++ b/rendering_api/vulkan/src/instance/vulkan_instance.c @@ -58,7 +58,7 @@ gnReturnCode gnCreateInstanceFn(gnInstanceHandle instance, gnInstanceInfo instan #ifdef GN_PLATFORM_LINUX - gnBool isX11 = gnFalse; + gnBool isX11 = gnTrue; uint32_t extensionCount = 3; const char* extensions[3]; if (isX11) { @@ -101,7 +101,12 @@ gnReturnCode gnCreateInstanceFn(gnInstanceHandle instance, gnInstanceInfo instan VkInstanceCreateInfo createInfo = {}; createInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO; createInfo.pApplicationInfo = &appInfo; - createInfo.flags = VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR; + VkInstanceCreateFlags createFlags = 0; + #ifdef GN_PLATFORM_MACOS + createFlags |= VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR; + #endif + + createInfo.flags = createFlags; const char* validation_layers[1] = { "VK_LAYER_KHRONOS_validation" }; createInfo.enabledLayerCount = 1; diff --git a/rendering_api/vulkan/src/vulkan_surface/vulkan_surface.c b/rendering_api/vulkan/src/vulkan_surface/vulkan_surface.c index af35b46..d2207f7 100644 --- a/rendering_api/vulkan/src/vulkan_surface/vulkan_surface.c +++ b/rendering_api/vulkan/src/vulkan_surface/vulkan_surface.c @@ -1,13 +1,15 @@ +#include #include #include "vulkan_surface.h" #include #include + #ifdef GN_PLATFORM_LINUX #ifdef GN_WINDOW_X11 #include #include -gnReturnCode gnCreateX11WindowSurfaceFn(struct gnWindowSurface_t* windowSurface, gnInstanceHandle instance, struct gnX11WindowSurfaceInfo_t createInfo) { +gnReturnCode gnCreateX11WindowSurfaceFn(gnWindowSurfaceHandle windowSurface, gnInstanceHandle instance, gnX11WindowSurfaceInfo createInfo) { windowSurface->windowSurface = malloc(sizeof(struct gnPlatformWindowSurface_t)); VkXlibSurfaceCreateInfoKHR info = {}; info.sType = VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR; diff --git a/src/core/debugger/gryphn_debugger.c b/src/core/debugger/gryphn_debugger.c index 1568e2f..dca6536 100644 --- a/src/core/debugger/gryphn_debugger.c +++ b/src/core/debugger/gryphn_debugger.c @@ -1,6 +1,5 @@ #include "gryphn_debugger.h" #include -#include "stdio.h" gnReturnCode gnCreateDebugger(gnDebuggerHandle* debugger, const struct gnDebuggerInfo_t info) { *debugger = malloc(sizeof(struct gnDebugger_t)); diff --git a/src/core/window_surface/gryphn_surface_create_functions.c b/src/core/window_surface/gryphn_surface_create_functions.c index 6799b0a..433e92b 100644 --- a/src/core/window_surface/gryphn_surface_create_functions.c +++ b/src/core/window_surface/gryphn_surface_create_functions.c @@ -1,12 +1,15 @@ +#define GN_WINDOW_X11 #include "gryphn_surface_create_functions.h" #include "core/instance/gryphn_instance.h" #include "core/gryphn_platform_functions.h" +#include "stdio.h" #ifdef GN_PLATFORM_LINUX #ifdef GN_WINDOW_X11 gnReturnCode gnCreateX11WindowSurface(gnWindowSurfaceHandle* windowSurface, gnInstanceHandle instance, struct gnX11WindowSurfaceInfo_t createInfo) { *windowSurface = malloc(sizeof(struct gnWindowSurface_t)); - return instance->functions->_gnCreateX11WindowSurface(windowSurface, instance, createInfo); + (*windowSurface)->instance = instance; + return instance->functions->_gnCreateX11WindowSurface(*windowSurface, instance, createInfo); } #endif #ifdef GN_WINDOW_WAYLAND diff --git a/src/core/window_surface/gryphn_surface_create_functions.h b/src/core/window_surface/gryphn_surface_create_functions.h index 2aa39fd..b434653 100644 --- a/src/core/window_surface/gryphn_surface_create_functions.h +++ b/src/core/window_surface/gryphn_surface_create_functions.h @@ -7,10 +7,10 @@ #ifdef GN_WINDOW_X11 typedef struct gnX11WindowSurfaceInfo_t { Display* display; - Window* window; - } gnX11WindowSurfaceCreateInfo; + Window window; + } gnX11WindowSurfaceInfo; - gnReturnCode gnCreateX11WindowSurface(gnWindowSurfaceHandle* windowSurface, gnInstanceHandle instance, struct gnX11WindowSurfaceInfo_t createInfo); + gnReturnCode gnCreateX11WindowSurface(gnWindowSurfaceHandle* windowSurface, gnInstanceHandle instance, gnX11WindowSurfaceInfo createInfo); #endif #ifdef GN_WINDOW_WAYLAND typedef struct gnWaylandWindowSurfaceInfo_t {