Comment cleanup.

This commit is contained in:
Camilla Berglund 2015-04-07 02:51:45 +02:00
parent 135be952fe
commit dc9d287e33
3 changed files with 31 additions and 60 deletions

View File

@ -112,24 +112,18 @@ static GLboolean chooseFBConfigs(const _GLFWctxconfig* ctxconfig,
_GLFWfbconfig* u = usableConfigs + usableCount;
#if defined(_GLFW_X11)
// Only consider EGLConfigs with associated visuals
if (!getConfigAttrib(n, EGL_NATIVE_VISUAL_ID))
{
// Only consider EGLConfigs with associated visuals
continue;
}
#endif // _GLFW_X11
// Only consider RGB(A) EGLConfigs
if (!(getConfigAttrib(n, EGL_COLOR_BUFFER_TYPE) & EGL_RGB_BUFFER))
{
// Only consider RGB(A) EGLConfigs
continue;
}
// Only consider window EGLConfigs
if (!(getConfigAttrib(n, EGL_SURFACE_TYPE) & EGL_WINDOW_BIT))
{
// Only consider window EGLConfigs
continue;
}
if (ctxconfig->api == GLFW_OPENGL_ES_API)
{
@ -270,8 +264,8 @@ int _glfwCreateContext(_GLFWwindow* window,
}
else
{
// some EGL drivers don't implement the EGL_NATIVE_VISUAL_ID
// attribute, so attempt to find the closest match.
// Some EGL drivers do not implement the EGL_NATIVE_VISUAL_ID
// attribute, so attempt to find the closest match
eglGetConfigAttrib(_glfw.egl.display, config,
EGL_RED_SIZE, &redBits);

View File

@ -61,13 +61,11 @@ static GLboolean chooseFBConfig(const _GLFWfbconfig* desired, GLXFBConfig* resul
const char* vendor;
GLboolean trustWindowBit = GL_TRUE;
// HACK: This is a (hopefully temporary) workaround for Chromium
// (VirtualBox GL) not setting the window bit on any GLXFBConfigs
vendor = glXGetClientString(_glfw.x11.display, GLX_VENDOR);
if (strcmp(vendor, "Chromium") == 0)
{
// HACK: This is a (hopefully temporary) workaround for Chromium
// (VirtualBox GL) not setting the window bit on any GLXFBConfigs
trustWindowBit = GL_FALSE;
}
nativeConfigs = glXGetFBConfigs(_glfw.x11.display, _glfw.x11.screen,
&nativeCount);
@ -85,25 +83,19 @@ static GLboolean chooseFBConfig(const _GLFWfbconfig* desired, GLXFBConfig* resul
const GLXFBConfig n = nativeConfigs[i];
_GLFWfbconfig* u = usableConfigs + usableCount;
// Only consider GLXFBConfigs with associated visuals
if (!getFBConfigAttrib(n, GLX_VISUAL_ID))
{
// Only consider GLXFBConfigs with associated visuals
continue;
}
// Only consider RGBA GLXFBConfigs
if (!(getFBConfigAttrib(n, GLX_RENDER_TYPE) & GLX_RGBA_BIT))
{
// Only consider RGBA GLXFBConfigs
continue;
}
// Only consider window GLXFBConfigs
if (!(getFBConfigAttrib(n, GLX_DRAWABLE_TYPE) & GLX_WINDOW_BIT))
{
if (trustWindowBit)
{
// Only consider window GLXFBConfigs
continue;
}
}
u->redBits = getFBConfigAttrib(n, GLX_RED_SIZE);
@ -304,7 +296,6 @@ int _glfwCreateContext(_GLFWwindow* window,
return GL_FALSE;
}
// Retrieve the corresponding visual
window->glx.visual = glXGetVisualFromFBConfig(_glfw.x11.display, native);
if (!window->glx.visual)
{
@ -404,12 +395,11 @@ int _glfwCreateContext(_GLFWwindow* window,
}
}
// NOTE: Only request an explicitly versioned context when necessary, as
// explicitly requesting version 1.0 does not always return the
// highest version supported by the driver
if (ctxconfig->major != 1 || ctxconfig->minor != 0)
{
// NOTE: Only request an explicitly versioned context when
// necessary, as explicitly requesting version 1.0 does not
// always return the highest available version
setGLXattrib(GLX_CONTEXT_MAJOR_VERSION_ARB, ctxconfig->major);
setGLXattrib(GLX_CONTEXT_MINOR_VERSION_ARB, ctxconfig->minor);
}
@ -429,12 +419,12 @@ int _glfwCreateContext(_GLFWwindow* window,
True,
attribs);
// HACK: This is a fallback for broken versions of the Mesa
// implementation of GLX_ARB_create_context_profile that fail
// default 1.0 context creation with a GLXBadProfileARB error in
// violation of the extension spec
if (!window->glx.context)
{
// HACK: This is a fallback for the broken Mesa implementation of
// GLX_ARB_create_context_profile, which fails default 1.0
// context creation with a GLXBadProfileARB error in violation
// of the extension spec
if (_glfw.x11.errorCode == _glfw.glx.errorBase + GLXBadProfileARB &&
ctxconfig->api == GLFW_OPENGL_API &&
ctxconfig->profile == GLFW_OPENGL_ANY_PROFILE &&
@ -522,12 +512,11 @@ void _glfwPlatformSwapInterval(int interval)
int _glfwPlatformExtensionSupported(const char* extension)
{
const GLubyte* extensions;
const GLubyte* extensions =
(const GLubyte*) glXQueryExtensionsString(_glfw.x11.display,
_glfw.x11.screen);
// Get list of GLX extensions
extensions = (const GLubyte*) glXQueryExtensionsString(_glfw.x11.display,
_glfw.x11.screen);
if (extensions != NULL)
if (extensions)
{
if (_glfwStringInExtensionString(extension, extensions))
return GL_TRUE;

View File

@ -176,7 +176,8 @@ static GLboolean choosePixelFormat(_GLFWwindow* window,
if (window->wgl.ARB_pixel_format)
{
// Get pixel format attributes through WGL_ARB_pixel_format
// Get pixel format attributes through "modern" extension
if (!getPixelFormatAttrib(window, n, WGL_SUPPORT_OPENGL_ARB) ||
!getPixelFormatAttrib(window, n, WGL_DRAW_TO_WINDOW_ARB))
{
@ -228,7 +229,7 @@ static GLboolean choosePixelFormat(_GLFWwindow* window,
{
PIXELFORMATDESCRIPTOR pfd;
// Get pixel format attributes through old-fashioned PFDs
// Get pixel format attributes through legacy PFDs
if (!DescribePixelFormat(window->wgl.dc,
n,
@ -437,12 +438,11 @@ int _glfwCreateContext(_GLFWwindow* window,
}
}
// NOTE: Only request an explicitly versioned context when necessary, as
// explicitly requesting version 1.0 does not always return the
// highest version supported by the driver
if (ctxconfig->major != 1 || ctxconfig->minor != 0)
{
// NOTE: Only request an explicitly versioned context when
// necessary, as explicitly requesting version 1.0 does not
// always return the highest available version
setWGLattrib(WGL_CONTEXT_MAJOR_VERSION_ARB, ctxconfig->major);
setWGLattrib(WGL_CONTEXT_MINOR_VERSION_ARB, ctxconfig->minor);
}
@ -579,26 +579,16 @@ int _glfwAnalyzeContext(const _GLFWwindow* window,
if (fbconfig->samples > 0)
{
// We want FSAA, but can we get it?
// FSAA is not a hard constraint, so otherwise we just don't care
// MSAA is not a hard constraint, so do nothing if it's not supported
if (window->wgl.ARB_multisample && window->wgl.ARB_pixel_format)
{
// We appear to have both the extension and the means to ask for it
required = GL_TRUE;
}
}
if (fbconfig->sRGB)
{
// We want sRGB, but can we get it?
// sRGB is not a hard constraint, so otherwise we just don't care
// sRGB is not a hard constraint, so do nothing if it's not supported
if (window->wgl.ARB_framebuffer_sRGB && window->wgl.ARB_pixel_format)
{
// We appear to have both the extension and the means to ask for it
required = GL_TRUE;
}
}
if (required)
@ -632,12 +622,10 @@ void _glfwPlatformSwapInterval(int interval)
_GLFWwindow* window = _glfwPlatformGetCurrentContext();
#if !defined(_GLFW_USE_DWM_SWAP_INTERVAL)
// HACK: Don't enabled vsync when desktop compositing is enabled, as it
// leads to severe frame jitter on some cards
if (_glfwIsCompositionEnabled() && interval)
{
// Don't enabled vsync when desktop compositing is enabled, as it leads
// to frame jitter
return;
}
#endif
if (window->wgl.EXT_swap_control)