mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-10 05:57:51 +00:00
Add basic or stub implementations of upstream instance/adapter APIs
Adds upstream instance/adapter APIs. In dawn_native, the basic APIs to get limits and properties are implemented, but requestAdapter and requestDevice are not. In dawn_wire, nothing is implemented, but the stub definitions are put in place, as well the mechanism to inject WGPUInstance into the wire. There is a lifetime concern with WGPUInstance and WGPUAdapter on the wire in that we need to ensure that the client cannot free the instance or adapter while they are in use. In the near term, this is not a problem because Chromium will always hold ownership of the instance and adapters outside of the wire - i.e. it won't inject and then release ownership. Bug: dawn:160, dawn:689 Change-Id: Id904272983f23babc9177bc163d78c4fa1044da0 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/71520 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Loko Kung <lokokung@google.com> Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
@@ -52,6 +52,12 @@ namespace dawn_wire {
|
||||
uint32_t generation;
|
||||
};
|
||||
|
||||
struct ReservedInstance {
|
||||
WGPUInstance instance;
|
||||
uint32_t id;
|
||||
uint32_t generation;
|
||||
};
|
||||
|
||||
struct DAWN_WIRE_EXPORT WireClientDescriptor {
|
||||
CommandSerializer* serializer;
|
||||
client::MemoryTransferService* memoryTransferService = nullptr;
|
||||
@@ -68,10 +74,12 @@ namespace dawn_wire {
|
||||
ReservedTexture ReserveTexture(WGPUDevice device);
|
||||
ReservedSwapChain ReserveSwapChain(WGPUDevice device);
|
||||
ReservedDevice ReserveDevice();
|
||||
ReservedInstance ReserveInstance();
|
||||
|
||||
void ReclaimTextureReservation(const ReservedTexture& reservation);
|
||||
void ReclaimSwapChainReservation(const ReservedSwapChain& reservation);
|
||||
void ReclaimDeviceReservation(const ReservedDevice& reservation);
|
||||
void ReclaimInstanceReservation(const ReservedInstance& reservation);
|
||||
|
||||
// Disconnects the client.
|
||||
// Commands allocated after this point will not be sent.
|
||||
|
||||
@@ -55,6 +55,8 @@ namespace dawn_wire {
|
||||
|
||||
bool InjectDevice(WGPUDevice device, uint32_t id, uint32_t generation);
|
||||
|
||||
bool InjectInstance(WGPUInstance instance, uint32_t id, uint32_t generation);
|
||||
|
||||
// Look up a device by (id, generation) pair. Returns nullptr if the generation
|
||||
// has expired or the id is not found.
|
||||
// The Wire does not have destroy hooks to allow an embedder to observe when an object
|
||||
|
||||
Reference in New Issue
Block a user