Skip to content

Commit 98cf31d

Browse files
committed
Review fomattings
1 parent 467aa0d commit 98cf31d

18 files changed

Lines changed: 190 additions & 219 deletions

File tree

libraries/core/tests/serialisation/binary_reader.tests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ namespace morpheus::serialisation
3131

3232
TEST_CASE("Binary reader handles error cases gracefully", "[morpheus.serialisation.binary_reader.error_handling]")
3333
{
34-
auto constexpr bytes = testing::makeBytes(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
35-
auto constexpr string = std::string_view{"String longer than 4-bytes"};
34+
constexpr auto bytes = testing::makeBytes(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
35+
constexpr auto string = std::string_view{"String longer than 4-bytes"};
3636

3737
#if (__cpp_lib_spanstream >= 202106L)
3838
SECTION("Serialise via spanstream to test failure condition when the the underling stream runs out of memory while writing but does not throw an exception")

libraries/core/tests/serialisation/binary_roundtrip.tests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ TEST_CASE("Binary serialisation can roundtrip standard library types to binary a
4848
REQUIRE(roundtrip(std::pair<int, bool>{50, true}) == std::pair<int, bool>{50, true});
4949
REQUIRE(roundtrip(std::string("Hello")) == std::string("Hello"));
5050
REQUIRE(*roundtrip(std::make_unique<int>(123)) == 123);
51-
//REQUIRE(roundtrip(std::vector<int>{1, 2, 3, 4, 5}) == std::vector<int>{1, 2, 3, 4, 5});
51+
// REQUIRE(roundtrip(std::vector<int>{1, 2, 3, 4, 5}) == std::vector<int>{1, 2, 3, 4, 5});
5252

5353
/* REQUIRE(test::serialise(std::variant<int, bool, std::string>{true}) == R"({"type":"bool","value":true})");
54-
*/
54+
*/
5555
}
5656

5757
} // namespace morpheus::serialisation

libraries/core/tests/serialisation/binary_writer.tests.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ namespace morpheus::serialisation
2828

2929
TEST_CASE("Binary writer handles error cases gracefully", "[morpheus.serialisation.binary_writer.error_handling]")
3030
{
31-
auto constexpr bytes = testing::makeBytes(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
32-
auto constexpr string = std::string_view{"String longer than 4-bytes"};
31+
constexpr auto bytes = testing::makeBytes(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
32+
constexpr auto string = std::string_view{"String longer than 4-bytes"};
3333

3434
#if (__cpp_lib_spanstream >= 202106L)
3535
SECTION("Serialise via spanstream to test failure condition when the the underling stream runs out of memory while writing but does not throw an exception")
@@ -74,12 +74,12 @@ TEST_CASE("Binary writer can write std types to underlying text representation",
7474
REQUIRE(test::serialisationRoundtrip(std::chrono::years{100}) == std::chrono::years{100});
7575
REQUIRE(test::serialisationRoundtrip(std::chrono::months{12}) == std::chrono::months{12});*/
7676
}
77-
/* REQUIRE(test::serialisationRoundtrip(std::monostate{}) == std::monostate{});
78-
REQUIRE(test::serialisationRoundtrip(std::optional<int>{100}) == std::optional<int>{100});
79-
REQUIRE(test::serialisationRoundtrip(std::optional<int>{}) == std::optional<int>{});
80-
REQUIRE(test::serialisationRoundtrip(std::pair<int, bool>{50, true}) == std::pair<int, bool>{50, true});
81-
REQUIRE(*test::serialisationRoundtrip(std::make_unique<int>(123)) == 123);
82-
*/
77+
/* REQUIRE(test::serialisationRoundtrip(std::monostate{}) == std::monostate{});
78+
REQUIRE(test::serialisationRoundtrip(std::optional<int>{100}) == std::optional<int>{100});
79+
REQUIRE(test::serialisationRoundtrip(std::optional<int>{}) == std::optional<int>{});
80+
REQUIRE(test::serialisationRoundtrip(std::pair<int, bool>{50, true}) == std::pair<int, bool>{50, true});
81+
REQUIRE(*test::serialisationRoundtrip(std::make_unique<int>(123)) == 123);
82+
*/
8383
/* REQUIRE(test::serialise(std::variant<int, bool, std::string>{true}) == R"({"type":"bool","value":true})");
8484
REQUIRE(test::serialise(std::vector<int>{1, 2, 3, 4, 5}) == R"([1,2,3,4,5])");
8585
*/

libraries/gfx/d3d12/src/morpheus/gfx/d3d12/adapter.cpp

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -27,50 +27,43 @@ auto createDXGIFactory()
2727
return dxgiFactory;
2828
}
2929

30-
auto getAdapterDescription(const DXGIAdapter& adapter)
30+
auto getAdapterDescription(DXGIAdapter const& adapter)
3131
{
3232
DXGI_ADAPTER_DESC1 desc{};
3333
MORPHEUS_D3D12_VERIFY(adapter->GetDesc1(&desc));
3434
return desc;
3535
}
3636

37-
auto getOutputModes(const DXGIOutput& output)
37+
auto getOutputModes(DXGIOutput const& output)
3838
{
39-
UINT numModes = 0;
39+
UINT numModes = 0;
4040
MORPHEUS_D3D12_VERIFY(output->GetDisplayModeList(DXGI_FORMAT_R8G8B8A8_UNORM, 0, &numModes, nullptr));
4141

4242
std::vector<DXGI_MODE_DESC> displayModes(numModes);
4343
MORPHEUS_D3D12_VERIFY(output->GetDisplayModeList(DXGI_FORMAT_R8G8B8A8_UNORM, 0, &numModes, displayModes.data()));
4444
return displayModes;
4545
}
4646

47-
auto getOutputModes(const DXGIAdapter& adapter)
47+
auto getOutputModes(DXGIAdapter const& adapter)
4848
{
4949
DXGIOutput output;
5050
std::vector<DXGI_MODE_DESC> displayModes;
5151

5252
for (UINT outputCount = 0; DXGI_ERROR_NOT_FOUND != adapter->EnumOutputs(outputCount, &output); ++outputCount)
5353
{
5454
auto outputDisplayModes = getOutputModes(output);
55-
displayModes.insert(
56-
displayModes.end(),
57-
std::make_move_iterator(outputDisplayModes.begin()),
58-
std::make_move_iterator(outputDisplayModes.end())
59-
);
55+
displayModes.insert(displayModes.end(), std::make_move_iterator(outputDisplayModes.begin()), std::make_move_iterator(outputDisplayModes.end()));
6056
}
6157

6258
return displayModes;
6359
}
6460

65-
}
61+
} // namespace
6662

67-
Adapter::Adapter(
68-
DXGIAdapter dxgiAdapter
69-
)
70-
: mDxgiAdapter(std::move(dxgiAdapter))
71-
, mDescription(getAdapterDescription(mDxgiAdapter))
72-
{
73-
}
63+
Adapter::Adapter(DXGIAdapter dxgiAdapter)
64+
: mDxgiAdapter(std::move(dxgiAdapter))
65+
, mDescription(getAdapterDescription(mDxgiAdapter))
66+
{}
7467

7568
[[nodiscard]] Vendor Adapter::vendor() const noexcept
7669
{
@@ -86,9 +79,9 @@ concurrency::Generator<Adapter> enumerateAdapters()
8679
for (UINT adapterId = 0; DXGI_ERROR_NOT_FOUND != dxgiFactory->EnumAdapters1(adapterId, &pDXGIAdapter); ++adapterId)
8780
{
8881
// Ignore software adapters
89-
// if (graphics_adapter.dxgi_description.Flags & DXGI_ADAPTER_FLAG_SOFTWARE) {
90-
// continue;
91-
// }
82+
// if (graphics_adapter.dxgi_description.Flags & DXGI_ADAPTER_FLAG_SOFTWARE) {
83+
// continue;
84+
// }
9285

9386
co_yield Adapter(pDXGIAdapter);
9487
}

libraries/gfx/d3d12/tests/adapter.tests.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
1-
#include <morpheus/gfx/d3d12/adapter.hpp>
21
#include <catch2/catch_all.hpp>
2+
#include <morpheus/gfx/d3d12/adapter.hpp>
33

44
namespace morpheus::gfx::d3d12::test
55
{
6-
//using namespace morpheus::gfx;
6+
// using namespace morpheus::gfx;
77

8-
TEST_CASE("Create an adapter mode list", "[morpheus.gfx.d3d12.adapter_list]")
9-
{
10-
}
8+
TEST_CASE("Create an adapter mode list", "[morpheus.gfx.d3d12.adapter_list]") {}
119

1210
TEST_CASE("Iterates over the adapters in the list", "[morpheus.gfx.d3d12.adapter_list]")
1311
{
1412
GIVEN("An adapter list")
1513
{
16-
//adapter_list adapters;
14+
// adapter_list adapters;
1715
THEN("Loop over all adapters using native for loop syntax")
1816
{
19-
// for (const auto& adapter : adapters)
20-
{
21-
22-
}
17+
// for (const auto& adapter : adapters)
18+
{}
2319
}
2420
}
2521
}

libraries/gfx/d3d12/tests/video_mode_list.tests.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
namespace morpheus::gfx::d3d12
55
{
66

7-
TEST_CASE("Create a video mode list", "[morpheus.gfx.d3d12.video_mode_list]")
8-
{
9-
}
7+
TEST_CASE("Create a video mode list", "[morpheus.gfx.d3d12.video_mode_list]") {}
108

119
} // namespace morpheus::gfx::d3d12
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
#include <catch2/catch_test_macros.hpp>
22

3-
TEST_CASE("Test the GL render system", "[morpheus.core.gfx.gl4.render_system]")
4-
{
5-
}
3+
TEST_CASE("Test the GL render system", "[morpheus.core.gfx.gl4.render_system]") {}

libraries/gfx/gl4/tests/wgl/adapter.tests.cpp

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,29 @@
11
#include <morpheus/gfx/gl4/wgl/adapter.hpp>
22
#include <morpheus/gfx/platform/concepts/adapter.hpp>
3-
#include <catch2/catch_all.hpp>
4-
5-
63

4+
#include <catch2/catch_all.hpp>
75

86
#include <morpheus/core/conformance/expected.hpp>
97
#include <vector>
108

11-
#include <windows.h>
129
#include <cfgmgr32.h>
10+
#include <windows.h>
1311
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM)
14-
//#error "Missing define"
12+
// #error "Missing define"
1513
#endif
1614

1715
#include <devpkey.h>
1816
#include <setupapi.h>
1917

20-
#include <initguid.h>
2118
#include <devpkey.h>
19+
#include <initguid.h>
2220

2321
#include <Cfgmgr32.h>
2422
#include <Wiaintfc.h>
2523

2624
#include <devguid.h>
27-
#include <winioctl.h>
2825
#include <rpc.h>
29-
26+
#include <winioctl.h>
3027

3128
/*
3229
#include <CL/cl.h>
@@ -35,7 +32,7 @@
3532
#include <string.h>
3633
*/
3734
#ifdef _WIN32
38-
#include <windows.h>
35+
#include <windows.h>
3936
extern "C" __declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
4037
extern "C" __declspec(dllexport) DWORD AmdPowerXpressRequestHighPerformance = 0x00000001;
4138
#endif
@@ -72,25 +69,25 @@ exp_ns::expected<DisplayConfig, HRESULT> getCurrentDisplayConfig()
7269
if (rc != ERROR_INSUFFICIENT_BUFFER)
7370
return exp_ns::unexpected(rc);
7471
}
75-
return DisplayConfig{ std::move(pathInfo), std::move(modeInfo) };
72+
return DisplayConfig{std::move(pathInfo), std::move(modeInfo)};
7673
}
7774

7875
TEST_CASE("Create an adapter mode list", "[morpheus.core.gfx.gl.wgl.adapter_list]")
7976
{
80-
// DISPLAYCONFIG_ADAPTER_NAME adapter{ {DISPLAYCONFIG_DEVICE_INFO_GET_ADAPTER_NAME , sizeof(DISPLAYCONFIG_ADAPTER_NAME)} };
81-
// MORPHEUS_VERIFY(DisplayConfigGetDeviceInfo(adapter.header) == ERROR_SUCCESS);
77+
// DISPLAYCONFIG_ADAPTER_NAME adapter{ {DISPLAYCONFIG_DEVICE_INFO_GET_ADAPTER_NAME , sizeof(DISPLAYCONFIG_ADAPTER_NAME)} };
78+
// MORPHEUS_VERIFY(DisplayConfigGetDeviceInfo(adapter.header) == ERROR_SUCCESS);
8279

8380
LUID targetAdapter; // the LUID of the target we want to find the source for
84-
ULONG targetId = 0; // the id of the target we want to find the source for
81+
ULONG targetId = 0; // the id of the target we want to find the source for
8582

8683
DISPLAYCONFIG_ADAPTER_NAME adapterName = {};
87-
adapterName.header.adapterId = LUID{68511,0}, //path.targetInfo.adapterId;
84+
adapterName.header.adapterId = LUID{68511, 0}; // path.targetInfo.adapterId;
8885
adapterName.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_ADAPTER_NAME;
8986
adapterName.header.size = sizeof(adapterName);
9087
auto result2 = DisplayConfigGetDeviceInfo(&adapterName.header);
9188

9289
DISPLAYCONFIG_ADAPTER_NAME adapterName2 = {};
93-
adapterName2.header.adapterId = LUID{69333,0}, //path.targetInfo.adapterId;
90+
adapterName2.header.adapterId = LUID{69333, 0}; // path.targetInfo.adapterId;
9491
adapterName2.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_ADAPTER_NAME;
9592
adapterName2.header.size = sizeof(adapterName2);
9693
auto result3 = DisplayConfigGetDeviceInfo(&adapterName2.header);
@@ -99,12 +96,11 @@ TEST_CASE("Create an adapter mode list", "[morpheus.core.gfx.gl.wgl.adapter_list
9996
ULONG PropertySize = 0;
10097
ULONG SomeValue = 0;
10198

102-
103-
SP_DEVICE_INTERFACE_DATA interfaceData = { 0 };
99+
SP_DEVICE_INTERFACE_DATA interfaceData = {0};
104100
interfaceData.cbSize = sizeof(SP_DEVICE_INTERFACE_DATA);
105101

106-
// HDEVINFO deviceInfoSet = SetupDiCreateDeviceInfoList(NULL, NULL);
107-
// SetupDiOpenDeviceInterface(deviceInfoSet, adapterName.adapterDevicePath, 0, &interfaceData);
102+
// HDEVINFO deviceInfoSet = SetupDiCreateDeviceInfoList(NULL, NULL);
103+
// SetupDiOpenDeviceInterface(deviceInfoSet, adapterName.adapterDevicePath, 0, &interfaceData);
108104
/*
109105
PropertySize = sizeof(SomeValue);
110106
auto cr = CM_Get_DevNode_PropertyW(DevInst,
@@ -121,12 +117,12 @@ TEST_CASE("Create an adapter mode list", "[morpheus.core.gfx.gl.wgl.adapter_list
121117

122118
auto& [pathInfo, modeInfo] = result.value();
123119

124-
for (UINT32 tryEnable = 0;; ++tryEnable) {
120+
for (UINT32 tryEnable = 0;; ++tryEnable)
121+
{
125122
DISPLAYCONFIG_PATH_INFO* pCurrentPath = NULL;
126123
for (UINT32 i = 0, j = 0; i < pathInfo.size(); ++i)
127124
{
128-
if (pathInfo[i].targetInfo.targetAvailable &&
129-
!memcmp(&pathInfo[i].targetInfo.adapterId, &targetAdapter, sizeof(LUID)) &&
125+
if (pathInfo[i].targetInfo.targetAvailable && !memcmp(&pathInfo[i].targetInfo.adapterId, &targetAdapter, sizeof(LUID)) &&
130126
pathInfo[i].targetInfo.id == targetId)
131127
{
132128
pathInfo[i].targetInfo.statusFlags |= DISPLAYCONFIG_TARGET_IN_USE;
@@ -153,7 +149,7 @@ TEST_CASE("Create an adapter mode list", "[morpheus.core.gfx.gl.wgl.adapter_list
153149
return; // failure. tried everything, apparently no source is connected to our target
154150

155151
LONG rc = SetDisplayConfig(pathInfo.size(), pathInfo.data(), modeInfo.size(), modeInfo.data(),
156-
SDC_VALIDATE | SDC_USE_SUPPLIED_DISPLAY_CONFIG | SDC_ALLOW_CHANGES);
152+
SDC_VALIDATE | SDC_USE_SUPPLIED_DISPLAY_CONFIG | SDC_ALLOW_CHANGES);
157153

158154
if (rc != ERROR_SUCCESS)
159155
{
@@ -167,24 +163,24 @@ TEST_CASE("Create an adapter mode list", "[morpheus.core.gfx.gl.wgl.adapter_list
167163
break; // success!
168164
}
169165
}
170-
//Note: pSource is pointing to the source relevant to the relevant source now!
171-
//You just need to copy off whatever you need.
166+
// Note: pSource is pointing to the source relevant to the relevant source now!
167+
// You just need to copy off whatever you need.
172168
}
173169

174170
TEST_CASE("Concept checks for WGL adapters", "[morpheus.gfx.gl.wgl.adapter.concepts]")
175171
{
176-
// STATIC_REQUIRE(concepts::VideoMode<VideoMode>);
177-
//STATIC_REQUIRE(requires(Adapter t) { { t.getName() } -> std::convertible_to<std::string_view>; });
178-
//STATIC_REQUIRE(requires(Adapter t) { { t.getVideoModes() } -> morpheus::gfx::concepts::VideoModeRange; });
172+
// STATIC_REQUIRE(concepts::VideoMode<VideoMode>);
173+
// STATIC_REQUIRE(requires(Adapter t) { { t.getName() } -> std::convertible_to<std::string_view>; });
174+
// STATIC_REQUIRE(requires(Adapter t) { { t.getVideoModes() } -> morpheus::gfx::concepts::VideoModeRange; });
179175

180-
// STATIC_REQUIRE(gfx::concepts::Adapter<Adapter>);
176+
// STATIC_REQUIRE(gfx::concepts::Adapter<Adapter>);
181177
}
182178

183179
TEST_CASE("Iterates over the adapters in the list", "[morpheus.core.gfx.gl.wgl.adapter_list]")
184180
{
185181
GIVEN("An adapter list")
186182
{
187-
//adapter_list adapters;
183+
// adapter_list adapters;
188184
THEN("Loop over all adapters using native for loop syntax")
189185
{
190186
for (auto& adapter : enumerateAdapters())
@@ -193,7 +189,6 @@ TEST_CASE("Iterates over the adapters in the list", "[morpheus.core.gfx.gl.wgl.a
193189
}
194190
}
195191
}
196-
197192
}
198193

199194
/*

libraries/gfx/gl4/tests/wgl/video_mode.tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace morpheus::test
77

88
TEST_CASE("Create a video mode list", "[morpheus.core.gfx.video_mode_list]")
99
{
10-
// INFO("The number is " << i);
10+
// INFO("The number is " << i);
1111
}
1212

1313
} // namespace morpheus::test

0 commit comments

Comments
 (0)