egl: Add _eglHasAttrib() function
Provide a simple function for checking if an EGLDisplay is using a specific EGLAttrib. This can be useful when trying to inhibit platform behavior depending on the EGLAttribs provided. Signed-off-by: Robert Foss <rfoss@kernel.org> Reviewed-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26131>
This commit is contained in:
@@ -257,6 +257,23 @@ _eglGetDisplayHandle(_EGLDisplay *disp)
|
||||
return (EGLDisplay)((disp) ? disp : EGL_NO_DISPLAY);
|
||||
}
|
||||
|
||||
static inline EGLBoolean
|
||||
_eglHasAttrib(_EGLDisplay *disp, EGLAttrib attrib)
|
||||
{
|
||||
EGLAttrib *attribs = disp->Options.Attribs;
|
||||
|
||||
if (!attribs) {
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
for (int i = 0; attribs[i] != EGL_NONE; i += 2) {
|
||||
if (attrib == attribs[i]) {
|
||||
return EGL_TRUE;
|
||||
}
|
||||
}
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
extern void
|
||||
_eglInitResource(_EGLResource *res, EGLint size, _EGLDisplay *disp);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user