Improve validation errors in Adapter
Updates all validation messages in Adapter.cpp to give them better contextual information. Bug: dawn:563 Change-Id: I71381f56b51ef69c3064af837fe20d6afa7ce271 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/65581 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Brandon Jones <bajones@google.com> Commit-Queue: François Beaufort <beaufort.francois@gmail.com>
This commit is contained in:
parent
5ad5250a3b
commit
7a93485410
|
@ -121,8 +121,12 @@ namespace dawn_native {
|
|||
MaybeError AdapterBase::CreateDeviceInternal(DeviceBase** result,
|
||||
const DeviceDescriptor* descriptor) {
|
||||
if (descriptor != nullptr) {
|
||||
if (!SupportsAllRequestedExtensions(descriptor->requiredExtensions)) {
|
||||
return DAWN_VALIDATION_ERROR("One or more requested extensions are not supported");
|
||||
for (const char* extensionStr : descriptor->requiredExtensions) {
|
||||
Extension extensionEnum = mInstance->ExtensionNameToEnum(extensionStr);
|
||||
DAWN_INVALID_IF(extensionEnum == Extension::InvalidEnum,
|
||||
"Requested feature %s is unknown.", extensionStr);
|
||||
DAWN_INVALID_IF(!mSupportedExtensions.IsEnabled(extensionEnum),
|
||||
"Requested feature %s is disabled.", extensionStr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -131,9 +135,8 @@ namespace dawn_native {
|
|||
mUseTieredLimits ? ApplyLimitTiers(mLimits.v1) : mLimits.v1,
|
||||
reinterpret_cast<const RequiredLimits*>(descriptor->requiredLimits)->limits));
|
||||
|
||||
if (descriptor->requiredLimits->nextInChain != nullptr) {
|
||||
return DAWN_VALIDATION_ERROR("Unsupported limit extension struct");
|
||||
}
|
||||
DAWN_INVALID_IF(descriptor->requiredLimits->nextInChain != nullptr,
|
||||
"nextInChain is not nullptr.");
|
||||
}
|
||||
|
||||
DAWN_TRY_ASSIGN(*result, CreateDeviceImpl(descriptor));
|
||||
|
|
Loading…
Reference in New Issue