Fix resolutions reported by dxgi-info.exe on high DPI systems

This commit is contained in:
Cameron Gutman 2023-05-23 22:57:23 -05:00
commit f5e3353f82

View file

@ -1,7 +1,8 @@
/**
* @file tools/dxgi.cpp
* @brief todo
* @brief Displays information about connected displays and GPUs
*/
#define WINVER 0x0A00
#include <d3dcommon.h>
#include <dxgi.h>
@ -27,6 +28,9 @@ int
main(int argc, char *argv[]) {
HRESULT status;
// Set ourselves as per-monitor DPI aware for accurate resolution values on High DPI systems
SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
dxgi::factory1_t::pointer factory_p {};
status = CreateDXGIFactory1(IID_IDXGIFactory1, (void **) &factory_p);
dxgi::factory1_t factory { factory_p };