mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-12 06:45:16 +00:00
dawn_wire: Add Reserve/InjectDevice
Now that the wire does enough tracking to prevent a malicious client from freeing a device before its child objects, and the device is no longer a "special" object with regard to reference/release, it is safe to support multiple devices on the wire. The simplest way to use this in WebGPU (to fix createReadyRenderPipeline validation) is to add a reserve/inject device API similar to the one we use for swapchain textures. Bug: dawn:565 Change-Id: Ie956aff528c5610c9ecc5c189dab2d22185cb572 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37800 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
b830da7d6e
commit
8bcde8e394
@@ -88,15 +88,23 @@ void WireTest::TearDown() {
|
||||
api.IgnoreAllReleaseCalls();
|
||||
mWireClient = nullptr;
|
||||
|
||||
if (mWireServer) {
|
||||
if (mWireServer && apiDevice) {
|
||||
// These are called on server destruction to clear the callbacks. They must not be
|
||||
// called after the server is destroyed.
|
||||
EXPECT_CALL(api, OnDeviceSetUncapturedErrorCallback(_, nullptr, nullptr)).Times(Exactly(1));
|
||||
EXPECT_CALL(api, OnDeviceSetDeviceLostCallback(_, nullptr, nullptr)).Times(Exactly(1));
|
||||
EXPECT_CALL(api, OnDeviceSetUncapturedErrorCallback(apiDevice, nullptr, nullptr))
|
||||
.Times(Exactly(1));
|
||||
EXPECT_CALL(api, OnDeviceSetDeviceLostCallback(apiDevice, nullptr, nullptr))
|
||||
.Times(Exactly(1));
|
||||
}
|
||||
mWireServer = nullptr;
|
||||
}
|
||||
|
||||
// This should be called if |apiDevice| is no longer exists on the wire.
|
||||
// This signals that expectations in |TearDowb| shouldn't be added.
|
||||
void WireTest::DefaultApiDeviceWasReleased() {
|
||||
apiDevice = nullptr;
|
||||
}
|
||||
|
||||
void WireTest::FlushClient(bool success) {
|
||||
ASSERT_EQ(mC2sBuf->Flush(), success);
|
||||
|
||||
@@ -123,8 +131,10 @@ void WireTest::DeleteServer() {
|
||||
if (mWireServer) {
|
||||
// These are called on server destruction to clear the callbacks. They must not be
|
||||
// called after the server is destroyed.
|
||||
EXPECT_CALL(api, OnDeviceSetUncapturedErrorCallback(_, nullptr, nullptr)).Times(Exactly(1));
|
||||
EXPECT_CALL(api, OnDeviceSetDeviceLostCallback(_, nullptr, nullptr)).Times(Exactly(1));
|
||||
EXPECT_CALL(api, OnDeviceSetUncapturedErrorCallback(apiDevice, nullptr, nullptr))
|
||||
.Times(Exactly(1));
|
||||
EXPECT_CALL(api, OnDeviceSetDeviceLostCallback(apiDevice, nullptr, nullptr))
|
||||
.Times(Exactly(1));
|
||||
}
|
||||
mWireServer = nullptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user