Fix up a ton of implicit memory_order_seq_cst for unique id gen
Change-Id: Icfbaa3129f5b45b5053c4f3444ff904c188b211a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/332725
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
diff --git a/src/gpu/GrResourceCache.cpp b/src/gpu/GrResourceCache.cpp
index a7aaeb2..0a074e9 100644
--- a/src/gpu/GrResourceCache.cpp
+++ b/src/gpu/GrResourceCache.cpp
@@ -36,7 +36,7 @@
GrScratchKey::ResourceType GrScratchKey::GenerateResourceType() {
static std::atomic<int32_t> nextType{INHERITED::kInvalidDomain + 1};
- int32_t type = nextType++;
+ int32_t type = nextType.fetch_add(1, std::memory_order_relaxed);
if (type > SkTo<int32_t>(UINT16_MAX)) {
SK_ABORT("Too many Resource Types");
}
@@ -47,7 +47,7 @@
GrUniqueKey::Domain GrUniqueKey::GenerateDomain() {
static std::atomic<int32_t> nextDomain{INHERITED::kInvalidDomain + 1};
- int32_t domain = nextDomain++;
+ int32_t domain = nextDomain.fetch_add(1, std::memory_order_relaxed);
if (domain > SkTo<int32_t>(UINT16_MAX)) {
SK_ABORT("Too many GrUniqueKey Domains");
}