From cbf3e427a1ebe5cbbfda44e8c0ede266761ace99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 25 Nov 2015 02:53:22 +0100 Subject: [PATCH] Recognizing `amd-nv-no-forward-compatible-core-context` workaround. --- src/Magnum/Implementation/driverSpecific.cpp | 7 ++++++- src/Magnum/Platform/Sdl2Application.cpp | 1 + src/Magnum/Platform/WindowlessGlxApplication.cpp | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Magnum/Implementation/driverSpecific.cpp b/src/Magnum/Implementation/driverSpecific.cpp index c7fed59e7..771f1688d 100644 --- a/src/Magnum/Implementation/driverSpecific.cpp +++ b/src/Magnum/Implementation/driverSpecific.cpp @@ -34,7 +34,12 @@ namespace Magnum { #ifndef CORRADE_NO_ASSERT namespace { - std::vector KnownWorkarounds{}; + std::vector KnownWorkarounds{ + /* Creating core context with specific version on AMD and NV + proprietary drivers causes the context to be forced to given + version instead of selecting latest available version */ + "amd-nv-no-forward-compatible-core-context" + }; } #endif diff --git a/src/Magnum/Platform/Sdl2Application.cpp b/src/Magnum/Platform/Sdl2Application.cpp index 40f40ad58..e8cbceda1 100644 --- a/src/Magnum/Platform/Sdl2Application.cpp +++ b/src/Magnum/Platform/Sdl2Application.cpp @@ -189,6 +189,7 @@ bool Sdl2Application::tryCreateContext(const Configuration& configuration) { #ifndef CORRADE_TARGET_APPLE /* Sorry about the UGLY code, HOPEFULLY THERE WON'T BE MORE WORKAROUNDS */ || (vendorString = reinterpret_cast(glGetString(GL_VENDOR)), + !_context->isDriverWorkaroundDisabled("amd-nv-no-forward-compatible-core-context") && (std::strncmp(vendorString, nvidiaVendorString, sizeof(nvidiaVendorString)) == 0 || std::strncmp(vendorString, amdVendorString, sizeof(amdVendorString)) == 0)) #endif diff --git a/src/Magnum/Platform/WindowlessGlxApplication.cpp b/src/Magnum/Platform/WindowlessGlxApplication.cpp index 6fb8b8fd1..ab86937bd 100644 --- a/src/Magnum/Platform/WindowlessGlxApplication.cpp +++ b/src/Magnum/Platform/WindowlessGlxApplication.cpp @@ -124,6 +124,7 @@ bool WindowlessGlxApplication::tryCreateContext(const Configuration&) { and HOPEFULLY THERE WON'T BE MORE WORKAROUNDS */ || (glXMakeContextCurrent(_display, _pbuffer, _pbuffer, _glContext) && (vendorString = reinterpret_cast(glGetString(GL_VENDOR)), + !_context->isDriverWorkaroundDisabled("amd-nv-no-forward-compatible-core-context") && (std::strncmp(vendorString, nvidiaVendorString, sizeof(nvidiaVendorString)) == 0 || std::strncmp(vendorString, amdVendorString, sizeof(amdVendorString)) == 0))) #endif