aboutsummaryrefslogtreecommitdiff
path: root/src/video_core/renderer_vulkan/vk_swapchain.cpp
Commit message (Collapse)AuthorAgeFilesLines
* vulkan: never flush the scheduler from the async present threadTakoroka5 days1-8/+8
| | | | | | | | | | | Swapchain::AcquireNextImage waits for the main scheduler's tick of the image's last use; when that tick was not submitted yet, Scheduler::Wait flushed, recording into the current chunk on the present thread while the GPU thread recorded into it too (corrupt command buffers, crashes in vkCmdEndRenderPass and in CommandChunk::Record). With async presentation the present thread now waits up to 20 ms for the recording thread to submit the tick, and goes on without the wait otherwise (the copy to the swapchain has its own fences).
* [vulkan, android] Initial implementation of LSFG-VK (#4263)CamilleLaVey2026-08-171-0/+3
| | | | | | | | | | | | | Pretty much self explanatory, own implementation based on LSFG-VK available with some additional reverse engineer work for the actual use of shaders inside Lossless.dll, we don't store/ bundle any tools that bypass security and self ownership: to use this feature is required to own your own copy of Lossless Scaling and I encourage to support developers behind this work. Special thanks: 1.- THS - Original developer behind Lossless Scaling 2.- PancakeTAS - Developer behind LSFG-VK 3.- The Big Smolio The Sleeper (@gidoly) Co-authored-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4263
* [*] basic in-house cpp linting (#4039)lizzie2026-06-041-3/+3
| | | | | | | | | | | | - add `#pragma once` to remainder files - "correcter" defines (ANDROID), see https://groups.google.com/g/android-ndk/c/cf9_f1SLXls - extra miscelly fixups Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4039 Reviewed-by: MaranBr <maranbr@eden-emu.dev> Reviewed-by: crueter <crueter@eden-emu.dev>
* [vk,swapchain] vsync: Changed Immediate fallback from (FIFO) to (Mailbox, ↵xbzk2026-04-111-1/+3
| | | | | | | | | | | | | | | | | | | | then FIFO) (#3746) Just discovered that stock adreno drivers on a730 had no Immediate VSync mode available, and it was falling back to FIFO, which causes a lot of response delay in Unity games. But if someone chose Immediate, it prefers low latency above buffering, so Mailbox is his friend, and FIFO is his nemesis. So i just changed Immediate to fall back to Mailbox first, and only if Mailbox is not available either it falls back to FIFO: Immediate -> Mailbox -> FIFO; Mailbox -> FIFO; FIFO Relaxed -> FIFO. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3746 Reviewed-by: crueter <crueter@eden-emu.dev> Reviewed-by: MaranBr <maranbr@eden-emu.dev> Co-authored-by: xbzk <xbzk@eden-emu.dev> Co-committed-by: xbzk <xbzk@eden-emu.dev>
* [android] Rework of frame pacing mode + Surface mode detection per API ↵PavelBARABANOV2026-03-241-0/+16
| | | | | | | | | | | | | level. (#3735) This Pr is a reply to certain issues found on Android due to the new artificial waits inside Vulkan (Frame Pacing Mode); which caused GPU/CPU desync's even if TimelineSemaphore (Adreno's drivers) does a constant check to retain synchronization with each frame-data, removes the yield() for all platforms (remains the same on PC) and aligns a new way to handle the output of video by using native Android tools, such as AGP, which makes a bridge inside Vulkan to Android's Surface (screen) and reduces not only the latency, but also improves the smoothness of each frame processed; currently we quantize the amount of frame processed by hinting the surface on Android space and adjust the heuristics of the old handling (yuzu) and we link it to screen refresh rate; this way we ensure that even if the game moves below the screen's HZ, we can always pick up the cadence by clamping the duration of each frame and using a chrono function to work as internal fernce if performance goes below the game speed requirment or game's frame rate requirements. Co-authored-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3735 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-by: Lizzie <lizzie@eden-emu.dev> Co-authored-by: PavelBARABANOV <pavelbarabanov94@gmail.com> Co-committed-by: PavelBARABANOV <pavelbarabanov94@gmail.com>
* [common/logging] Simplify logging logic and fix issues when logging before ↵lizzie2026-03-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | system is created (#3688) - our logging code was bigger than spdlog itself, why???? just keep it simple - fix issues when logging before logging system is even started - removes the "initialized logging twice" issue - removes uneeded indirection in file logging - uses direct formatting instead of jumping hoopla-around the fmt::format() ressult - code duplication and dead code removal as usual I did explore dup2() but I think it's not worth the hassle I did try `fwopen()` but it's better if things are just kept as-is. there is a lot of noise because I removed a bunch of redundant files on logging and just put everything in one file now normally this wouldn't be a good idea, however consider: the complexity of logging; it's less than 500 lines... does it really need a whole subsystem?!?!?! ITS JUST LOGGING Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3688 Reviewed-by: crueter <crueter@eden-emu.dev> Reviewed-by: DraVee <chimera@dravee.dev> Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [vk] unify VkSurfaceKHR with Android and the rest of platforms; remove ↵lizzie2026-03-051-46/+8
| | | | | | | | | | | | | | | | technically incorrect nullptr() ctor for handles (#2971) Removes some odd #ifdef-ing that just can use a shrimple opaque type. Also removes nullptr() ctor'ing for vulkan handles and such; it's not incorrect per se like how `void *p = 0;` isn't incorrect, just that, y'know, any static analyzer will go "woah". Also there isn't any guarantee that handles `sizeof(Handle) == sizeof(void*)` so may as well :) Signed-off-by: lizzie lizzie@eden-emu.dev Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2971 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-by: MaranBr <maranbr@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [vk] Disable vsync when Turbo Mode is enabled (#3633)crueter2026-02-261-3/+3
| | | | | | | | | Note to self: you have a 60Hz display, use it Signed-off-by: crueter <crueter@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3633 Reviewed-by: DraVee <dravee@eden-emu.dev> Reviewed-by: MaranBr <maranbr@eden-emu.dev>
* [vulkan] Improve frame pacing (#3535)MaranBr2026-02-151-37/+16
| | | | | | | | This improves frame pacing control, fixes accumulated drift, and adds the ability to change it while the game is running. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3535 Co-authored-by: MaranBr <maranbr@outlook.com> Co-committed-by: MaranBr <maranbr@outlook.com>
* [vulkan] Add support for target FPS frame pacing (#3494)MaranBr2026-02-121-2/+40
| | | | | | | | | This allows users to choose how the emulator manages frame pacing to reduce stuttering and provide a smoother and more consistent frame rate. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3494 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Co-authored-by: MaranBr <maranbr@outlook.com> Co-committed-by: MaranBr <maranbr@outlook.com>
* [refactor, vk] DynamicState, ExtendedDynamicState and ↵CamilleLaVey2026-01-071-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | VertexInputDynamicState (#3074) This PR rewrites the DynamicState, ExtendedDynamicState and VertexInputDynamicState logic: - Adds proper handling on how features should be loaded based on driver available features for ExtendedDynamicState/ VertexInputDynamicState. - Fixes some old regressions with emulated formats for Android. - Adds better formatting for tiling format features. - Adds better formatting for format features. - Adds NonWritable buffers handling for Spir-v. - Updates Maintenance features calling. - Adds new features: Multidraw, Robustness2, Image Robustness. - Removes dead code/ duplicated on Vulkan device related to ExtendedDynamicState handling. - Adjusts and conditions with better handling for some features callings: SwapchainMaintenance1, ConditionalRendering, ShaderExtencilExport, CustomBorderColor, TransformFeedback, VertexInputDynamicState. - Removes some older feature ban logic. - Adds hardware resolve path for MSAA Image Blits on Nvidia cards. - Adds flat decorations for input interfaces on Spir-v. - Reduces flushwork within drawcalls. - Clamps render limits on out-of-area for rasterizer. Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-authored-by: Caio Oliveira <caiooliveirafarias0@gmail.com> Co-authored-by: DraVee <dravee@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3074 Reviewed-by: DraVee <dravee@eden-emu.dev> Reviewed-by: Lizzie <lizzie@eden-emu.dev> Co-authored-by: CamilleLaVey <camillelavey99@gmail.com> Co-committed-by: CamilleLaVey <camillelavey99@gmail.com>
* [vk] Unify RAII in Vulkan (#2679)Ribbit2025-10-081-0/+1
| | | | | | | | | | | This PR consolidates Vulkan RAII on video_core/vulkan_common/vulkan_wrapper.h’s vk::Handle and remove the unused duplicate src/video_core/vulkan_common/vulkan_raii.h, reducing confusion and maintenance. Swapchain now uses RAII‑managed per‑image semaphores and clears them in Destroy(), providing correct present synchronization and automatic cleanup. Expected result: simpler lifetimes, fewer leak risks, and more stable presentation with negligible overhead. Co-authored-by: Ribbit <ribbit@placeholder.com> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2679 Reviewed-by: MaranBr <maranbr@eden-emu.dev> Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Co-authored-by: Ribbit <ribbit@eden-emu.dev> Co-committed-by: Ribbit <ribbit@eden-emu.dev>
* [common] remove ranges polyfill (#2546)lizzie2025-09-241-1/+1
| | | | | | | | | Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2546 Reviewed-by: MaranBr <maranbr@eden-emu.dev> Reviewed-by: crueter <crueter@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [meta] fix license headers (#2547)lizzie2025-09-211-0/+3
| | | | | | | Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2547 Reviewed-by: MaranBr <maranbr@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* [cmake] enable clang-cl and WoA builds (#348)lizzie2025-09-091-8/+8
| | | | | | | | | | | | | | Compilation and CMake fixes for both Windows on ARM and clang-cl, meaning Windows can now be built on both MSVC and clang on both amd64 and aarch64. Compiling on clang is *dramatically* faster so this should be useful for CI. Co-authored-by: crueter <crueter@eden-emu.dev> Co-authored-by: crueter <crueter@crueter.xyz> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/348 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-by: crueter <crueter@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
* fix a large variety of issues (#101)swurl2025-05-111-6/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - GLASM/SPIR-V mixup on Android - potential greenscreen fix (thx suyu) - save memory layout and add 10gb/12gb options - potential samsung gaming hub fix - fix layout of controller UI - fix default settings to sensible defaults. - note to TotK that you should increase memory layout - Error checking for Windows linking - fix an IDE error - improved migration system w/threading and busy indicator - disabled citron migration for now - replaced some user-facing legacy strings with eden - Added 10GB and 12GB DRAM layouts - Fix Android black screen issues - add discord link & update FAQ/Quickstart - update links in about page - add back rich presence - add Don't show again for desktop pre alpha banner - add citron warning to android and polaris to desktop Signed-off-by: swurl <swurl@swurl.xyz> Co-authored-by: Pavel Barabanov <pavelbarabanov94@gmail.com> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/101 Co-authored-by: swurl <swurl@swurl.xyz> Co-committed-by: swurl <swurl@swurl.xyz>
* renderer_vulkan: Use raw surface handles and improve release logic (#75)Briar2025-05-021-10/+10
| | | | | | | | | Should fix or at least lessen the crashes when leaving runtime emulation on both Android / PC Also, may have improved the time required to leave the game Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/75 Co-authored-by: Briar <205427297+icy-briar@users.noreply.github.com> Co-committed-by: Briar <205427297+icy-briar@users.noreply.github.com>
* Simplify VkResult lookupMike Lothian2024-01-221-2/+3
|
* renderer_vulkan: do not recreate swapchain for srgbLiam2023-12-031-8/+7
|
* renderer_vulkan: ensure exception on surface lossLiam2023-10-291-0/+6
|
* settings,general: Rename non-confirming enumslat9nq2023-07-211-6/+6
|
* android: Fix screen orientation & blurriness.bunnei2023-06-101-0/+5
|
* android: vulkan: Recreate surface after suspension & adapt to async. ↵bunnei2023-06-031-2/+3
| | | | presentation.
* video_core: vk_swapchain: Fix image format for Android.bunnei2023-06-031-0/+5
|
* renderer_vulkan: remove wrong constexprLiam2023-05-181-2/+2
|
* vk_swapchain: Use certain modes for unlockedlat9nq2023-05-021-23/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | Uses mailbox, then immediate for unlocked framerate depending on support for either. Also adds support for FIFO_RELAXED. This function now assumes vsync_mode was originially configured to a value that the driver supports. vk_swapchain: ChooseSwapPresentMode determines updates Simplifies swapchain a bit and allows us to change the present mode during guest runtime. vk_swapchain: Fix MSVC error vk_swapchain: Enforce available present modes Some frontends don't check the value of vsync_mode before comitting it. Just as well, since a driver update or misconfiguration could problems in the swap chain. vk_swapchain: Silence warnings Silences GCC warnings implicit-fallthrough and shadow, which apparently are not enabled on clang.
* configuration: Expose separate swap present modeslat9nq2023-05-021-13/+14
| | | | | | | | Previously, yuzu would try and guess which vsync mode to use given different scenarios, but apparently we didn't always get it right. This exposes the separate modes in a drop-down the user can select. If a mode isn't available in Vulkan, it defaults to FIFO.
* renderer_vulkan: Async presentationGPUCode2023-05-011-39/+10
|
* vulkan: pick alpha composite flags based on available valuesLiam2023-04-131-1/+14
|
* general: fix spelling mistakesLiam2023-03-121-1/+1
|
* video_core/vulkan: Explicity check swapchain size when deciding to recreateAlexander Orzechowski2022-12-131-7/+8
| | | | | | Vulkan for whatever reason does not return VK_ERROR_OUT_OF_DATE_KHR when the swapchain is the wrong size. Explicity make sure the size is indeed up to date to workaround this.
* general: fix compile for Apple ClangLiam2022-11-221-0/+1
|
* Vulkan Swapchain: Overall improvements.Fernando Sahmkow2022-10-061-3/+12
|
* Make vsync setting work for VulkanDJRobX2022-08-071-2/+3
|
* yuzu: settings: Remove framerate cap and merge unlocked framerate setting.bunnei2022-07-161-3/+3
| | | | - These were all somewhat redundant.
* video_core: Replace VKSwapchain with Swapchaingerman772022-06-261-13/+13
|
* video_core: Replace VKScheduler with Schedulergerman772022-06-261-1/+1
|
* general: Convert source file copyright comments over to SPDXMorph2022-04-231-3/+2
| | | | | This formats all copyright comments according to SPDX formatting guidelines. Additionally, this resolves the remaining GPLv2 only licensed files by relicensing them to GPLv2.0-or-later.
* video_core: Reduce unused includesameerj2022-03-191-2/+0
|
* vk_swapchain: Use immediate present mode when mailbox is unavailable and FPS ↵ameerj2021-09-121-3/+26
| | | | | | is unlocked Allows drivers that do not support VK_PRESENT_MODE_MAILBOX_KHR the ability to present at a framerate higher than the monitor's refresh rate when the FPS is unlocked.
* Merge pull request #6941 from ameerj/swapchain-srgbFernando S2021-09-111-7/+17
|\ | | | | vk_swapchain: Prefer linear swapchain format when presenting sRGB images
| * vulkan_device: Enable VK_KHR_swapchain_mutable_format if availableameerj2021-08-291-0/+11
| | | | | | | | Silences validation errors when creating sRGB image views of linear swapchain images
| * vk_swapchain: Prefer linear swapchain format when presenting sRGB imagesameerj2021-08-291-7/+6
| | | | | | | | Fixes broken sRGB when presenting from a secondary GPU.
* | renderer_vulkan: Wait on present semaphore at queue submitameerj2021-09-021-4/+2
|/ | | | | | | | | | The present semaphore is being signalled by the call to acquire the swapchain image. This semaphore is meant to be waited on when rendering to the swapchain image. Currently it is waited on when presenting, but moving its usage to be waited on in the command buffer submission allows for proper usage of this semaphore. Fixes the device lost when launching titles on the Intel Linux Mesa driver.
* vk_swapchain: Handle outdated swapchainsReinUsesLisp2021-07-221-7/+19
| | | | Fixes pixelated presentation on Intel devices.
* vk_scheduler: Allow command submission on worker threadReinUsesLisp2021-07-221-26/+13
| | | | | | | | | | | | This changes how Scheduler::Flush works. It queues the current command buffer to be sent to the GPU but does not do it immediately. The Vulkan worker thread takes care of that. Users will have to use Scheduler::Flush + Scheduler::WaitWorker to get the previous behavior. Scheduler::Finish is unchanged. To avoid waiting on work never queued, Scheduler::Wait sends the current command buffer if that's what the caller wants to wait.
* renderer_vulkan: Check return value of AcquireNextImageJoshua Ashton2021-04-111-3/+5
| | | | | We can get into a really bad state by ignoring this leading to device loss and using incorrect resources.
* gpu: Report renderer errors with exceptionsReinUsesLisp2021-02-131-2/+5
| | | | | | Instead of using a two step initialization to report errors, initialize the GPU renderer and rasterizer on the constructor and report errors through std::runtime_error.
* renderer_vulkan: Move device abstraction to vulkan_commonReinUsesLisp2021-01-041-1/+1
|
* renderer_vulkan: Rename VKDevice to DeviceReinUsesLisp2021-01-031-1/+1
| | | | | | | The "VK" prefix predates the "Vulkan" namespace. It was carried around the codebase for consistency. "VKDevice" currently is a bad alias with "VkDevice" (only an upcase character of difference) that can cause confusion. Rename all instances of it.