diff options
| author | Egor <egor.yusov@gmail.com> | 2018-11-03 06:00:33 +0000 |
|---|---|---|
| committer | Egor <egor.yusov@gmail.com> | 2018-11-03 06:00:33 +0000 |
| commit | fdfd3b6dd70be5a8d456d6837758aa43a90ab3cc (patch) | |
| tree | 08fcf5f176ccacd241bf5f2c5480501e02833991 | |
| parent | Fixed Vulkan validation error message about incorrect buffer offset alignment... (diff) | |
| download | DiligentCore-fdfd3b6dd70be5a8d456d6837758aa43a90ab3cc.tar.gz DiligentCore-fdfd3b6dd70be5a8d456d6837758aa43a90ab3cc.zip | |
Fixed few linux build issues
| -rw-r--r-- | Common/interface/STDAllocator.h | 13 | ||||
| -rw-r--r-- | Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp | 10 | ||||
| -rw-r--r-- | 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 T> +typename std::enable_if<std::is_destructible<T>::value, void>::type Destruct(T *ptr) +{ + ptr->~T(); +} + +template <typename T> +typename std::enable_if<!std::is_destructible<T>::value, void>::type Destruct(T *ptr) +{ +} + template <typename T, typename AllocatorType> 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<Uint32>(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<const RenderDeviceVkImpl>()->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<RenderDeviceVkImpl>()->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<Long> AtomicLong; - typedef std::atomic<int64_t> AtomicInt64; + using Long = long; + using AtomicLong = std::atomic<Long>; + using Int64 = int64_t; + using AtomicInt64 = std::atomic<Int64>; // The function returns the resulting INCREMENTED value. template<typename Type> |
