This commit is contained in:
nashmuhandes 2016-08-30 18:47:35 +08:00
commit 0dbf23de19
5 changed files with 10 additions and 26 deletions

View file

@ -480,7 +480,6 @@ void FGLRenderer::RenderTranslucent()
// stencil, z-buffer and the projection matrix intact! // stencil, z-buffer and the projection matrix intact!
// //
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
EXTERN_CVAR(Bool, gl_draw_sync)
void FGLRenderer::DrawScene(int drawmode) 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. 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<OpenGLFrameBuffer*>(screen)->Swap();
All.Clock();
}
RenderScene(recursion); RenderScene(recursion);
// Handle all portals after rendering the opaque objects but before // Handle all portals after rendering the opaque objects but before

View file

@ -142,7 +142,6 @@ void GLWall::PutWall(bool translucent)
{ {
if (gl.lightmethod == LM_SOFTWARE && !translucent) if (gl.lightmethod == LM_SOFTWARE && !translucent)
{ {
// This is not yet ready.
if (PutWallCompat(passflag[type])) return; if (PutWallCompat(passflag[type])) return;
} }

View file

@ -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() void OpenGLFrameBuffer::Update()
{ {
if (!CanUpdate()) if (!CanUpdate())
@ -197,10 +194,7 @@ void OpenGLFrameBuffer::Update()
GLRenderer->SetOutputViewport(nullptr); GLRenderer->SetOutputViewport(nullptr);
if (gl_draw_sync || !swapped) Swap();
{
Swap();
}
swapped = false; swapped = false;
Unlock(); Unlock();
CheckBench(); CheckBench();

View file

@ -190,6 +190,9 @@ typedef NSInteger NSApplicationActivationPolicy;
static const NSWindowCollectionBehavior NSWindowCollectionBehaviorFullScreenAuxiliary = NSWindowCollectionBehavior(1 << 8); static const NSWindowCollectionBehavior NSWindowCollectionBehaviorFullScreenAuxiliary = NSWindowCollectionBehavior(1 << 8);
static const NSOpenGLPixelFormatAttribute NSOpenGLPFAOpenGLProfile(96);
static const NSOpenGLPixelFormatAttribute NSOpenGLProfileVersion3_2Core(0x3200);
#endif // prior to 10.7 #endif // prior to 10.7
#endif // COCOA_I_COMMON_INCLUDED #endif // COCOA_I_COMMON_INCLUDED

View file

@ -232,7 +232,7 @@ namespace
class CocoaVideo : public IVideo class CocoaVideo : public IVideo
{ {
public: public:
explicit CocoaVideo(int multisample); CocoaVideo();
virtual EDisplayType GetDisplayType() { return DISPLAY_Both; } virtual EDisplayType GetDisplayType() { return DISPLAY_Both; }
virtual void SetWindowedScale(float scale); virtual void SetWindowedScale(float scale);
@ -464,7 +464,7 @@ CocoaWindow* CreateCocoaWindow(const NSUInteger styleMask)
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
CocoaVideo::CocoaVideo(const int multisample) CocoaVideo::CocoaVideo()
: m_window(CreateCocoaWindow(STYLE_MASK_WINDOWED)) : m_window(CreateCocoaWindow(STYLE_MASK_WINDOWED))
, m_width(-1) , m_width(-1)
, m_height(-1) , m_height(-1)
@ -491,13 +491,10 @@ CocoaVideo::CocoaVideo(const int multisample)
attributes[i++] = NSOpenGLPFAAllowOfflineRenderers; attributes[i++] = NSOpenGLPFAAllowOfflineRenderers;
} }
if (multisample) if (NSAppKitVersionNumber >= AppKit10_7)
{ {
attributes[i++] = NSOpenGLPFAMultisample; attributes[i++] = NSOpenGLPFAOpenGLProfile;
attributes[i++] = NSOpenGLPFASampleBuffers; attributes[i++] = NSOpenGLProfileVersion3_2Core;
attributes[i++] = NSOpenGLPixelFormatAttribute(1);
attributes[i++] = NSOpenGLPFASamples;
attributes[i++] = NSOpenGLPixelFormatAttribute(multisample);
} }
attributes[i] = NSOpenGLPixelFormatAttribute(0); attributes[i] = NSOpenGLPixelFormatAttribute(0);
@ -1253,7 +1250,7 @@ void I_InitGraphics()
val.Bool = !!Args->CheckParm("-devparm"); val.Bool = !!Args->CheckParm("-devparm");
ticker.SetGenericRepDefault(val, CVAR_Bool); ticker.SetGenericRepDefault(val, CVAR_Bool);
Video = new CocoaVideo(0); Video = new CocoaVideo;
atterm(I_ShutdownGraphics); atterm(I_ShutdownGraphics);
} }