mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-04-29 23:41:19 -06:00
more vulkan settings
This commit is contained in:
parent
fbd6dd8215
commit
6e5e765498
@ -158,11 +158,6 @@ static ConfigEntry<bool> shouldDumpShaders(false);
|
||||
static ConfigEntry<bool> shouldPatchShaders(false);
|
||||
static ConfigEntry<u32> vblankFrequency(60);
|
||||
|
||||
// Vulkan
|
||||
static ConfigEntry<bool> rdocEnable(false);
|
||||
static ConfigEntry<bool> pipelineCacheEnable(false);
|
||||
static ConfigEntry<bool> pipelineCacheArchive(false);
|
||||
|
||||
// Debug
|
||||
static ConfigEntry<bool> isFpsColor(true);
|
||||
static ConfigEntry<bool> showFpsCounter(false);
|
||||
@ -268,18 +263,6 @@ bool patchShaders() {
|
||||
return shouldPatchShaders.get();
|
||||
}
|
||||
|
||||
bool isRdocEnabled() {
|
||||
return rdocEnable.get();
|
||||
}
|
||||
|
||||
bool isPipelineCacheEnabled() {
|
||||
return pipelineCacheEnable.get();
|
||||
}
|
||||
|
||||
bool isPipelineCacheArchived() {
|
||||
return pipelineCacheArchive.get();
|
||||
}
|
||||
|
||||
bool fpsColor() {
|
||||
return isFpsColor.get();
|
||||
}
|
||||
@ -304,18 +287,6 @@ void setDumpShaders(bool enable, bool is_game_specific) {
|
||||
shouldDumpShaders.set(enable, is_game_specific);
|
||||
}
|
||||
|
||||
void setRdocEnabled(bool enable, bool is_game_specific) {
|
||||
rdocEnable.set(enable, is_game_specific);
|
||||
}
|
||||
|
||||
void setPipelineCacheEnabled(bool enable, bool is_game_specific) {
|
||||
pipelineCacheEnable.set(enable, is_game_specific);
|
||||
}
|
||||
|
||||
void setPipelineCacheArchived(bool enable, bool is_game_specific) {
|
||||
pipelineCacheArchive.set(enable, is_game_specific);
|
||||
}
|
||||
|
||||
void setVblankFreq(u32 value, bool is_game_specific) {
|
||||
vblankFrequency.set(value, is_game_specific);
|
||||
}
|
||||
@ -429,13 +400,6 @@ void load(const std::filesystem::path& path, bool is_game_specific) {
|
||||
vblankFrequency.setFromToml(gpu, "vblankFrequency", is_game_specific);
|
||||
}
|
||||
|
||||
if (data.contains("Vulkan")) {
|
||||
const toml::value& vk = data.at("Vulkan");
|
||||
rdocEnable.setFromToml(vk, "rdocEnable", is_game_specific);
|
||||
pipelineCacheEnable.setFromToml(vk, "pipelineCacheEnable", is_game_specific);
|
||||
pipelineCacheArchive.setFromToml(vk, "pipelineCacheArchive", is_game_specific);
|
||||
}
|
||||
|
||||
string current_version = {};
|
||||
if (data.contains("Debug")) {
|
||||
const toml::value& debug = data.at("Debug");
|
||||
@ -526,9 +490,6 @@ void save(const std::filesystem::path& path, bool is_game_specific) {
|
||||
|
||||
shouldDumpShaders.setTomlValue(data, "GPU", "dumpShaders", is_game_specific);
|
||||
vblankFrequency.setTomlValue(data, "GPU", "vblankFrequency", is_game_specific);
|
||||
rdocEnable.setTomlValue(data, "Vulkan", "rdocEnable", is_game_specific);
|
||||
pipelineCacheEnable.setTomlValue(data, "Vulkan", "pipelineCacheEnable", is_game_specific);
|
||||
pipelineCacheArchive.setTomlValue(data, "Vulkan", "pipelineCacheArchive", is_game_specific);
|
||||
|
||||
m_language.setTomlValue(data, "Settings", "consoleLanguage", is_game_specific);
|
||||
|
||||
@ -576,11 +537,6 @@ void setDefaultValues(bool is_game_specific) {
|
||||
shouldDumpShaders.setDefault(is_game_specific);
|
||||
vblankFrequency.setDefault(is_game_specific);
|
||||
|
||||
// GS - Vulkan
|
||||
rdocEnable.set(false, is_game_specific);
|
||||
pipelineCacheEnable.set(false, is_game_specific);
|
||||
pipelineCacheArchive.set(false, is_game_specific);
|
||||
|
||||
// GS - Settings
|
||||
m_language.setDefault(is_game_specific);
|
||||
|
||||
|
||||
@ -37,12 +37,6 @@ u32 vblankFreq();
|
||||
void setVblankFreq(u32 value, bool is_game_specific = false);
|
||||
s16 getCursorState();
|
||||
void setCursorState(s16 cursorState, bool is_game_specific = false);
|
||||
bool isRdocEnabled();
|
||||
bool isPipelineCacheEnabled();
|
||||
bool isPipelineCacheArchived();
|
||||
void setRdocEnabled(bool enable, bool is_game_specific = false);
|
||||
void setPipelineCacheEnabled(bool enable, bool is_game_specific = false);
|
||||
void setPipelineCacheArchived(bool enable, bool is_game_specific = false);
|
||||
int getCursorHideTimeout();
|
||||
void setCursorHideTimeout(int newcursorHideTimeout, bool is_game_specific = false);
|
||||
u32 GetLanguage();
|
||||
|
||||
@ -265,8 +265,8 @@ struct VulkanSettings {
|
||||
Setting<bool> vkcrash_diagnostic_enabled{false};
|
||||
Setting<bool> vkhost_markers{false};
|
||||
Setting<bool> vkguest_markers{false};
|
||||
Setting<bool> vkpipeline_cache_enabled{false};
|
||||
Setting<bool> vkpipeline_cache_archive{false};
|
||||
Setting<bool> pipeline_cache_enabled{false};
|
||||
Setting<bool> pipeline_cache_archived{false};
|
||||
std::vector<OverrideItem> GetOverrideableFields() const {
|
||||
return std::vector<OverrideItem>{
|
||||
make_override<VulkanSettings>("gpu_id", &VulkanSettings::gpu_id),
|
||||
@ -282,19 +282,20 @@ struct VulkanSettings {
|
||||
&VulkanSettings::vkvalidation_gpu_enabled),
|
||||
make_override<VulkanSettings>("vkcrash_diagnostic_enabled",
|
||||
&VulkanSettings::vkcrash_diagnostic_enabled),
|
||||
make_override<VulkanSettings>("host_markers", &VulkanSettings::vkhost_markers),
|
||||
make_override<VulkanSettings>("guest_markers", &VulkanSettings::vkguest_markers),
|
||||
make_override<VulkanSettings>("vkpipeline_cache_enabled",
|
||||
&VulkanSettings::vkpipeline_cache_enabled),
|
||||
make_override<VulkanSettings>("vkpipeline_cache_archive",
|
||||
&VulkanSettings::vkpipeline_cache_archive),
|
||||
make_override<VulkanSettings>("vkhost_markers", &VulkanSettings::vkhost_markers),
|
||||
make_override<VulkanSettings>("vkguest_markers", &VulkanSettings::vkguest_markers),
|
||||
make_override<VulkanSettings>("pipeline_cache_enabled",
|
||||
&VulkanSettings::pipeline_cache_enabled),
|
||||
make_override<VulkanSettings>("pipeline_cache_archived",
|
||||
&VulkanSettings::pipeline_cache_archived),
|
||||
};
|
||||
}
|
||||
};
|
||||
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(VulkanSettings, gpu_id, full_screen, renderdoc_enabled,
|
||||
vkvalidation_enabled, vkvalidation_core_enabled,
|
||||
vkvalidation_sync_enabled, vkvalidation_gpu_enabled,
|
||||
vkcrash_diagnostic_enabled, vkhost_markers, vkguest_markers)
|
||||
vkcrash_diagnostic_enabled, vkhost_markers, vkguest_markers,
|
||||
pipeline_cache_enabled, pipeline_cache_archived)
|
||||
// -------------------------------
|
||||
// User settings
|
||||
// -------------------------------
|
||||
@ -440,8 +441,8 @@ public:
|
||||
SETTING_FORWARD_BOOL(m_vulkan, VkCrashDiagnosticEnabled, vkcrash_diagnostic_enabled)
|
||||
SETTING_FORWARD_BOOL(m_vulkan, VkHostMarkersEnabled, vkhost_markers)
|
||||
SETTING_FORWARD_BOOL(m_vulkan, VkGuestMarkersEnabled, vkguest_markers)
|
||||
SETTING_FORWARD_BOOL(m_vulkan, VkPipelineCacheEnabled, vkpipeline_cache_enabled)
|
||||
SETTING_FORWARD_BOOL(m_vulkan, VkPipelineCacheArchive, vkpipeline_cache_archive)
|
||||
SETTING_FORWARD_BOOL(m_vulkan, PipelineCacheEnabled, pipeline_cache_enabled)
|
||||
SETTING_FORWARD_BOOL(m_vulkan, PipelineCacheArchived, pipeline_cache_archived)
|
||||
|
||||
#undef SETTING_FORWARD
|
||||
#undef SETTING_FORWARD_BOOL
|
||||
|
||||
@ -227,15 +227,22 @@ void Emulator::Run(std::filesystem::path file, std::vector<std::string> args,
|
||||
EmulatorSettings::GetInstance()->IsVkValidationEnabled());
|
||||
LOG_INFO(Config, "Vulkan vkValidationCore: {}",
|
||||
EmulatorSettings::GetInstance()->IsVkValidationCoreEnabled());
|
||||
LOG_INFO(Config, "Vulkan vkValidationSync: {}", EmulatorSettings::GetInstance()->IsVkValidationSyncEnabled());
|
||||
LOG_INFO(Config, "Vulkan vkValidationSync: {}",
|
||||
EmulatorSettings::GetInstance()->IsVkValidationSyncEnabled());
|
||||
LOG_INFO(Config, "Vulkan vkValidationGpu: {}",
|
||||
EmulatorSettings::GetInstance()->IsVkValidationGpuEnabled());
|
||||
LOG_INFO(Config, "Vulkan crashDiagnostics: {}", EmulatorSettings::GetInstance()->IsVkCrashDiagnosticEnabled());
|
||||
LOG_INFO(Config, "Vulkan crashDiagnostics: {}",
|
||||
EmulatorSettings::GetInstance()->IsVkCrashDiagnosticEnabled());
|
||||
LOG_INFO(Config, "Vulkan hostMarkers: {}",
|
||||
EmulatorSettings::GetInstance()->IsVkHostMarkersEnabled());
|
||||
LOG_INFO(Config, "Vulkan guestMarkers: {}",
|
||||
EmulatorSettings::GetInstance()->IsVkGuestMarkersEnabled());
|
||||
LOG_INFO(Config, "Vulkan rdocEnable: {}", Config::isRdocEnabled());
|
||||
LOG_INFO(Config, "Vulkan rdocEnable: {}",
|
||||
EmulatorSettings::GetInstance()->IsRenderdocEnabled());
|
||||
LOG_INFO(Config, "Vulkan PipelineCacheEnabled: {}",
|
||||
EmulatorSettings::GetInstance()->IsPipelineCacheEnabled());
|
||||
LOG_INFO(Config, "Vulkan PipelineCacheArchived: {}",
|
||||
EmulatorSettings::GetInstance()->IsPipelineCacheArchived());
|
||||
|
||||
hwinfo::Memory ram;
|
||||
hwinfo::OS os;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2025 shadPS4 Emulator Project
|
||||
// SPDX-FileCopyrightText: Copyright 2025-2026 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "common/config.h"
|
||||
@ -7,6 +7,7 @@
|
||||
#include "common/polyfill_thread.h"
|
||||
#include "common/thread.h"
|
||||
|
||||
#include "core/emulator_settings.h"
|
||||
#include "video_core/cache_storage.h"
|
||||
#include "video_core/renderer_vulkan/vk_instance.h"
|
||||
#include "video_core/renderer_vulkan/vk_pipeline_cache.h"
|
||||
@ -95,7 +96,7 @@ void DataBase::Open() {
|
||||
const auto& game_info = Common::ElfInfo::Instance();
|
||||
|
||||
using namespace Common::FS;
|
||||
if (Config::isPipelineCacheArchived()) {
|
||||
if (EmulatorSettings::GetInstance()->IsPipelineCacheArchived()) {
|
||||
mz_zip_zero_struct(&zip_ar);
|
||||
|
||||
cache_path = GetUserPath(PathType::CacheDir) /
|
||||
@ -128,7 +129,7 @@ void DataBase::Close() {
|
||||
io_worker.request_stop();
|
||||
io_worker.join();
|
||||
|
||||
if (Config::isPipelineCacheArchived()) {
|
||||
if (EmulatorSettings::GetInstance()->IsPipelineCacheArchived()) {
|
||||
mz_zip_writer_finalize_archive(&zip_ar);
|
||||
mz_zip_writer_end(&zip_ar);
|
||||
}
|
||||
@ -142,7 +143,7 @@ bool WriteVector(const BlobType type, std::filesystem::path&& path_, std::vector
|
||||
auto request = std::packaged_task<void()>{[=]() {
|
||||
auto path{path_};
|
||||
path.replace_extension(GetBlobFileExtension(type));
|
||||
if (Config::isPipelineCacheArchived()) {
|
||||
if (EmulatorSettings::GetInstance()->IsPipelineCacheArchived()) {
|
||||
ASSERT_MSG(!ar_is_read_only,
|
||||
"The archive is read-only. Did you forget to call `FinishPreload`?");
|
||||
if (!mz_zip_writer_add_mem(&zip_ar, path.string().c_str(), v.data(),
|
||||
@ -169,7 +170,7 @@ template <typename T>
|
||||
void LoadVector(BlobType type, std::filesystem::path& path, std::vector<T>& v) {
|
||||
using namespace Common::FS;
|
||||
path.replace_extension(GetBlobFileExtension(type));
|
||||
if (Config::isPipelineCacheArchived()) {
|
||||
if (EmulatorSettings::GetInstance()->IsPipelineCacheArchived()) {
|
||||
int index{-1};
|
||||
index = mz_zip_reader_locate_file(&zip_ar, path.string().c_str(), nullptr, 0);
|
||||
if (index < 0) {
|
||||
@ -192,7 +193,9 @@ bool DataBase::Save(BlobType type, const std::string& name, std::vector<u8>&& da
|
||||
return false;
|
||||
}
|
||||
|
||||
auto path = Config::isPipelineCacheArchived() ? std::filesystem::path{name} : cache_path / name;
|
||||
auto path = EmulatorSettings::GetInstance()->IsPipelineCacheArchived()
|
||||
? std::filesystem::path{name}
|
||||
: cache_path / name;
|
||||
return WriteVector(type, std::move(path), std::move(data));
|
||||
}
|
||||
|
||||
@ -201,7 +204,9 @@ bool DataBase::Save(BlobType type, const std::string& name, std::vector<u32>&& d
|
||||
return false;
|
||||
}
|
||||
|
||||
auto path = Config::isPipelineCacheArchived() ? std::filesystem::path{name} : cache_path / name;
|
||||
auto path = EmulatorSettings::GetInstance()->IsPipelineCacheArchived()
|
||||
? std::filesystem::path{name}
|
||||
: cache_path / name;
|
||||
return WriteVector(type, std::move(path), std::move(data));
|
||||
}
|
||||
|
||||
@ -210,7 +215,9 @@ void DataBase::Load(BlobType type, const std::string& name, std::vector<u8>& dat
|
||||
return;
|
||||
}
|
||||
|
||||
auto path = Config::isPipelineCacheArchived() ? std::filesystem::path{name} : cache_path / name;
|
||||
auto path = EmulatorSettings::GetInstance()->IsPipelineCacheArchived()
|
||||
? std::filesystem::path{name}
|
||||
: cache_path / name;
|
||||
return LoadVector(type, path, data);
|
||||
}
|
||||
|
||||
@ -219,13 +226,15 @@ void DataBase::Load(BlobType type, const std::string& name, std::vector<u32>& da
|
||||
return;
|
||||
}
|
||||
|
||||
auto path = Config::isPipelineCacheArchived() ? std::filesystem::path{name} : cache_path / name;
|
||||
auto path = EmulatorSettings::GetInstance()->IsPipelineCacheArchived()
|
||||
? std::filesystem::path{name}
|
||||
: cache_path / name;
|
||||
return LoadVector(type, path, data);
|
||||
}
|
||||
|
||||
void DataBase::ForEachBlob(BlobType type, const std::function<void(std::vector<u8>&& data)>& func) {
|
||||
const auto& ext = GetBlobFileExtension(type);
|
||||
if (Config::isPipelineCacheArchived()) {
|
||||
if (EmulatorSettings::GetInstance()->IsPipelineCacheArchived()) {
|
||||
const auto num_files = mz_zip_reader_get_num_files(&zip_ar);
|
||||
for (int index = 0; index < num_files; ++index) {
|
||||
std::array<char, MZ_ZIP_MAX_ARCHIVE_FILENAME_SIZE> file_name{};
|
||||
@ -255,7 +264,7 @@ void DataBase::ForEachBlob(BlobType type, const std::function<void(std::vector<u
|
||||
}
|
||||
|
||||
void DataBase::FinishPreload() {
|
||||
if (Config::isPipelineCacheArchived()) {
|
||||
if (EmulatorSettings::GetInstance()->IsPipelineCacheArchived()) {
|
||||
mz_zip_writer_init_from_reader(&zip_ar, cache_path.string().c_str());
|
||||
ar_is_read_only = false;
|
||||
}
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
||||
// SPDX-FileCopyrightText: Copyright 2024-2026 shadPS4 Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "common/assert.h"
|
||||
#include "common/config.h"
|
||||
#include "core/emulator_settings.h"
|
||||
#include "video_core/renderdoc.h"
|
||||
|
||||
#include <renderdoc_app.h>
|
||||
@ -31,7 +32,7 @@ void LoadRenderDoc() {
|
||||
|
||||
// Check if we are running by RDoc GUI
|
||||
HMODULE mod = GetModuleHandleA("renderdoc.dll");
|
||||
if (!mod && Config::isRdocEnabled()) {
|
||||
if (!mod && EmulatorSettings::GetInstance()->IsRenderdocEnabled()) {
|
||||
// If enabled in config, try to load RDoc runtime in offline mode
|
||||
HKEY h_reg_key;
|
||||
LONG result = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
||||
@ -67,7 +68,7 @@ void LoadRenderDoc() {
|
||||
#endif
|
||||
// Check if we are running by RDoc GUI
|
||||
void* mod = dlopen(RENDERDOC_LIB, RTLD_NOW | RTLD_NOLOAD);
|
||||
if (!mod && Config::isRdocEnabled()) {
|
||||
if (!mod && EmulatorSettings::GetInstance()->IsRenderdocEnabled()) {
|
||||
// If enabled in config, try to load RDoc runtime in offline mode
|
||||
if ((mod = dlopen(RENDERDOC_LIB, RTLD_NOW))) {
|
||||
const auto RENDERDOC_GetAPI =
|
||||
|
||||
@ -9,6 +9,8 @@
|
||||
#include "video_core/renderer_vulkan/vk_instance.h"
|
||||
#include "video_core/renderer_vulkan/vk_pipeline_cache.h"
|
||||
#include "video_core/renderer_vulkan/vk_shader_util.h"
|
||||
#include "core/emulator_settings.h"
|
||||
|
||||
|
||||
namespace Serialization {
|
||||
/* You should increment versions below once corresponding serialization scheme is changed. */
|
||||
@ -295,7 +297,7 @@ bool PipelineCache::LoadPipelineStage(Serialization::Archive& ar, size_t stage)
|
||||
}
|
||||
|
||||
void PipelineCache::WarmUp() {
|
||||
if (!Config::isPipelineCacheEnabled()) {
|
||||
if (!EmulatorSettings::GetInstance()->IsPipelineCacheEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user