diff options
| author | CamilleLaVey <camillelavey99@gmail.com> | 2026-09-10 15:14:02 +0200 |
|---|---|---|
| committer | crueter <crueter@eden-emu.dev> | 2026-09-10 15:14:02 +0200 |
| commit | ed566919f468e45ecb56e4e61185d98142a2cd1c (patch) | |
| tree | 5e9a1756c2b3fe99c9beabea0144a0e88e227bcb /src/video_core/renderer_vulkan/present/layer.cpp | |
| parent | 5f142c7926d0c7fcbbd0ce30794d72f638a43b2a (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/renderer_vulkan/present/layer.cpp')
| -rw-r--r-- | src/video_core/renderer_vulkan/present/layer.cpp | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/video_core/renderer_vulkan/present/layer.cpp b/src/video_core/renderer_vulkan/present/layer.cpp index 14935f92bb..1868142f51 100644 --- a/src/video_core/renderer_vulkan/present/layer.cpp +++ b/src/video_core/renderer_vulkan/present/layer.cpp @@ -18,6 +18,10 @@ #include "video_core/renderer_vulkan/present/sgsr.h" #include "video_core/renderer_vulkan/present/fxaa.h" #include "video_core/renderer_vulkan/present/layer.h" +#ifdef HAS_RESHADE +#include "video_core/post_processing/fx_chain.h" +#include "video_core/renderer_vulkan/present/post_process.h" +#endif #include "video_core/renderer_vulkan/present/present_push_constants.h" #include "video_core/renderer_vulkan/present/smaa.h" #include "video_core/renderer_vulkan/present/util.h" @@ -93,6 +97,9 @@ void Layer::ConfigureDraw(const Device& device, PresentPushConstants* out_push_c RefreshResources(device, framebuffer); SetAntiAliasPass(device); +#ifdef HAS_RESHADE + SetPostProcessPass(device); +#endif // Finish any pending renderpass scheduler.RequestOutsideRenderPassOperationContext(); @@ -115,6 +122,12 @@ void Layer::ConfigureDraw(const Device& device, PresentPushConstants* out_push_c smaa->Draw(device, scheduler, image_index, &source_image, &source_image_view); } +#ifdef HAS_RESHADE + if (post_process.has_value()) { + post_process->Draw(device, scheduler, image_index, &source_image, &source_image_view); + } +#endif + auto crop_rect = Tegra::NormalizeCrop(framebuffer, texture_width, texture_height); const VkExtent2D render_extent{ .width = scaled_width, @@ -214,6 +227,43 @@ void Layer::SetAntiAliasPass(const Device& device) { } } +#ifdef HAS_RESHADE +void Layer::SetPostProcessPass(const Device& device) { + const VkExtent2D render_area{ + .width = Settings::values.resolution_info.ScaleUp(raw_width), + .height = Settings::values.resolution_info.ScaleUp(raw_height), + }; + + const u64 generation = VideoCore::FxChain::Instance().Snapshot().generation; + const bool enabled = Settings::values.post_shader_enabled.GetValue(); + + if (post_process_generation == generation && post_process_enabled == enabled && + post_process_extent.width == render_area.width && + post_process_extent.height == render_area.height) { + return; + } + + for (const u64 tick : resource_ticks) { + scheduler.Wait(tick); + } + + post_process_generation = generation; + post_process_enabled = enabled; + post_process_extent = render_area; + post_process.reset(); + + if (!enabled || VideoCore::FxChain::Instance().Size() == 0) { + return; + } + + post_process.emplace(device, memory_allocator, scheduler, image_count, render_area); + + if (post_process->Empty()) { + post_process.reset(); + } +} +#endif + void Layer::ReleaseRawImages() { for (const u64 tick : resource_ticks) { scheduler.Wait(tick); |
