From 5ae028f1e950ef18b5af5d1776f82e285bf76f52 Mon Sep 17 00:00:00 2001 From: Nick Fisher Date: Sun, 3 Nov 2024 20:42:18 +0800 Subject: [PATCH] print default gpu in cli_windows thermion_window --- .../cli_windows/native/thermion_window.cpp | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/examples/dart/cli_windows/native/thermion_window.cpp b/examples/dart/cli_windows/native/thermion_window.cpp index 64b236c4..1410cfcb 100644 --- a/examples/dart/cli_windows/native/thermion_window.cpp +++ b/examples/dart/cli_windows/native/thermion_window.cpp @@ -4,7 +4,9 @@ #pragma comment(lib, "opengl32.lib") #pragma comment(lib, "Gdi32.lib") #pragma comment(lib, "User32.lib") +#pragma comment(lib, "dxgi.lib") +#include #include #include #include @@ -20,6 +22,22 @@ namespace thermion { +void PrintDefaultGPU() { + IDXGIFactory* factory = nullptr; + CreateDXGIFactory(__uuidof(IDXGIFactory), (void**)&factory); + + IDXGIAdapter* adapter = nullptr; + factory->EnumAdapters(0, &adapter); // 0 is the default adapter + + DXGI_ADAPTER_DESC desc; + adapter->GetDesc(&desc); + + std::wcout << L"GPU: " << desc.Description << std::endl; + + adapter->Release(); + factory->Release(); +} + /// /// Instantiating a ThermionWindow creates a HWND that can be passed /// to Filament to create a swapchain. @@ -320,6 +338,9 @@ ThermionWindow::ThermionWindow(int width, int height, int left, int top) : _width(width), _height(height), _left(left), _top(top) { + + PrintDefaultGPU(); + auto window_class = WNDCLASSEX{}; ::SecureZeroMemory(&window_class, sizeof(window_class)); window_class.cbSize = sizeof(window_class);