mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-16 16:37:08 +00:00
dawn_wire: Factor the common command serialization pattern.
Bug: dawn:445 Change-Id: I15a99a126c0494fd06dd727ff5c9008cde675d76 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23560 Reviewed-by: Austin Eng <enga@chromium.org> Reviewed-by: Stephen White <senorblanco@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
8f9523eb38
commit
90abd47a28
@@ -252,14 +252,11 @@ namespace dawn_wire { namespace server {
|
||||
cmd.initialDataInfoLength = initialDataInfoLength;
|
||||
cmd.initialDataInfo = nullptr;
|
||||
|
||||
size_t commandSize = cmd.GetRequiredSize();
|
||||
size_t requiredSize = commandSize + initialDataInfoLength;
|
||||
char* allocatedBuffer = static_cast<char*>(GetCmdSpace(requiredSize));
|
||||
cmd.Serialize(allocatedBuffer);
|
||||
char* readHandleSpace = SerializeCommand(cmd, initialDataInfoLength);
|
||||
|
||||
if (status == WGPUBufferMapAsyncStatus_Success) {
|
||||
// Serialize the initialization message into the space after the command.
|
||||
data->readHandle->SerializeInitialData(ptr, dataLength, allocatedBuffer + commandSize);
|
||||
data->readHandle->SerializeInitialData(ptr, dataLength, readHandleSpace);
|
||||
|
||||
// The in-flight map request returned successfully.
|
||||
// Move the ReadHandle so it is owned by the buffer.
|
||||
@@ -284,9 +281,7 @@ namespace dawn_wire { namespace server {
|
||||
cmd.requestSerial = data->requestSerial;
|
||||
cmd.status = status;
|
||||
|
||||
size_t requiredSize = cmd.GetRequiredSize();
|
||||
char* allocatedBuffer = static_cast<char*>(GetCmdSpace(requiredSize));
|
||||
cmd.Serialize(allocatedBuffer);
|
||||
SerializeCommand(cmd);
|
||||
|
||||
if (status == WGPUBufferMapAsyncStatus_Success) {
|
||||
// The in-flight map request returned successfully.
|
||||
|
||||
Reference in New Issue
Block a user