Skip to content

Commit f045880

Browse files
Merge pull request #43 from PixelCatalyst/fix_atomic_initialization
Use list initialization for atomics
2 parents 434fd4e + 3b12988 commit f045880

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

include/D3D12MemAlloc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ class D3D12MA_API IUnknownImpl : public IUnknown
145145
protected:
146146
virtual void ReleaseThis() { delete this; }
147147
private:
148-
D3D12MA_ATOMIC_UINT32 m_RefCount = 1;
148+
D3D12MA_ATOMIC_UINT32 m_RefCount = {1};
149149
};
150150
} // namespace D3D12MA
151151

src/D3D12MemAlloc.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6120,7 +6120,7 @@ class CurrentBudgetData
61206120
D3D12MA_ATOMIC_UINT64 m_BlockBytes[DXGI_MEMORY_SEGMENT_GROUP_COUNT] = {};
61216121
D3D12MA_ATOMIC_UINT64 m_AllocationBytes[DXGI_MEMORY_SEGMENT_GROUP_COUNT] = {};
61226122

6123-
D3D12MA_ATOMIC_UINT32 m_OperationsSinceBudgetFetch = 0;
6123+
D3D12MA_ATOMIC_UINT32 m_OperationsSinceBudgetFetch = {0};
61246124
D3D12MA_RW_MUTEX m_BudgetMutex;
61256125
UINT64 m_D3D12Usage[DXGI_MEMORY_SEGMENT_GROUP_COUNT] = {};
61266126
UINT64 m_D3D12Budget[DXGI_MEMORY_SEGMENT_GROUP_COUNT] = {};
@@ -6355,7 +6355,7 @@ class AllocatorPimpl
63556355
friend class Allocator;
63566356
friend class Pool;
63576357
public:
6358-
std::atomic_uint32_t m_RefCount = 1;
6358+
std::atomic_uint32_t m_RefCount = {1};
63596359
CurrentBudgetData m_Budget;
63606360

63616361
AllocatorPimpl(const ALLOCATION_CALLBACKS& allocationCallbacks, const ALLOCATOR_DESC& desc);

0 commit comments

Comments
 (0)