mirror of
				https://github.com/glfw/glfw.git
				synced 2025-11-04 06:15:07 +00:00 
			
		
		
		
	EGL: Add support for EGL_KHR_context_flush_control
This commit is contained in:
		
							parent
							
								
									7c070f55be
								
							
						
					
					
						commit
						27a8b3c17b
					
				@ -188,6 +188,7 @@ information on what to include when reporting a bug.
 | 
			
		||||
- [Cocoa] Bugfix: Iconified full screen windows could not be restored (#848)
 | 
			
		||||
- [X11] Moved to XI2 `XI_RawMotion` for disable cursor mode motion input (#125)
 | 
			
		||||
- [EGL] Added support for `EGL_KHR_get_all_proc_addresses` (#871)
 | 
			
		||||
- [EGL] Added support for `EGL_KHR_context_flush_control`
 | 
			
		||||
- [EGL] Bugfix: The test for `EGL_RGB_BUFFER` was invalid
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -403,6 +403,8 @@ GLFWbool _glfwInitEGL(void)
 | 
			
		||||
        extensionSupportedEGL("EGL_KHR_gl_colorspace");
 | 
			
		||||
    _glfw.egl.KHR_get_all_proc_addresses =
 | 
			
		||||
        extensionSupportedEGL("EGL_KHR_get_all_proc_addresses");
 | 
			
		||||
    _glfw.egl.KHR_context_flush_control =
 | 
			
		||||
        extensionSupportedEGL("EGL_KHR_context_flush_control");
 | 
			
		||||
 | 
			
		||||
    return GLFW_TRUE;
 | 
			
		||||
}
 | 
			
		||||
@ -440,6 +442,7 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
 | 
			
		||||
    EGLint attribs[40];
 | 
			
		||||
    EGLConfig config;
 | 
			
		||||
    EGLContext share = NULL;
 | 
			
		||||
    int index = 0;
 | 
			
		||||
 | 
			
		||||
    if (!_glfw.egl.display)
 | 
			
		||||
    {
 | 
			
		||||
@ -480,7 +483,7 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
 | 
			
		||||
 | 
			
		||||
    if (_glfw.egl.KHR_create_context)
 | 
			
		||||
    {
 | 
			
		||||
        int index = 0, mask = 0, flags = 0;
 | 
			
		||||
        int mask = 0, flags = 0;
 | 
			
		||||
 | 
			
		||||
        if (ctxconfig->client == GLFW_OPENGL_API)
 | 
			
		||||
        {
 | 
			
		||||
@ -529,21 +532,28 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window,
 | 
			
		||||
 | 
			
		||||
        if (flags)
 | 
			
		||||
            setEGLattrib(EGL_CONTEXT_FLAGS_KHR, flags);
 | 
			
		||||
 | 
			
		||||
        setEGLattrib(EGL_NONE, EGL_NONE);
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
    {
 | 
			
		||||
        int index = 0;
 | 
			
		||||
 | 
			
		||||
        if (ctxconfig->client == GLFW_OPENGL_ES_API)
 | 
			
		||||
            setEGLattrib(EGL_CONTEXT_CLIENT_VERSION, ctxconfig->major);
 | 
			
		||||
 | 
			
		||||
        setEGLattrib(EGL_NONE, EGL_NONE);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Context release behaviors (GL_KHR_context_flush_control) are not yet
 | 
			
		||||
    // supported on EGL but are not a hard constraint, so ignore and continue
 | 
			
		||||
    if (_glfw.egl.KHR_context_flush_control)
 | 
			
		||||
    {
 | 
			
		||||
        if (ctxconfig->release == GLFW_RELEASE_BEHAVIOR_NONE)
 | 
			
		||||
        {
 | 
			
		||||
            setEGLattrib(EGL_CONTEXT_RELEASE_BEHAVIOR_KHR,
 | 
			
		||||
                         EGL_CONTEXT_RELEASE_BEHAVIOR_NONE_KHR);
 | 
			
		||||
        }
 | 
			
		||||
        else if (ctxconfig->release == GLFW_RELEASE_BEHAVIOR_FLUSH)
 | 
			
		||||
        {
 | 
			
		||||
            setEGLattrib(EGL_CONTEXT_RELEASE_BEHAVIOR_KHR,
 | 
			
		||||
                         EGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    setEGLattrib(EGL_NONE, EGL_NONE);
 | 
			
		||||
 | 
			
		||||
    window->context.egl.handle = eglCreateContext(_glfw.egl.display,
 | 
			
		||||
                                                  config, share, attribs);
 | 
			
		||||
 | 
			
		||||
@ -110,6 +110,9 @@ typedef MirEGLNativeWindowType EGLNativeWindowType;
 | 
			
		||||
#define EGL_CONTEXT_OPENGL_NO_ERROR_KHR 0x31b3
 | 
			
		||||
#define EGL_GL_COLORSPACE_KHR 0x309d
 | 
			
		||||
#define EGL_GL_COLORSPACE_SRGB_KHR 0x3089
 | 
			
		||||
#define EGL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x2097
 | 
			
		||||
#define EGL_CONTEXT_RELEASE_BEHAVIOR_NONE_KHR 0
 | 
			
		||||
#define EGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR 0x2098
 | 
			
		||||
 | 
			
		||||
typedef int EGLint;
 | 
			
		||||
typedef unsigned int EGLBoolean;
 | 
			
		||||
@ -181,6 +184,7 @@ typedef struct _GLFWlibraryEGL
 | 
			
		||||
    GLFWbool        KHR_create_context_no_error;
 | 
			
		||||
    GLFWbool        KHR_gl_colorspace;
 | 
			
		||||
    GLFWbool        KHR_get_all_proc_addresses;
 | 
			
		||||
    GLFWbool        KHR_context_flush_control;
 | 
			
		||||
 | 
			
		||||
    void*           handle;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user