aboutsummaryrefslogtreecommitdiff
path: root/src/video_core/post_processing/fx_chain.h
diff options
context:
space:
mode:
authorCamilleLaVey <camillelavey99@gmail.com>2026-09-10 15:14:02 +0200
committercrueter <crueter@eden-emu.dev>2026-09-10 15:14:02 +0200
commited566919f468e45ecb56e4e61185d98142a2cd1c (patch)
tree5e9a1756c2b3fe99c9beabea0144a0e88e227bcb /src/video_core/post_processing/fx_chain.h
parent5f142c7926d0c7fcbbd0ce30794d72f638a43b2a (diff)
[vulkan, android] Add feature of post-processing shaders on Android (#4348)
Very self-explanatory; implementation of the feature for post-processing shaders for Android (at least for now); will allow users to enhance the graphic quality of video games based on the use of multiple shaders adjustable, presets and more, inspired on the PPSSPP implementation, this feature adds 22 customizable shaders (1 pass) that lives on the overlay of the screen, which means that aside of the capability to chain multiple shaders on the screen, this doesn't have depths (pixel/ depth z-buffer) so it ensures the performance with it's use. Few shaders were a faithful port from PPSSPP with their respective attribution on the shader headers for their respective owners; and there are adaptations from public references/ cinematographic (Anime4K) and the rest are my own addition. _Special Credits:_ 1.- PPSSPP Team for their contribution on the public references for shaders: Henrik Rydgard, ShadX, SimoneT, KillaMaaki and guest(r). 2.- Niklas Haas. 3.- bloc97. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4348 Reviewed-by: lizzie <lizzie@eden-emu.dev> Reviewed-by: Maufeat <sahyno1996@gmail.com>
Diffstat (limited to 'src/video_core/post_processing/fx_chain.h')
-rw-r--r--src/video_core/post_processing/fx_chain.h86
1 files changed, 86 insertions, 0 deletions
diff --git a/src/video_core/post_processing/fx_chain.h b/src/video_core/post_processing/fx_chain.h
new file mode 100644
index 0000000000..066f7e428d
--- /dev/null
+++ b/src/video_core/post_processing/fx_chain.h
@@ -0,0 +1,86 @@
+// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#pragma once
+
+#include <array>
+#include <atomic>
+#include <map>
+#include <mutex>
+#include <span>
+#include <string>
+#include <string_view>
+#include <vector>
+
+#include "common/common_types.h"
+
+namespace VideoCore {
+
+struct FxChainEntry {
+ std::string file;
+ std::string technique;
+ std::map<std::string, std::array<f32, 4>> values;
+
+ bool operator==(const FxChainEntry&) const = default;
+};
+
+struct FxChainSnapshot {
+ std::vector<FxChainEntry> entries;
+ u64 generation{};
+};
+
+std::vector<FxChainEntry> ParseFxChain(std::string_view value);
+
+std::string SerializeFxChain(std::span<const FxChainEntry> entries);
+
+void UseGlobalFxSettings();
+
+void UsePerGameFxSettings();
+
+class FxChain {
+public:
+ static FxChain& Instance();
+
+ FxChainSnapshot Snapshot() const;
+
+ std::vector<FxChainEntry> Entries() const;
+
+ size_t Size() const;
+
+ void Append(std::string_view file, std::string_view technique);
+
+ void Replace(size_t index, std::string_view file, std::string_view technique);
+
+ void Remove(size_t index);
+
+ void Move(size_t index, int delta);
+
+ void Clear();
+
+ void SetEntries(std::vector<FxChainEntry> next);
+
+ void SetValue(size_t index, std::string_view uniform, const std::array<f32, 4>& value);
+
+ std::array<f32, 4> GetValue(size_t index, std::string_view uniform) const;
+
+ std::map<std::string, std::array<f32, 4>> EntryValues(size_t index) const;
+
+ bool HasValue(size_t index, std::string_view uniform) const;
+
+ void ResetValues(size_t index);
+
+ void LoadFromSettings();
+
+ void StoreToSettings() const;
+
+ void DropUnknownEntries();
+
+private:
+ FxChain() = default;
+
+ mutable std::mutex mutex;
+ std::vector<FxChainEntry> entries;
+ std::atomic<u64> generation{1};
+};
+
+} // namespace VideoCore