Move update pointers to the containers they update

This commit is contained in:
Chris Robinson
2019-08-13 22:06:14 -07:00
parent 0806a003e2
commit ecab99bce9
6 changed files with 13 additions and 12 deletions
+2 -2
View File
@@ -706,7 +706,7 @@ ALeffectslot::~ALeffectslot()
DecrementRef(Target->ref);
Target = nullptr;
ALeffectslotProps *props{Update.load()};
ALeffectslotProps *props{Params.Update.load()};
if(props)
{
if(props->State) props->State->release();
@@ -750,7 +750,7 @@ void UpdateEffectSlotProps(ALeffectslot *slot, ALCcontext *context)
props->State = slot->Effect.State;
/* Set the new container for updating internal parameters. */
props = slot->Update.exchange(props, std::memory_order_acq_rel);
props = slot->Params.Update.exchange(props, std::memory_order_acq_rel);
if(props)
{
/* If there was an unused update container, put it back in the
+2 -2
View File
@@ -51,9 +51,9 @@ struct ALeffectslot {
RefCount ref{0u};
std::atomic<ALeffectslotProps*> Update{nullptr};
struct {
std::atomic<ALeffectslotProps*> Update{nullptr};
ALfloat Gain{1.0f};
ALboolean AuxSendAuto{AL_TRUE};
ALeffectslot *Target{nullptr};
+1 -1
View File
@@ -441,7 +441,7 @@ void UpdateListenerProps(ALCcontext *context)
props->MetersPerUnit = listener.mMetersPerUnit;
/* Set the new container for updating internal parameters. */
props = listener.Update.exchange(props, std::memory_order_acq_rel);
props = listener.Params.Update.exchange(props, std::memory_order_acq_rel);
if(props)
{
/* If there was an unused update container, put it back in the
+5 -4
View File
@@ -37,11 +37,12 @@ struct ALlistener {
std::atomic_flag PropsClean;
/* Pointer to the most recent property values that are awaiting an update.
*/
std::atomic<ALlistenerProps*> Update{nullptr};
struct {
/* Pointer to the most recent property values that are awaiting an
* update.
*/
std::atomic<ALlistenerProps*> Update{nullptr};
alu::Matrix Matrix;
alu::Vector Velocity;
+1 -1
View File
@@ -2382,7 +2382,7 @@ ALCcontext::~ALCcontext()
mVoices = nullptr;
mVoiceCount.store(0, std::memory_order_relaxed);
ALlistenerProps *lprops{mListener.Update.exchange(nullptr, std::memory_order_relaxed)};
ALlistenerProps *lprops{mListener.Params.Update.exchange(nullptr, std::memory_order_relaxed)};
if(lprops)
{
TRACE("Freed unapplied listener update %p\n", lprops);
+2 -2
View File
@@ -286,7 +286,7 @@ bool CalcListenerParams(ALCcontext *Context)
{
ALlistener &Listener = Context->mListener;
ALlistenerProps *props{Listener.Update.exchange(nullptr, std::memory_order_acq_rel)};
ALlistenerProps *props{Listener.Params.Update.exchange(nullptr, std::memory_order_acq_rel)};
if(!props) return false;
/* AT then UP */
@@ -321,7 +321,7 @@ bool CalcListenerParams(ALCcontext *Context)
bool CalcEffectSlotParams(ALeffectslot *slot, ALCcontext *context)
{
ALeffectslotProps *props{slot->Update.exchange(nullptr, std::memory_order_acq_rel)};
ALeffectslotProps *props{slot->Params.Update.exchange(nullptr, std::memory_order_acq_rel)};
if(!props) return false;
slot->Params.Gain = props->Gain;