From b7ec26335f8c8fd0e223e3f268c2b7d2258e5b07 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Mon, 29 Aug 2016 22:03:25 +0300 Subject: [PATCH 1/3] Enabled OpenGL Core Profile on macOS --- src/posix/cocoa/i_common.h | 3 +++ src/posix/cocoa/i_video.mm | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/src/posix/cocoa/i_common.h b/src/posix/cocoa/i_common.h index 4a558cf24..9cedb0262 100644 --- a/src/posix/cocoa/i_common.h +++ b/src/posix/cocoa/i_common.h @@ -190,6 +190,9 @@ typedef NSInteger NSApplicationActivationPolicy; static const NSWindowCollectionBehavior NSWindowCollectionBehaviorFullScreenAuxiliary = NSWindowCollectionBehavior(1 << 8); +static const NSOpenGLPixelFormatAttribute NSOpenGLPFAOpenGLProfile(96); +static const NSOpenGLPixelFormatAttribute NSOpenGLProfileVersion3_2Core(0x3200); + #endif // prior to 10.7 #endif // COCOA_I_COMMON_INCLUDED diff --git a/src/posix/cocoa/i_video.mm b/src/posix/cocoa/i_video.mm index e2b59449d..b026fa9b9 100644 --- a/src/posix/cocoa/i_video.mm +++ b/src/posix/cocoa/i_video.mm @@ -501,6 +501,12 @@ CocoaVideo::CocoaVideo(const int multisample) attributes[i++] = NSOpenGLPixelFormatAttribute(multisample); } + if (NSAppKitVersionNumber >= AppKit10_7) + { + attributes[i++] = NSOpenGLPFAOpenGLProfile; + attributes[i++] = NSOpenGLProfileVersion3_2Core; + } + attributes[i] = NSOpenGLPixelFormatAttribute(0); // Create OpenGL context and view From 3ba3149df35f858e135b1d49cceeecc6d6910d1a Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Mon, 29 Aug 2016 22:08:57 +0300 Subject: [PATCH 2/3] Deleted remains of obsolete multisampling in Cocoa backend --- src/posix/cocoa/i_video.mm | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/posix/cocoa/i_video.mm b/src/posix/cocoa/i_video.mm index b026fa9b9..f455a5f9f 100644 --- a/src/posix/cocoa/i_video.mm +++ b/src/posix/cocoa/i_video.mm @@ -233,7 +233,7 @@ namespace class CocoaVideo : public IVideo { public: - explicit CocoaVideo(int multisample); + CocoaVideo(); virtual EDisplayType GetDisplayType() { return DISPLAY_Both; } virtual void SetWindowedScale(float scale); @@ -465,7 +465,7 @@ CocoaWindow* CreateCocoaWindow(const NSUInteger styleMask) // --------------------------------------------------------------------------- -CocoaVideo::CocoaVideo(const int multisample) +CocoaVideo::CocoaVideo() : m_window(CreateCocoaWindow(STYLE_MASK_WINDOWED)) , m_width(-1) , m_height(-1) @@ -492,15 +492,6 @@ CocoaVideo::CocoaVideo(const int multisample) attributes[i++] = NSOpenGLPFAAllowOfflineRenderers; } - if (multisample) - { - attributes[i++] = NSOpenGLPFAMultisample; - attributes[i++] = NSOpenGLPFASampleBuffers; - attributes[i++] = NSOpenGLPixelFormatAttribute(1); - attributes[i++] = NSOpenGLPFASamples; - attributes[i++] = NSOpenGLPixelFormatAttribute(multisample); - } - if (NSAppKitVersionNumber >= AppKit10_7) { attributes[i++] = NSOpenGLPFAOpenGLProfile; @@ -1260,7 +1251,7 @@ void I_InitGraphics() val.Bool = !!Args->CheckParm("-devparm"); ticker.SetGenericRepDefault(val, CVAR_Bool); - Video = new CocoaVideo(0); + Video = new CocoaVideo; atterm(I_ShutdownGraphics); } From 45ff15559dc713248bcde7fa44a68f5b78219d68 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 30 Aug 2016 00:33:02 +0200 Subject: [PATCH 3/3] - removed gl_draw_synv because with the postprocessing this is no longer useful. --- src/gl/scene/gl_scene.cpp | 9 --------- src/gl/scene/gl_walls.cpp | 1 - src/gl/system/gl_framebuffer.cpp | 8 +------- 3 files changed, 1 insertion(+), 17 deletions(-) diff --git a/src/gl/scene/gl_scene.cpp b/src/gl/scene/gl_scene.cpp index 08591283c..c2812db0f 100644 --- a/src/gl/scene/gl_scene.cpp +++ b/src/gl/scene/gl_scene.cpp @@ -480,7 +480,6 @@ void FGLRenderer::RenderTranslucent() // stencil, z-buffer and the projection matrix intact! // //----------------------------------------------------------------------------- -EXTERN_CVAR(Bool, gl_draw_sync) void FGLRenderer::DrawScene(int drawmode) { @@ -502,14 +501,6 @@ void FGLRenderer::DrawScene(int drawmode) } GLRenderer->mClipPortal = NULL; // this must be reset before any portal recursion takes place. - // Up to this point in the main draw call no rendering is performed so we can wait - // with swapping the render buffer until now. - if (!gl_draw_sync && drawmode == DM_MAINVIEW) - { - All.Unclock(); - static_cast(screen)->Swap(); - All.Clock(); - } RenderScene(recursion); // Handle all portals after rendering the opaque objects but before diff --git a/src/gl/scene/gl_walls.cpp b/src/gl/scene/gl_walls.cpp index 3afde063c..5b2271433 100644 --- a/src/gl/scene/gl_walls.cpp +++ b/src/gl/scene/gl_walls.cpp @@ -142,7 +142,6 @@ void GLWall::PutWall(bool translucent) { if (gl.lightmethod == LM_SOFTWARE && !translucent) { - // This is not yet ready. if (PutWallCompat(passflag[type])) return; } diff --git a/src/gl/system/gl_framebuffer.cpp b/src/gl/system/gl_framebuffer.cpp index ae1fabaed..ec77cfd14 100644 --- a/src/gl/system/gl_framebuffer.cpp +++ b/src/gl/system/gl_framebuffer.cpp @@ -179,9 +179,6 @@ void OpenGLFrameBuffer::InitializeState() // //========================================================================== -// Testing only for now. -CVAR(Bool, gl_draw_sync, true, 0) //false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) - void OpenGLFrameBuffer::Update() { if (!CanUpdate()) @@ -197,10 +194,7 @@ void OpenGLFrameBuffer::Update() GLRenderer->SetOutputViewport(nullptr); - if (gl_draw_sync || !swapped) - { - Swap(); - } + Swap(); swapped = false; Unlock(); CheckBench();