Skip to content

Commit 031ccce

Browse files
committed
Switch to C++17
1 parent e81c850 commit 031ccce

69 files changed

Lines changed: 204 additions & 302 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ OPTION(ENABLE_PIX "Enable PIX debug/capture API" OFF)
1515

1616
set(CMAKE_CONFIGURATION_TYPES "Debug;Release;RelWithDebInfo;Asan;Tsan" CACHE STRING "" FORCE)
1717

18-
set(CMAKE_CXX_STANDARD 14)
18+
set(CMAKE_CXX_STANDARD 17)
1919
set(CMAKE_CXX_STANDARD_REQUIRED ON)
2020

2121
if(MSVC)

internal/AtmosphereRef.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ std::pair<Ray::Ref::fvec4, Ray::Ref::fvec4> Ray::Ref::IntegrateScatteringMain(
591591
inout_transmittance * light_transmittance * light_color;
592592
}
593593

594-
return std::make_pair(radiance, multiscat_as_1);
594+
return std::pair{radiance, multiscat_as_1};
595595
}
596596

597597
template std::pair<Ray::Ref::fvec4, Ray::Ref::fvec4> Ray::Ref::IntegrateScatteringMain<false>(

internal/AtmosphereRef.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44

55
#include "CoreRef.h"
66

7-
namespace Ray {
8-
namespace Ref {
7+
namespace Ray::Ref {
98
fvec4 IntegrateOpticalDepth(const atmosphere_params_t &params, const fvec4 &ray_start, const fvec4 &ray_dir);
109

1110
template <bool UniformPhase = false>
@@ -34,5 +33,4 @@ void ShadeSkyPrimary(const pass_settings_t &ps, Span<const hit_data_t> inters, S
3433
void ShadeSkySecondary(const pass_settings_t &ps, float clamp_direct, Span<const hit_data_t> inters,
3534
Span<const ray_data_t> rays, Span<const uint32_t> ray_indices, const scene_data_t &sc,
3635
int iteration, int img_w, color_rgba_t *out_color);
37-
} // namespace Ref
38-
} // namespace Ray
36+
} // namespace Ray::Ref

internal/Convolution.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
#pragma warning(push)
66
#pragma warning(disable : 6294) // Ill-defined for-loop
77

8-
namespace Ray {
9-
namespace NS {
8+
namespace Ray::NS {
109
void ClearBorders(const rect_t &rect, const int w, const int h, const bool downscaled, const int out_channels,
1110
float output[]) {
1211
if (!downscaled) {
@@ -586,7 +585,6 @@ void ConvolutionConcat3x3(const float *restrict data1, const float *restrict dat
586585

587586
#undef index1
588587
}
589-
} // namespace NS
590-
} // namespace Ray
588+
} // namespace Ray::NS
591589

592590
#pragma warning(pop)

internal/Core.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -652,9 +652,8 @@ uint32_t Ray::PreprocessPrims_HLBVH(Span<const prim_t> prims, std::vector<bvh_no
652652
s.min_primitives_in_leaf = 1;
653653

654654
// Build top level hierarchy using SAH
655-
const uint32_t new_nodes_count =
655+
[[maybe_unused]] const uint32_t new_nodes_count =
656656
PreprocessPrims_SAH({&top_prims[0], top_prims.size()}, {}, s, out_nodes, top_indices);
657-
unused(new_nodes_count);
658657

659658
auto bottom_nodes_start = uint32_t(out_nodes.size());
660659

internal/Core.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,6 @@ force_inline unsigned char _BitScanForward64(unsigned long *Index, unsigned __in
5858

5959
#endif
6060

61-
#define unused(x) ((void)x)
62-
#define countof(x) (sizeof(x) / sizeof(x[0]))
63-
6461
#include "simd/aligned_allocator.h"
6562

6663
#define pack_unorm_16(x) uint16_t(x * 65535.0f)

internal/CoreSIMD.h

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4068,11 +4068,10 @@ bool Ray::NS::Traverse_BLAS_WithStack_ClosestHit(const float ro[3], const float
40684068
goto TRAVERSE;
40694069
}
40704070
} else {
4071-
const int tri_start = int(nodes[cur.index].child[0] & PRIM_INDEX_BITS),
4072-
tri_end = int(tri_start + nodes[cur.index].child[1]);
4071+
[[maybe_unused]] const int tri_start = int(nodes[cur.index].child[0] & PRIM_INDEX_BITS),
4072+
tri_end = int(tri_start + nodes[cur.index].child[1]);
40734073
assert((tri_start % 8) == 0);
40744074
assert((tri_end - tri_start) <= 8);
4075-
unused(tri_end);
40764075
res |=
40774076
IntersectTri<S>(ro, rd, mtris[tri_start / 8], tri_start, inter_prim_index, inter_t, inter_u, inter_v);
40784077
}
@@ -4123,9 +4122,8 @@ Ray::NS::ivec<S> Ray::NS::Traverse_BLAS_WithStack_AnyHit(const fvec<S> ro[3], co
41234122
} else {
41244123
const int tri_start = nodes[cur].prim_index & PRIM_INDEX_BITS,
41254124
tri_end = tri_start + nodes[cur].prim_count;
4126-
const bool hit_found =
4125+
[[maybe_unused]] const bool hit_found =
41274126
IntersectTris_AnyHit(ro, rd, st.queue[st.index].mask, tris, tri_start, tri_end, obj_index, inter);
4128-
unused(hit_found);
41294127
/*if (hit_found) {
41304128
const bool is_backfacing = inter.prim_index < 0;
41314129
const uint32_t prim_index = is_backfacing ? -inter.prim_index - 1 : inter.prim_index;
@@ -4226,11 +4224,10 @@ int Ray::NS::Traverse_BLAS_WithStack_AnyHit(const float ro[3], const float rd[3]
42264224
goto TRAVERSE;
42274225
}
42284226
} else {
4229-
const int tri_start = int(nodes[cur.index].child[0] & PRIM_INDEX_BITS),
4230-
tri_end = int(tri_start + nodes[cur.index].child[1]);
4227+
[[maybe_unused]] const int tri_start = int(nodes[cur.index].child[0] & PRIM_INDEX_BITS),
4228+
tri_end = int(tri_start + nodes[cur.index].child[1]);
42314229
assert((tri_start % 8) == 0);
42324230
assert((tri_end - tri_start) <= 8);
4233-
unused(tri_end);
42344231
const bool hit_found =
42354232
IntersectTri<S>(ro, rd, mtris[tri_start / 8], tri_start, inter_prim_index, inter_t, inter_u, inter_v);
42364233
if (hit_found) {

internal/DenoiseRef.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
#include "CoreRef.h"
44

5-
namespace Ray {
6-
namespace Ref {
5+
namespace Ray::Ref {
76
template <int WINDOW_SIZE = 7, int NEIGHBORHOOD_SIZE = 3>
87
void JointNLMFilter(const color_rgba_t input[], const rect_t &rect, int input_stride, float alpha, float damping,
98
const color_rgba_t variance[], const color_rgba_t feature0[], float feature0_weight,
@@ -33,5 +32,4 @@ void ConvolutionConcat3x3(const float data1[], const float data2[], const float
3332
const float weights[], const float biases[], float output[], int output_stride,
3433
aligned_vector<float, 64> &temp_data);
3534
void ClearBorders(const rect_t &rect, int w, int h, bool downscaled, int out_channels, float output[]);
36-
} // namespace Ref
37-
} // namespace Ray
35+
} // namespace Ray::Ref

internal/Dx/AccStructureDX.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
#include "DescriptorPoolDX.h"
44
#include "ResourceDX.h"
55

6-
namespace Ray {
7-
namespace Dx {
6+
namespace Ray::Dx {
87
class Context;
98

109
class AccStructure {
@@ -32,5 +31,4 @@ class AccStructure {
3231

3332
eResState resource_state = eResState::Undefined;
3433
};
35-
} // namespace Dx
36-
} // namespace Ray
34+
} // namespace Ray::Dx

internal/Dx/BufferDX.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
#include "../../Log.h"
1616
#include "ContextDX.h"
1717

18-
namespace Ray {
19-
namespace Dx {
18+
namespace Ray::Dx {
2019
D3D12_HEAP_TYPE GetDxHeapType(const eBufType type) {
2120
if (type == eBufType::Upload) {
2221
return D3D12_HEAP_TYPE_UPLOAD;
@@ -36,8 +35,7 @@ eResState GetInitialDxResourceState(const eBufType type) {
3635
}
3736
return eResState::Undefined;
3837
}
39-
} // namespace Dx
40-
} // namespace Ray
38+
} // namespace Ray::Dx
4139

4240
int Ray::Dx::Buffer::g_GenCounter = 0;
4341

0 commit comments

Comments
 (0)