mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-16 16:37:08 +00:00
Ensure all wire child objects are destroyed before their device
Destroying a device will implicit destroy all its child objects. Attempting to use a child object after results in a fatal error. Bug: dawn:384 Change-Id: I43c27c92cacde759be83cca79ac890f41bac3927 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37002 Commit-Queue: Austin Eng <enga@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
This commit is contained in:
committed by
Commit Bot service account
parent
0562802757
commit
8ba0a01d1e
@@ -120,18 +120,27 @@ namespace dawn_wire { namespace server {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Server::DoDeviceCreateBuffer(WGPUDevice device,
|
||||
bool Server::DoDeviceCreateBuffer(ObjectId deviceId,
|
||||
const WGPUBufferDescriptor* descriptor,
|
||||
ObjectHandle bufferResult,
|
||||
uint64_t handleCreateInfoLength,
|
||||
const uint8_t* handleCreateInfo) {
|
||||
auto* device = DeviceObjects().Get(deviceId);
|
||||
if (device == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create and register the buffer object.
|
||||
auto* resultData = BufferObjects().Allocate(bufferResult.id);
|
||||
if (resultData == nullptr) {
|
||||
return false;
|
||||
}
|
||||
resultData->generation = bufferResult.generation;
|
||||
resultData->handle = mProcs.deviceCreateBuffer(device, descriptor);
|
||||
resultData->handle = mProcs.deviceCreateBuffer(device->handle, descriptor);
|
||||
resultData->device = device;
|
||||
if (!TrackDeviceChild(device, ObjectType::Buffer, bufferResult.id)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If the buffer isn't mapped at creation, we are done.
|
||||
if (!descriptor->mappedAtCreation) {
|
||||
|
||||
Reference in New Issue
Block a user