MetalBackend: Enable multithread support.
Bug: dawn:1662 Change-Id: If2f74b4bbce9d108fcd5906c2105f9ebd95845fe Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/124400 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
This commit is contained in:
parent
6ffc7890fb
commit
3dce55a6fe
|
@ -38,6 +38,7 @@ WGPUTexture WrapIOSurface(WGPUDevice device, const ExternalImageDescriptorIOSurf
|
|||
waitEvents.push_back(
|
||||
{static_cast<id<MTLSharedEvent>>(waitEvent.sharedEvent), waitEvent.signaledValue});
|
||||
}
|
||||
auto deviceLock(backendDevice->GetScopedLock());
|
||||
Ref<TextureBase> texture = backendDevice->CreateTextureWrappingIOSurface(
|
||||
cDescriptor, cDescriptor->ioSurface, std::move(waitEvents));
|
||||
return ToAPI(texture.Detach());
|
||||
|
@ -46,11 +47,15 @@ WGPUTexture WrapIOSurface(WGPUDevice device, const ExternalImageDescriptorIOSurf
|
|||
void IOSurfaceEndAccess(WGPUTexture cTexture,
|
||||
ExternalImageIOSurfaceEndAccessDescriptor* descriptor) {
|
||||
Texture* texture = ToBackend(FromAPI(cTexture));
|
||||
auto device = texture->GetDevice();
|
||||
auto deviceLock(device->GetScopedLock());
|
||||
texture->IOSurfaceEndAccess(descriptor);
|
||||
}
|
||||
|
||||
void WaitForCommandsToBeScheduled(WGPUDevice device) {
|
||||
ToBackend(FromAPI(device))->WaitForCommandsToBeScheduled();
|
||||
Device* backendDevice = ToBackend(FromAPI(device));
|
||||
auto deviceLock(backendDevice->GetScopedLock());
|
||||
backendDevice->WaitForCommandsToBeScheduled();
|
||||
}
|
||||
|
||||
} // namespace dawn::native::metal
|
||||
|
|
Loading…
Reference in New Issue