mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-19 01:46:35 +00:00
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:
committed by
Commit Bot service account
parent
b676602188
commit
e190045664
@@ -96,6 +96,18 @@ namespace dawn_wire { namespace client {
|
||||
return result;
|
||||
}
|
||||
|
||||
ReservedSwapChain Client::ReserveSwapChain(WGPUDevice device) {
|
||||
auto* allocation = SwapChainAllocator().New(this);
|
||||
|
||||
ReservedSwapChain result;
|
||||
result.swapchain = ToAPI(allocation->object.get());
|
||||
result.id = allocation->object->id;
|
||||
result.generation = allocation->generation;
|
||||
result.deviceId = FromAPI(device)->id;
|
||||
result.deviceGeneration = DeviceAllocator().GetGeneration(FromAPI(device)->id);
|
||||
return result;
|
||||
}
|
||||
|
||||
ReservedDevice Client::ReserveDevice() {
|
||||
auto* allocation = DeviceAllocator().New(this);
|
||||
|
||||
@@ -110,6 +122,10 @@ namespace dawn_wire { namespace client {
|
||||
TextureAllocator().Free(FromAPI(reservation.texture));
|
||||
}
|
||||
|
||||
void Client::ReclaimSwapChainReservation(const ReservedSwapChain& reservation) {
|
||||
SwapChainAllocator().Free(FromAPI(reservation.swapchain));
|
||||
}
|
||||
|
||||
void Client::ReclaimDeviceReservation(const ReservedDevice& reservation) {
|
||||
DeviceAllocator().Free(FromAPI(reservation.device));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user