macOS fixes

This commit is contained in:
Jérôme Leclercq 2022-03-20 10:02:31 +01:00
parent cfe136796c
commit a6dce6861d
5 changed files with 18 additions and 3 deletions

View File

@ -21,7 +21,7 @@ namespace Nz::GL
EGLContextWin32(EGLContextWin32&&) = default;
~EGLContextWin32() = default;
bool Create(const ContextParams& params, const EGLContextBase* shareContext = nullptr);
bool Create(const ContextParams& params, const EGLContextBase* shareContext = nullptr) override;
bool Create(const ContextParams& params, WindowHandle window, const EGLContextBase* shareContext = nullptr) override;
void Destroy() override;

View File

@ -16,6 +16,7 @@ namespace Nz
{
Invalid,
Cocoa,
X11,
Wayland,
Windows
@ -27,6 +28,11 @@ namespace Nz
union
{
struct
{
void* window; //< NSWindow*
} cocoa;
struct
{
void* display; //< Display*

View File

@ -13,7 +13,6 @@
#include <Nazara/Platform/SDL2/SDLHelper.hpp>
#include <Nazara/Utility/Image.hpp>
#include <SDL2/SDL.h>
#include <SDL2/SDL_config.h>
#include <SDL2/SDL_syswm.h>
#include <Utfcpp/utf8.h>
#include <cstdio>
@ -202,6 +201,14 @@ namespace Nz
switch (wmInfo.subsystem)
{
#if defined(SDL_VIDEO_DRIVER_COCOA)
case SDL_SYSWM_COCOA:
{
handle.type = WindowManager::Cocoa;
handle.cocoa.window = wmInfo.info.cocoa.window;
break;
}
#endif
#if defined(SDL_VIDEO_DRIVER_X11)
case SDL_SYSWM_X11:
{

View File

@ -59,6 +59,7 @@ namespace Nz
}
}
}
#elif defined(NAZARA_PLATFORM_MACOS)
#else
#error This OS is not supported by Vulkan
#endif

View File

@ -72,6 +72,7 @@ local modules = {
add_defines("SDL_VIDEO_DRIVER_WAYLAND=1")
elseif is_plat("macosx") then
add_defines("SDL_VIDEO_DRIVER_COCOA=1")
add_sysincludedirs("/opt/X11/include")
end
end
},
@ -101,7 +102,7 @@ local modules = {
add_defines("VK_USE_PLATFORM_XLIB_KHR")
add_defines("VK_USE_PLATFORM_WAYLAND_KHR")
elseif is_plat("macosx") then
add_defines("VK_USE_PLATFORM_MACOS_MVK")
add_defines("VK_USE_PLATFORM_METAL_EXT")
end
end
},