Skip to content
Permalink
Browse files

- implemented OpenGL / Vulkan switch in Cocoa backend

  • Loading branch information...
alexey-lysiuk committed Mar 12, 2019
1 parent 7b5eede commit 3dd25bd4c04d1c78ded11a738dbd2694161a464e
Showing with 6 additions and 10 deletions.
  1. +6 −10 src/posix/cocoa/i_video.mm
@@ -95,6 +95,7 @@ - (void)enterFullscreenOnZoom
EXTERN_CVAR(Bool, vid_hidpi)
EXTERN_CVAR(Int, vid_defwidth)
EXTERN_CVAR(Int, vid_defheight)
EXTERN_CVAR(Int, vid_backend)

CUSTOM_CVAR(Bool, vid_autoswitch, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
{
@@ -342,7 +343,7 @@ void SetupOpenGLView(CocoaWindow* window)
public:
CocoaVideo()
{
ms_isVulkanSupported = true; // todo
ms_isVulkanEnabled = vid_backend == 0 && NSAppKitVersionNumber >= 1404; // NSAppKitVersionNumber10_11
}

~CocoaVideo()
@@ -359,7 +360,7 @@ void SetupOpenGLView(CocoaWindow* window)

SystemBaseFrameBuffer *fb = nullptr;

if (ms_isVulkanSupported)
if (ms_isVulkanEnabled)
{
const NSRect contentRect = [ms_window contentRectForFrameRect:[ms_window frame]];

@@ -380,7 +381,7 @@ void SetupOpenGLView(CocoaWindow* window)
}
catch (std::exception const&)
{
ms_isVulkanSupported = false;
ms_isVulkanEnabled = false;

SetupOpenGLView(ms_window);
}
@@ -402,23 +403,18 @@ void SetupOpenGLView(CocoaWindow* window)
return ms_window;
}

static bool IsVulkanSupported()
{
return ms_isVulkanSupported;
}

private:
VulkanDevice *m_vulkanDevice = nullptr;

static CocoaWindow* ms_window;

static bool ms_isVulkanSupported;
static bool ms_isVulkanEnabled;
};


CocoaWindow* CocoaVideo::ms_window;

bool CocoaVideo::ms_isVulkanSupported;
bool CocoaVideo::ms_isVulkanEnabled;


// ---------------------------------------------------------------------------

0 comments on commit 3dd25bd

Please sign in to comment.
You can’t perform that action at this time.