Remove configuration macro D3D12MA_ALLOW_SHADER_ATOMICS and automatic usage of D3D12_HEAP_FLAG_ALLOW_SHADER_ATOMICS
diff --git a/src/D3D12MemAlloc.cpp b/src/D3D12MemAlloc.cpp
index b49d56f..7fc1695 100644
--- a/src/D3D12MemAlloc.cpp
+++ b/src/D3D12MemAlloc.cpp
@@ -86,17 +86,6 @@
#define D3D12MA_DEFAULT_BLOCK_SIZE (256ull * 1024 * 1024)
#endif
-#ifndef D3D12MA_ALLOW_SHADER_ATOMICS
- /*
- Set this to 1 to make the library automatically adding flag
- D3D12_HEAP_FLAG_ALLOW_SHADER_ATOMICS to any allocated heap that might contain a
- buffer or a texture used as a UAV. You can change it to 0 if you are sure your
- program doesn't use atomic functions in its shaders. In practice this flag
- doesn't seem to change anything.
- */
- #define D3D12MA_ALLOW_SHADER_ATOMICS (1)
-#endif
-
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//
@@ -737,9 +726,6 @@
{
D3D12_HEAP_FLAGS result =
D3D12_HEAP_FLAG_DENY_BUFFERS | D3D12_HEAP_FLAG_DENY_RT_DS_TEXTURES | D3D12_HEAP_FLAG_DENY_NON_RT_DS_TEXTURES;
-#if D3D12MA_ALLOW_SHADER_ATOMICS
- result |= D3D12_HEAP_FLAG_ALLOW_SHADER_ATOMICS;
-#endif
return result;
}
@@ -3884,12 +3870,6 @@
const UINT64 preferredBlockSize = explicitBlockSize ? desc.BlockSize : D3D12MA_DEFAULT_BLOCK_SIZE;
D3D12_HEAP_FLAGS heapFlags = desc.HeapFlags;
-#if D3D12MA_ALLOW_SHADER_ATOMICS
- if(desc.HeapType == D3D12_HEAP_TYPE_DEFAULT)
- {
- heapFlags |= D3D12_HEAP_FLAG_ALLOW_SHADER_ATOMICS;
- }
-#endif
UINT maxBlockCount = desc.MaxBlockCount != 0 ? desc.MaxBlockCount : UINT_MAX;
@@ -4469,13 +4449,6 @@
heapProps.Type = pAllocDesc->HeapType;
D3D12_HEAP_FLAGS heapFlags = pAllocDesc->ExtraHeapFlags;
-#if D3D12MA_ALLOW_SHADER_ATOMICS
- if((pResourceDesc->Flags & D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS) != 0)
- {
- D3D12MA_ASSERT(pAllocDesc->HeapType == D3D12_HEAP_TYPE_DEFAULT);
- heapFlags = D3D12_HEAP_FLAG_ALLOW_SHADER_ATOMICS;
- }
-#endif
ID3D12Resource* res = NULL;
HRESULT hr = m_Device->CreateCommittedResource(
@@ -4527,12 +4500,6 @@
}
D3D12_HEAP_FLAGS heapFlags = pAllocDesc->ExtraHeapFlags;
-#if D3D12MA_ALLOW_SHADER_ATOMICS
- if(pAllocDesc->HeapType == D3D12_HEAP_TYPE_DEFAULT)
- {
- heapFlags |= D3D12_HEAP_FLAG_ALLOW_SHADER_ATOMICS;
- }
-#endif
D3D12_HEAP_DESC heapDesc = {};
heapDesc.SizeInBytes = allocInfo.SizeInBytes;
@@ -4684,13 +4651,6 @@
default:
D3D12MA_ASSERT(0);
}
-
-#if D3D12MA_ALLOW_SHADER_ATOMICS
- if(outHeapType == D3D12_HEAP_TYPE_DEFAULT)
- {
- outHeapFlags |= D3D12_HEAP_FLAG_ALLOW_SHADER_ATOMICS;
- }
-#endif
}
void AllocatorPimpl::RegisterCommittedAllocation(Allocation* alloc, D3D12_HEAP_TYPE heapType)
diff --git a/src/D3D12MemAlloc.h b/src/D3D12MemAlloc.h
index 9a675aa..c1be18a 100644
--- a/src/D3D12MemAlloc.h
+++ b/src/D3D12MemAlloc.h
@@ -494,8 +494,6 @@
- If you use D3D12MA::Allocator::AllocateMemory(), you should specify one of those `ALLOW_ONLY` flags.
Except when you validate that D3D12MA::Allocator::GetD3D12Options()`.ResourceHeapTier == D3D12_RESOURCE_HEAP_TIER_1` -
then you can leave it 0.
- - If configuration macro `D3D12MA_ALLOW_SHADER_ATOMICS` is set to 1 (which is the default),
- `D3D12_HEAP_FLAG_ALLOW_SHADER_ATOMICS` is added automatically wherever it might be needed.
- You can specify additional flags if needed. Then the memory will always be allocated as
separate block using `D3D12Device::CreateCommittedResource` or `CreateHeap`, not as part of an existing larget block.
@@ -688,9 +686,6 @@
`D3D12_HEAP_FLAG_ALLOW_ONLY_RT_DS_TEXTURES`.
Except if ResourceHeapTier = 2, then it may be `D3D12_HEAP_FLAG_ALLOW_ALL_BUFFERS_AND_TEXTURES` = 0.
- If configuration macro `D3D12MA_ALLOW_SHADER_ATOMICS` is set to 1 (which is the default),
- `D3D12_HEAP_FLAG_ALLOW_SHADER_ATOMICS` is added automatically wherever it might be needed.
-
You can specify additional flags if needed.
*/
D3D12_HEAP_FLAGS HeapFlags;