/* This platform recognizes only EXT_explicit_device */
if (attrib_list) {
- if (attrib_list[0] != EGL_DEVICE_EXT) {
- _eglError(EGL_BAD_ATTRIBUTE, "eglGetPlatformDisplay");
- return NULL;
- }
- dev = _eglLookupDevice((void *)attrib_list[1]);
- if (!dev) {
- _eglError(EGL_BAD_DEVICE_EXT, "eglGetPlatformDisplay");
- return NULL;
+ for (int i = 0; attrib_list[i] != EGL_NONE; i += 2) {
+ EGLAttrib attrib = attrib_list[i];
+ EGLAttrib value = attrib_list[i + 1];
+
+ switch (attrib) {
+ case EGL_DEVICE_EXT:
+ dev = _eglLookupDevice((void *)value);
+ if (!dev) {
+ _eglError(EGL_BAD_DEVICE_EXT, "eglGetPlatformDisplay");
+ return NULL;
+ }
+ break;
+
+ default:
+ _eglError(EGL_BAD_ATTRIBUTE, "eglGetPlatformDisplay");
+ return NULL;
+ }
}
}
/* This platform recognizes only EXT_explicit_device */
if (attrib_list) {
- if (attrib_list[0] != EGL_DEVICE_EXT) {
- _eglError(EGL_BAD_ATTRIBUTE, "eglGetPlatformDisplay");
- return NULL;
- }
- dev = _eglLookupDevice((void *)attrib_list[1]);
- if (!dev) {
- _eglError(EGL_BAD_DEVICE_EXT, "eglGetPlatformDisplay");
- return NULL;
+ for (int i = 0; attrib_list[i] != EGL_NONE; i += 2) {
+ EGLAttrib attrib = attrib_list[i];
+ EGLAttrib value = attrib_list[i + 1];
+
+ switch (attrib) {
+ case EGL_DEVICE_EXT:
+ dev = _eglLookupDevice((void *)value);
+ if (!dev) {
+ _eglError(EGL_BAD_DEVICE_EXT, "eglGetPlatformDisplay");
+ return NULL;
+ }
+ break;
+
+ default:
+ _eglError(EGL_BAD_ATTRIBUTE, "eglGetPlatformDisplay");
+ return NULL;
+ }
}
}
/* This platform recognizes only EXT_explicit_device */
if (attrib_list) {
- if (attrib_list[0] != EGL_DEVICE_EXT) {
- _eglError(EGL_BAD_ATTRIBUTE, "eglGetPlatformDisplay");
- return NULL;
- }
- if ((native_display && native_display != (void *)attrib_list[1]) ||
- (native_display != _eglLookupDevice(native_display))) {
- _eglError(EGL_BAD_DEVICE_EXT, "eglGetPlatformDisplay");
- return NULL;
+ for (int i = 0; attrib_list[i] != EGL_NONE; i += 2) {
+ EGLAttrib attrib = attrib_list[i];
+ EGLAttrib value = attrib_list[i + 1];
+
+ switch (attrib) {
+ case EGL_DEVICE_EXT:
+ if ((native_display && native_display != (void *)value) ||
+ (native_display != _eglLookupDevice(native_display))) {
+ _eglError(EGL_BAD_DEVICE_EXT, "eglGetPlatformDisplay");
+ return NULL;
+ }
+ break;
+
+ default:
+ _eglError(EGL_BAD_ATTRIBUTE, "eglGetPlatformDisplay");
+ return NULL;
+ }
}
}