Improvements:
- Report the numeric value of a bad attribute
- Show the requested/desired/unsupported version and the max version
- Correct printf attribute set and previous errors fixed

Bug: b/186543601
Change-Id: I889f2384afbe134496cad9e349766b7ff756dcee
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3224566
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Yuxin Hu <yuxinhu@google.com>
This commit is contained in:
Ian Elliott 2021-10-15 15:43:18 -06:00 коммит произвёл Angle LUCI CQ
Родитель 4d5711291e
Коммит 6c44865981
2 изменённых файлов: 13 добавлений и 8 удалений

Просмотреть файл

@ -259,7 +259,7 @@ bool ValidateConfigAttribute(const ValidationContext *val,
break;
default:
val->setError(EGL_BAD_ATTRIBUTE, "Unknown attribute: 0x%04X", attribute);
val->setError(EGL_BAD_ATTRIBUTE, "Unknown attribute: 0x%04" PRIxPTR "X", attribute);
return false;
}
@ -1060,8 +1060,7 @@ bool ValidateDisplayPointer(const ValidationContext *val, const Display *display
{
if (val)
{
val->setError(EGL_BAD_DISPLAY, "display is not a valid display: 0x%04" PRIXPTR,
display);
val->setError(EGL_BAD_DISPLAY, "display is not a valid display: 0x%p", display);
}
return false;
}
@ -2006,7 +2005,7 @@ bool ValidateCreateContext(const ValidationContext *val,
break;
default:
val->setError(EGL_BAD_ATTRIBUTE, "Unknown attribute: 0x%04X", attribute);
val->setError(EGL_BAD_ATTRIBUTE, "Unknown attribute: 0x%04" PRIxPTR "X", attribute);
return false;
}
}
@ -2061,7 +2060,12 @@ bool ValidateCreateContext(const ValidationContext *val,
gl::Version(static_cast<GLuint>(clientMajorVersion),
static_cast<GLuint>(clientMinorVersion)))
{
val->setError(EGL_BAD_ATTRIBUTE, "Requested GLES version is not supported.");
gl::Version max = display->getMaxSupportedESVersion();
val->setError(EGL_BAD_ATTRIBUTE,
"Requested GLES version (%" PRIxPTR ".%" PRIxPTR
") is greater than "
"max supported (%d, %d).",
clientMajorVersion, clientMinorVersion, max.major, max.minor);
return false;
}
break;
@ -2816,7 +2820,7 @@ bool ValidateCreatePixmapSurface(const ValidationContext *val,
break;
default:
val->setError(EGL_BAD_ATTRIBUTE, "Unknown attribute");
val->setError(EGL_BAD_ATTRIBUTE, "Unknown attribute: 0x%04" PRIxPTR "X", attribute);
return false;
}
}
@ -3179,7 +3183,7 @@ bool ValidateCreateImage(const ValidationContext *val,
break;
default:
val->setError(EGL_BAD_PARAMETER, "invalid attribute: 0x%X", attribute);
val->setError(EGL_BAD_PARAMETER, "invalid attribute: 0x%04" PRIxPTR "X", attribute);
return false;
}
}
@ -5282,7 +5286,7 @@ bool ValidateQueryDebugKHR(const ValidationContext *val, EGLint attribute, const
break;
default:
val->setError(EGL_BAD_ATTRIBUTE, "unknown attribute.");
val->setError(EGL_BAD_ATTRIBUTE, "Unknown attribute: 0x%04X", attribute);
return false;
}

Просмотреть файл

@ -44,6 +44,7 @@ struct ValidationContext
// We should remove the message-less overload once we have messages for all EGL errors.
void setError(EGLint error) const;
ANGLE_FORMAT_PRINTF(3, 4)
void setError(EGLint error, const char *message...) const;
Thread *eglThread;