Add the user-visible logging interface.

Details:
- Add the logging level type WGPULoggingType, including levels verbose,
info, warning, and error,
- Add the API SetLoggingCallback, which bind the callback to deal with
logging string,
- Add the return command DeviceLoggingCallback and related code,
- Add DeviceBase::EmitLog(WGPULoggingType, const char*) , and
DeviceBase::EmitLog(const char*) use WGPULoggingType_info as default,
to post logging from native or server device to bound callback
via CallbackTaskManager.

BUG: dawn:792
Change-Id: I107b9134ff8567a46fa452509799e10b6862b8d3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/52200
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
This commit is contained in:
Zhaoming Jiang
2021-06-04 07:10:56 +00:00
committed by Dawn LUCI CQ
parent 9d911d4957
commit b44000e7af
16 changed files with 221 additions and 16 deletions

View File

@@ -67,6 +67,15 @@ namespace dawn_wire { namespace server {
SerializeCommand(cmd);
}
void Server::OnLogging(ObjectHandle device, WGPULoggingType type, const char* message) {
ReturnDeviceLoggingCallbackCmd cmd;
cmd.device = device;
cmd.type = type;
cmd.message = message;
SerializeCommand(cmd);
}
bool Server::DoDevicePopErrorScope(ObjectId deviceId, uint64_t requestSerial) {
auto* device = DeviceObjects().Get(deviceId);
if (device == nullptr) {