mirror of
https://github.com/Alex313031/thorium.git
synced 2025-01-09 11:27:32 -03:00
50 lines
1.8 KiB
Diff
50 lines
1.8 KiB
Diff
author: Andres Salomon <dilinger@debian.org>
|
|
description: revert compile-time lockfree check; switch back to a runtime check.
|
|
|
|
This reverts the following:
|
|
|
|
"commit ce8ce6f81eff8a84e2ea59930cb995b1107181e2 (origin/chromium/5572)
|
|
Author: Kimmo Kinnunen <kkinnunen@apple.com>
|
|
Date: Tue Jan 31 13:06:47 2023 +0200
|
|
|
|
Remove ASSERT from AtomicSerial, use static_assert
|
|
|
|
ASSERT is not constexpr, while the AtomicSerial constructor was.
|
|
This would cause compile errors.
|
|
|
|
Bug: angleproject:7989
|
|
Change-Id: Ib6a438d4c055378d4f2f667285b0d2e99f2522ad
|
|
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4205892
|
|
"
|
|
|
|
The problem is that this is a compile-time check to ensure that a std::atomic<uint64_t>
|
|
doesn't require a mutex, but for i386 we can't guarantee that; instead, i386 checks
|
|
at runtime for the relevant CPU instructions. So we need to revert back to a runtime
|
|
assertion.
|
|
|
|
Since this is in ANGLE rather than Chromium, hopefully there's a chance they'll take a
|
|
fix upstream; probably a revert combined with dropping the "constexpr".
|
|
|
|
# This goes in //chromium/src/third_party/angle/src
|
|
|
|
--- a/src/libANGLE/renderer/serial_utils.h
|
|
+++ b/src/libANGLE/renderer/serial_utils.h
|
|
@@ -119,6 +119,7 @@ class Serial final
|
|
class alignas(8) AtomicQueueSerial final
|
|
{
|
|
public:
|
|
+ constexpr AtomicQueueSerial() : mValue(kInvalid) { ASSERT(mValue.is_lock_free()); }
|
|
AtomicQueueSerial &operator=(const Serial &other)
|
|
{
|
|
mValue.store(other.mValue, std::memory_order_release);
|
|
@@ -127,8 +128,8 @@ class alignas(8) AtomicQueueSerial final
|
|
Serial getSerial() const { return Serial(mValue.load(std::memory_order_consume)); }
|
|
|
|
private:
|
|
+ std::atomic<uint64_t> mValue;
|
|
static constexpr uint64_t kInvalid = 0;
|
|
- std::atomic<uint64_t> mValue = kInvalid;
|
|
};
|
|
|
|
// Used as default/initial serial
|
|
|