From 0bc0ea3dcd760b864f1388359403f76916b9b100 Mon Sep 17 00:00:00 2001 From: assiduous Date: Mon, 21 Dec 2020 12:47:56 -0800 Subject: Vulkan backend: code clean-up --- Graphics/GraphicsEngineD3D12/include/BufferD3D12Impl.hpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'Graphics/GraphicsEngineD3D12') diff --git a/Graphics/GraphicsEngineD3D12/include/BufferD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/BufferD3D12Impl.hpp index da9fd65e..69f7f0db 100644 --- a/Graphics/GraphicsEngineD3D12/include/BufferD3D12Impl.hpp +++ b/Graphics/GraphicsEngineD3D12/include/BufferD3D12Impl.hpp @@ -121,16 +121,17 @@ private: DescriptorHeapAllocation m_CBVDescriptorAllocation; // Align the struct size to the cache line size to avoid false sharing - struct alignas(64) CtxDynamicData : D3D12DynamicAllocation + static constexpr size_t CacheLineSize = 64; + struct alignas(CacheLineSize) CtxDynamicData : D3D12DynamicAllocation { CtxDynamicData& operator=(const D3D12DynamicAllocation& Allocation) { *static_cast(this) = Allocation; return *this; } - Uint8 Padding[64 - sizeof(D3D12DynamicAllocation)]; + Uint8 Padding[CacheLineSize - sizeof(D3D12DynamicAllocation)]; }; - static_assert(sizeof(CtxDynamicData) == 64, "Unexpected sizeof(CtxDynamicData)"); + static_assert(sizeof(CtxDynamicData) == CacheLineSize, "Unexpected sizeof(CtxDynamicData)"); friend class DeviceContextD3D12Impl; // Array of dynamic allocations for every device context. -- cgit v1.2.3