Skip to content

Commit

Permalink
Added selection of frame buffer implementation in Cocoa backend
Browse files Browse the repository at this point in the history
Added vid_glswfb CVAR but set it to false by default for compatibility reasons
  • Loading branch information
alexey-lysiuk committed Apr 23, 2017
1 parent ea3b47d commit bd74cf8
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/posix/cocoa/i_video.mm
Expand Up @@ -116,6 +116,11 @@ - (void)enterFullscreenOnZoom

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)
Expand Down Expand Up @@ -551,9 +556,12 @@ - (void)setCursor:(NSCursor*)cursor

// 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);

Expand Down Expand Up @@ -647,11 +655,14 @@ - (void)setCursor:(NSCursor*)cursor
{
fb = new OpenGLFrameBuffer(NULL, width, height, 32, 60, fullscreen);
}
else
else if (vid_glswfb)
{
//fb = new CocoaFrameBuffer(width, height, bgra, fullscreen);
fb = CreateGLSWFrameBuffer(width, height, bgra, fullscreen);
}
else
{
fb = new CocoaFrameBuffer(width, height, bgra, fullscreen);
}

fb->SetFlash(flashColor, flashAmount);

Expand Down

0 comments on commit bd74cf8

Please sign in to comment.