From fdfd3b6dd70be5a8d456d6837758aa43a90ab3cc Mon Sep 17 00:00:00 2001 From: Egor Date: Fri, 2 Nov 2018 23:00:33 -0700 Subject: Fixed few linux build issues --- Common/interface/STDAllocator.h | 13 ++++++++++++- Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp | 10 +++++----- Platforms/Basic/interface/BasicAtomics.h | 7 ++++--- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/Common/interface/STDAllocator.h b/Common/interface/STDAllocator.h index 10f6769a..2371bdb8 100644 --- a/Common/interface/STDAllocator.h +++ b/Common/interface/STDAllocator.h @@ -34,6 +34,17 @@ namespace Diligent { +template +typename std::enable_if::value, void>::type Destruct(T *ptr) +{ + ptr->~T(); +} + +template +typename std::enable_if::value, void>::type Destruct(T *ptr) +{ +} + template struct STDAllocator { @@ -183,7 +194,7 @@ struct STDDeleter void operator()(T *ptr) noexcept { VERIFY(m_Allocator != nullptr, "The deleter has been moved away or never initialized, and can't be used"); - ptr->~T(); + Destruct(ptr); m_Allocator->Free(ptr); } diff --git a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp index 5f93f689..cffc5591 100644 --- a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp @@ -303,7 +303,7 @@ namespace Diligent void DeviceContextVkImpl::TransitionVkVertexBuffers() { - for ( UINT Buff = 0; Buff < m_NumVertexStreams; ++Buff ) + for ( Uint32 Buff = 0; Buff < m_NumVertexStreams; ++Buff ) { auto& CurrStream = m_VertexStreams[Buff]; auto* pBufferVk = CurrStream.pBuffer.RawPtr(); @@ -323,7 +323,7 @@ namespace Diligent VkDeviceSize Offsets[MaxBufferSlots]; VERIFY( m_NumVertexStreams <= MaxBufferSlots, "Too many buffers are being set" ); bool DynamicBufferPresent = false; - for ( UINT slot = 0; slot < m_NumVertexStreams; ++slot ) + for ( Uint32 slot = 0; slot < m_NumVertexStreams; ++slot ) { auto& CurrStream = m_VertexStreams[slot]; if (auto* pBufferVk = CurrStream.pBuffer.RawPtr()) @@ -1186,7 +1186,7 @@ namespace Diligent CopyInfo.Stride = Align(CopyInfo.RowSize, static_cast(DeviceLimits.optimalBufferCopyRowPitchAlignment)); if (FmtAttribs.ComponentType == COMPONENT_TYPE_COMPRESSED) { - // If the calling command’s VkImage parameter is a compressed image, + // If the calling command�s VkImage parameter is a compressed image, // bufferRowLength must be a multiple of the compressed texel block width // In texels (not even in compressed blocks!) CopyInfo.StrideInTexels = CopyInfo.Stride / Uint32{FmtAttribs.ComponentSize} * Uint32{FmtAttribs.BlockWidth}; @@ -1219,7 +1219,7 @@ namespace Diligent const auto& DeviceLimits = m_pDevice.RawPtr()->GetPhysicalDevice().GetProperties().limits; // Source buffer offset must be multiple of 4 (18.4) auto BufferOffsetAlignment = std::max(DeviceLimits.optimalBufferCopyOffsetAlignment, VkDeviceSize{4}); - // If the calling command’s VkImage parameter is a compressed image, bufferOffset must be a multiple of + // If the calling command�s VkImage parameter is a compressed image, bufferOffset must be a multiple of // the compressed texel block size in bytes (18.4) const auto& FmtAttribs = GetTextureFormatAttribs(TexDesc.Format); if (FmtAttribs.ComponentType == COMPONENT_TYPE_COMPRESSED) @@ -1349,7 +1349,7 @@ namespace Diligent const auto& DeviceLimits = m_pDevice.RawPtr()->GetPhysicalDevice().GetProperties().limits; // Source buffer offset must be multiple of 4 (18.4) auto Alignment = std::max(DeviceLimits.optimalBufferCopyOffsetAlignment, VkDeviceSize{4}); - // If the calling command’s VkImage parameter is a compressed image, bufferOffset must be a multiple of + // If the calling command�s VkImage parameter is a compressed image, bufferOffset must be a multiple of // the compressed texel block size in bytes (18.4) const auto& FmtAttribs = GetTextureFormatAttribs(TexDesc.Format); if (FmtAttribs.ComponentType == COMPONENT_TYPE_COMPRESSED) diff --git a/Platforms/Basic/interface/BasicAtomics.h b/Platforms/Basic/interface/BasicAtomics.h index 3d9ea8ea..a4c40b03 100644 --- a/Platforms/Basic/interface/BasicAtomics.h +++ b/Platforms/Basic/interface/BasicAtomics.h @@ -27,9 +27,10 @@ struct BasicAtomics { - typedef long Long; - typedef std::atomic AtomicLong; - typedef std::atomic AtomicInt64; + using Long = long; + using AtomicLong = std::atomic; + using Int64 = int64_t; + using AtomicInt64 = std::atomic; // The function returns the resulting INCREMENTED value. template -- cgit v1.2.3