mirror of
https://github.com/glfw/glfw.git
synced 2024-11-26 20:11:58 +00:00
Comment cleanup.
This commit is contained in:
parent
135be952fe
commit
dc9d287e33
@ -112,24 +112,18 @@ static GLboolean chooseFBConfigs(const _GLFWctxconfig* ctxconfig,
|
|||||||
_GLFWfbconfig* u = usableConfigs + usableCount;
|
_GLFWfbconfig* u = usableConfigs + usableCount;
|
||||||
|
|
||||||
#if defined(_GLFW_X11)
|
#if defined(_GLFW_X11)
|
||||||
if (!getConfigAttrib(n, EGL_NATIVE_VISUAL_ID))
|
|
||||||
{
|
|
||||||
// Only consider EGLConfigs with associated visuals
|
// Only consider EGLConfigs with associated visuals
|
||||||
|
if (!getConfigAttrib(n, EGL_NATIVE_VISUAL_ID))
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
#endif // _GLFW_X11
|
#endif // _GLFW_X11
|
||||||
|
|
||||||
if (!(getConfigAttrib(n, EGL_COLOR_BUFFER_TYPE) & EGL_RGB_BUFFER))
|
|
||||||
{
|
|
||||||
// Only consider RGB(A) EGLConfigs
|
// Only consider RGB(A) EGLConfigs
|
||||||
|
if (!(getConfigAttrib(n, EGL_COLOR_BUFFER_TYPE) & EGL_RGB_BUFFER))
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
if (!(getConfigAttrib(n, EGL_SURFACE_TYPE) & EGL_WINDOW_BIT))
|
|
||||||
{
|
|
||||||
// Only consider window EGLConfigs
|
// Only consider window EGLConfigs
|
||||||
|
if (!(getConfigAttrib(n, EGL_SURFACE_TYPE) & EGL_WINDOW_BIT))
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
if (ctxconfig->api == GLFW_OPENGL_ES_API)
|
if (ctxconfig->api == GLFW_OPENGL_ES_API)
|
||||||
{
|
{
|
||||||
@ -270,8 +264,8 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// some EGL drivers don't implement the EGL_NATIVE_VISUAL_ID
|
// Some EGL drivers do not implement the EGL_NATIVE_VISUAL_ID
|
||||||
// attribute, so attempt to find the closest match.
|
// attribute, so attempt to find the closest match
|
||||||
|
|
||||||
eglGetConfigAttrib(_glfw.egl.display, config,
|
eglGetConfigAttrib(_glfw.egl.display, config,
|
||||||
EGL_RED_SIZE, &redBits);
|
EGL_RED_SIZE, &redBits);
|
||||||
|
@ -61,13 +61,11 @@ static GLboolean chooseFBConfig(const _GLFWfbconfig* desired, GLXFBConfig* resul
|
|||||||
const char* vendor;
|
const char* vendor;
|
||||||
GLboolean trustWindowBit = GL_TRUE;
|
GLboolean trustWindowBit = GL_TRUE;
|
||||||
|
|
||||||
vendor = glXGetClientString(_glfw.x11.display, GLX_VENDOR);
|
|
||||||
if (strcmp(vendor, "Chromium") == 0)
|
|
||||||
{
|
|
||||||
// HACK: This is a (hopefully temporary) workaround for Chromium
|
// HACK: This is a (hopefully temporary) workaround for Chromium
|
||||||
// (VirtualBox GL) not setting the window bit on any GLXFBConfigs
|
// (VirtualBox GL) not setting the window bit on any GLXFBConfigs
|
||||||
|
vendor = glXGetClientString(_glfw.x11.display, GLX_VENDOR);
|
||||||
|
if (strcmp(vendor, "Chromium") == 0)
|
||||||
trustWindowBit = GL_FALSE;
|
trustWindowBit = GL_FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
nativeConfigs = glXGetFBConfigs(_glfw.x11.display, _glfw.x11.screen,
|
nativeConfigs = glXGetFBConfigs(_glfw.x11.display, _glfw.x11.screen,
|
||||||
&nativeCount);
|
&nativeCount);
|
||||||
@ -85,26 +83,20 @@ static GLboolean chooseFBConfig(const _GLFWfbconfig* desired, GLXFBConfig* resul
|
|||||||
const GLXFBConfig n = nativeConfigs[i];
|
const GLXFBConfig n = nativeConfigs[i];
|
||||||
_GLFWfbconfig* u = usableConfigs + usableCount;
|
_GLFWfbconfig* u = usableConfigs + usableCount;
|
||||||
|
|
||||||
if (!getFBConfigAttrib(n, GLX_VISUAL_ID))
|
|
||||||
{
|
|
||||||
// Only consider GLXFBConfigs with associated visuals
|
// Only consider GLXFBConfigs with associated visuals
|
||||||
|
if (!getFBConfigAttrib(n, GLX_VISUAL_ID))
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
if (!(getFBConfigAttrib(n, GLX_RENDER_TYPE) & GLX_RGBA_BIT))
|
|
||||||
{
|
|
||||||
// Only consider RGBA GLXFBConfigs
|
// Only consider RGBA GLXFBConfigs
|
||||||
|
if (!(getFBConfigAttrib(n, GLX_RENDER_TYPE) & GLX_RGBA_BIT))
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
|
// Only consider window GLXFBConfigs
|
||||||
if (!(getFBConfigAttrib(n, GLX_DRAWABLE_TYPE) & GLX_WINDOW_BIT))
|
if (!(getFBConfigAttrib(n, GLX_DRAWABLE_TYPE) & GLX_WINDOW_BIT))
|
||||||
{
|
{
|
||||||
if (trustWindowBit)
|
if (trustWindowBit)
|
||||||
{
|
|
||||||
// Only consider window GLXFBConfigs
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
u->redBits = getFBConfigAttrib(n, GLX_RED_SIZE);
|
u->redBits = getFBConfigAttrib(n, GLX_RED_SIZE);
|
||||||
u->greenBits = getFBConfigAttrib(n, GLX_GREEN_SIZE);
|
u->greenBits = getFBConfigAttrib(n, GLX_GREEN_SIZE);
|
||||||
@ -304,7 +296,6 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve the corresponding visual
|
|
||||||
window->glx.visual = glXGetVisualFromFBConfig(_glfw.x11.display, native);
|
window->glx.visual = glXGetVisualFromFBConfig(_glfw.x11.display, native);
|
||||||
if (!window->glx.visual)
|
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)
|
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_MAJOR_VERSION_ARB, ctxconfig->major);
|
||||||
setGLXattrib(GLX_CONTEXT_MINOR_VERSION_ARB, ctxconfig->minor);
|
setGLXattrib(GLX_CONTEXT_MINOR_VERSION_ARB, ctxconfig->minor);
|
||||||
}
|
}
|
||||||
@ -429,12 +419,12 @@ int _glfwCreateContext(_GLFWwindow* window,
|
|||||||
True,
|
True,
|
||||||
attribs);
|
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)
|
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 &&
|
if (_glfw.x11.errorCode == _glfw.glx.errorBase + GLXBadProfileARB &&
|
||||||
ctxconfig->api == GLFW_OPENGL_API &&
|
ctxconfig->api == GLFW_OPENGL_API &&
|
||||||
ctxconfig->profile == GLFW_OPENGL_ANY_PROFILE &&
|
ctxconfig->profile == GLFW_OPENGL_ANY_PROFILE &&
|
||||||
@ -522,12 +512,11 @@ void _glfwPlatformSwapInterval(int interval)
|
|||||||
|
|
||||||
int _glfwPlatformExtensionSupported(const char* extension)
|
int _glfwPlatformExtensionSupported(const char* extension)
|
||||||
{
|
{
|
||||||
const GLubyte* extensions;
|
const GLubyte* extensions =
|
||||||
|
(const GLubyte*) glXQueryExtensionsString(_glfw.x11.display,
|
||||||
// Get list of GLX extensions
|
|
||||||
extensions = (const GLubyte*) glXQueryExtensionsString(_glfw.x11.display,
|
|
||||||
_glfw.x11.screen);
|
_glfw.x11.screen);
|
||||||
if (extensions != NULL)
|
|
||||||
|
if (extensions)
|
||||||
{
|
{
|
||||||
if (_glfwStringInExtensionString(extension, extensions))
|
if (_glfwStringInExtensionString(extension, extensions))
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
|
@ -176,7 +176,8 @@ static GLboolean choosePixelFormat(_GLFWwindow* window,
|
|||||||
|
|
||||||
if (window->wgl.ARB_pixel_format)
|
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) ||
|
if (!getPixelFormatAttrib(window, n, WGL_SUPPORT_OPENGL_ARB) ||
|
||||||
!getPixelFormatAttrib(window, n, WGL_DRAW_TO_WINDOW_ARB))
|
!getPixelFormatAttrib(window, n, WGL_DRAW_TO_WINDOW_ARB))
|
||||||
{
|
{
|
||||||
@ -228,7 +229,7 @@ static GLboolean choosePixelFormat(_GLFWwindow* window,
|
|||||||
{
|
{
|
||||||
PIXELFORMATDESCRIPTOR pfd;
|
PIXELFORMATDESCRIPTOR pfd;
|
||||||
|
|
||||||
// Get pixel format attributes through old-fashioned PFDs
|
// Get pixel format attributes through legacy PFDs
|
||||||
|
|
||||||
if (!DescribePixelFormat(window->wgl.dc,
|
if (!DescribePixelFormat(window->wgl.dc,
|
||||||
n,
|
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)
|
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_MAJOR_VERSION_ARB, ctxconfig->major);
|
||||||
setWGLattrib(WGL_CONTEXT_MINOR_VERSION_ARB, ctxconfig->minor);
|
setWGLattrib(WGL_CONTEXT_MINOR_VERSION_ARB, ctxconfig->minor);
|
||||||
}
|
}
|
||||||
@ -579,27 +579,17 @@ int _glfwAnalyzeContext(const _GLFWwindow* window,
|
|||||||
|
|
||||||
if (fbconfig->samples > 0)
|
if (fbconfig->samples > 0)
|
||||||
{
|
{
|
||||||
// We want FSAA, but can we get it?
|
// MSAA is not a hard constraint, so do nothing if it's not supported
|
||||||
// FSAA is not a hard constraint, so otherwise we just don't care
|
|
||||||
|
|
||||||
if (window->wgl.ARB_multisample && window->wgl.ARB_pixel_format)
|
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;
|
required = GL_TRUE;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (fbconfig->sRGB)
|
if (fbconfig->sRGB)
|
||||||
{
|
{
|
||||||
// We want sRGB, but can we get it?
|
// sRGB is not a hard constraint, so do nothing if it's not supported
|
||||||
// sRGB is not a hard constraint, so otherwise we just don't care
|
|
||||||
|
|
||||||
if (window->wgl.ARB_framebuffer_sRGB && window->wgl.ARB_pixel_format)
|
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;
|
required = GL_TRUE;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (required)
|
if (required)
|
||||||
return _GLFW_RECREATION_REQUIRED;
|
return _GLFW_RECREATION_REQUIRED;
|
||||||
@ -632,12 +622,10 @@ void _glfwPlatformSwapInterval(int interval)
|
|||||||
_GLFWwindow* window = _glfwPlatformGetCurrentContext();
|
_GLFWwindow* window = _glfwPlatformGetCurrentContext();
|
||||||
|
|
||||||
#if !defined(_GLFW_USE_DWM_SWAP_INTERVAL)
|
#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)
|
if (_glfwIsCompositionEnabled() && interval)
|
||||||
{
|
|
||||||
// Don't enabled vsync when desktop compositing is enabled, as it leads
|
|
||||||
// to frame jitter
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (window->wgl.EXT_swap_control)
|
if (window->wgl.EXT_swap_control)
|
||||||
|
Loading…
Reference in New Issue
Block a user