Simplified WGL extension logic.

Not applying this to GLX or EGL yet because Mesa.
master
Camilla Berglund ago%!(EXTRA string=10 years)
parent 656666e722
commit 905073a506
  1. 110
      src/wgl_context.c

@ -36,89 +36,45 @@
// //
static void initWGLExtensions(_GLFWwindow* window) static void initWGLExtensions(_GLFWwindow* window)
{ {
// This needs to include every function pointer loaded below // Functions for WGL_EXT_extension_string
window->wgl.SwapIntervalEXT = NULL; // NOTE: These are needed by _glfwPlatformExtensionSupported
window->wgl.GetPixelFormatAttribivARB = NULL;
window->wgl.GetExtensionsStringARB = NULL;
window->wgl.GetExtensionsStringEXT = NULL;
window->wgl.CreateContextAttribsARB = NULL;
// This needs to include every extension used below except for
// WGL_ARB_extensions_string and WGL_EXT_extensions_string
window->wgl.ARB_multisample = GL_FALSE;
window->wgl.ARB_framebuffer_sRGB = GL_FALSE;
window->wgl.ARB_create_context = GL_FALSE;
window->wgl.ARB_create_context_profile = GL_FALSE;
window->wgl.EXT_create_context_es2_profile = GL_FALSE;
window->wgl.ARB_create_context_robustness = GL_FALSE;
window->wgl.EXT_swap_control = GL_FALSE;
window->wgl.ARB_pixel_format = GL_FALSE;
window->wgl.ARB_context_flush_control = GL_FALSE;
window->wgl.GetExtensionsStringEXT = (PFNWGLGETEXTENSIONSSTRINGEXTPROC) window->wgl.GetExtensionsStringEXT = (PFNWGLGETEXTENSIONSSTRINGEXTPROC)
wglGetProcAddress("wglGetExtensionsStringEXT"); wglGetProcAddress("wglGetExtensionsStringEXT");
if (!window->wgl.GetExtensionsStringEXT) window->wgl.GetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC)
{ wglGetProcAddress("wglGetExtensionsStringARB");
window->wgl.GetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC)
wglGetProcAddress("wglGetExtensionsStringARB");
if (!window->wgl.GetExtensionsStringARB)
return;
}
if (_glfwPlatformExtensionSupported("WGL_ARB_multisample"))
window->wgl.ARB_multisample = GL_TRUE;
if (_glfwPlatformExtensionSupported("WGL_ARB_framebuffer_sRGB"))
window->wgl.ARB_framebuffer_sRGB = GL_TRUE;
if (_glfwPlatformExtensionSupported("WGL_ARB_create_context"))
{
window->wgl.CreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)
wglGetProcAddress("wglCreateContextAttribsARB");
if (window->wgl.CreateContextAttribsARB)
window->wgl.ARB_create_context = GL_TRUE;
}
if (window->wgl.ARB_create_context)
{
if (_glfwPlatformExtensionSupported("WGL_ARB_create_context_profile"))
window->wgl.ARB_create_context_profile = GL_TRUE;
}
if (window->wgl.ARB_create_context && // Functions for WGL_ARB_create_context
window->wgl.ARB_create_context_profile) window->wgl.CreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)
{ wglGetProcAddress("wglCreateContextAttribsARB");
if (_glfwPlatformExtensionSupported("WGL_EXT_create_context_es2_profile"))
window->wgl.EXT_create_context_es2_profile = GL_TRUE;
}
if (window->wgl.ARB_create_context) // Functions for WGL_EXT_swap_control
{ window->wgl.SwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC)
if (_glfwPlatformExtensionSupported("WGL_ARB_create_context_robustness")) wglGetProcAddress("wglSwapIntervalEXT");
window->wgl.ARB_create_context_robustness = GL_TRUE;
}
if (_glfwPlatformExtensionSupported("WGL_EXT_swap_control")) // Functions for WGL_ARB_pixel_format
{ window->wgl.GetPixelFormatAttribivARB = (PFNWGLGETPIXELFORMATATTRIBIVARBPROC)
window->wgl.SwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC) wglGetProcAddress("wglGetPixelFormatAttribivARB");
wglGetProcAddress("wglSwapIntervalEXT");
if (window->wgl.SwapIntervalEXT) // This needs to include every extension used below except for
window->wgl.EXT_swap_control = GL_TRUE; // WGL_ARB_extensions_string and WGL_EXT_extensions_string
} window->wgl.ARB_multisample =
_glfwPlatformExtensionSupported("WGL_ARB_multisample");
if (_glfwPlatformExtensionSupported("WGL_ARB_pixel_format")) window->wgl.ARB_framebuffer_sRGB =
{ _glfwPlatformExtensionSupported("WGL_ARB_framebuffer_sRGB");
window->wgl.GetPixelFormatAttribivARB = (PFNWGLGETPIXELFORMATATTRIBIVARBPROC) window->wgl.ARB_create_context =
wglGetProcAddress("wglGetPixelFormatAttribivARB"); _glfwPlatformExtensionSupported("WGL_ARB_create_context");
window->wgl.ARB_create_context_profile =
if (window->wgl.GetPixelFormatAttribivARB) _glfwPlatformExtensionSupported("WGL_ARB_create_context_profile");
window->wgl.ARB_pixel_format = GL_TRUE; window->wgl.EXT_create_context_es2_profile =
} _glfwPlatformExtensionSupported("WGL_EXT_create_context_es2_profile");
window->wgl.ARB_create_context_robustness =
if (_glfwPlatformExtensionSupported("WGL_ARB_context_flush_control")) _glfwPlatformExtensionSupported("WGL_ARB_create_context_robustness");
window->wgl.ARB_context_flush_control = GL_TRUE; window->wgl.EXT_swap_control =
_glfwPlatformExtensionSupported("WGL_EXT_swap_control");
window->wgl.ARB_pixel_format =
_glfwPlatformExtensionSupported("WGL_ARB_pixel_format");
window->wgl.ARB_context_flush_control =
_glfwPlatformExtensionSupported("WGL_ARB_context_flush_control");
} }
// Returns the specified attribute of the specified pixel format // Returns the specified attribute of the specified pixel format

Loading…
Cancel
Save