2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

Merge pull request #6502 from ameerj/vendor-title

main: Add GPU Vendor name to running title bar
This commit is contained in:
Morph 2021-06-28 14:51:49 -04:00 committed by GitHub
commit ec68cba440
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 100 additions and 10 deletions

View file

@ -42,6 +42,8 @@ public:
[[nodiscard]] virtual RasterizerInterface* ReadRasterizer() = 0; [[nodiscard]] virtual RasterizerInterface* ReadRasterizer() = 0;
[[nodiscard]] virtual std::string GetDeviceVendor() const = 0;
// Getter/setter functions: // Getter/setter functions:
// ------------------------ // ------------------------

View file

@ -202,13 +202,13 @@ Device::Device() {
LOG_ERROR(Render_OpenGL, "OpenGL 4.6 is not available"); LOG_ERROR(Render_OpenGL, "OpenGL 4.6 is not available");
throw std::runtime_error{"Insufficient version"}; throw std::runtime_error{"Insufficient version"};
} }
const std::string_view vendor = reinterpret_cast<const char*>(glGetString(GL_VENDOR)); vendor_name = reinterpret_cast<const char*>(glGetString(GL_VENDOR));
const std::string_view version = reinterpret_cast<const char*>(glGetString(GL_VERSION)); const std::string_view version = reinterpret_cast<const char*>(glGetString(GL_VERSION));
const std::vector extensions = GetExtensions(); const std::vector extensions = GetExtensions();
const bool is_nvidia = vendor == "NVIDIA Corporation"; const bool is_nvidia = vendor_name == "NVIDIA Corporation";
const bool is_amd = vendor == "ATI Technologies Inc."; const bool is_amd = vendor_name == "ATI Technologies Inc.";
const bool is_intel = vendor == "Intel"; const bool is_intel = vendor_name == "Intel";
#ifdef __unix__ #ifdef __unix__
const bool is_linux = true; const bool is_linux = true;
@ -275,6 +275,56 @@ Device::Device() {
} }
} }
std::string Device::GetVendorName() const {
if (vendor_name == "NVIDIA Corporation") {
return "NVIDIA";
}
if (vendor_name == "ATI Technologies Inc.") {
return "AMD";
}
if (vendor_name == "Intel") {
// For Mesa, `Intel` is an overloaded vendor string that could mean crocus or iris.
// Simply return `INTEL` for those as well as the Windows driver.
return "INTEL";
}
if (vendor_name == "Intel Open Source Technology Center") {
return "I965";
}
if (vendor_name == "Mesa Project") {
return "I915";
}
if (vendor_name == "Mesa/X.org") {
// This vendor string is overloaded between llvmpipe, softpipe, and virgl, so just return
// MESA instead of one of those driver names.
return "MESA";
}
if (vendor_name == "AMD") {
return "RADEONSI";
}
if (vendor_name == "nouveau") {
return "NOUVEAU";
}
if (vendor_name == "X.Org") {
return "R600";
}
if (vendor_name == "Collabora Ltd") {
return "ZINK";
}
if (vendor_name == "Intel Corporation") {
return "OPENSWR";
}
if (vendor_name == "Microsoft Corporation") {
return "D3D12";
}
if (vendor_name == "NVIDIA") {
// Mesa's tegra driver reports `NVIDIA`. Only present in this list because the default
// strategy would have returned `NVIDIA` here for this driver, the same result as the
// proprietary driver.
return "TEGRA";
}
return vendor_name;
}
Device::Device(std::nullptr_t) { Device::Device(std::nullptr_t) {
max_uniform_buffers.fill(std::numeric_limits<u32>::max()); max_uniform_buffers.fill(std::numeric_limits<u32>::max());
uniform_buffer_alignment = 4; uniform_buffer_alignment = 4;

View file

@ -22,6 +22,8 @@ public:
explicit Device(); explicit Device();
explicit Device(std::nullptr_t); explicit Device(std::nullptr_t);
[[nodiscard]] std::string GetVendorName() const;
u32 GetMaxUniformBuffers(Tegra::Engines::ShaderType shader_type) const noexcept { u32 GetMaxUniformBuffers(Tegra::Engines::ShaderType shader_type) const noexcept {
return max_uniform_buffers[static_cast<std::size_t>(shader_type)]; return max_uniform_buffers[static_cast<std::size_t>(shader_type)];
} }
@ -130,6 +132,7 @@ private:
static bool TestVariableAoffi(); static bool TestVariableAoffi();
static bool TestPreciseBug(); static bool TestPreciseBug();
std::string vendor_name;
std::array<u32, Tegra::Engines::MaxShaderTypes> max_uniform_buffers{}; std::array<u32, Tegra::Engines::MaxShaderTypes> max_uniform_buffers{};
std::array<BaseBindings, Tegra::Engines::MaxShaderTypes> base_bindings{}; std::array<BaseBindings, Tegra::Engines::MaxShaderTypes> base_bindings{};
size_t uniform_buffer_alignment{}; size_t uniform_buffer_alignment{};

View file

@ -70,6 +70,10 @@ public:
return &rasterizer; return &rasterizer;
} }
[[nodiscard]] std::string GetDeviceVendor() const override {
return device.GetVendorName();
}
private: private:
/// Initializes the OpenGL state and creates persistent objects. /// Initializes the OpenGL state and creates persistent objects.
void InitOpenGLObjects(); void InitOpenGLObjects();

View file

