mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-29 21:30:53 +00:00
Remove volatile from Atomic parameter declarations
* This was leaky from windows' InterlockedIncrement etc declarations, and is not necessary.
This commit is contained in:
@@ -1124,7 +1124,7 @@ ExecuteResult AndroidRemoteServer::ExecuteAndInject(const char *a, const char *w
|
||||
rdcstr intentArgs = c && c[0] ? c : "";
|
||||
|
||||
// we spin up a thread to Ping() every second, since starting a package can block for a long time.
|
||||
volatile int32_t done = 0;
|
||||
int32_t done = 0;
|
||||
Threading::ThreadHandle pingThread = Threading::CreateThread([&done, this]() {
|
||||
Threading::SetCurrentThreadName("Android Ping");
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
bool Trylock() { return Atomic::CmpExch32(&val, 0, 1) == 0; }
|
||||
void Unlock() { Atomic::CmpExch32(&val, 1, 0); }
|
||||
private:
|
||||
volatile int32_t val = 0;
|
||||
int32_t val = 0;
|
||||
};
|
||||
|
||||
class ScopedSpinLock
|
||||
|
||||
@@ -696,8 +696,8 @@ private:
|
||||
RemoteExecution_ThreadActive = 2,
|
||||
};
|
||||
|
||||
volatile int32_t m_RemoteExecutionKill = 0;
|
||||
volatile int32_t m_RemoteExecutionState = RemoteExecution_Inactive;
|
||||
int32_t m_RemoteExecutionKill = 0;
|
||||
int32_t m_RemoteExecutionState = RemoteExecution_Inactive;
|
||||
|
||||
bool IsThreadIdle()
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
namespace ResourceIDGen
|
||||
{
|
||||
static volatile int64_t globalIDCounter = 1;
|
||||
static int64_t globalIDCounter = 1;
|
||||
|
||||
ResourceId GetNewUniqueID()
|
||||
{
|
||||
|
||||
@@ -493,7 +493,7 @@ struct ResourceRecord
|
||||
bool DataWritten;
|
||||
|
||||
protected:
|
||||
volatile int32_t RefCount;
|
||||
int32_t RefCount;
|
||||
|
||||
byte *DataPtr;
|
||||
uint64_t DataOffset;
|
||||
@@ -504,7 +504,7 @@ protected:
|
||||
|
||||
int64_t GetID()
|
||||
{
|
||||
static volatile int64_t globalIDCounter = 10;
|
||||
static int64_t globalIDCounter = 10;
|
||||
|
||||
return Atomic::Inc64(&globalIDCounter);
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public:
|
||||
WrappedOpenGL driver;
|
||||
std::set<CGLContextObj> contexts;
|
||||
|
||||
volatile int32_t suppressed = 0;
|
||||
int32_t suppressed = 0;
|
||||
} cglhook;
|
||||
|
||||
CGLError GL_EXPORT_NAME(CGLCreateContext)(CGLPixelFormatObj pix, CGLContextObj share,
|
||||
|
||||
@@ -346,7 +346,7 @@ private:
|
||||
std::map<GLsync, ResourceId> m_SyncIDs;
|
||||
std::map<GLuint, GLsync> m_CurrentSyncs;
|
||||
std::map<ResourceId, rdcstr> m_Names;
|
||||
volatile int64_t m_SyncName;
|
||||
int64_t m_SyncName;
|
||||
|
||||
struct FBOCache
|
||||
{
|
||||
|
||||
@@ -294,7 +294,7 @@ private:
|
||||
CaptureState m_State;
|
||||
bool m_AppControlledCapture = false;
|
||||
|
||||
volatile int32_t m_ReuseEnabled = 1;
|
||||
int32_t m_ReuseEnabled = 1;
|
||||
|
||||
PerformanceTimer m_CaptureTimer;
|
||||
|
||||
@@ -761,7 +761,7 @@ private:
|
||||
rdcarray<VkResourceRecord *> m_ForcedReferences;
|
||||
Threading::CriticalSection m_ForcedReferencesLock;
|
||||
|
||||
volatile int64_t m_QueueCounter = 0;
|
||||
int64_t m_QueueCounter = 0;
|
||||
|
||||
rdcarray<VkResourceRecord *> GetForcedReferences()
|
||||
{
|
||||
|
||||
@@ -500,7 +500,7 @@ TEST_CASE("Test OS-specific functions", "[osspecific]")
|
||||
|
||||
SECTION("Atomics")
|
||||
{
|
||||
volatile int32_t value = 0;
|
||||
int32_t value = 0;
|
||||
|
||||
// check that thread atomics work on multiple overlapping threads
|
||||
Threading::ThreadHandle threads[numThreads];
|
||||
|
||||
@@ -224,12 +224,12 @@ void Shutdown();
|
||||
|
||||
namespace Atomic
|
||||
{
|
||||
int32_t Inc32(volatile int32_t *i);
|
||||
int32_t Dec32(volatile int32_t *i);
|
||||
int64_t Inc64(volatile int64_t *i);
|
||||
int64_t Dec64(volatile int64_t *i);
|
||||
int64_t ExchAdd64(volatile int64_t *i, int64_t a);
|
||||
int32_t CmpExch32(volatile int32_t *dest, int32_t oldVal, int32_t newVal);
|
||||
int32_t Inc32(int32_t *i);
|
||||
int32_t Dec32(int32_t *i);
|
||||
int64_t Inc64(int64_t *i);
|
||||
int64_t Dec64(int64_t *i);
|
||||
int64_t ExchAdd64(int64_t *i, int64_t a);
|
||||
int32_t CmpExch32(int32_t *dest, int32_t oldVal, int32_t newVal);
|
||||
};
|
||||
|
||||
namespace Callstack
|
||||
|
||||
@@ -51,7 +51,7 @@ DLOPENPROC realdlopen = NULL;
|
||||
FORKPROC realfork = NULL;
|
||||
DLSYMPROC realdlsym = NULL;
|
||||
|
||||
static volatile int32_t tlsbusyflag = 0;
|
||||
static int32_t tlsbusyflag = 0;
|
||||
|
||||
__attribute__((visibility("default"))) void *dlopen(const char *filename, int flag)
|
||||
{
|
||||
|
||||
@@ -41,32 +41,32 @@ time_t Timing::GetUTCTime()
|
||||
|
||||
namespace Atomic
|
||||
{
|
||||
int32_t Inc32(volatile int32_t *i)
|
||||
int32_t Inc32(int32_t *i)
|
||||
{
|
||||
return __sync_add_and_fetch(i, int32_t(1));
|
||||
}
|
||||
|
||||
int32_t Dec32(volatile int32_t *i)
|
||||
int32_t Dec32(int32_t *i)
|
||||
{
|
||||
return __sync_add_and_fetch(i, int32_t(-1));
|
||||
}
|
||||
|
||||
int64_t Inc64(volatile int64_t *i)
|
||||
int64_t Inc64(int64_t *i)
|
||||
{
|
||||
return __sync_add_and_fetch(i, int64_t(1));
|
||||
}
|
||||
|
||||
int64_t Dec64(volatile int64_t *i)
|
||||
int64_t Dec64(int64_t *i)
|
||||
{
|
||||
return __sync_add_and_fetch(i, int64_t(-1));
|
||||
}
|
||||
|
||||
int64_t ExchAdd64(volatile int64_t *i, int64_t a)
|
||||
int64_t ExchAdd64(int64_t *i, int64_t a)
|
||||
{
|
||||
return __sync_add_and_fetch(i, int64_t(a));
|
||||
}
|
||||
|
||||
int32_t CmpExch32(volatile int32_t *dest, int32_t oldVal, int32_t newVal)
|
||||
int32_t CmpExch32(int32_t *dest, int32_t oldVal, int32_t newVal)
|
||||
{
|
||||
return __sync_val_compare_and_swap(dest, oldVal, newVal);
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ struct CachedHookData
|
||||
|
||||
bool missedOrdinals;
|
||||
|
||||
volatile int32_t posthooking = 0;
|
||||
int32_t posthooking = 0;
|
||||
|
||||
void ApplyHooks(const char *modName, HMODULE module)
|
||||
{
|
||||
|
||||
@@ -1135,7 +1135,7 @@ struct GlobalHookData
|
||||
rdcwstr appinitDLLs;
|
||||
} dataNative, dataWow32;
|
||||
|
||||
volatile int32_t finished = 0;
|
||||
int32_t finished = 0;
|
||||
Threading::ThreadHandle pipeThread = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -54,32 +54,32 @@ time_t Timing::GetUTCTime()
|
||||
|
||||
namespace Atomic
|
||||
{
|
||||
int32_t Inc32(volatile int32_t *i)
|
||||
int32_t Inc32(int32_t *i)
|
||||
{
|
||||
return (int32_t)InterlockedIncrement((volatile LONG *)i);
|
||||
}
|
||||
|
||||
int32_t Dec32(volatile int32_t *i)
|
||||
int32_t Dec32(int32_t *i)
|
||||
{
|
||||
return (int32_t)InterlockedDecrement((volatile LONG *)i);
|
||||
}
|
||||
|
||||
int64_t Inc64(volatile int64_t *i)
|
||||
int64_t Inc64(int64_t *i)
|
||||
{
|
||||
return (int64_t)InterlockedIncrement64((volatile LONG64 *)i);
|
||||
}
|
||||
|
||||
int64_t Dec64(volatile int64_t *i)
|
||||
int64_t Dec64(int64_t *i)
|
||||
{
|
||||
return (int64_t)InterlockedDecrement64((volatile LONG64 *)i);
|
||||
}
|
||||
|
||||
int64_t ExchAdd64(volatile int64_t *i, int64_t a)
|
||||
int64_t ExchAdd64(int64_t *i, int64_t a)
|
||||
{
|
||||
return (int64_t)InterlockedExchangeAdd64((volatile LONG64 *)i, a);
|
||||
}
|
||||
|
||||
int32_t CmpExch32(volatile int32_t *dest, int32_t oldVal, int32_t newVal)
|
||||
int32_t CmpExch32(int32_t *dest, int32_t oldVal, int32_t newVal)
|
||||
{
|
||||
return (int32_t)InterlockedCompareExchange((volatile LONG *)dest, newVal, oldVal);
|
||||
}
|
||||
|
||||
@@ -37,14 +37,14 @@
|
||||
|
||||
#include "catch/catch.hpp"
|
||||
|
||||
static volatile int32_t constructor = 0;
|
||||
static volatile int32_t moveConstructor = 0;
|
||||
static volatile int32_t valueConstructor = 0;
|
||||
static volatile int32_t copyConstructor = 0;
|
||||
static volatile int32_t destructor = 0;
|
||||
static volatile int32_t movedDestructor = 0;
|
||||
static volatile int32_t copyAssignment = 0;
|
||||
static volatile int32_t moveAssignment = 0;
|
||||
static int32_t constructor = 0;
|
||||
static int32_t moveConstructor = 0;
|
||||
static int32_t valueConstructor = 0;
|
||||
static int32_t copyConstructor = 0;
|
||||
static int32_t destructor = 0;
|
||||
static int32_t movedDestructor = 0;
|
||||
static int32_t copyAssignment = 0;
|
||||
static int32_t moveAssignment = 0;
|
||||
|
||||
struct ConstructorCounter
|
||||
{
|
||||
|
||||
@@ -235,8 +235,8 @@ private:
|
||||
APIProperties m_APIProps;
|
||||
rdcarray<rdcstr> m_GCNTargets;
|
||||
|
||||
volatile int32_t m_ReplayLoopCancel = 0;
|
||||
volatile int32_t m_ReplayLoopFinished = 0;
|
||||
int32_t m_ReplayLoopCancel = 0;
|
||||
int32_t m_ReplayLoopFinished = 0;
|
||||
|
||||
uint32_t m_EventID;
|
||||
|
||||
|
||||
@@ -174,7 +174,7 @@ TEST_CASE("Test stream I/O operations over the network", "[streamio][network]")
|
||||
rdcarray<uint64_t> list = {1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597};
|
||||
|
||||
// Tracks the lifetime of each thread.
|
||||
volatile int32_t threadA = 0, threadB = 0;
|
||||
int32_t threadA = 0, threadB = 0;
|
||||
|
||||
Threading::ThreadHandle recvThread =
|
||||
Threading::CreateThread([&threadA, &reader, &receivedValues]() {
|
||||
|
||||
Reference in New Issue
Block a user