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 <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
This commit is contained in:
Le Hoang Quyen 2023-04-10 10:09:57 +00:00 committed by Dawn LUCI CQ
parent 3dce55a6fe
commit dc626d357d
1 changed files with 2 additions and 0 deletions

View File

@ -212,6 +212,8 @@ ResultOrError<ComputePipelineBase*> 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));
}