mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-17 00:47:13 +00:00
Special-case GetDefaultQueue in the wire
Reland with a fix where commands only start being serialized by the device after the first GetDevice() is called, not in the constructor. This makes it so calling GetDefaultQueue always returns the same object. It required updating various WireTests to account for the additional wire calls. Bug: dawn:22 Change-Id: Ibe43d84b25100f58a9ec5029a9341e400aec97f6 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19982 Commit-Queue: Kai Ninomiya <kainino@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
b46d002057
commit
409cf67207
@@ -21,7 +21,6 @@ namespace dawn_wire { namespace client {
|
||||
|
||||
Client::Client(CommandSerializer* serializer, MemoryTransferService* memoryTransferService)
|
||||
: ClientBase(),
|
||||
mDevice(DeviceAllocator().New(this)->object.get()),
|
||||
mSerializer(serializer),
|
||||
mMemoryTransferService(memoryTransferService) {
|
||||
if (mMemoryTransferService == nullptr) {
|
||||
@@ -32,7 +31,16 @@ namespace dawn_wire { namespace client {
|
||||
}
|
||||
|
||||
Client::~Client() {
|
||||
DeviceAllocator().Free(mDevice);
|
||||
if (mDevice != nullptr) {
|
||||
DeviceAllocator().Free(mDevice);
|
||||
}
|
||||
}
|
||||
|
||||
WGPUDevice Client::GetDevice() {
|
||||
if (mDevice == nullptr) {
|
||||
mDevice = DeviceAllocator().New(this)->object.get();
|
||||
}
|
||||
return reinterpret_cast<WGPUDeviceImpl*>(mDevice);
|
||||
}
|
||||
|
||||
ReservedTexture Client::ReserveTexture(WGPUDevice cDevice) {
|
||||
@@ -57,8 +65,12 @@ namespace dawn_wire { namespace client {
|
||||
}
|
||||
|
||||
void Client::Disconnect() {
|
||||
if (!mIsDisconnected) {
|
||||
mIsDisconnected = true;
|
||||
if (mIsDisconnected) {
|
||||
return;
|
||||
}
|
||||
|
||||
mIsDisconnected = true;
|
||||
if (mDevice != nullptr) {
|
||||
mDevice->HandleDeviceLost("GPU connection lost");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user