This commit is contained in:
Tim 2022-02-13 15:40:35 +01:00 committed by GitHub
commit 9d692a7ca1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 84 additions and 0 deletions

View File

@ -304,6 +304,8 @@ information on what to include when reporting a bug.
- [EGL] Added ANGLE backend selection via `EGL_ANGLE_platform_angle` extension
(#1380)
- [EGL] Bugfix: The `GLFW_DOUBLEBUFFER` context attribute was ignored (#1843)
- [EGL] Made it possible to query the `EGLConfig` that was chosen to create a given window via `glfwGetEGLConfig`
- [GLX] Made it possible to query the `GLXFBConfig` that was chosen to create a given window via `glfwGetGLXFBConfig`
## Contact

View File

@ -71,6 +71,20 @@ Alt-and-then-Space shortcuts. This may be useful for more GUI-oriented
applications.
@subsubsection features_34_glx_getfbconfig Query GLXFBConfig
GLFW now provides the [glfwGetGLXFBConfig](@ref glfwGetGLXFBConfig)
function that returns the GLXFBConfig that was chosen to create the
given window handle.
@subsubsection features_34_egl_getconfig Query EGLConfig
GLFW now provides the [glfwGetEGLConfig](@ref glfwGetEGLConfig)
function that returns the EGLConfig that was chosen to create the
given window handle.
@subsection caveats_34 Caveats for version 3.4
@subsection caveats Caveats for version 3.4
@subsubsection native_34 Multiple sets of native access functions
@ -176,6 +190,8 @@ then GLFW will fail to initialize.
@subsubsection functions_34 New functions in version 3.4
- @ref glfwGetGLXFBConfig
- @ref glfwGetEGLConfig
- @ref glfwInitAllocator
- @ref glfwGetPlatform
- @ref glfwPlatformSupported

View File

@ -415,6 +415,21 @@ GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow* window);
* @ingroup native
*/
GLFWAPI GLXWindow glfwGetGLXWindow(GLFWwindow* window);
/*! @brief Returns the `GLXFBConfig` that was chosen to create the
* specified window.
*
* @return The `GLXFBConfig` that was chosen to create the specified
* window, or `NULL` if an [error](@ref error_handling) occurred.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.4
*
* @ingroup native
*/
GLFWAPI GLXFBConfig glfwGetGLXFBConfig(GLFWwindow* window);
#endif
#if defined(GLFW_EXPOSE_NATIVE_WAYLAND)
@ -517,6 +532,23 @@ GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow* window);
* @ingroup native
*/
GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* window);
/*! @brief Returns the `EGLConfig` of the specified window.
*
* @return The `EGLConfig` of the specified window, or `EGL_NO_SURFACE` if an
* [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NO_WINDOW_CONTEXT and @ref
* GLFW_NOT_INITIALIZED.
*
* @thread_safety This function may be called from any thread. Access is not
* synchronized.
*
* @since Added in version 3.0.
*
* @ingroup native
*/
GLFWAPI EGLConfig glfwGetEGLConfig(GLFWwindow* window);
#endif
#if defined(GLFW_EXPOSE_NATIVE_OSMESA)

View File

@ -866,3 +866,16 @@ GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow* handle)
return window->context.egl.surface;
}
GLFWAPI EGLConfig glfwGetEGLConfig(GLFWwindow* handle)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
_GLFW_REQUIRE_INIT_OR_RETURN(EGL_NO_SURFACE);
if (window->context.source != GLFW_EGL_CONTEXT_API)
{
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
return EGL_NO_SURFACE;
}
return window->context.egl.config;
}

View File

@ -242,6 +242,11 @@ static void destroyContextGLX(_GLFWwindow* window)
glXDestroyContext(_glfw.x11.display, window->context.glx.handle);
window->context.glx.handle = NULL;
}
if (window->context.glx.fbConfig)
{
window->context.glx.fbConfig = NULL;
}
}
@ -621,6 +626,8 @@ GLFWbool _glfwCreateContextGLX(_GLFWwindow* window,
return GLFW_FALSE;
}
window->context.glx.fbConfig = native;
window->context.makeCurrent = makeContextCurrentGLX;
window->context.swapBuffers = swapBuffersGLX;
window->context.swapInterval = swapIntervalGLX;
@ -710,3 +717,16 @@ GLFWAPI GLXWindow glfwGetGLXWindow(GLFWwindow* handle)
return window->context.glx.window;
}
GLFWAPI GLXFBConfig glfwGetGLXFBConfig(GLFWwindow* handle)
{
_GLFWwindow* window = (_GLFWwindow*) handle;
_GLFW_REQUIRE_INIT_OR_RETURN(None);
if (window->context.client == GLFW_NO_API)
{
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
return NULL;
}
return window->context.glx.fbConfig;
}

View File

@ -469,6 +469,7 @@ typedef struct _GLFWcontextGLX
{
GLXContext handle;
GLXWindow window;
GLXFBConfig fbConfig;
} _GLFWcontextGLX;
// GLX-specific global data