-
Use atomic operations to specify shared memory access order · 6b164c33Alexis Hetu authored
TSAN detected many data race errors in the SwiftShader Renderer class. x86 has a strong memory ordering model which guarantees that changes are observed in the same order by other threads. However, C++ does not provide such guarantees unless specified using atomic operations. In order to fix these, a new AtomicInt class was added which is a basically a wrapper class for std::atomic<int> and which only exposes the portion of the API required by SwiftShader. Since std::atomic isn't available on older versions of Android, a fallback class was implemented without using std::atomic, which is closer to the previous implementation. Both classes appear to work properly after performing a few dEQP tests. Both also perform similarly. A few minor changes were made in order to attempt to reduce the use of atomic integer operations when possible. Change-Id: Ife6d3a2b6113346f8f8163b692e79c2a0e03b22f Reviewed-on: https://swiftshader-review.googlesource.com/12308Reviewed-by:
Nicolas Capens <nicolascapens@google.com> Tested-by:
Nicolas Capens <nicolascapens@google.com>
6b164c33
×