Skip to content

Commit 7c1cee8

Browse files
committed
add c++ 20 support.
1 parent 67bcf92 commit 7c1cee8

38 files changed

+192
-187
lines changed

Diff for: commands/command_allocator.hpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22

33
#include "../devices/device.hpp"
44

5-
namespace wrapper::directx12 {
5+
namespace wrapper::directx12
6+
{
67

7-
class command_allocator final : public wrapper_t<ID3D12CommandAllocator> {
8+
class command_allocator final : public wrapper_t<ID3D12CommandAllocator>
9+
{
810
public:
911
command_allocator() = default;
1012

1113
explicit command_allocator(const ComPtr<ID3D12CommandAllocator>& source);
1214

13-
~command_allocator() = default;
14-
1515
static command_allocator create(const device& device);
1616
};
1717

Diff for: commands/command_list.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ void wrapper::directx12::graphics_command_list::set_descriptor_heaps(
3737
std::vector<ID3D12DescriptorHeap*> origins(heaps.size());
3838

3939
std::transform(heaps.begin(), heaps.end(), origins.begin(),
40-
[](const ComPtr<ID3D12DescriptorHeap> heap) { return heap.Get(); });
40+
[](const ComPtr<ID3D12DescriptorHeap>& heap) { return heap.Get(); });
4141

4242
mWrapperInstance->SetDescriptorHeaps(static_cast<UINT>(heaps.size()), origins.data());
4343
}

Diff for: commands/command_list.hpp

+8-6
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22

33
#include "command_allocator.hpp"
44

5-
namespace wrapper::directx12 {
5+
namespace wrapper::directx12
6+
{
67

78
class buffer;
89

9-
struct value32bit {
10-
union {
10+
struct value32bit
11+
{
12+
union
13+
{
1114
uint32 uint32;
1215
int32 int32;
1316
real real;
@@ -22,14 +25,13 @@ namespace wrapper::directx12 {
2225
value32bit(const directx12::real& value) : real(value) {}
2326
};
2427

25-
class graphics_command_list final : public wrapper_t<ID3D12GraphicsCommandList4> {
28+
class graphics_command_list final : public wrapper_t<ID3D12GraphicsCommandList4>
29+
{
2630
public:
2731
graphics_command_list() = default;
2832

2933
explicit graphics_command_list(const ComPtr<ID3D12GraphicsCommandList4>& source);
3034

31-
~graphics_command_list() = default;
32-
3335
void clear_unordered_access_view(
3436
const D3D12_CPU_DESCRIPTOR_HANDLE& cpu_handle_in_non_shader_visible_heap,
3537
const D3D12_GPU_DESCRIPTOR_HANDLE& gpu_handle_in_shader_visible_heap,

Diff for: commands/command_queue.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ void wrapper::directx12::command_queue::wait(const fence& fence) const
1919

2020
mWrapperInstance->Signal(fence.get(), value);
2121

22-
if (fence->GetCompletedValue() < value) {
22+
if (fence->GetCompletedValue() < value)
23+
{
2324
const auto event_handle = CreateEventEx(nullptr, nullptr, false, EVENT_ALL_ACCESS);
2425

2526
fence->SetEventOnCompletion(value, event_handle);

Diff for: commands/command_queue.hpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55

66
#include <vector>
77

8-
namespace wrapper::directx12 {
8+
namespace wrapper::directx12
9+
{
910

10-
class command_queue final : public wrapper_t<ID3D12CommandQueue> {
11+
class command_queue final : public wrapper_t<ID3D12CommandQueue>
12+
{
1113
public:
1214
command_queue() = default;
1315

1416
explicit command_queue(const ComPtr<ID3D12CommandQueue>& source);
15-
16-
~command_queue() = default;
17-
17+
1818
void execute(const std::vector<graphics_command_list>& command_lists) const;
1919

2020
void wait(const fence& fence) const;

Diff for: descriptors/descriptor_heap.hpp

+10-15
Original file line numberDiff line numberDiff line change
@@ -6,40 +6,36 @@
66
#include <vector>
77
#include <string>
88

9-
namespace wrapper::directx12 {
9+
namespace wrapper::directx12
10+
{
1011

11-
struct cpu_descriptor_handle : D3D12_CPU_DESCRIPTOR_HANDLE {
12+
struct cpu_descriptor_handle : D3D12_CPU_DESCRIPTOR_HANDLE
13+
{
1214
cpu_descriptor_handle() = default;
1315

1416
cpu_descriptor_handle(const D3D12_CPU_DESCRIPTOR_HANDLE& handle);
1517

16-
~cpu_descriptor_handle() = default;
17-
1818
cpu_descriptor_handle& operator+(const cpu_descriptor_handle& rhs);
1919
cpu_descriptor_handle& operator-(const cpu_descriptor_handle& rhs);
2020
cpu_descriptor_handle& operator+(size_t offset);
2121
cpu_descriptor_handle& operator-(size_t offset);
2222
};
2323

24-
struct gpu_descriptor_handle : D3D12_GPU_DESCRIPTOR_HANDLE {
24+
struct gpu_descriptor_handle : D3D12_GPU_DESCRIPTOR_HANDLE
25+
{
2526
gpu_descriptor_handle() = default;
2627

2728
gpu_descriptor_handle(const D3D12_GPU_DESCRIPTOR_HANDLE& handle);
2829

29-
~gpu_descriptor_handle() = default;
30-
3130
gpu_descriptor_handle& operator+(const gpu_descriptor_handle& rhs);
3231
gpu_descriptor_handle& operator-(const gpu_descriptor_handle& rhs);
3332
gpu_descriptor_handle& operator+(size_t offset);
3433
gpu_descriptor_handle& operator-(size_t offset);
3534
};
3635

37-
class descriptor_table final {
36+
class descriptor_table final
37+
{
3838
public:
39-
descriptor_table() = default;
40-
41-
~descriptor_table() = default;
42-
4339
descriptor_table& add_srv_range(const std::vector<std::string>& name, size_t base, size_t space);
4440

4541
descriptor_table& add_uav_range(const std::vector<std::string>& name, size_t base, size_t space);
@@ -59,14 +55,13 @@ namespace wrapper::directx12 {
5955
std::vector<D3D12_DESCRIPTOR_RANGE> mRanges;
6056
};
6157

62-
class descriptor_heap final : public wrapper_t<ID3D12DescriptorHeap> {
58+
class descriptor_heap final : public wrapper_t<ID3D12DescriptorHeap>
59+
{
6360
public:
6461
descriptor_heap() = default;
6562

6663
explicit descriptor_heap(const ComPtr<ID3D12DescriptorHeap>& source, const ComPtr<ID3D12Device5>& device);
6764

68-
~descriptor_heap() = default;
69-
7065
D3D12_CPU_DESCRIPTOR_HANDLE cpu_handle(size_t index = 0) const;
7166
D3D12_GPU_DESCRIPTOR_HANDLE gpu_handle(size_t index = 0) const;
7267

Diff for: descriptors/root_signature.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ wrapper::directx12::root_signature wrapper::directx12::root_signature::create(co
155155
D3D12SerializeRootSignature(&desc, D3D_ROOT_SIGNATURE_VERSION_1, signature_blob.GetAddressOf(), error_blob.GetAddressOf());
156156

157157
// output error message if we have
158-
if (error_blob != nullptr) {
158+
if (error_blob != nullptr)
159+
{
159160
auto error = copy_data_to_string(error_blob->GetBufferPointer(), error_blob->GetBufferSize());
160161

161162
if (!error.empty() && error.back() == '\n') error.pop_back();

Diff for: descriptors/root_signature.hpp

+6-9
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,12 @@
66
#include <vector>
77
#include <string>
88

9-
namespace wrapper::directx12 {
9+
namespace wrapper::directx12
10+
{
1011

11-
class root_signature_info final {
12+
class root_signature_info final
13+
{
1214
public:
13-
root_signature_info() = default;
14-
15-
~root_signature_info() = default;
16-
1715
root_signature_info& add_descriptor(const std::string& name, const D3D12_ROOT_PARAMETER_TYPE& type, uint32 base, uint32 space);
1816

1917
root_signature_info& add_descriptor_table(const std::string& name, const descriptor_table& table);
@@ -56,14 +54,13 @@ namespace wrapper::directx12 {
5654
size_t mSize = 0;
5755
};
5856

59-
class root_signature final : public wrapper_t<ID3D12RootSignature> {
57+
class root_signature final : public wrapper_t<ID3D12RootSignature>
58+
{
6059
public:
6160
root_signature() = default;
6261

6362
root_signature(const ComPtr<ID3D12RootSignature>& source);
6463

65-
~root_signature() = default;
66-
6764
static root_signature create(const device& device, const root_signature_info& info, bool local = false);
6865
};
6966

Diff for: devices/adapter.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ std::vector<wrapper::directx12::adapter> wrapper::directx12::adapter::all()
1717
std::vector<directx12::adapter> adapters;
1818

1919
while (factory->EnumAdapters1(index++, &adapter) != DXGI_ERROR_NOT_FOUND)
20+
{
2021
adapters.push_back(directx12::adapter(adapter));
21-
22+
}
23+
2224
return adapters;
2325
}

Diff for: devices/adapter.hpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22

33
#include "../interfaces/wrapper.hpp"
44

5-
namespace wrapper::directx12 {
5+
namespace wrapper::directx12
6+
{
67

7-
class adapter final : public wrapper_t<IDXGIAdapter1> {
8+
class adapter final : public wrapper_t<IDXGIAdapter1>
9+
{
810
public:
911
adapter() = default;
1012

1113
explicit adapter(const ComPtr<IDXGIAdapter1>& source);
1214

13-
~adapter() = default;
14-
1515
static std::vector<adapter> all();
1616
private:
1717
DXGI_ADAPTER_DESC1 mDesc;

Diff for: devices/device.hpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
#include "../interfaces/wrapper.hpp"
44
#include "adapter.hpp"
55

6-
namespace wrapper::directx12 {
6+
namespace wrapper::directx12
7+
{
78

89
class resource;
910

10-
class device final : public wrapper_t<ID3D12Device5> {
11+
class device final : public wrapper_t<ID3D12Device5>
12+
{
1113
public:
1214
device() = default;
1315

1416
explicit device(const ComPtr<ID3D12Device5>& source);
1517

16-
~device() = default;
17-
1818
void create_render_target_view(
1919
const D3D12_RENDER_TARGET_VIEW_DESC& desc,
2020
const D3D12_CPU_DESCRIPTOR_HANDLE& handle,

Diff for: directx12-wrapper.vcxproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@
185185
<SDLCheck>true</SDLCheck>
186186
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
187187
<ConformanceMode>true</ConformanceMode>
188-
<LanguageStandard>stdcpp17</LanguageStandard>
188+
<LanguageStandard>stdcpp20</LanguageStandard>
189189
<MultiProcessorCompilation>true</MultiProcessorCompilation>
190190
</ClCompile>
191191
<Link>

Diff for: enums/pixel_format.hpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22

33
#include "../utilities.hpp"
44

5-
namespace wrapper::directx12 {
5+
namespace wrapper::directx12
6+
{
67

7-
struct pixel_format {
8+
struct pixel_format
9+
{
810
public:
911
pixel_format() = default;
1012

Diff for: extensions/dxc.hpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111

1212
#pragma comment(lib, "dxcompiler.lib")
1313

14-
namespace wrapper::directx12::extensions {
14+
namespace wrapper::directx12::extensions
15+
{
1516

1617
inline shader_code compile_from_source_using_dxc(const std::string& source, const std::wstring& filename,
1718
const std::wstring& entry, const std::wstring& version, const std::vector<std::pair<std::wstring, std::wstring>>& macros = {})

Diff for: extensions/imgui.hpp

+6-5
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111

1212
#include <imgui.h>
1313

14-
namespace wrapper::directx12::extensions {
14+
namespace wrapper::directx12::extensions
15+
{
1516

16-
class imgui_frame_resources {
17+
class imgui_frame_resources
18+
{
1719
public:
1820
explicit imgui_frame_resources(const device& device);
1921

20-
~imgui_frame_resources() = default;
21-
2222
void update(ImDrawData* draw_data);
2323

2424
buffer vtx_buffer() const;
@@ -37,7 +37,8 @@ namespace wrapper::directx12::extensions {
3737
size_t mCurrentIdxBufferCount = 0;
3838
};
3939

40-
class imgui_context final {
40+
class imgui_context final
41+
{
4142
public:
4243
imgui_context() = delete;
4344

Diff for: extensions/pipeline.hpp

+6-9
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@
1212

1313
#include <fstream>
1414

15-
namespace wrapper::directx12::extensions {
15+
namespace wrapper::directx12::extensions
16+
{
1617

17-
struct render_pipeline final {
18+
struct render_pipeline final
19+
{
1820
root_signature_info root_signature_info;
1921
root_signature root_signature;
2022

@@ -32,16 +34,11 @@ namespace wrapper::directx12::extensions {
3234
std::vector<DXGI_FORMAT> rtv_format = {};
3335

3436
DXGI_FORMAT dsv_format = DXGI_FORMAT_UNKNOWN;
35-
36-
render_pipeline() = default;
3737
};
3838

39-
class render_pipelines final {
39+
class render_pipelines final
40+
{
4041
public:
41-
render_pipelines() = default;
42-
43-
~render_pipelines() = default;
44-
4542
bool empty() const noexcept;
4643

4744
const render_pipeline& at(const std::string& name) const;

Diff for: fence.hpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
#include "devices/device.hpp"
44

5-
namespace wrapper::directx12 {
5+
namespace wrapper::directx12
6+
{
67

7-
class fence final : public wrapper_t<ID3D12Fence> {
8+
class fence final : public wrapper_t<ID3D12Fence>
9+
{
810
public:
911
fence() = default;
1012

1113
explicit fence(const ComPtr<ID3D12Fence>& source);
12-
13-
~fence() = default;
1414

1515
static fence create(const device& device, size_t value);
1616
};

Diff for: interfaces/wrapper.hpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22

33
#include "../utilities.hpp"
44

5-
namespace wrapper::directx12 {
5+
namespace wrapper::directx12
6+
{
67

78
template <typename T>
8-
class wrapper_t {
9+
class wrapper_t
10+
{
911
public:
1012
wrapper_t() = default;
1113

0 commit comments

Comments
 (0)