From dc626d357d7146c48316b5de2cbfbdf8fed2be23 Mon Sep 17 00:00:00 2001 From: Le Hoang Quyen Date: Mon, 10 Apr 2023 10:09:57 +0000 Subject: [PATCH] Add missing lock when creating new pipeline during encoding. This was unsafe when encoding indirect draws with validations on multiple threads. Bug: dawn:1662 Change-Id: I479bb35bc98dd314860955b3c30df788d18ed84e Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126780 Reviewed-by: Corentin Wallez Kokoro: Kokoro Commit-Queue: Quyen Le --- src/dawn/native/IndirectDrawValidationEncoder.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/dawn/native/IndirectDrawValidationEncoder.cpp b/src/dawn/native/IndirectDrawValidationEncoder.cpp index c63f9d0f34..a94cfa5783 100644 --- a/src/dawn/native/IndirectDrawValidationEncoder.cpp +++ b/src/dawn/native/IndirectDrawValidationEncoder.cpp @@ -212,6 +212,8 @@ ResultOrError GetOrCreateRenderValidationPipeline(DeviceBa computePipelineDescriptor.compute.module = store->renderValidationShader.Get(); computePipelineDescriptor.compute.entryPoint = "main"; + // This will create new resource so we have to lock the device. + auto deviceLock(device->GetScopedLock()); DAWN_TRY_ASSIGN(store->renderValidationPipeline, device->CreateComputePipeline(&computePipelineDescriptor)); }