summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/CommandProcessor.h
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2021-05-13 18:44:59 +0200
committerJosJuice <josjuice@gmail.com>2021-05-13 18:56:27 +0200
commitb93983b50a8b2d50a2120601784aab022f46308c (patch)
treea169385d181f65ad39f47c6892fe2dc705233727 /Source/Core/VideoCommon/CommandProcessor.h
parent80ac36a712b80516f1708de56a5b6582127de2f4 (diff)
Remove Atomic.h
The STL has everything we need nowadays. I have tried to not alter any behavior or semantics with this change wherever possible. In particular, WriteLow and WriteHigh in CommandProcessor retain the ability to accidentally undo another thread's write to the upper half or lower half respectively. If that should be fixed, it should be done in a separate commit for clarity. One thing did change: The places where we were using += on a volatile variable (not an atomic operation) are now using fetch_add (actually an atomic operation). Tested with single core and dual core on x86-64 and AArch64.
Diffstat (limited to 'Source/Core/VideoCommon/CommandProcessor.h')
-rw-r--r--Source/Core/VideoCommon/CommandProcessor.h16
1 files changed, 9 insertions, 7 deletions
diff --git a/Source/Core/VideoCommon/CommandProcessor.h b/Source/Core/VideoCommon/CommandProcessor.h
index c246d5651d..bc0a8ede49 100644
--- a/Source/Core/VideoCommon/CommandProcessor.h
+++ b/Source/Core/VideoCommon/CommandProcessor.h
@@ -4,6 +4,8 @@
#pragma once
+#include <atomic>
+
#include "Common/CommonTypes.h"
class PointerWrap;
@@ -17,15 +19,15 @@ namespace CommandProcessor
struct SCPFifoStruct
{
// fifo registers
- volatile u32 CPBase;
- volatile u32 CPEnd;
+ std::atomic<u32> CPBase;
+ std::atomic<u32> CPEnd;
u32 CPHiWatermark;
u32 CPLoWatermark;
- volatile u32 CPReadWriteDistance;
- volatile u32 CPWritePointer;
- volatile u32 CPReadPointer;
- volatile u32 CPBreakpoint;
- volatile u32 SafeCPReadPointer;
+ std::atomic<u32> CPReadWriteDistance;
+ std::atomic<u32> CPWritePointer;
+ std::atomic<u32> CPReadPointer;
+ std::atomic<u32> CPBreakpoint;
+ std::atomic<u32> SafeCPReadPointer;
volatile u32 bFF_GPLinkEnable;
volatile u32 bFF_GPReadEnable;