Added selection of frame buffer implementation in Cocoa backend

Added vid_glswfb CVAR but set it to false by default for compatibility reasons
This commit is contained in:
alexey.lysiuk 2017-04-23 14:27:50 +03:00
parent ea3b47d0ad
commit bd74cf85a4

View file

@ -116,6 +116,11 @@
DFrameBuffer *CreateGLSWFrameBuffer(int width, int height, bool bgra, bool fullscreen); DFrameBuffer *CreateGLSWFrameBuffer(int width, int height, bool bgra, bool fullscreen);
CUSTOM_CVAR(Bool, vid_glswfb, false, CVAR_NOINITCALL)
{
Printf("This won't take effect until " GAMENAME " is restarted.\n");
}
EXTERN_CVAR(Bool, ticker ) EXTERN_CVAR(Bool, ticker )
EXTERN_CVAR(Bool, vid_vsync) EXTERN_CVAR(Bool, vid_vsync)
EXTERN_CVAR(Bool, vid_hidpi) EXTERN_CVAR(Bool, vid_hidpi)
@ -551,9 +556,12 @@ CocoaVideo::CocoaVideo()
// Create OpenGL pixel format // Create OpenGL pixel format
NSOpenGLPixelFormat* pixelFormat = CreatePixelFormat(OpenGLProfile::Core); const OpenGLProfile defaultProfile = (1 == vid_renderer || vid_glswfb)
? OpenGLProfile::Core
: OpenGLProfile::Legacy;
NSOpenGLPixelFormat* pixelFormat = CreatePixelFormat(defaultProfile);
if (nil == pixelFormat) if (nil == pixelFormat && OpenGLProfile::Core == defaultProfile)
{ {
pixelFormat = CreatePixelFormat(OpenGLProfile::Legacy); pixelFormat = CreatePixelFormat(OpenGLProfile::Legacy);
@ -647,10 +655,13 @@ DFrameBuffer* CocoaVideo::CreateFrameBuffer(const int width, const int height, c
{ {
fb = new OpenGLFrameBuffer(NULL, width, height, 32, 60, fullscreen); fb = new OpenGLFrameBuffer(NULL, width, height, 32, 60, fullscreen);
} }
else if (vid_glswfb)
{
fb = CreateGLSWFrameBuffer(width, height, bgra, fullscreen);
}
else else
{ {
//fb = new CocoaFrameBuffer(width, height, bgra, fullscreen); fb = new CocoaFrameBuffer(width, height, bgra, fullscreen);
fb = CreateGLSWFrameBuffer(width, height, bgra, fullscreen);
} }
fb->SetFlash(flashColor, flashAmount); fb->SetFlash(flashColor, flashAmount);