mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-16 16:37:08 +00:00
dawn_wire: Support chunked commands
This CL adds support for chunking large commands by first serializing large commands first into a separate buffer, and then sending the buffer data chunk by chunk. This code path is used for large writeBuffer and writeTexture, as well as the inline memory transfer service for buffer mapping. The transfer for writeBuffer and writeTexture will be optimized further in Chrome, and the inline memory transfer service is currently used only in tests. Bug: chromium:1123861, chromium:951558 Change-Id: I02491a44e653e2383174958d9c3d4a4db6fd7bde Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28882 Commit-Queue: Austin Eng <enga@chromium.org> Reviewed-by: Stephen White <senorblanco@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
ccaef85257
commit
cac0442277
@@ -238,26 +238,26 @@ namespace dawn_wire { namespace server {
|
||||
data->readHandle->SerializeInitialDataSize(readData, data->size);
|
||||
}
|
||||
|
||||
char* readHandleSpace = SerializeCommand(cmd, cmd.readInitialDataInfoLength);
|
||||
|
||||
if (isSuccess) {
|
||||
if (isRead) {
|
||||
// Serialize the initialization message into the space after the command.
|
||||
data->readHandle->SerializeInitialData(readData, data->size, readHandleSpace);
|
||||
// The in-flight map request returned successfully.
|
||||
// Move the ReadHandle so it is owned by the buffer.
|
||||
bufferData->readHandle = std::move(data->readHandle);
|
||||
} else {
|
||||
// The in-flight map request returned successfully.
|
||||
// Move the WriteHandle so it is owned by the buffer.
|
||||
bufferData->writeHandle = std::move(data->writeHandle);
|
||||
bufferData->mapWriteState = BufferMapWriteState::Mapped;
|
||||
// Set the target of the WriteHandle to the mapped buffer data.
|
||||
bufferData->writeHandle->SetTarget(
|
||||
mProcs.bufferGetMappedRange(data->bufferObj, data->offset, data->size),
|
||||
data->size);
|
||||
SerializeCommand(cmd, cmd.readInitialDataInfoLength, [&](char* cmdSpace) {
|
||||
if (isSuccess) {
|
||||
if (isRead) {
|
||||
// Serialize the initialization message into the space after the command.
|
||||
data->readHandle->SerializeInitialData(readData, data->size, cmdSpace);
|
||||
// The in-flight map request returned successfully.
|
||||
// Move the ReadHandle so it is owned by the buffer.
|
||||
bufferData->readHandle = std::move(data->readHandle);
|
||||
} else {
|
||||
// The in-flight map request returned successfully.
|
||||
// Move the WriteHandle so it is owned by the buffer.
|
||||
bufferData->writeHandle = std::move(data->writeHandle);
|
||||
bufferData->mapWriteState = BufferMapWriteState::Mapped;
|
||||
// Set the target of the WriteHandle to the mapped buffer data.
|
||||
bufferData->writeHandle->SetTarget(
|
||||
mProcs.bufferGetMappedRange(data->bufferObj, data->offset, data->size),
|
||||
data->size);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}} // namespace dawn_wire::server
|
||||
|
||||
Reference in New Issue
Block a user