Revert "Remove global device lock from CreateShaderModule"
This reverts commit 3d6882ad8522501fadc0515b4669ece6773520af.
Reason for revert: TSAN says there is a data race. See
https://chromium-swarm.appspot.com/task?id=67c3b0e6413b4111&o=true&w=true
Original change's description:
> Remove global device lock from CreateShaderModule
>
> Note that MultithreadTests already includes tests which
> create shader modules and pipelines on multiple threads.
>
> Bug: dawn:1662
> Change-Id: I7a02638854e0e13fece77e1cdb0bebfceacea827
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/174201
> Commit-Queue: Austin Eng <enga@chromium.org>
> Reviewed-by: Loko Kung <lokokung@google.com>
> Kokoro: Kokoro <noreply+kokoro@google.com>
TBR=enga@chromium.org,noreply+kokoro@google.com,dawn-scoped@luci-project-accounts.iam.gserviceaccount.com,lokokung@google.com
Change-Id: I5dc258ada14ae9737c002fccd4e3775261a6caa8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: dawn:1662
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/175180
Kokoro: Austin Eng <enga@chromium.org>
Commit-Queue: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Austin Eng <enga@chromium.org>
diff --git a/src/dawn/dawn.json b/src/dawn/dawn.json
index 76054ba..b5c1530 100644
--- a/src/dawn/dawn.json
+++ b/src/dawn/dawn.json
@@ -1280,7 +1280,6 @@
},
{
"name": "create shader module",
- "no autolock": true,
"returns": "shader module",
"args": [
{"name": "descriptor", "type": "shader module descriptor", "annotation": "const*"}
diff --git a/src/dawn/native/Device.cpp b/src/dawn/native/Device.cpp
index 41c8c88..15c7b39 100644
--- a/src/dawn/native/Device.cpp
+++ b/src/dawn/native/Device.cpp
@@ -1614,12 +1614,12 @@
// Limit the number of compilation error emitted to avoid spamming the devtools console hard.
constexpr uint32_t kCompilationLogSpamLimit = 20;
- if (mEmittedCompilationLogCount.load(std::memory_order_acquire) > kCompilationLogSpamLimit) {
+ if (mEmittedCompilationLogCount > kCompilationLogSpamLimit) {
return;
}
- if (mEmittedCompilationLogCount.fetch_add(1, std::memory_order_acq_rel) ==
- kCompilationLogSpamLimit - 1) {
+ mEmittedCompilationLogCount++;
+ if (mEmittedCompilationLogCount == kCompilationLogSpamLimit) {
return EmitLog(WGPULoggingType_Warning,
"Reached the WGSL compilation log warning limit. To see all the compilation "
"logs, query them directly on the ShaderModule objects.");
diff --git a/src/dawn/native/Device.h b/src/dawn/native/Device.h
index 263e8a6..13ff30a 100644
--- a/src/dawn/native/Device.h
+++ b/src/dawn/native/Device.h
@@ -601,7 +601,7 @@
struct DeprecationWarnings;
std::unique_ptr<DeprecationWarnings> mDeprecationWarnings;
- std::atomic<uint32_t> mEmittedCompilationLogCount = 0;
+ uint32_t mEmittedCompilationLogCount = 0;
absl::flat_hash_set<std::string> mWarnings;