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 {
std::vector<std::string> KnownWorkarounds{
#ifndef MAGNUM_TARGET_GLES
#ifndef CORRADE_TARGET_APPLE
/* 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",
proprietary drivers on Linux/Windows and Intel drivers on Windows
causes the context to be forced to given version instead of
selecting latest available version */
"no-forward-compatible-core-context",
#endif
#ifdef CORRADE_TARGET_WINDOWS
/* 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. */
#ifndef CORRADE_TARGET_APPLE
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.";
const char* vendorString;
#endif
@ -194,8 +197,11 @@ bool Sdl2Application::tryCreateContext(const Configuration& configuration) {
/* Sorry about the UGLY code, HOPEFULLY THERE WON'T BE MORE WORKAROUNDS */
|| (vendorString = reinterpret_cast<const char*>(glGetString(GL_VENDOR)),
(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)
&& !_context->isDriverWorkaroundDisabled("amd-nv-no-forward-compatible-core-context"))
&& !_context->isDriverWorkaroundDisabled("no-forward-compatible-core-context"))
#endif
)) {
/* 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);
/* 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
with highest available version, they force the version to the one
specified, which is completely useless behavior. */
drivers on Linux. Instead of creating forward-compatible context with
highest available version, they force the version to the one specified,
which is completely useless behavior. */
} else {
/* We need to make the context current to read out vendor string, so
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));
if((std::strncmp(vendorString, nvidiaVendorString, sizeof(nvidiaVendorString)) == 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 */
glXDestroyContext(_display, _context);

12
src/Magnum/Platform/WindowlessWglApplication.cpp

@ -138,10 +138,10 @@ WindowlessWglContext::WindowlessWglContext(const Configuration& configuration, C
};
_context = wglCreateContextAttribsARB(_deviceContext, nullptr, fallbackContextAttributes);
/* 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
with highest available version, they force the version to the one
specified, which is completely useless behavior. */
/* Fall back to (forward compatible) GL 2.1 if we are on binary
NVidia/AMD/Intel drivers on Windows. Instead of creating forward-compatible
context with highest available version, they force the version to the
one specified, which is completely useless behavior. */
} else {
/* We need to make the context current to read out vendor string */
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
list on unrelated drivers */
constexpr static const char nvidiaVendorString[] = "NVIDIA Corporation";
constexpr static const char intelVendorString[] = "Intel";
constexpr static const char amdVendorString[] = "ATI Technologies Inc.";
const char* const vendorString = reinterpret_cast<const char*>(glGetString(GL_VENDOR));
if((std::strncmp(vendorString, nvidiaVendorString, sizeof(nvidiaVendorString)) == 0 ||
std::strncmp(vendorString, intelVendorString, sizeof(intelVendorString)) == 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 */
wglDeleteContext(_context);

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

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

Loading…
Cancel
Save