Browse files

Add a new cvar "r_waylandcompat"

Commit 9e15847 set the SDL OpenGL attribut SDL_GL_ALPHA_SIZE to 0 since
the alpha channel is used by Wayland. But for X11 the GLX 1.4 specification
clearly states: "If the requested number of bits in attrib_list for a
particular color component is 0 or GLX_DONT_CARE, then the number of
bits for that component is not considered." So if SDL_GL_ALPHA_SIZE is
0 a framebuffer without an alpha channel is created. This is no problem
on the default GLX module due to a non standard implementation but
manifests with Nvidias GLX module. The consequence are render mistakes
like in game display showing static or the flashlight looking weird.
  • Loading branch information...
1 parent f317b05 commit 9a9babf8d62386736dd433063590536da2f598b2 @Yamagi Yamagi committed with DanielGibson Sep 19, 2012
Showing with 6 additions and 1 deletion.
  1. +6 −1 neo/sys/glimp.cpp
@@ -35,6 +35,7 @@ If you have questions concerning this license or the applicable additional terms
#include "renderer/tr_local.h"
idCVar in_nograb("in_nograb", "0", CVAR_SYSTEM | CVAR_NOCHEAT, "prevents input grabbing");
+idCVar r_waylandcompat("r_waylandcompat", "0", CVAR_SYSTEM | CVAR_NOCHEAT | CVAR_ARCHIVE, "wayland compatible framebuffer");
static bool grabbed = false;
@@ -126,11 +127,15 @@ bool GLimp_Init(glimpParms_t parms) {
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, channelcolorbits);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, channelcolorbits);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, channelcolorbits);
- SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 0);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, tdepthbits);
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, tstencilbits);
+ if (r_waylandcompat.GetBool())
+ SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 0);
+ else
+ SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, channelcolorbits);
SDL_GL_SetAttribute(SDL_GL_STEREO, parms.stereo ? 1 : 0);
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, parms.multiSamples ? 1 : 0);

0 comments on commit 9a9babf

Please sign in to comment.