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:
Austin Eng
2020-10-13 22:35:34 +00:00
committed by Commit Bot service account
parent ccaef85257
commit cac0442277
22 changed files with 439 additions and 151 deletions

View File

@@ -16,6 +16,7 @@
#define DAWNWIRE_WIRE_H_
#include <cstdint>
#include <limits>
#include "dawn/webgpu.h"
#include "dawn_wire/dawn_wire_export.h"
@@ -25,8 +26,18 @@ namespace dawn_wire {
class DAWN_WIRE_EXPORT CommandSerializer {
public:
virtual ~CommandSerializer() = default;
// Get space for serializing commands.
// GetCmdSpace will never be called with a value larger than
// what GetMaximumAllocationSize returns. Return nullptr to indicate
// a fatal error.
virtual void* GetCmdSpace(size_t size) = 0;
virtual bool Flush() = 0;
// TODO(enga): Make pure virtual after updating Chromium.
virtual size_t GetMaximumAllocationSize() const {
return std::numeric_limits<size_t>::max();
}
};
class DAWN_WIRE_EXPORT CommandHandler {