EGL: Add support for eglQueryDisplayAttribKHR and NV.
There are KHR, EXT, and NV versions of eglQueryDisplayAttrib, so add support for all of them. Define separate eglQueryDisplayAttribEXT, eglQueryDisplayAttribKHR, and eglQueryDisplayAttribNV functions. They all call into the same common function, with the only difference being the name passed to an error callback. When loading a vendor library, check for the vendor's eglQueryDisplayAttrib using all three suffixes, and use whichever one is available.
This commit is contained in:
parent
055a4bab62
commit
db5ca3370c
|
@ -1043,31 +1043,31 @@ EGLBoolean EGLAPIENTRY eglQueryDevicesEXT(EGLint max_devices,
|
|||
}
|
||||
|
||||
|
||||
EGLBoolean eglQueryDisplayAttribEXT(EGLDisplay dpy, EGLint attribute, EGLAttrib *value)
|
||||
static EGLBoolean CommonQueryDisplayAttrib(const char *name, EGLDisplay dpy, EGLint attribute, EGLAttrib *value)
|
||||
{
|
||||
__EGLvendorInfo *vendor;
|
||||
|
||||
if (value == NULL) {
|
||||
__eglReportError(EGL_BAD_PARAMETER, "eglQueryDisplayAttribEXT", NULL,
|
||||
__eglReportError(EGL_BAD_PARAMETER, name, NULL,
|
||||
"Missing value pointer");
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
vendor = __eglGetVendorFromDisplay(dpy);
|
||||
if (vendor == NULL) {
|
||||
__eglReportError(EGL_BAD_DISPLAY, "eglQueryDisplayAttribEXT", NULL,
|
||||
__eglReportError(EGL_BAD_DISPLAY, name, NULL,
|
||||
"Invalid EGLDisplay handle");
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
if (vendor->staticDispatch.queryDisplayAttribEXT == NULL) {
|
||||
__eglReportError(EGL_BAD_DISPLAY, "eglQueryDisplayAttribEXT", NULL,
|
||||
"Driver does not support eglQueryDisplayAttribEXT");
|
||||
if (vendor->staticDispatch.queryDisplayAttrib == NULL) {
|
||||
__eglReportError(EGL_BAD_DISPLAY, name, NULL,
|
||||
"Driver does not support eglQueryDisplayAttrib");
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
__eglSetLastVendor(vendor);
|
||||
if (!vendor->staticDispatch.queryDisplayAttribEXT(dpy, attribute, value)) {
|
||||
if (!vendor->staticDispatch.queryDisplayAttrib(dpy, attribute, value)) {
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
|
@ -1082,6 +1082,19 @@ EGLBoolean eglQueryDisplayAttribEXT(EGLDisplay dpy, EGLint attribute, EGLAttrib
|
|||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
EGLBoolean eglQueryDisplayAttribEXT(EGLDisplay dpy, EGLint attribute, EGLAttrib *value)
|
||||
{
|
||||
return CommonQueryDisplayAttrib("eglQueryDisplayAttribEXT", dpy, attribute, value);
|
||||
}
|
||||
EGLBoolean eglQueryDisplayAttribKHR(EGLDisplay dpy, EGLint attribute, EGLAttrib *value)
|
||||
{
|
||||
return CommonQueryDisplayAttrib("eglQueryDisplayAttribKHR", dpy, attribute, value);
|
||||
}
|
||||
EGLBoolean eglQueryDisplayAttribNV(EGLDisplay dpy, EGLint attribute, EGLAttrib *value)
|
||||
{
|
||||
return CommonQueryDisplayAttrib("eglQueryDisplayAttribNV", dpy, attribute, value);
|
||||
}
|
||||
|
||||
// TODO: The function hash is the same as in GLX. It should go into a common
|
||||
// file.
|
||||
typedef struct {
|
||||
|
|
|
@ -91,7 +91,7 @@ typedef struct __EGLdispatchTableStaticRec {
|
|||
|
||||
// Extension functions that libEGL cares about.
|
||||
EGLBoolean (* queryDevicesEXT) (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices);
|
||||
EGLBoolean (* queryDisplayAttribEXT) (EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
|
||||
EGLBoolean (* queryDisplayAttrib) (EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
|
||||
|
||||
|
||||
EGLint (* debugMessageControlKHR) (EGLDEBUGPROCKHR callback, const EGLAttrib *attrib_list);
|
||||
|
|
|
@ -242,13 +242,25 @@ static GLboolean LookupVendorEntrypoints(__EGLvendorInfo *vendor)
|
|||
LOADENTRYPOINT(createPlatformPixmapSurface, "eglCreatePlatformPixmapSurface" );
|
||||
LOADENTRYPOINT(waitSync, "eglWaitSync" );
|
||||
LOADENTRYPOINT(queryDevicesEXT, "eglQueryDevicesEXT" );
|
||||
LOADENTRYPOINT(queryDisplayAttribEXT, "eglQueryDisplayAttribEXT" );
|
||||
|
||||
LOADENTRYPOINT(debugMessageControlKHR, "eglDebugMessageControlKHR" );
|
||||
LOADENTRYPOINT(queryDebugKHR, "eglQueryDebugKHR" );
|
||||
LOADENTRYPOINT(labelObjectKHR, "eglLabelObjectKHR" );
|
||||
#undef LOADENTRYPOINT
|
||||
|
||||
// eglQueryDisplayAttrib has KHR, EXT, and NV versions. They're all
|
||||
// interchangeable, but the vendor might not support all of them.
|
||||
vendor->staticDispatch.queryDisplayAttrib =
|
||||
vendor->eglvc.getProcAddress("eglQueryDisplayAttribKHR");
|
||||
if (vendor->staticDispatch.queryDisplayAttrib == NULL) {
|
||||
vendor->staticDispatch.queryDisplayAttrib =
|
||||
vendor->eglvc.getProcAddress("eglQueryDisplayAttribEXT");
|
||||
}
|
||||
if (vendor->staticDispatch.queryDisplayAttrib == NULL) {
|
||||
vendor->staticDispatch.queryDisplayAttrib =
|
||||
vendor->eglvc.getProcAddress("eglQueryDisplayAttribNV");
|
||||
}
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -142,6 +142,12 @@ EGL_FUNCTIONS = (
|
|||
# EGL_EXT_device_query
|
||||
_eglExt("eglQueryDisplayAttribEXT", "custom"),
|
||||
|
||||
# EGL_KHR_display_reference
|
||||
_eglExt("eglQueryDisplayAttribKHR", "custom"),
|
||||
|
||||
# EGL_NV_stream_metadata
|
||||
_eglExt("eglQueryDisplayAttribNV", "custom"),
|
||||
|
||||
# EGL_KHR_debug
|
||||
_eglExt("eglDebugMessageControlKHR", "custom"),
|
||||
_eglExt("eglQueryDebugKHR", "custom"),
|
||||
|
|
Loading…
Reference in New Issue