Bug 1940671 - Fix command buffer id leak. r=webgpu-reviewers,ErichDonGubler
Differential Revision: https://phabricator.services.mozilla.com/D234023
This commit is contained in:
@@ -223,8 +223,11 @@ void WebGPUChild::SwapChainPresent(RawId aTextureId,
|
|||||||
const RemoteTextureOwnerId& aOwnerId) {
|
const RemoteTextureOwnerId& aOwnerId) {
|
||||||
// Hack: the function expects `DeviceId`, but it only uses it for `backend()`
|
// Hack: the function expects `DeviceId`, but it only uses it for `backend()`
|
||||||
// selection.
|
// selection.
|
||||||
|
// The parent side needs to create a command encoder which will be submitted
|
||||||
|
// and dropped right away so we create and release an encoder ID here.
|
||||||
RawId encoderId = ffi::wgpu_client_make_encoder_id(mClient.get());
|
RawId encoderId = ffi::wgpu_client_make_encoder_id(mClient.get());
|
||||||
SendSwapChainPresent(aTextureId, encoderId, aRemoteTextureId, aOwnerId);
|
SendSwapChainPresent(aTextureId, encoderId, aRemoteTextureId, aOwnerId);
|
||||||
|
ffi::wgpu_client_free_command_encoder_id(mClient.get(), encoderId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebGPUChild::RegisterDevice(Device* const aDevice) {
|
void WebGPUChild::RegisterDevice(Device* const aDevice) {
|
||||||
|
|||||||
@@ -1319,6 +1319,7 @@ ipc::IPCResult WebGPUParent::RecvSwapChainPresent(
|
|||||||
ffi::wgpu_server_encoder_finish(mContext.get(), aCommandEncoderId,
|
ffi::wgpu_server_encoder_finish(mContext.get(), aCommandEncoderId,
|
||||||
&commandDesc, error.ToFFI());
|
&commandDesc, error.ToFFI());
|
||||||
if (ForwardError(data->mDeviceId, error)) {
|
if (ForwardError(data->mDeviceId, error)) {
|
||||||
|
ffi::wgpu_server_encoder_drop(mContext.get(), aCommandEncoderId);
|
||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1327,6 +1328,7 @@ ipc::IPCResult WebGPUParent::RecvSwapChainPresent(
|
|||||||
ErrorBuffer error;
|
ErrorBuffer error;
|
||||||
ffi::wgpu_server_queue_submit(mContext.get(), data->mQueueId,
|
ffi::wgpu_server_queue_submit(mContext.get(), data->mQueueId,
|
||||||
&aCommandEncoderId, 1, error.ToFFI());
|
&aCommandEncoderId, 1, error.ToFFI());
|
||||||
|
ffi::wgpu_server_encoder_drop(mContext.get(), aCommandEncoderId);
|
||||||
if (ForwardError(data->mDeviceId, error)) {
|
if (ForwardError(data->mDeviceId, error)) {
|
||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user