Browse Source

Platform: drop the forward compatible flag for fallback GLX 2.1 context.

Same is already done in the GLFW and SDL2 app. Also updated the comments
to clarify why is it done (instead of an "I have no idea" TODO).
pull/427/merge
Vladimír Vondruš 6 years ago
parent
commit
68559411fc
  1. 4
      src/Magnum/Platform/GlfwApplication.cpp
  2. 4
      src/Magnum/Platform/Sdl2Application.cpp
  3. 10
      src/Magnum/Platform/WindowlessGlxApplication.cpp

4
src/Magnum/Platform/GlfwApplication.cpp

@ -527,7 +527,9 @@ bool GlfwApplication::tryCreate(const Configuration& configuration, const GLConf
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_ANY_PROFILE);
/** @todo or keep the fwcompat? */
/* Discard the ForwardCompatible flag for the fallback. Having it set
makes the fallback context creation fail on Mesa's Zink (which is
just 2.1) and I assume on others as well. */
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, false);
_window = glfwCreateWindow(scaledWindowSize.x(), scaledWindowSize.y(), configuration.title().c_str(), monitor, nullptr);

4
src/Magnum/Platform/Sdl2Application.cpp

@ -572,7 +572,9 @@ bool Sdl2Application::tryCreate(const Configuration& configuration, const GLConf
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY);
/** @todo or keep the fwcompat? */
/* Discard the ForwardCompatible flag for the fallback. Having it set
makes the fallback context creation fail on Mesa's Zink (which is
just 2.1) and I assume on others as well. */
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, int(glFlags) & int(~GLConfiguration::Flag::ForwardCompatible));
if(!(_window = SDL_CreateWindow(configuration.title().data(),

10
src/Magnum/Platform/WindowlessGlxApplication.cpp

@ -149,7 +149,10 @@ WindowlessGlxContext::WindowlessGlxContext(const WindowlessGlxContext::Configura
}
const GLint fallbackContextAttributes[] = {
GLX_CONTEXT_FLAGS_ARB, GLint(flags),
/* Discard the ForwardCompatible flag for the fallback. Having it
set makes the fallback context creation fail on Mesa's Zink
(which is just 2.1) and I assume on others as well. */
GLX_CONTEXT_FLAGS_ARB, GLint(flags & ~Configuration::Flag::ForwardCompatible),
0
};
{
@ -188,7 +191,10 @@ WindowlessGlxContext::WindowlessGlxContext(const WindowlessGlxContext::Configura
/* Destroy the core context and create a compatibility one */
glXDestroyContext(_display, _context);
const GLint fallbackContextAttributes[] = {
/** @todo keep the fwcompat? */
/* Discard the ForwardCompatible flag for the fallback.
Compared to the above case of a 2.1 fallback it's not really
needed here (AFAIK it works in both cases), but let's be
consistent. */
GLX_CONTEXT_FLAGS_ARB, GLint(flags & ~Configuration::Flag::ForwardCompatible),
0
};

Loading…
Cancel
Save