ryujinx-mirror/Ryujinx.Graphics.OpenGL
riperiperi e20abbf9cc
Vulkan: Don't flush commands when creating most sync (#4087)
* Vulkan: Don't flush commands when creating most sync

When the WaitForIdle method is called, we create sync as some internal GPU method may read back written buffer data. Some games randomly intersperse compute dispatch into their render passes, which result in this happening an unbounded number of times depending on how many times they run compute.

Creating sync in Vulkan is expensive, as we need to flush the current command buffer so that it can be waited on. We have a limited number of active command buffers due to how we track resource usage, so submitting too many command buffers will force us to wait for them to return to the pool.

This PR allows less "important" sync (things which are less likely to be waited on) to wait on a command buffer's result without submitting it, instead relying on AutoFlush or another, more important sync to flush it later on.

Because of the possibility of us waiting for a command buffer that hasn't submitted yet, any thread needs to be able to force the active command buffer to submit. The ability to do this has been added to the backend multithreading via an "Interrupt", though it is not supported without multithreading.

OpenGL drivers should already be doing something similar so they don't blow up when creating lots of sync, which is why this hasn't been a problem for these games over there.

Improves Vulkan performance on Xenoblade DE, Pokemon Scarlet/Violet, and Zelda BOTW (still another large issue here)

* Add strict argument

This is technically a separate concern from whether the sync is a host syncpoint.

* Remove _interrupted variable

* Actually wait for the invoke

This is required by AMD GPUs, and also may have caused some issues on other GPUs.

* Remove unused using.

* I don't know why it added these ones.

* Address Feedback

* Fix typo
2022-12-29 15:39:04 +01:00
..
Helper Replace DllImport usage with LibraryImport (#4084) 2022-12-15 18:07:31 +01:00
Image Minor improvement to Vulkan pipeline state and bindings management (#3829) 2022-11-10 13:38:38 -03:00
Queries ui: Fixes disposing on GTK/Avalonia and Firmware Messages on Avalonia (#3885) 2022-11-24 15:08:27 +01:00
BackgroundContextWorker.cs Vulkan backend (#2518) 2022-07-31 18:26:06 -03:00
Buffer.cs Vulkan backend (#2518) 2022-07-31 18:26:06 -03:00
Constants.cs Fix transform feedback errors caused by host pause/resume and multiple uses (#1634) 2020-10-25 17:23:42 -03:00
Debugger.cs Rename DebugLevel Performance to Slowdowns (#1450) 2020-08-07 15:30:06 +02:00
DrawTextureEmulation.cs Implement DrawTexture functionality (#2747) 2021-11-10 15:37:49 -03:00
EnumConversion.cs GPU: Always draw polygon topology as triangle fan (#3932) 2022-11-28 19:18:22 -03:00
FormatInfo.cs Make structs readonly when applicable (#4002) 2022-12-05 14:47:39 +01:00
FormatTable.cs Vulkan: Add ETC2 texture formats (#3576) 2022-08-16 15:42:42 +02:00
Framebuffer.cs OpenGL: Fix clears of unbound color targets (#3564) 2022-08-08 17:39:22 +00:00
Handle.cs Spanify Graphics Abstraction Layer (#1226) 2020-05-23 11:46:09 +02:00
HwCapabilities.cs Move gl_Layer from vertex to geometry if GPU does not support it on vertex (#3866) 2022-11-18 23:27:54 -03:00
IOpenGLContext.cs Miria: The Death of OpenTK 3 (#2194) 2021-04-14 12:28:43 +02:00
OpenGLRenderer.cs Vulkan: Don't flush commands when creating most sync (#4087) 2022-12-29 15:39:04 +01:00
PersistentBuffers.cs Texture Sync, incompatible overlap handling, data flush improvements. (#2971) 2022-01-09 13:28:48 -03:00
Pipeline.cs GAL: Send all buffer assignments at once rather than individually (#3881) 2022-11-24 07:50:59 +00:00
Program.cs New shader cache implementation (#3194) 2022-04-10 10:49:44 -03:00
ResourcePool.cs Texture/Buffer Memory Management Improvements (#1408) 2020-09-10 16:44:04 -03:00
Ryujinx.Graphics.OpenGL.csproj Use NuGet Central Package Management to manage package versions solution-wise (#4095) 2022-12-12 16:03:10 +01:00
Sync.cs GPU: Track buffer migrations and flush source on incomplete copy (#3952) 2022-12-01 16:30:13 +01:00
VertexArray.cs Ensure that vertex attribute buffer index is valid on GPU (#3942) 2022-11-30 18:06:40 -03:00
Window.cs ui: Fixes disposing on GTK/Avalonia and Firmware Messages on Avalonia (#3885) 2022-11-24 15:08:27 +01:00