@ -47,6 +47,10 @@ public:
return &rasterizer; return &rasterizer;
} }
[[nodiscard]] std::string GetDeviceVendor() const override {
return device.GetDriverName();
}
private: private:
void Report() const; void Report() const;

View file

@ -532,6 +532,27 @@ bool Device::IsFormatSupported(VkFormat wanted_format, VkFormatFeatureFlags want
return (supported_usage & wanted_usage) == wanted_usage; return (supported_usage & wanted_usage) == wanted_usage;
} }
std::string Device::GetDriverName() const {
switch (driver_id) {
case VK_DRIVER_ID_AMD_PROPRIETARY:
return "AMD";
case VK_DRIVER_ID_AMD_OPEN_SOURCE:
return "AMDVLK";
case VK_DRIVER_ID_MESA_RADV:
return "RADV";
case VK_DRIVER_ID_NVIDIA_PROPRIETARY:
return "NVIDIA";
case VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS:
return "INTEL";
case VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA:
return "ANV";
case VK_DRIVER_ID_MESA_LLVMPIPE:
return "LAVAPIPE";
default:
return vendor_name;
}
}
void Device::CheckSuitability(bool requires_swapchain) const { void Device::CheckSuitability(bool requires_swapchain) const {
std::bitset<REQUIRED_EXTENSIONS.size()> available_extensions; std::bitset<REQUIRED_EXTENSIONS.size()> available_extensions;
bool has_swapchain = false; bool has_swapchain = false;

View file

@ -45,6 +45,9 @@ public:
/// Reports a shader to Nsight Aftermath. /// Reports a shader to Nsight Aftermath.
void SaveShader(const std::vector<u32>& spirv) const; void SaveShader(const std::vector<u32>& spirv) const;
/// Returns the name of the VkDriverId reported from Vulkan.
std::string GetDriverName() const;
/// Returns the dispatch loader with direct function pointers of the device. /// Returns the dispatch loader with direct function pointers of the device.
const vk::DeviceDispatch& GetDispatchLoader() const { const vk::DeviceDispatch& GetDispatchLoader() const {
return dld; return dld;

View file

@ -104,6 +104,7 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual
#include "input_common/main.h" #include "input_common/main.h"
#include "util/overlay_dialog.h" #include "util/overlay_dialog.h"
#include "video_core/gpu.h" #include "video_core/gpu.h"
#include "video_core/renderer_base.h"
#include "video_core/shader_notify.h" #include "video_core/shader_notify.h"
#include "yuzu/about_dialog.h" #include "yuzu/about_dialog.h"
#include "yuzu/bootmanager.h" #include "yuzu/bootmanager.h"
@ -1426,7 +1427,8 @@ void GMainWindow::BootGame(const QString& filename, std::size_t program_index, S
const auto instruction_set_suffix = is_64bit ? " (64-bit)" : " (32-bit)"; const auto instruction_set_suffix = is_64bit ? " (64-bit)" : " (32-bit)";
title_name += instruction_set_suffix; title_name += instruction_set_suffix;
LOG_INFO(Frontend, "Booting game: {:016X} | {} | {}", title_id, title_name, title_version); LOG_INFO(Frontend, "Booting game: {:016X} | {} | {}", title_id, title_name, title_version);
UpdateWindowTitle(title_name, title_version); const auto gpu_vendor = system.GPU().Renderer().GetDeviceVendor();
UpdateWindowTitle(title_name, title_version, gpu_vendor);
loading_screen->Prepare(system.GetAppLoader()); loading_screen->Prepare(system.GetAppLoader());
loading_screen->show(); loading_screen->show();
@ -2855,8 +2857,8 @@ void GMainWindow::MigrateConfigFiles() {
} }
} }
void GMainWindow::UpdateWindowTitle(const std::string& title_name, void GMainWindow::UpdateWindowTitle(std::string_view title_name, std::string_view title_version,
const std::string& title_version) { std::string_view gpu_vendor) {
const auto branch_name = std::string(Common::g_scm_branch); const auto branch_name = std::string(Common::g_scm_branch);
const auto description = std::string(Common::g_scm_desc); const auto description = std::string(Common::g_scm_desc);
const auto build_id = std::string(Common::g_build_id); const auto build_id = std::string(Common::g_build_id);
@ -2869,7 +2871,8 @@ void GMainWindow::UpdateWindowTitle(const std::string& title_name,
if (title_name.empty()) { if (title_name.empty()) {
setWindowTitle(QString::fromStdString(window_title)); setWindowTitle(QString::fromStdString(window_title));
} else { } else {
const auto run_title = fmt::format("{} | {} | {}", window_title, title_name, title_version); const auto run_title =
fmt::format("{} | {} | {} | {}", window_title, title_name, title_version, gpu_vendor);
setWindowTitle(QString::fromStdString(run_title)); setWindowTitle(QString::fromStdString(run_title));
} }
} }

View file

@ -287,8 +287,8 @@ private:
InstallResult InstallNSPXCI(const QString& filename); InstallResult InstallNSPXCI(const QString& filename);
InstallResult InstallNCA(const QString& filename); InstallResult InstallNCA(const QString& filename);
void MigrateConfigFiles(); void MigrateConfigFiles();
void UpdateWindowTitle(const std::string& title_name = {}, void UpdateWindowTitle(std::string_view title_name = {}, std::string_view title_version = {},
const std::string& title_version = {}); std::string_view gpu_vendor = {});
void UpdateStatusBar(); void UpdateStatusBar();
void UpdateStatusButtons(); void UpdateStatusButtons();
void UpdateUISettings(); void UpdateUISettings();