mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-19 01:46:35 +00:00
Add empty implementations of Push/PopErrorScope
This adds Push/PopErrorScope to the API with empty implementations which just call the error callback. Also adds unittests that the wire callbacks return as expected. Bug: dawn:153 Change-Id: I63826360e39fbac4c9855d3d55a05b5ca26db450 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10543 Commit-Queue: Austin Eng <enga@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
f5c44772a6
commit
45238d775a
@@ -31,4 +31,33 @@ namespace dawn_wire { namespace server {
|
||||
cmd.Serialize(allocatedBuffer);
|
||||
}
|
||||
|
||||
bool Server::DoDevicePopErrorScope(DawnDevice cDevice, uint64_t requestSerial) {
|
||||
ErrorScopeUserdata* userdata = new ErrorScopeUserdata;
|
||||
userdata->server = this;
|
||||
userdata->requestSerial = requestSerial;
|
||||
|
||||
return mProcs.devicePopErrorScope(cDevice, ForwardPopErrorScope, userdata);
|
||||
}
|
||||
|
||||
// static
|
||||
void Server::ForwardPopErrorScope(DawnErrorType type, const char* message, void* userdata) {
|
||||
auto* data = reinterpret_cast<ErrorScopeUserdata*>(userdata);
|
||||
data->server->OnDevicePopErrorScope(type, message, data);
|
||||
}
|
||||
|
||||
void Server::OnDevicePopErrorScope(DawnErrorType type,
|
||||
const char* message,
|
||||
ErrorScopeUserdata* userdata) {
|
||||
std::unique_ptr<ErrorScopeUserdata> data{userdata};
|
||||
|
||||
ReturnDevicePopErrorScopeCallbackCmd cmd;
|
||||
cmd.requestSerial = data->requestSerial;
|
||||
cmd.type = type;
|
||||
cmd.message = message;
|
||||
|
||||
size_t requiredSize = cmd.GetRequiredSize();
|
||||
char* allocatedBuffer = static_cast<char*>(GetCmdSpace(requiredSize));
|
||||
cmd.Serialize(allocatedBuffer);
|
||||
}
|
||||
|
||||
}} // namespace dawn_wire::server
|
||||
|
||||
Reference in New Issue
Block a user