mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-02-26 21:20:57 +00:00
- implemented OpenGL / Vulkan switch in Cocoa backend
This commit is contained in:
parent
7b5eedea32
commit
3dd25bd4c0
1 changed files with 6 additions and 10 deletions
|
@ -95,6 +95,7 @@ EXTERN_CVAR(Bool, vid_vsync)
|
||||||
EXTERN_CVAR(Bool, vid_hidpi)
|
EXTERN_CVAR(Bool, vid_hidpi)
|
||||||
EXTERN_CVAR(Int, vid_defwidth)
|
EXTERN_CVAR(Int, vid_defwidth)
|
||||||
EXTERN_CVAR(Int, vid_defheight)
|
EXTERN_CVAR(Int, vid_defheight)
|
||||||
|
EXTERN_CVAR(Int, vid_backend)
|
||||||
|
|
||||||
CUSTOM_CVAR(Bool, vid_autoswitch, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
|
CUSTOM_CVAR(Bool, vid_autoswitch, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
|
||||||
{
|
{
|
||||||
|
@ -342,7 +343,7 @@ class CocoaVideo : public IVideo
|
||||||
public:
|
public:
|
||||||
CocoaVideo()
|
CocoaVideo()
|
||||||
{
|
{
|
||||||
ms_isVulkanSupported = true; // todo
|
ms_isVulkanEnabled = vid_backend == 0 && NSAppKitVersionNumber >= 1404; // NSAppKitVersionNumber10_11
|
||||||
}
|
}
|
||||||
|
|
||||||
~CocoaVideo()
|
~CocoaVideo()
|
||||||
|
@ -359,7 +360,7 @@ public:
|
||||||
|
|
||||||
SystemBaseFrameBuffer *fb = nullptr;
|
SystemBaseFrameBuffer *fb = nullptr;
|
||||||
|
|
||||||
if (ms_isVulkanSupported)
|
if (ms_isVulkanEnabled)
|
||||||
{
|
{
|
||||||
const NSRect contentRect = [ms_window contentRectForFrameRect:[ms_window frame]];
|
const NSRect contentRect = [ms_window contentRectForFrameRect:[ms_window frame]];
|
||||||
|
|
||||||
|
@ -380,7 +381,7 @@ public:
|
||||||
}
|
}
|
||||||
catch (std::exception const&)
|
catch (std::exception const&)
|
||||||
{
|
{
|
||||||
ms_isVulkanSupported = false;
|
ms_isVulkanEnabled = false;
|
||||||
|
|
||||||
SetupOpenGLView(ms_window);
|
SetupOpenGLView(ms_window);
|
||||||
}
|
}
|
||||||
|
@ -402,23 +403,18 @@ public:
|
||||||
return ms_window;
|
return ms_window;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool IsVulkanSupported()
|
|
||||||
{
|
|
||||||
return ms_isVulkanSupported;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VulkanDevice *m_vulkanDevice = nullptr;
|
VulkanDevice *m_vulkanDevice = nullptr;
|
||||||
|
|
||||||
static CocoaWindow* ms_window;
|
static CocoaWindow* ms_window;
|
||||||
|
|
||||||
static bool ms_isVulkanSupported;
|
static bool ms_isVulkanEnabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
CocoaWindow* CocoaVideo::ms_window;
|
CocoaWindow* CocoaVideo::ms_window;
|
||||||
|
|
||||||
bool CocoaVideo::ms_isVulkanSupported;
|
bool CocoaVideo::ms_isVulkanEnabled;
|
||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in a new issue