浏览代码

libobs-d3d11: Log VRAM in GiB

(cherry picked from commit 433912f04ac16e90504440900fecd95afb685dae)
derrod 2 年之前
父节点
当前提交
5e06703171
共有 1 个文件被更改,包括 10 次插入4 次删除
  1. 10 4
      libobs-d3d11/d3d11-subsystem.cpp

+ 10 - 4
libobs-d3d11/d3d11-subsystem.cpp

@@ -1453,6 +1453,11 @@ static inline void LogAdapterMonitors(IDXGIAdapter1 *adapter)
 	}
 	}
 }
 }
 
 
+static inline double to_GiB(size_t bytes)
+{
+	return static_cast<double>(bytes) / (1 << 30);
+}
+
 static inline void LogD3DAdapters()
 static inline void LogD3DAdapters()
 {
 {
 	ComPtr<IDXGIFactory1> factory;
 	ComPtr<IDXGIFactory1> factory;
@@ -1480,10 +1485,11 @@ static inline void LogD3DAdapters()
 
 
 		os_wcs_to_utf8(desc.Description, 0, name, sizeof(name));
 		os_wcs_to_utf8(desc.Description, 0, name, sizeof(name));
 		blog(LOG_INFO, "\tAdapter %u: %s", i, name);
 		blog(LOG_INFO, "\tAdapter %u: %s", i, name);
-		blog(LOG_INFO, "\t  Dedicated VRAM: %" PRIu64,
-		     desc.DedicatedVideoMemory);
-		blog(LOG_INFO, "\t  Shared VRAM:    %" PRIu64,
-		     desc.SharedSystemMemory);
+		blog(LOG_INFO, "\t  Dedicated VRAM: %" PRIu64 " (%.01f GiB)",
+		     desc.DedicatedVideoMemory,
+		     to_GiB(desc.DedicatedVideoMemory));
+		blog(LOG_INFO, "\t  Shared VRAM:    %" PRIu64 " (%.01f GiB)",
+		     desc.SharedSystemMemory, to_GiB(desc.SharedSystemMemory));
 		blog(LOG_INFO, "\t  PCI ID:         %x:%.4x", desc.VendorId,
 		blog(LOG_INFO, "\t  PCI ID:         %x:%.4x", desc.VendorId,
 		     desc.DeviceId);
 		     desc.DeviceId);