print default gpu in cli_windows thermion_window

This commit is contained in:
Nick Fisher
2024-11-03 20:42:18 +08:00
parent 859a514bc5
commit 5ae028f1e9

View File

@@ -4,7 +4,9 @@
#pragma comment(lib, "opengl32.lib") #pragma comment(lib, "opengl32.lib")
#pragma comment(lib, "Gdi32.lib") #pragma comment(lib, "Gdi32.lib")
#pragma comment(lib, "User32.lib") #pragma comment(lib, "User32.lib")
#pragma comment(lib, "dxgi.lib")
#include <dxgi.h>
#include <cstdint> #include <cstdint>
#include <chrono> #include <chrono>
#include <thread> #include <thread>
@@ -20,6 +22,22 @@
namespace thermion { 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 /// Instantiating a ThermionWindow creates a HWND that can be passed
/// to Filament to create a swapchain. /// to Filament to create a swapchain.
@@ -320,6 +338,9 @@ ThermionWindow::ThermionWindow(int width,
int height, int height,
int left, int left,
int top) : _width(width), _height(height), _left(left), _top(top) { int top) : _width(width), _height(height), _left(left), _top(top) {
PrintDefaultGPU();
auto window_class = WNDCLASSEX{}; auto window_class = WNDCLASSEX{};
::SecureZeroMemory(&window_class, sizeof(window_class)); ::SecureZeroMemory(&window_class, sizeof(window_class));
window_class.cbSize = sizeof(window_class); window_class.cbSize = sizeof(window_class);