dawn_wire: Add support for injecting/reserving swapchains

This will help experiment using dawn_wire for remoting WebGPU to render
on the screen.

Bug: None
Change-Id: I9a60ff8c3889ec917f6fd56e4cbb1ffef639748d
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/47621
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
Corentin Wallez
2021-04-13 01:26:04 +00:00
committed by Commit Bot service account
parent b676602188
commit e190045664
10 changed files with 206 additions and 3 deletions

View File

@@ -38,6 +38,14 @@ namespace dawn_wire {
uint32_t deviceGeneration;
};
struct ReservedSwapChain {
WGPUSwapChain swapchain;
uint32_t id;
uint32_t generation;
uint32_t deviceId;
uint32_t deviceGeneration;
};
struct ReservedDevice {
WGPUDevice device;
uint32_t id;
@@ -58,9 +66,11 @@ namespace dawn_wire {
size_t size) override final;
ReservedTexture ReserveTexture(WGPUDevice device);
ReservedSwapChain ReserveSwapChain(WGPUDevice device);
ReservedDevice ReserveDevice();
void ReclaimTextureReservation(const ReservedTexture& reservation);
void ReclaimSwapChainReservation(const ReservedSwapChain& reservation);
void ReclaimDeviceReservation(const ReservedDevice& reservation);
// Disconnects the client.

View File

@@ -42,12 +42,16 @@ namespace dawn_wire {
const volatile char* HandleCommands(const volatile char* commands,
size_t size) override final;
// TODO(enga): Remove defaults after updating Chrome.
bool InjectTexture(WGPUTexture texture,
uint32_t id,
uint32_t generation,
uint32_t deviceId = 1,
uint32_t deviceGeneration = 0);
uint32_t deviceId,
uint32_t deviceGeneration);
bool InjectSwapChain(WGPUSwapChain swapchain,
uint32_t id,
uint32_t generation,
uint32_t deviceId,
uint32_t deviceGeneration);
bool InjectDevice(WGPUDevice device, uint32_t id, uint32_t generation);