Browse Source

Platform: no-forward-compatible-core-context also on Intel/Windows.

Detected in WindowlessWglApplication, added it to both Sdl2Application
and WindowlessWglApplication. Renamed the workaround to reflect that it
is for all three major vendors.
pull/158/head
Vladimír Vondruš 10 years ago
parent
commit
f96b22e117
  1. 9
      src/Magnum/Implementation/driverSpecific.cpp
  2. 8
      src/Magnum/Platform/Sdl2Application.cpp
  3. 8
      src/Magnum/Platform/WindowlessGlxApplication.cpp
  4. 12
      src/Magnum/Platform/WindowlessWglApplication.cpp
  5. 2
      src/Magnum/Platform/magnum-info.cpp

9
src/Magnum/Implementation/driverSpecific.cpp

@ -35,10 +35,13 @@ namespace Magnum {
namespace { namespace {
std::vector<std::string> KnownWorkarounds{ std::vector<std::string> KnownWorkarounds{
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
#ifndef CORRADE_TARGET_APPLE
/* Creating core context with specific version on AMD and NV /* Creating core context with specific version on AMD and NV
proprietary drivers causes the context to be forced to given proprietary drivers on Linux/Windows and Intel drivers on Windows
version instead of selecting latest available version */ causes the context to be forced to given version instead of
"amd-nv-no-forward-compatible-core-context", selecting latest available version */
"no-forward-compatible-core-context",
#endif
#ifdef CORRADE_TARGET_WINDOWS #ifdef CORRADE_TARGET_WINDOWS
/* On Windows Intel drivers ARB_shading_language_420pack is exposed in /* On Windows Intel drivers ARB_shading_language_420pack is exposed in

8
src/Magnum/Platform/Sdl2Application.cpp

@ -186,6 +186,9 @@ bool Sdl2Application::tryCreateContext(const Configuration& configuration) {
version to the one specified, which is completely useless behavior. */ version to the one specified, which is completely useless behavior. */
#ifndef CORRADE_TARGET_APPLE #ifndef CORRADE_TARGET_APPLE
constexpr static const char nvidiaVendorString[] = "NVIDIA Corporation"; constexpr static const char nvidiaVendorString[] = "NVIDIA Corporation";
#ifdef CORRADE_TARGET_WINDOWS
constexpr static const char intelVendorString[] = "Intel";
#endif
constexpr static const char amdVendorString[] = "ATI Technologies Inc."; constexpr static const char amdVendorString[] = "ATI Technologies Inc.";
const char* vendorString; const char* vendorString;
#endif #endif
@ -194,8 +197,11 @@ bool Sdl2Application::tryCreateContext(const Configuration& configuration) {
/* Sorry about the UGLY code, HOPEFULLY THERE WON'T BE MORE WORKAROUNDS */ /* Sorry about the UGLY code, HOPEFULLY THERE WON'T BE MORE WORKAROUNDS */
|| (vendorString = reinterpret_cast<const char*>(glGetString(GL_VENDOR)), || (vendorString = reinterpret_cast<const char*>(glGetString(GL_VENDOR)),
(std::strncmp(vendorString, nvidiaVendorString, sizeof(nvidiaVendorString)) == 0 || (std::strncmp(vendorString, nvidiaVendorString, sizeof(nvidiaVendorString)) == 0 ||
#ifdef CORRADE_TARGET_WINDOWS
std::strncmp(vendorString, intelVendorString, sizeof(intelVendorString)) == 0 ||
#endif
std::strncmp(vendorString, amdVendorString, sizeof(amdVendorString)) == 0) std::strncmp(vendorString, amdVendorString, sizeof(amdVendorString)) == 0)
&& !_context->isDriverWorkaroundDisabled("amd-nv-no-forward-compatible-core-context")) && !_context->isDriverWorkaroundDisabled("no-forward-compatible-core-context"))
#endif #endif
)) { )) {
/* Don't print any warning when doing the NV workaround, because the /* Don't print any warning when doing the NV workaround, because the

8
src/Magnum/Platform/WindowlessGlxApplication.cpp

@ -103,9 +103,9 @@ WindowlessGlxContext::WindowlessGlxContext(const WindowlessGlxContext::Configura
_context = glXCreateContextAttribsARB(_display, configs[0], nullptr, True, fallbackContextAttributes); _context = glXCreateContextAttribsARB(_display, configs[0], nullptr, True, fallbackContextAttributes);
/* Fall back to (forward compatible) GL 2.1 if we are on binary NVidia/AMD /* Fall back to (forward compatible) GL 2.1 if we are on binary NVidia/AMD
drivers on Linux/Windows. Instead of creating forward-compatible context drivers on Linux. Instead of creating forward-compatible context with
with highest available version, they force the version to the one highest available version, they force the version to the one specified,
specified, which is completely useless behavior. */ which is completely useless behavior. */
} else { } else {
/* We need to make the context current to read out vendor string, so /* We need to make the context current to read out vendor string, so
save the previous values so we can safely revert back without save the previous values so we can safely revert back without
@ -125,7 +125,7 @@ WindowlessGlxContext::WindowlessGlxContext(const WindowlessGlxContext::Configura
const char* const vendorString = reinterpret_cast<const char*>(glGetString(GL_VENDOR)); const char* const vendorString = reinterpret_cast<const char*>(glGetString(GL_VENDOR));
if((std::strncmp(vendorString, nvidiaVendorString, sizeof(nvidiaVendorString)) == 0 || if((std::strncmp(vendorString, nvidiaVendorString, sizeof(nvidiaVendorString)) == 0 ||
std::strncmp(vendorString, amdVendorString, sizeof(amdVendorString)) == 0) && std::strncmp(vendorString, amdVendorString, sizeof(amdVendorString)) == 0) &&
(!magnumContext || !magnumContext->isDriverWorkaroundDisabled("amd-nv-no-forward-compatible-core-context"))) (!magnumContext || !magnumContext->isDriverWorkaroundDisabled("no-forward-compatible-core-context")))
{ {
/* Destroy the core context and create a compatibility one */ /* Destroy the core context and create a compatibility one */
glXDestroyContext(_display, _context); glXDestroyContext(_display, _context);

12
src/Magnum/Platform/WindowlessWglApplication.cpp

@ -138,10 +138,10 @@ WindowlessWglContext::WindowlessWglContext(const Configuration& configuration, C
}; };
_context = wglCreateContextAttribsARB(_deviceContext, nullptr, fallbackContextAttributes); _context = wglCreateContextAttribsARB(_deviceContext, nullptr, fallbackContextAttributes);
/* Fall back to (forward compatible) GL 2.1 if we are on binary NVidia/AMD /* Fall back to (forward compatible) GL 2.1 if we are on binary
drivers on Linux/Windows. Instead of creating forward-compatible context NVidia/AMD/Intel drivers on Windows. Instead of creating forward-compatible
with highest available version, they force the version to the one context with highest available version, they force the version to the
specified, which is completely useless behavior. */ one specified, which is completely useless behavior. */
} else { } else {
/* We need to make the context current to read out vendor string */ /* We need to make the context current to read out vendor string */
if(!wglMakeCurrent(_deviceContext, _context)) { if(!wglMakeCurrent(_deviceContext, _context)) {
@ -157,11 +157,13 @@ WindowlessWglContext::WindowlessWglContext(const Configuration& configuration, C
/* The workaround check is the last so it doesn't appear in workaround /* The workaround check is the last so it doesn't appear in workaround
list on unrelated drivers */ list on unrelated drivers */
constexpr static const char nvidiaVendorString[] = "NVIDIA Corporation"; constexpr static const char nvidiaVendorString[] = "NVIDIA Corporation";
constexpr static const char intelVendorString[] = "Intel";
constexpr static const char amdVendorString[] = "ATI Technologies Inc."; constexpr static const char amdVendorString[] = "ATI Technologies Inc.";
const char* const vendorString = reinterpret_cast<const char*>(glGetString(GL_VENDOR)); const char* const vendorString = reinterpret_cast<const char*>(glGetString(GL_VENDOR));
if((std::strncmp(vendorString, nvidiaVendorString, sizeof(nvidiaVendorString)) == 0 || if((std::strncmp(vendorString, nvidiaVendorString, sizeof(nvidiaVendorString)) == 0 ||
std::strncmp(vendorString, intelVendorString, sizeof(intelVendorString)) == 0 ||
std::strncmp(vendorString, amdVendorString, sizeof(amdVendorString)) == 0) && std::strncmp(vendorString, amdVendorString, sizeof(amdVendorString)) == 0) &&
(!magnumContext || !magnumContext->isDriverWorkaroundDisabled("amd-nv-no-forward-compatible-core-context"))) (!magnumContext || !magnumContext->isDriverWorkaroundDisabled("no-forward-compatible-core-context")))
{ {
/* Destroy the core context and create a compatibility one */ /* Destroy the core context and create a compatibility one */
wglDeleteContext(_context); wglDeleteContext(_context);

2
src/Magnum/Platform/magnum-info.cpp

@ -115,7 +115,7 @@ Using optional features:
GL_ARB_invalidate_subdata GL_ARB_invalidate_subdata
... ...
Using driver workarounds: Using driver workarounds:
amd-nv-no-forward-compatible-core-context no-forward-compatible-core-context
no-layout-qualifiers-on-old-glsl no-layout-qualifiers-on-old-glsl
Context flags: Context flags:
Supported GLSL versions: Supported GLSL versions:

Loading…
Cancel
Save