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>
3532#include <string.h>
3633*/
3734#ifdef _WIN32
38- #include < windows.h>
35+ #include < windows.h>
3936extern " C" __declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001 ;
4037extern " 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
7875TEST_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
174170TEST_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
183179TEST_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/*
0 commit comments