Removed stricter Unix visual requirements for now and increased Windows pixel format array size from 256 to 512 to make sure all pixel formats are taken into consideration on systems that support that many.

This commit is contained in:
binary1248 2015-04-15 00:46:21 +02:00
parent ac3a5394ca
commit 53f61e9596
2 changed files with 11 additions and 34 deletions

View File

@ -308,34 +308,17 @@ XVisualInfo GlxContext::selectBestVisual(::Display* display, unsigned int bitsPe
XVisualInfo* visuals = XGetVisualInfo(display, 0, NULL, &count);
if (visuals)
{
// There are no GLX versions prior to 1.0
int major = 0;
int minor = 0;
if (!glXQueryVersion(display, &major, &minor))
err() << "Failed to query GLX version" << std::endl;
// Evaluate all the returned visuals, and pick the best one
int bestScore = 0x7FFFFFFF;
XVisualInfo bestVisual;
for (int i = 0; i < count; ++i)
{
// Check mandatory attributes
int useGL, doubleBuffer, rgba;
glXGetConfig(display, &visuals[i], GLX_USE_GL, &useGL);
int doubleBuffer;
glXGetConfig(display, &visuals[i], GLX_DOUBLEBUFFER, &doubleBuffer);
glXGetConfig(display, &visuals[i], GLX_RGBA, &rgba);
if (!useGL || !doubleBuffer || !rgba)
if (!doubleBuffer)
continue;
if (major > 1 || minor >= 3)
{
int drawableType;
glXGetConfig(display, &visuals[i], GLX_DRAWABLE_TYPE, &drawableType);
if (!(drawableType & GLX_WINDOW_BIT))
continue;
}
// Extract the components of the current visual
int red, green, blue, alpha, depth, stencil, multiSampling, samples;
glXGetConfig(display, &visuals[i], GLX_RED_SIZE, &red);
@ -356,14 +339,8 @@ XVisualInfo GlxContext::selectBestVisual(::Display* display, unsigned int bitsPe
samples = 0;
}
// TODO: Replace this with proper acceleration detection
bool accelerated = true;
if (major > 1 || minor >= 3)
{
int caveat;
glXGetConfig(display, &visuals[i], GLX_CONFIG_CAVEAT, &caveat);
if (caveat == GLX_SLOW_CONFIG)
accelerated = false;
}
// Evaluate the visual
int color = red + green + blue + alpha;

View File

@ -231,9 +231,9 @@ int WglContext::selectBestPixelFormat(HDC deviceContext, unsigned int bitsPerPix
};
// Let's check how many formats are supporting our requirements
int formats[256];
int formats[512];
UINT nbFormats;
bool isValid = wglChoosePixelFormatARB(deviceContext, intAttributes, NULL, 256, formats, &nbFormats) != 0;
bool isValid = wglChoosePixelFormatARB(deviceContext, intAttributes, NULL, 512, formats, &nbFormats) != 0;
// Get the best format among the returned ones
if (isValid && (nbFormats > 0))