Browse Source

Log which adapter is used on OpenGL & D3D9 (#2370)

* Log used adapter for OpenGL

* Updated OpenGL code

* Also support querying adapter on D3D9.
Florastamine 7 years ago
parent
commit
86c2afb46a

+ 5 - 0
Source/Urho3D/Graphics/Direct3D9/D3D9Graphics.cpp

@@ -479,6 +479,11 @@ bool Graphics::SetMode(int width, int height, bool fullscreen, bool borderless,
     impl_->device_->Present(nullptr, nullptr, nullptr, nullptr);
 
 #ifdef URHO3D_LOGGING
+    D3DADAPTER_IDENTIFIER9 id = {0};
+    HRESULT hr = impl_->interface_->GetAdapterIdentifier(D3DADAPTER_DEFAULT, 0, &id);
+    if (S_OK == hr)
+      URHO3D_LOGINFOF("Adapter used %s", id.Description);
+
     String msg;
     msg.AppendWithFormat("Set screen mode %dx%d %s monitor %d", width_, height_, (fullscreen_ ? "fullscreen" : "windowed"), monitor_);
     if (borderless_)

+ 2 - 0
Source/Urho3D/Graphics/OpenGL/OGLGraphics.cpp

@@ -500,6 +500,8 @@ bool Graphics::SetMode(int width, int height, bool fullscreen, bool borderless,
     CheckFeatureSupport();
 
 #ifdef URHO3D_LOGGING
+    URHO3D_LOGINFOF("Adapter used %s %s", (const char *) glGetString(GL_VENDOR), (const char *) glGetString(GL_RENDERER));
+    
     String msg;
     msg.AppendWithFormat("Set screen mode %dx%d %s monitor %d", width_, height_, (fullscreen_ ? "fullscreen" : "windowed"), monitor_);
     if (borderless_)