Commit Graph

29 Commits

Author SHA1 Message Date
58b0ae84b5 renderer_vulkan: Make unconditional use of VK_KHR_timeline_semaphore
This reworks how host<->device synchronization works on the Vulkan
backend. Instead of "protecting" resources with a fence and signalling
these as free when the fence is known to be signalled by the host GPU,
use timeline semaphores.

Vulkan timeline semaphores allow use to work on a subset of D3D12
fences. As far as we are concerned, timeline semaphores are a value set
by the host or the device that can be waited by either of them.

Taking advantange of this, we can have a monolithically increasing
atomic value for each submission to the graphics queue. Instead of
protecting resources with a fence, we simply store the current logical
tick (the atomic value stored in CPU memory). When we want to know if a
resource is free, it can be compared to the current GPU tick.

This greatly simplifies resource management code and the free status of
resources should have less false negatives.

To workaround bugs in validation layers, when these are attached there's
a thread waiting for timeline semaphores.
2020-09-19 01:46:37 -03:00
eb914b6c50 video_core: Enforce -Werror=switch
This forces us to fix all -Wswitch warnings in video_core.
2020-09-16 17:48:01 -03:00
2d2e235bcf Merge pull request #4522 from lioncash/vulk-copy
vulkan/wrapper: Avoid unnecessary copy in EnumerateInstanceExtensionProperties()
2020-08-18 19:31:35 -04:00
6ac97405df Vk Async pipeline compilation 2020-08-16 12:02:22 -04:00
167d36ec3c vulkan/wrapper: Avoid unnecessary copy in EnumerateInstanceExtensionProperties()
Given this is implicitly creating a std::optional, we can move the
vector into it.
2020-08-14 08:23:49 -04:00
7785123b1c wrapper: Make use of designated initializers where applicable 2020-07-16 20:01:01 -04:00
35f7740b6c Merge pull request #4150 from ReinUsesLisp/dynamic-state-impl
vulkan: Use VK_EXT_extended_dynamic_state when available
2020-07-07 10:58:09 -04:00
a6db8e5f4d renderer_vulkan/wrapper: Add VK_EXT_extended_dynamic_state functions 2020-06-26 20:55:15 -03:00
2f09c7ddd3 renderer_vulkan: Update validation layer name and test before enabling
Update validation layer string to VK_LAYER_KHRONOS_validation.

While we are at it, properly check for available validation layers
before enabling them.
2020-06-22 04:10:45 -03:00
a6e5b84d1f vulkan/wrapper: Remove noexcept from GetSurfaceCapabilitiesKHR()
Check() can throw an exception if the Vulkan result isn't successful.

We remove the check so that std::terminate isn't outright called and
allows for better debugging (should it ever actually fail).
2020-06-19 23:01:59 -04:00
fe931ac976 {maxwell_3d,buffer_cache}: Implement memory barriers using 3D registers
Drop MemoryBarrier from the buffer cache and use Maxwell3D's register
WaitForIdle.

To implement this on OpenGL we just call glMemoryBarrier with the
necessary bits.

Vulkan lacks this synchronization primitive, so we set an event and
immediately wait for it. This is not a pretty solution, but it's what
Vulkan can do without submitting the current command buffer to the queue
(which ends up being more expensive on the CPU).
2020-04-28 02:18:12 -03:00
c5bf693882 Merge pull request #3721 from ReinUsesLisp/sort-devices
vulkan/wrapper: Sort physical devices
2020-04-25 03:27:40 -04:00
bf2ddb8fd5 Merge pull request #3677 from FernandoS27/better-sync
Introduce Predictive Flushing and Improve ASYNC GPU
2020-04-22 22:09:38 -04:00
b752faf2d3 vk_fence_manager: Initial implementation 2020-04-22 11:36:19 -04:00
c81bf06d03 vulkan/wrapper: Sort physical devices
Sort discrete GPUs over the rest, Nvidia over AMD, AMD over Intel, Intel
over the rest. This gives us a somewhat consistent order when Optimus
is removed (renderdoc does this when it's attached).

This can break the configuration of users with an Intel GPU that
manually remove Optimus on yuzu. That said, it's a very unlikely to
happen.
2020-04-18 21:31:15 -03:00
0e232cfdc1 renderer_vulkan: Integrate Nvidia Nsight Aftermath on Windows
Adds optional support for Nsight Aftermath. It is enabled through
ENABLE_NSIGHT_AFTERMATH in cmake. A path to the SDK has to be provided
by the environment variable NSIGHT_AFTERMATH_SDK.

Nsight Aftermath allows an application to generate "minidumps" of the
GPU state when a device loss happens. By analysing these on Nsight we
can know what a game was doing and why it triggered a device loss.

The dump is generated inside %APPDATA%\yuzu\log\gpucrash and this
directory is deleted every time a new instance is initialized with
Nsight enabled.

To enable it on yuzu there has a to be a driver and device capable of
running Nsight Aftermath on Vulkan. That means only Turing based GPUs
on the latest stable driver, beta drivers won't work for now.

It is manually enabled in Configuration>Debug>Enable Graphics Debugging
because when using all debugging capabilities there is a runtime cost.
2020-04-14 00:39:21 -03:00
6cfe2a7246 renderer_vulkan: Remove Nvidia checkpoints 2020-04-13 17:33:59 -03:00
f22f6b72c3 renderer_vulkan/wrapper: Add vkEnumerateInstanceExtensionProperties wrapper 2020-03-31 21:32:08 -03:00
5c90d060d8 renderer_vulkan/wrapper: Add physical device handle 2020-03-31 21:32:08 -03:00
0eb37de98f renderer_vulkan/wrapper: Add device handle 2020-03-31 21:32:08 -03:00
11774308d3 renderer_vulkan/wrapper: Add swapchain handle 2020-03-31 21:32:07 -03:00
397f53dea1 renderer_vulkan/wrapper: Add pool handles 2020-03-31 21:32:07 -03:00
affee77b70 renderer_vulkan/wrapper: Add buffer and image handles 2020-03-31 21:32:07 -03:00
d85ca0ab33 renderer_vulkan/wrapper: Add queue handle 2020-03-31 21:32:07 -03:00
151ddcf419 renderer_vulkan/wrapper: Add instance handle 2020-03-31 21:32:07 -03:00
60f351084a renderer_vulkan/wrapper: Add destroy and free overload set 2020-03-27 03:21:04 -03:00
a9e4528d10 renderer_vulkan/wrapper: Add dispatch table and loaders 2020-03-27 03:21:04 -03:00
3f0b7673f0 renderer_vulkan/wrapper: Add exception class 2020-03-27 03:21:04 -03:00
f5cee0e885 renderer_vulkan/wrapper: Add ToString function for VkResult 2020-03-27 03:21:03 -03:00