From e73d1f7f90f29e19dcc6bf545b71dcddc60fb210 Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Fri, 5 Jul 2024 01:02:59 +0200 Subject: [PATCH] source/Platform/Win32/Win32GLContext.cpp: skip goto in createGLContext() --- source/Platform/Win32/Win32GLContext.cpp | 29 +++++++++++------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/source/Platform/Win32/Win32GLContext.cpp b/source/Platform/Win32/Win32GLContext.cpp index cfc59bc..9ca4b0c 100644 --- a/source/Platform/Win32/Win32GLContext.cpp +++ b/source/Platform/Win32/Win32GLContext.cpp @@ -100,24 +100,21 @@ void Win32GLContext::createGLContext() tmpDC = ::wglCreateContext(m_deviceContext); ::wglMakeCurrent(m_deviceContext, tmpDC); - if (!ensureExtensionsLoaded(m_deviceContext)) { - goto err; + if (ensureExtensionsLoaded(m_deviceContext)) { + // TODO: For now.. We force 3.2 Core but this should not be implementation specific. + // The Display class should force that for all GLContext Implementations. + + int attriblist[] = { + WGL_CONTEXT_MAJOR_VERSION_ARB, 3, + WGL_CONTEXT_MINOR_VERSION_ARB, 2, + WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB, + 0, 0 + }; + + // Create real context. + m_renderContext = ::wglCreateContextAttribsARB(m_deviceContext, 0, attriblist); } - // TODO: For now.. We force 3.2 Core but this should not be implementation specific. - // The Display class should force that for all GLContext Implementations. - - int attriblist[] = { - WGL_CONTEXT_MAJOR_VERSION_ARB, 3, - WGL_CONTEXT_MINOR_VERSION_ARB, 2, - WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB, - 0, 0 - }; - - // Create real context. - m_renderContext = ::wglCreateContextAttribsARB(m_deviceContext, 0, attriblist); - -err: // Dont need the old one anymore. wglMakeCurrent(m_deviceContext, NULL); ::wglDeleteContext(tmpDC);