early-access version 1814
This commit is contained in:
@@ -4,10 +4,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <atomic>
|
||||
#include <functional>
|
||||
#include <optional>
|
||||
#include <span>
|
||||
#include <stop_token>
|
||||
#include "common/common_types.h"
|
||||
#include "video_core/engines/fermi_2d.h"
|
||||
#include "video_core/gpu.h"
|
||||
@@ -129,7 +129,7 @@ public:
|
||||
virtual void UpdatePagesCachedCount(VAddr addr, u64 size, int delta) {}
|
||||
|
||||
/// Initialize disk cached resources for the game being emulated
|
||||
virtual void LoadDiskResources(u64 title_id, const std::atomic_bool& stop_loading,
|
||||
virtual void LoadDiskResources(u64 title_id, std::stop_token stop_loading,
|
||||
const DiskResourceLoadCallback& callback) {}
|
||||
|
||||
/// Grant access to the Guest Driver Profile for recording/obtaining info on the guest driver.
|
||||
|
@@ -42,6 +42,8 @@ public:
|
||||
|
||||
[[nodiscard]] virtual RasterizerInterface* ReadRasterizer() = 0;
|
||||
|
||||
[[nodiscard]] virtual std::string GetDeviceVendor() const = 0;
|
||||
|
||||
// Getter/setter functions:
|
||||
// ------------------------
|
||||
|
||||
|
@@ -202,13 +202,13 @@ Device::Device() {
|
||||
LOG_ERROR(Render_OpenGL, "OpenGL 4.6 is not available");
|
||||
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::vector extensions = GetExtensions();
|
||||
|
||||
const bool is_nvidia = vendor == "NVIDIA Corporation";
|
||||
const bool is_amd = vendor == "ATI Technologies Inc.";
|
||||
const bool is_intel = vendor == "Intel";
|
||||
const bool is_nvidia = vendor_name == "NVIDIA Corporation";
|
||||
const bool is_amd = vendor_name == "ATI Technologies Inc.";
|
||||
const bool is_intel = vendor_name == "Intel";
|
||||
|
||||
#ifdef __unix__
|
||||
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) {
|
||||
max_uniform_buffers.fill(std::numeric_limits<u32>::max());
|
||||
uniform_buffer_alignment = 4;
|
||||
|
@@ -22,6 +22,8 @@ public:
|
||||
explicit Device();
|
||||
explicit Device(std::nullptr_t);
|
||||
|
||||
[[nodiscard]] std::string GetVendorName() const;
|
||||
|
||||
u32 GetMaxUniformBuffers(Tegra::Engines::ShaderType shader_type) const noexcept {
|
||||
return max_uniform_buffers[static_cast<std::size_t>(shader_type)];
|
||||
}
|
||||
@@ -130,6 +132,7 @@ private:
|
||||
static bool TestVariableAoffi();
|
||||
static bool TestPreciseBug();
|
||||
|
||||
std::string vendor_name;
|
||||
std::array<u32, Tegra::Engines::MaxShaderTypes> max_uniform_buffers{};
|
||||
std::array<BaseBindings, Tegra::Engines::MaxShaderTypes> base_bindings{};
|
||||
size_t uniform_buffer_alignment{};
|
||||
|
@@ -351,7 +351,7 @@ void RasterizerOpenGL::SetupShaders(bool is_indexed) {
|
||||
}
|
||||
}
|
||||
|
||||
void RasterizerOpenGL::LoadDiskResources(u64 title_id, const std::atomic_bool& stop_loading,
|
||||
void RasterizerOpenGL::LoadDiskResources(u64 title_id, std::stop_token stop_loading,
|
||||
const VideoCore::DiskResourceLoadCallback& callback) {
|
||||
shader_cache.LoadDiskCache(title_id, stop_loading, callback);
|
||||
}
|
||||
|
@@ -96,7 +96,7 @@ public:
|
||||
const Tegra::Engines::Fermi2D::Config& copy_config) override;
|
||||
bool AccelerateDisplay(const Tegra::FramebufferConfig& config, VAddr framebuffer_addr,
|
||||
u32 pixel_stride) override;
|
||||
void LoadDiskResources(u64 title_id, const std::atomic_bool& stop_loading,
|
||||
void LoadDiskResources(u64 title_id, std::stop_token stop_loading,
|
||||
const VideoCore::DiskResourceLoadCallback& callback) override;
|
||||
|
||||
/// Returns true when there are commands queued to the OpenGL server.
|
||||
|
@@ -331,7 +331,7 @@ ShaderCacheOpenGL::ShaderCacheOpenGL(RasterizerOpenGL& rasterizer_,
|
||||
|
||||
ShaderCacheOpenGL::~ShaderCacheOpenGL() = default;
|
||||
|
||||
void ShaderCacheOpenGL::LoadDiskCache(u64 title_id, const std::atomic_bool& stop_loading,
|
||||
void ShaderCacheOpenGL::LoadDiskCache(u64 title_id, std::stop_token stop_loading,
|
||||
const VideoCore::DiskResourceLoadCallback& callback) {
|
||||
disk_cache.BindTitleID(title_id);
|
||||
const std::optional transferable = disk_cache.LoadTransferable();
|
||||
@@ -372,7 +372,7 @@ void ShaderCacheOpenGL::LoadDiskCache(u64 title_id, const std::atomic_bool& stop
|
||||
const auto scope = context->Acquire();
|
||||
|
||||
for (std::size_t i = begin; i < end; ++i) {
|
||||
if (stop_loading) {
|
||||
if (stop_loading.stop_requested()) {
|
||||
return;
|
||||
}
|
||||
const auto& entry = (*transferable)[i];
|
||||
@@ -435,7 +435,7 @@ void ShaderCacheOpenGL::LoadDiskCache(u64 title_id, const std::atomic_bool& stop
|
||||
precompiled_cache_altered = true;
|
||||
return;
|
||||
}
|
||||
if (stop_loading) {
|
||||
if (stop_loading.stop_requested()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -127,7 +127,7 @@ public:
|
||||
~ShaderCacheOpenGL() override;
|
||||
|
||||
/// Loads disk cache for the current game
|
||||
void LoadDiskCache(u64 title_id, const std::atomic_bool& stop_loading,
|
||||
void LoadDiskCache(u64 title_id, std::stop_token stop_loading,
|
||||
const VideoCore::DiskResourceLoadCallback& callback);
|
||||
|
||||
/// Gets the current specified shader stage program
|
||||
|
@@ -70,6 +70,10 @@ public:
|
||||
return &rasterizer;
|
||||
}
|
||||
|
||||
[[nodiscard]] std::string GetDeviceVendor() const override {
|
||||
return device.GetVendorName();
|
||||
}
|
||||
|
||||
private:
|
||||
/// Initializes the OpenGL state and creates persistent objects.
|
||||
void InitOpenGLObjects();
|
||||
|
@@ -47,6 +47,10 @@ public:
|
||||
return &rasterizer;
|
||||
}
|
||||
|
||||
[[nodiscard]] std::string GetDeviceVendor() const override {
|
||||
return device.GetDriverName();
|
||||
}
|
||||
|
||||
private:
|
||||
void Report() const;
|
||||
|
||||
|
@@ -344,6 +344,7 @@ private:
|
||||
|
||||
bool has_deleted_images = false;
|
||||
u64 total_used_memory = 0;
|
||||
u64 minimum_memory;
|
||||
u64 expected_memory;
|
||||
u64 critical_memory;
|
||||
|
||||
@@ -396,10 +397,12 @@ TextureCache<P>::TextureCache(Runtime& runtime_, VideoCore::RasterizerInterface&
|
||||
const u64 possible_critical_memory = (device_memory * 6) / 10;
|
||||
expected_memory = std::max(possible_expected_memory, DEFAULT_EXPECTED_MEMORY);
|
||||
critical_memory = std::max(possible_critical_memory, DEFAULT_CRITICAL_MEMORY);
|
||||
minimum_memory = 0;
|
||||
} else {
|
||||
// on OGL we can be more conservatives as the driver takes care.
|
||||
expected_memory = DEFAULT_EXPECTED_MEMORY + Common::Size_512_MB;
|
||||
critical_memory = DEFAULT_CRITICAL_MEMORY + Common::Size_1_GB;
|
||||
minimum_memory = expected_memory;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -470,7 +473,7 @@ void TextureCache<P>::RunGarbageCollector() {
|
||||
|
||||
template <class P>
|
||||
void TextureCache<P>::TickFrame() {
|
||||
if (Settings::values.use_caches_gc.GetValue()) {
|
||||
if (Settings::values.use_caches_gc.GetValue() && total_used_memory > minimum_memory) {
|
||||
RunGarbageCollector();
|
||||
}
|
||||
sentenced_images.Tick();
|
||||
|
@@ -50,7 +50,7 @@ NsightAftermathTracker::NsightAftermathTracker() {
|
||||
}
|
||||
dump_dir = Common::FS::GetYuzuPath(Common::FS::YuzuPath::LogDir) / "gpucrash";
|
||||
|
||||
void(Common::FS::RemoveDirRecursively(dump_dir));
|
||||
Common::FS::RemoveDirRecursively(dump_dir);
|
||||
if (!Common::FS::CreateDir(dump_dir)) {
|
||||
LOG_ERROR(Render_Vulkan, "Failed to create Nsight Aftermath dump directory");
|
||||
return;
|
||||
|
@@ -532,6 +532,27 @@ bool Device::IsFormatSupported(VkFormat wanted_format, VkFormatFeatureFlags want
|
||||
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 {
|
||||
std::bitset<REQUIRED_EXTENSIONS.size()> available_extensions;
|
||||
bool has_swapchain = false;
|
||||
|
@@ -45,6 +45,9 @@ public:
|
||||
/// Reports a shader to Nsight Aftermath.
|
||||
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.
|
||||
const vk::DeviceDispatch& GetDispatchLoader() const {
|
||||
return dld;
|
||||
|
Reference in New Issue
Block a user