diff --git a/src/posix/cocoa/i_video.mm b/src/posix/cocoa/i_video.mm index e74161559..542d02fdd 100644 --- a/src/posix/cocoa/i_video.mm +++ b/src/posix/cocoa/i_video.mm @@ -116,6 +116,11 @@ 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, vid_vsync) EXTERN_CVAR(Bool, vid_hidpi) @@ -551,9 +556,12 @@ CocoaVideo::CocoaVideo() // 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); @@ -647,10 +655,13 @@ DFrameBuffer* CocoaVideo::CreateFrameBuffer(const int width, const int height, c { fb = new OpenGLFrameBuffer(NULL, width, height, 32, 60, fullscreen); } + else if (vid_glswfb) + { + fb = CreateGLSWFrameBuffer(width, height, bgra, fullscreen); + } else { - //fb = new CocoaFrameBuffer(width, height, bgra, fullscreen); - fb = CreateGLSWFrameBuffer(width, height, bgra, fullscreen); + fb = new CocoaFrameBuffer(width, height, bgra, fullscreen); } fb->SetFlash(flashColor, flashAmount);