From 9a685b43f18f4744e718ddfc1429701fa377465d Mon Sep 17 00:00:00 2001 From: res Date: Tue, 26 Feb 2008 11:27:24 +0000 Subject: [PATCH] Change GLX visual acquisition to also try without sample buffers if samples == 1 - some Mesa drivers don't provide visuals with any sample buffer git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8136 d7cf8633-e32d-0410-b094-e92efae38249 --- vid_glx.c | 7 +++++++ vid_shared.c | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/vid_glx.c b/vid_glx.c index ff985108..d51318a6 100644 --- a/vid_glx.c +++ b/vid_glx.c @@ -702,6 +702,13 @@ int VID_InitMode(int fullscreen, int width, int height, int bpp, int refreshrate VID_BuildGLXAttrib(attrib, bpp == 32, stereobuffer, samples); visinfo = qglXChooseVisual(vidx11_display, vidx11_screen, attrib); + if (!visinfo && (samples == 1)) + { + /* Some Mesa drivers reject sample buffers with 1 sample, so try + * entirely without one */ + VID_BuildGLXAttrib(attrib, bpp == 32, stereobuffer, 0); + visinfo = qglXChooseVisual(vidx11_display, vidx11_screen, attrib); + } if (!visinfo) { Con_Print("Couldn't get an RGB, Double-buffered, Depth visual\n"); diff --git a/vid_shared.c b/vid_shared.c index 14498edf..aaea23c0 100644 --- a/vid_shared.c +++ b/vid_shared.c @@ -1068,7 +1068,7 @@ void VID_Shared_Init(void) int VID_Mode(int fullscreen, int width, int height, int bpp, int refreshrate, int stereobuffer, int samples) { cl_ignoremousemoves = 2; - Con_Printf("Initialized Video Mode: %s %dx%dx%dx%dhz%s%s\n", fullscreen ? "fullscreen" : "window", width, height, bpp, refreshrate, stereobuffer ? " stereo" : "", samples > 1 ? va(" (%ix AA)", samples) : ""); + Con_Printf("Initializing Video Mode: %s %dx%dx%dx%dhz%s%s\n", fullscreen ? "fullscreen" : "window", width, height, bpp, refreshrate, stereobuffer ? " stereo" : "", samples > 1 ? va(" (%ix AA)", samples) : ""); if (VID_InitMode(fullscreen, width, height, bpp, vid_userefreshrate.integer ? max(1, refreshrate) : 0, stereobuffer, samples)) { vid.fullscreen = fullscreen; -- 2.39.2