Merge remote-tracking branch 'gzdoom/modern' into hw_postprocess

This commit is contained in:
Magnus Norddahl 2018-06-30 16:47:06 +02:00
commit 5b3212df13
2 changed files with 8 additions and 27 deletions

View file

@ -76,7 +76,7 @@ EXTERN_CVAR (Bool, r_drawvoxels)
void FDrawInfo::ApplyVPUniforms() void FDrawInfo::ApplyVPUniforms()
{ {
VPUniforms.CalcDependencies(); VPUniforms.CalcDependencies();
GLRenderer->mShaderManager->ApplyMatrices(&VPUniforms, NORMAL_PASS); GLRenderer->mShaderManager->ApplyMatrices(&VPUniforms, gl_RenderState.GetPassType());
if (!(gl.flags & RFL_NO_CLIP_PLANES)) if (!(gl.flags & RFL_NO_CLIP_PLANES))
{ {

View file

@ -288,7 +288,7 @@ CocoaWindow* CreateWindow(const NSUInteger styleMask)
return window; return window;
} }
NSOpenGLPixelFormat* CreatePixelFormat(const NSOpenGLPixelFormatAttribute profile) NSOpenGLPixelFormat* CreatePixelFormat()
{ {
NSOpenGLPixelFormatAttribute attributes[16]; NSOpenGLPixelFormatAttribute attributes[16];
size_t i = 0; size_t i = 0;
@ -301,7 +301,7 @@ NSOpenGLPixelFormat* CreatePixelFormat(const NSOpenGLPixelFormatAttribute profil
attributes[i++] = NSOpenGLPFAStencilSize; attributes[i++] = NSOpenGLPFAStencilSize;
attributes[i++] = NSOpenGLPixelFormatAttribute(8); attributes[i++] = NSOpenGLPixelFormatAttribute(8);
attributes[i++] = NSOpenGLPFAOpenGLProfile; attributes[i++] = NSOpenGLPFAOpenGLProfile;
attributes[i++] = profile; attributes[i++] = NSOpenGLProfileVersion3_2Core;
if (!vid_autoswitch) if (!vid_autoswitch)
{ {
@ -330,30 +330,7 @@ SystemGLFrameBuffer::SystemGLFrameBuffer(void*, const bool fullscreen)
{ {
SetFlash(0, 0); SetFlash(0, 0);
// Create OpenGL pixel format NSOpenGLPixelFormat* pixelFormat = CreatePixelFormat();
NSOpenGLPixelFormatAttribute defaultProfile = NSOpenGLProfileVersion3_2Core;
if (NSAppKitVersionNumber < AppKit10_9)
{
// There is no support for OpenGL 3.3 before Mavericks
defaultProfile = NSOpenGLProfileVersionLegacy;
}
else if (const char* const glversion = Args->CheckValue("-glversion"))
{
// Check for explicit version specified in command line
const double version = strtod(glversion, nullptr) + 0.01;
if (version < 3.3)
{
defaultProfile = NSOpenGLProfileVersionLegacy;
}
}
NSOpenGLPixelFormat* pixelFormat = CreatePixelFormat(defaultProfile);
if (nil == pixelFormat && NSOpenGLProfileVersion3_2Core == defaultProfile)
{
pixelFormat = CreatePixelFormat(NSOpenGLProfileVersionLegacy);
}
if (nil == pixelFormat) if (nil == pixelFormat)
{ {
@ -386,6 +363,7 @@ SystemGLFrameBuffer::SystemGLFrameBuffer(void*, const bool fullscreen)
} }
} }
assert(frameBuffer == nullptr);
frameBuffer = this; frameBuffer = this;
FConsoleWindow::GetInstance().Show(false); FConsoleWindow::GetInstance().Show(false);
@ -393,6 +371,9 @@ SystemGLFrameBuffer::SystemGLFrameBuffer(void*, const bool fullscreen)
SystemGLFrameBuffer::~SystemGLFrameBuffer() SystemGLFrameBuffer::~SystemGLFrameBuffer()
{ {
assert(frameBuffer == this);
frameBuffer = nullptr;
NSNotificationCenter* nc = [NSNotificationCenter defaultCenter]; NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
[nc removeObserver:m_window [nc removeObserver:m_window
name:NSWindowDidMoveNotification name:NSWindowDidMoveNotification