bg_green{0, "bg_green"};
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h
index c7f7448e9..43b7ac0a6 100644
--- a/src/video_core/texture_cache/texture_cache.h
+++ b/src/video_core/texture_cache/texture_cache.h
@@ -186,6 +186,10 @@ void TextureCache::FillComputeImageViews(std::span views) {
template
void TextureCache::CheckFeedbackLoop(std::span views) {
+ if (!Settings::values.barrier_feedback_loops.GetValue()) {
+ return;
+ }
+
const bool requires_barrier = [&] {
for (const auto& view : views) {
if (!view.id) {
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp
index bac9dff90..edc206a25 100644
--- a/src/yuzu/configuration/config.cpp
+++ b/src/yuzu/configuration/config.cpp
@@ -761,6 +761,7 @@ void Config::ReadRendererValues() {
ReadGlobalSetting(Settings::values.use_vulkan_driver_pipeline_cache);
ReadGlobalSetting(Settings::values.enable_compute_pipelines);
ReadGlobalSetting(Settings::values.use_video_framerate);
+ ReadGlobalSetting(Settings::values.barrier_feedback_loops);
ReadGlobalSetting(Settings::values.bg_red);
ReadGlobalSetting(Settings::values.bg_green);
ReadGlobalSetting(Settings::values.bg_blue);
@@ -1417,6 +1418,7 @@ void Config::SaveRendererValues() {
WriteGlobalSetting(Settings::values.use_vulkan_driver_pipeline_cache);
WriteGlobalSetting(Settings::values.enable_compute_pipelines);
WriteGlobalSetting(Settings::values.use_video_framerate);
+ WriteGlobalSetting(Settings::values.barrier_feedback_loops);
WriteGlobalSetting(Settings::values.bg_red);
WriteGlobalSetting(Settings::values.bg_green);
WriteGlobalSetting(Settings::values.bg_blue);
diff --git a/src/yuzu/configuration/configure_graphics_advanced.cpp b/src/yuzu/configuration/configure_graphics_advanced.cpp
index 0463ac8b9..c0a044767 100644
--- a/src/yuzu/configuration/configure_graphics_advanced.cpp
+++ b/src/yuzu/configuration/configure_graphics_advanced.cpp
@@ -43,6 +43,8 @@ void ConfigureGraphicsAdvanced::SetConfiguration() {
ui->enable_compute_pipelines_checkbox->setChecked(
Settings::values.enable_compute_pipelines.GetValue());
ui->use_video_framerate_checkbox->setChecked(Settings::values.use_video_framerate.GetValue());
+ ui->barrier_feedback_loops_checkbox->setChecked(
+ Settings::values.barrier_feedback_loops.GetValue());
if (Settings::IsConfiguringGlobal()) {
ui->gpu_accuracy->setCurrentIndex(
@@ -94,6 +96,9 @@ void ConfigureGraphicsAdvanced::ApplyConfiguration() {
enable_compute_pipelines);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_video_framerate,
ui->use_video_framerate_checkbox, use_video_framerate);
+ ConfigurationShared::ApplyPerGameSetting(&Settings::values.barrier_feedback_loops,
+ ui->barrier_feedback_loops_checkbox,
+ barrier_feedback_loops);
}
void ConfigureGraphicsAdvanced::changeEvent(QEvent* event) {
@@ -130,6 +135,8 @@ void ConfigureGraphicsAdvanced::SetupPerGameUI() {
Settings::values.enable_compute_pipelines.UsingGlobal());
ui->use_video_framerate_checkbox->setEnabled(
Settings::values.use_video_framerate.UsingGlobal());
+ ui->barrier_feedback_loops_checkbox->setEnabled(
+ Settings::values.barrier_feedback_loops.UsingGlobal());
return;
}
@@ -157,6 +164,9 @@ void ConfigureGraphicsAdvanced::SetupPerGameUI() {
ConfigurationShared::SetColoredTristate(ui->use_video_framerate_checkbox,
Settings::values.use_video_framerate,
use_video_framerate);
+ ConfigurationShared::SetColoredTristate(ui->barrier_feedback_loops_checkbox,
+ Settings::values.barrier_feedback_loops,
+ barrier_feedback_loops);
ConfigurationShared::SetColoredComboBox(
ui->gpu_accuracy, ui->label_gpu_accuracy,
static_cast(Settings::values.gpu_accuracy.GetValue(true)));
diff --git a/src/yuzu/configuration/configure_graphics_advanced.h b/src/yuzu/configuration/configure_graphics_advanced.h
index a4dc8ceb0..369a7c83e 100644
--- a/src/yuzu/configuration/configure_graphics_advanced.h
+++ b/src/yuzu/configuration/configure_graphics_advanced.h
@@ -48,6 +48,7 @@ private:
ConfigurationShared::CheckState use_vulkan_driver_pipeline_cache;
ConfigurationShared::CheckState enable_compute_pipelines;
ConfigurationShared::CheckState use_video_framerate;
+ ConfigurationShared::CheckState barrier_feedback_loops;
const Core::System& system;
};
diff --git a/src/yuzu/configuration/configure_graphics_advanced.ui b/src/yuzu/configuration/configure_graphics_advanced.ui
index e7f0ef6be..d527a6f38 100644
--- a/src/yuzu/configuration/configure_graphics_advanced.ui
+++ b/src/yuzu/configuration/configure_graphics_advanced.ui
@@ -201,6 +201,16 @@ Compute pipelines are always enabled on all other drivers.
+ -
+
+
+ Improves rendering of transparency effects in specific games.
+
+
+ Barrier feedback loops
+
+
+
-
--
cgit v1.2.3
From 734242c5bcd56dbd7fc69fb49dba5b7d5ca090bc Mon Sep 17 00:00:00 2001
From: Liam
Date: Fri, 16 Jun 2023 15:12:46 -0400
Subject: vfs_real: misc optimizations
---
src/common/fs/fs.cpp | 8 ++++----
src/common/fs/fs_types.h | 2 +-
src/core/file_sys/vfs_real.cpp | 44 +++++++++++++++++++++++++-----------------
src/core/file_sys/vfs_real.h | 11 ++++++++++-
4 files changed, 41 insertions(+), 24 deletions(-)
(limited to 'src')
diff --git a/src/common/fs/fs.cpp b/src/common/fs/fs.cpp
index 6d66c926d..1baf6d746 100644
--- a/src/common/fs/fs.cpp
+++ b/src/common/fs/fs.cpp
@@ -436,7 +436,7 @@ void IterateDirEntries(const std::filesystem::path& path, const DirEntryCallable
if (True(filter & DirEntryFilter::File) &&
entry.status().type() == fs::file_type::regular) {
- if (!callback(entry.path())) {
+ if (!callback(entry)) {
callback_error = true;
break;
}
@@ -444,7 +444,7 @@ void IterateDirEntries(const std::filesystem::path& path, const DirEntryCallable
if (True(filter & DirEntryFilter::Directory) &&
entry.status().type() == fs::file_type::directory) {
- if (!callback(entry.path())) {
+ if (!callback(entry)) {
callback_error = true;
break;
}
@@ -493,7 +493,7 @@ void IterateDirEntriesRecursively(const std::filesystem::path& path,
if (True(filter & DirEntryFilter::File) &&
entry.status().type() == fs::file_type::regular) {
- if (!callback(entry.path())) {
+ if (!callback(entry)) {
callback_error = true;
break;
}
@@ -501,7 +501,7 @@ void IterateDirEntriesRecursively(const std::filesystem::path& path,
if (True(filter & DirEntryFilter::Directory) &&
entry.status().type() == fs::file_type::directory) {
- if (!callback(entry.path())) {
+ if (!callback(entry)) {
callback_error = true;
break;
}
diff --git a/src/common/fs/fs_types.h b/src/common/fs/fs_types.h
index 5a4090c19..900f85d24 100644
--- a/src/common/fs/fs_types.h
+++ b/src/common/fs/fs_types.h
@@ -66,6 +66,6 @@ DECLARE_ENUM_FLAG_OPERATORS(DirEntryFilter);
* @returns A boolean value.
* Return true to indicate whether the callback is successful, false otherwise.
*/
-using DirEntryCallable = std::function;
+using DirEntryCallable = std::function;
} // namespace Common::FS
diff --git a/src/core/file_sys/vfs_real.cpp b/src/core/file_sys/vfs_real.cpp
index 7a15d8438..a8fdc8f3e 100644
--- a/src/core/file_sys/vfs_real.cpp
+++ b/src/core/file_sys/vfs_real.cpp
@@ -10,6 +10,7 @@
#include "common/fs/fs.h"
#include "common/fs/path_util.h"
#include "common/logging/log.h"
+#include "core/file_sys/vfs.h"
#include "core/file_sys/vfs_real.h"
// For FileTimeStampRaw
@@ -72,7 +73,8 @@ VfsEntryType RealVfsFilesystem::GetEntryType(std::string_view path_) const {
return VfsEntryType::File;
}
-VirtualFile RealVfsFilesystem::OpenFile(std::string_view path_, Mode perms) {
+VirtualFile RealVfsFilesystem::OpenFileFromEntry(std::string_view path_, std::optional size,
+ Mode perms) {
const auto path = FS::SanitizePath(path_, FS::DirectorySeparator::PlatformDefault);
if (auto it = cache.find(path); it != cache.end()) {
@@ -81,20 +83,24 @@ VirtualFile RealVfsFilesystem::OpenFile(std::string_view path_, Mode perms) {
}
}
- if (!FS::Exists(path) || !FS::IsFile(path)) {
+ if (!size && !FS::IsFile(path)) {
return nullptr;
}
auto reference = std::make_unique();
this->InsertReferenceIntoList(*reference);
- auto file =
- std::shared_ptr(new RealVfsFile(*this, std::move(reference), path, perms));
+ auto file = std::shared_ptr(
+ new RealVfsFile(*this, std::move(reference), path, perms, size));
cache[path] = file;
return file;
}
+VirtualFile RealVfsFilesystem::OpenFile(std::string_view path_, Mode perms) {
+ return OpenFileFromEntry(path_, {}, perms);
+}
+
VirtualFile RealVfsFilesystem::CreateFile(std::string_view path_, Mode perms) {
const auto path = FS::SanitizePath(path_, FS::DirectorySeparator::PlatformDefault);
cache.erase(path);
@@ -243,10 +249,10 @@ void RealVfsFilesystem::RemoveReferenceFromList(FileReference& reference) {
}
RealVfsFile::RealVfsFile(RealVfsFilesystem& base_, std::unique_ptr reference_,
- const std::string& path_, Mode perms_)
+ const std::string& path_, Mode perms_, std::optional size_)
: base(base_), reference(std::move(reference_)), path(path_),
parent_path(FS::GetParentPath(path_)), path_components(FS::SplitPathComponents(path_)),
- perms(perms_) {}
+ size(size_), perms(perms_) {}
RealVfsFile::~RealVfsFile() {
base.DropReference(std::move(reference));
@@ -257,8 +263,10 @@ std::string RealVfsFile::GetName() const {
}
std::size_t RealVfsFile::GetSize() const {
- base.RefreshReference(path, perms, *reference);
- return reference->file ? reference->file->GetSize() : 0;
+ if (size) {
+ return *size;
+ }
+ return FS::GetSize(path);
}
bool RealVfsFile::Resize(std::size_t new_size) {
@@ -309,10 +317,11 @@ std::vector RealVfsDirectory::IterateEntries(
std::vector out;
- const FS::DirEntryCallable callback = [this, &out](const std::filesystem::path& full_path) {
- const auto full_path_string = FS::PathToUTF8String(full_path);
+ const FS::DirEntryCallable callback = [this,
+ &out](const std::filesystem::directory_entry& entry) {
+ const auto full_path_string = FS::PathToUTF8String(entry.path());
- out.emplace_back(base.OpenFile(full_path_string, perms));
+ out.emplace_back(base.OpenFileFromEntry(full_path_string, entry.file_size(), perms));
return true;
};
@@ -330,8 +339,9 @@ std::vector RealVfsDirectory::IterateEntries out;
- const FS::DirEntryCallable callback = [this, &out](const std::filesystem::path& full_path) {
- const auto full_path_string = FS::PathToUTF8String(full_path);
+ const FS::DirEntryCallable callback = [this,
+ &out](const std::filesystem::directory_entry& entry) {
+ const auto full_path_string = FS::PathToUTF8String(entry.path());
out.emplace_back(base.OpenDirectory(full_path_string, perms));
@@ -483,12 +493,10 @@ std::map> RealVfsDirectory::GetEntries()
std::map> out;
- const FS::DirEntryCallable callback = [&out](const std::filesystem::path& full_path) {
- const auto filename = FS::PathToUTF8String(full_path.filename());
-
+ const FS::DirEntryCallable callback = [&out](const std::filesystem::directory_entry& entry) {
+ const auto filename = FS::PathToUTF8String(entry.path().filename());
out.insert_or_assign(filename,
- FS::IsDir(full_path) ? VfsEntryType::Directory : VfsEntryType::File);
-
+ entry.is_directory() ? VfsEntryType::Directory : VfsEntryType::File);
return true;
};
diff --git a/src/core/file_sys/vfs_real.h b/src/core/file_sys/vfs_real.h
index d8c900e33..67f4c4422 100644
--- a/src/core/file_sys/vfs_real.h
+++ b/src/core/file_sys/vfs_real.h
@@ -4,6 +4,7 @@
#pragma once
#include