mirror of
				https://github.com/glfw/glfw.git
				synced 2025-11-03 22:04:15 +00:00 
			
		
		
		
	Simplified WGL extension logic.
Not applying this to GLX or EGL yet because Mesa.
This commit is contained in:
		
							parent
							
								
									656666e722
								
							
						
					
					
						commit
						905073a506
					
				@ -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.GetExtensionsStringEXT = (PFNWGLGETEXTENSIONSSTRINGEXTPROC)
 | 
				
			||||||
    window->wgl.GetExtensionsStringARB = NULL;
 | 
					        wglGetProcAddress("wglGetExtensionsStringEXT");
 | 
				
			||||||
    window->wgl.GetExtensionsStringEXT = NULL;
 | 
					    window->wgl.GetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC)
 | 
				
			||||||
    window->wgl.CreateContextAttribsARB = NULL;
 | 
					        wglGetProcAddress("wglGetExtensionsStringARB");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Functions for WGL_ARB_create_context
 | 
				
			||||||
 | 
					    window->wgl.CreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)
 | 
				
			||||||
 | 
					        wglGetProcAddress("wglCreateContextAttribsARB");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Functions for WGL_EXT_swap_control
 | 
				
			||||||
 | 
					    window->wgl.SwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC)
 | 
				
			||||||
 | 
					        wglGetProcAddress("wglSwapIntervalEXT");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Functions for WGL_ARB_pixel_format
 | 
				
			||||||
 | 
					    window->wgl.GetPixelFormatAttribivARB = (PFNWGLGETPIXELFORMATATTRIBIVARBPROC)
 | 
				
			||||||
 | 
					        wglGetProcAddress("wglGetPixelFormatAttribivARB");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // This needs to include every extension used below except for
 | 
					    // This needs to include every extension used below except for
 | 
				
			||||||
    // WGL_ARB_extensions_string and WGL_EXT_extensions_string
 | 
					    // WGL_ARB_extensions_string and WGL_EXT_extensions_string
 | 
				
			||||||
    window->wgl.ARB_multisample = GL_FALSE;
 | 
					    window->wgl.ARB_multisample =
 | 
				
			||||||
    window->wgl.ARB_framebuffer_sRGB = GL_FALSE;
 | 
					        _glfwPlatformExtensionSupported("WGL_ARB_multisample");
 | 
				
			||||||
    window->wgl.ARB_create_context = GL_FALSE;
 | 
					    window->wgl.ARB_framebuffer_sRGB =
 | 
				
			||||||
    window->wgl.ARB_create_context_profile = GL_FALSE;
 | 
					        _glfwPlatformExtensionSupported("WGL_ARB_framebuffer_sRGB");
 | 
				
			||||||
    window->wgl.EXT_create_context_es2_profile = GL_FALSE;
 | 
					    window->wgl.ARB_create_context =
 | 
				
			||||||
    window->wgl.ARB_create_context_robustness = GL_FALSE;
 | 
					        _glfwPlatformExtensionSupported("WGL_ARB_create_context");
 | 
				
			||||||
    window->wgl.EXT_swap_control = GL_FALSE;
 | 
					    window->wgl.ARB_create_context_profile =
 | 
				
			||||||
    window->wgl.ARB_pixel_format = GL_FALSE;
 | 
					        _glfwPlatformExtensionSupported("WGL_ARB_create_context_profile");
 | 
				
			||||||
    window->wgl.ARB_context_flush_control = GL_FALSE;
 | 
					    window->wgl.EXT_create_context_es2_profile =
 | 
				
			||||||
 | 
					        _glfwPlatformExtensionSupported("WGL_EXT_create_context_es2_profile");
 | 
				
			||||||
    window->wgl.GetExtensionsStringEXT = (PFNWGLGETEXTENSIONSSTRINGEXTPROC)
 | 
					    window->wgl.ARB_create_context_robustness =
 | 
				
			||||||
        wglGetProcAddress("wglGetExtensionsStringEXT");
 | 
					        _glfwPlatformExtensionSupported("WGL_ARB_create_context_robustness");
 | 
				
			||||||
    if (!window->wgl.GetExtensionsStringEXT)
 | 
					    window->wgl.EXT_swap_control =
 | 
				
			||||||
    {
 | 
					        _glfwPlatformExtensionSupported("WGL_EXT_swap_control");
 | 
				
			||||||
        window->wgl.GetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC)
 | 
					    window->wgl.ARB_pixel_format =
 | 
				
			||||||
            wglGetProcAddress("wglGetExtensionsStringARB");
 | 
					        _glfwPlatformExtensionSupported("WGL_ARB_pixel_format");
 | 
				
			||||||
        if (!window->wgl.GetExtensionsStringARB)
 | 
					    window->wgl.ARB_context_flush_control =
 | 
				
			||||||
            return;
 | 
					        _glfwPlatformExtensionSupported("WGL_ARB_context_flush_control");
 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    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 &&
 | 
					 | 
				
			||||||
        window->wgl.ARB_create_context_profile)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        if (_glfwPlatformExtensionSupported("WGL_EXT_create_context_es2_profile"))
 | 
					 | 
				
			||||||
            window->wgl.EXT_create_context_es2_profile = GL_TRUE;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (window->wgl.ARB_create_context)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        if (_glfwPlatformExtensionSupported("WGL_ARB_create_context_robustness"))
 | 
					 | 
				
			||||||
            window->wgl.ARB_create_context_robustness = GL_TRUE;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (_glfwPlatformExtensionSupported("WGL_EXT_swap_control"))
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        window->wgl.SwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC)
 | 
					 | 
				
			||||||
            wglGetProcAddress("wglSwapIntervalEXT");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (window->wgl.SwapIntervalEXT)
 | 
					 | 
				
			||||||
            window->wgl.EXT_swap_control = GL_TRUE;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (_glfwPlatformExtensionSupported("WGL_ARB_pixel_format"))
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        window->wgl.GetPixelFormatAttribivARB = (PFNWGLGETPIXELFORMATATTRIBIVARBPROC)
 | 
					 | 
				
			||||||
            wglGetProcAddress("wglGetPixelFormatAttribivARB");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (window->wgl.GetPixelFormatAttribivARB)
 | 
					 | 
				
			||||||
            window->wgl.ARB_pixel_format = GL_TRUE;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (_glfwPlatformExtensionSupported("WGL_ARB_context_flush_control"))
 | 
					 | 
				
			||||||
        window->wgl.ARB_context_flush_control = GL_TRUE;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Returns the specified attribute of the specified pixel format
 | 
					// Returns the specified attribute of the specified pixel format
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user