Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add C++20 compliance to LLGL #86

Merged
merged 5 commits into from
Jul 3, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions include/LLGL/Container/SmallVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -373,14 +373,16 @@ class LLGL_EXPORT SmallVector
{
if (size_ == cap_)
realloc(GrowStrategy::Grow(size_ + 1));
Allocator{}.construct(end(), value);
Allocator alloc;
std::allocator_traits<Allocator>::construct(alloc, end(), value);
++size_;
}

void push_back(value_type&& value)
{
reserve(size() + 1);
Allocator{}.construct(end(), std::forward<value_type&&>(value));
Allocator alloc;
std::allocator_traits<Allocator>::construct(alloc, end(), std::forward<value_type&&>(value));
++size_;
}

Expand Down Expand Up @@ -646,23 +648,23 @@ class LLGL_EXPORT SmallVector
{
Allocator alloc;
for (; from != to; ++from)
alloc.destroy(from);
std::allocator_traits<Allocator>::destroy(alloc, from);
}

template <typename... TArgs>
void construct_single(iterator from, iterator to, TArgs&&... args)
{
Allocator alloc;
for (; from != to; ++from)
alloc.construct(from, std::forward<TArgs>(args)...);
std::allocator_traits<Allocator>::construct(alloc, from, std::forward<TArgs>(args)...);
}

template <typename InputIter>
void construct_range(iterator pos, InputIter from, InputIter to)
{
Allocator alloc;
for (pointer p = pos; from != to; ++from, ++p)
alloc.construct(p, *from);
std::allocator_traits<Allocator>::construct(alloc, p, *from);
}

template <typename InputIter>
Expand Down Expand Up @@ -730,8 +732,8 @@ class LLGL_EXPORT SmallVector
for (; from != to; ++from, ++dst)
{
/* Copy element from current position 'from' to destination 'dst' and destroy the old one */
alloc.construct(dst, *from);
alloc.destroy(from);
std::allocator_traits<Allocator>::construct(alloc, dst, *from);
std::allocator_traits<Allocator>::destroy(alloc, from);
}
}

Expand All @@ -743,8 +745,8 @@ class LLGL_EXPORT SmallVector
for (auto rfrom = reverse_iterator{ to }, rto = reverse_iterator{ from }; rfrom != rto; ++rfrom, ++rdst)
{
/* Copy element from current position 'from' to destination 'dst' and destroy the old one */
alloc.construct(&(*rdst), *rfrom);
alloc.destroy(&(*rfrom));
std::allocator_traits<Allocator>::construct(alloc, &(*rdst), *rfrom);
gdianaty marked this conversation as resolved.
Show resolved Hide resolved
std::allocator_traits<Allocator>::destroy(alloc, &(*rfrom));
}
}

Expand Down
9 changes: 5 additions & 4 deletions sources/Renderer/Direct3D11/D3D11CommandBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ void D3D11CommandBuffer::CopyBuffer(
{
auto& dstBufferD3D = LLGL_CAST(D3D11Buffer&, dstBuffer);
auto& srcBufferD3D = LLGL_CAST(D3D11Buffer&, srcBuffer);
CD3D11_BOX box = CD3D11_BOX(
static_cast<LONG>(srcOffset), 0, 0,
static_cast<LONG>(srcOffset + size), 1, 1
);

context_->CopySubresourceRegion(
dstBufferD3D.GetNative(), // pDstResource
Expand All @@ -134,10 +138,7 @@ void D3D11CommandBuffer::CopyBuffer(
0, // DstZ
srcBufferD3D.GetNative(), // pSrcResource
0, // SrcSubresource
&CD3D11_BOX( // pSrcBox
static_cast<LONG>(srcOffset), 0, 0,
static_cast<LONG>(srcOffset + size), 1, 1
)
&box // pSrcBox
);
}

Expand Down
3 changes: 3 additions & 0 deletions sources/Renderer/Direct3D12/Shader/D3D12RootParameter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
namespace LLGL
{

D3D12RootParameter::D3D12RootParameter()
{
}

D3D12RootParameter::D3D12RootParameter(D3D12_ROOT_PARAMETER* managedRootParam) :
managedRootParam_ { managedRootParam }
Expand Down
2 changes: 1 addition & 1 deletion sources/Renderer/Direct3D12/Shader/D3D12RootParameter.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class D3D12RootParameter
{

public:

D3D12RootParameter();
gdianaty marked this conversation as resolved.
Show resolved Hide resolved
D3D12RootParameter(D3D12_ROOT_PARAMETER* managedRootParam);

D3D12RootParameter(const D3D12RootParameter&) = default;
Expand Down
2 changes: 1 addition & 1 deletion sources/Renderer/SPIRV/SpirvInstruction.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#define LLGL_SPIRV_INSTRUCTION_H


#include <spirv/1.2/spirv.hpp11>
#include <spirv-headers/spirv.hpp11>
gdianaty marked this conversation as resolved.
Show resolved Hide resolved
#include <cstdint>


Expand Down
2 changes: 1 addition & 1 deletion sources/Renderer/SPIRV/SpirvInstructionInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#define LLGL_SPIRV_INSTRUCTION_INFO_H


#include <spirv/1.2/spirv.hpp11>
#include <spirv-headers/spirv.hpp11>
#include <cstdint>


Expand Down
Loading