Commit graph

17883 commits

Author SHA1 Message Date
LC 06e3d3a658
Merge pull request #5917 from ReinUsesLisp/require-robustness2
vulkan_device: Require VK_EXT_robustness2
2021-02-13 02:55:31 -05:00
ReinUsesLisp 757fd1e917 vulkan_device: Require VK_EXT_robustness2
We are already using robustness2 features without requiring it
explicitly, causing potential crashes on drivers without the extension.
Requiring this at boot allows better diagnostics for it and formalizes
our usage on the extension.
2021-02-13 03:31:50 -03:00
bunnei d3c7a7e7cf
Merge pull request #5741 from ReinUsesLisp/new-bufcache
video_core: Reimplement the buffer cache
2021-02-12 22:22:18 -08:00
ReinUsesLisp 13becdf18a config: Make high GPU accuracy the default
This is a better default for most games, yielding better performance and
less graphical issues.
2021-02-13 02:38:05 -03:00
ReinUsesLisp 5b35b01070 video_core: Fix clang build issues 2021-02-13 02:26:47 -03:00
ReinUsesLisp 025fe458ae vk_staging_buffer_pool: Fix softlock when stream buffer overflows
There was still a code path that could wait on a timeline semaphore tick
that would never be signalled.

While we are at it, make use of more STL algorithms.
2021-02-13 02:18:38 -03:00
ReinUsesLisp 3a2eefb16c vk_buffer_cache: Add support for null index buffers
Games can bind a null index buffer (size=0) where all indices are
evaluated as zero. VK_EXT_robustness2 doesn't support this and all
drivers segfault when a null index buffer is passed to
vkCmdBindIndexBuffer.

Workaround this by creating a 4 byte buffer and filling it with zeroes.
If it's read out of bounds, robustness takes care of returning zeroes as
indices.
2021-02-13 02:18:38 -03:00
ReinUsesLisp 0b8b961442 buffer_cache: Add extra bytes to guest SSBOs
Bind extra bytes beyond the guest API's bound range.
This is due to some games like Astral Chain operating out of bounds.
Binding the whole map range would be technically correct, but games
have large maps that make this approach unaffordable for now.
2021-02-13 02:18:38 -03:00
ReinUsesLisp 93a69b6cc8 Merge branch 'bytes-to-map-end' into new-bufcache-wip 2021-02-13 02:18:35 -03:00
ReinUsesLisp 7402442442 vk_staging_buffer_pool: Get a staging buffer instead of waiting
Avoids waiting idle while the GPU finishes to do work, and fixes an
issue where we'd wait forever if a single command buffer (logic tick)
all the data.
2021-02-13 02:18:05 -03:00
ReinUsesLisp 75fd3f95a3 yuzu/config: Disable assembly shaders by default
Due to BindBufferRangeNV limitations and poor quality code emission from
our side, assembly shaders are currently slower than GLSL. Their build
time and feature advantages are still relevant, but they are outweighted
by their runtime performance.
2021-02-13 02:18:05 -03:00
ReinUsesLisp 0b631f22fc renderer_opengl: Remove interop
Remove unused interop code from the OpenGL backend.
2021-02-13 02:18:04 -03:00
ReinUsesLisp 3da87d3f12 gl_buffer_cache: Drop interop based parameter buffer workarounds
Sacrify runtime performance to avoid generating kernel exceptions on
Windows due to our abusive aliasing of interop buffer objects.
2021-02-13 02:17:24 -03:00
ReinUsesLisp 2b95c137ff buffer_cache: Heuristically detect stream buffers
Detect when a memory region has been joined several times and increase
the size of the created buffer on those instances. The buffer is assumed
to be a "stream buffer", increasing its size should stop us from
constantly recreating it and fragmenting memory.
2021-02-13 02:17:24 -03:00
ReinUsesLisp ec9354d6d9 buffer_cache: Split CreateBuffer in separate functions
Allow adding functionality to each function without making CreateBuffer
more complex.
2021-02-13 02:17:24 -03:00
ReinUsesLisp a02b4e1df6 buffer_cache: Skip cache on small uploads on Vulkan
Ports from OpenGL the optimization to skip small 3D uniform buffer
uploads. This will take advantage of the previously introduced stream
buffer.

Fixes instances where the staging buffer offset was being ignored.
2021-02-13 02:17:24 -03:00
ReinUsesLisp 35df1d1864 vk_staging_buffer_pool: Add stream buffer for small uploads
This uses a ring buffer similar to OpenGL's stream buffer for small
uploads. This stops us from allocating several small buffers, reducing
memory fragmentation and cache locality.

It uses dedicated allocations when possible.
2021-02-13 02:17:24 -03:00
ReinUsesLisp 8fd518ec40 vulkan_device: Enable robustBufferAccess
Fix regression on Pascal on Animal Crossing: New Horizons, fixing a
validation error.
2021-02-13 02:17:23 -03:00
ReinUsesLisp 82c2601555 video_core: Reimplement the buffer cache
Reimplement the buffer cache using cached bindings and page level
granularity for modification tracking. This also drops the usage of
shared pointers and virtual functions from the cache.

- Bindings are cached, allowing to skip work when the game changes few
  bits between draws.
- OpenGL Assembly shaders no longer copy when a region has been modified
  from the GPU to emulate constant buffers, instead GL_EXT_memory_object
  is used to alias sub-buffers within the same allocation.
- OpenGL Assembly shaders stream constant buffer data using
  glProgramBufferParametersIuivNV, from NV_parameter_buffer_object. In
  theory this should save one hash table resolve inside the driver
  compared to glBufferSubData.
- A new OpenGL stream buffer is implemented based on fences for drivers
  that are not Nvidia's proprietary, due to their low performance on
  partial glBufferSubData calls synchronized with 3D rendering (that
  some games use a lot).
- Most optimizations are shared between APIs now, allowing Vulkan to
  cache more bindings than before, skipping unnecesarry work.

This commit adds the necessary infrastructure to use Vulkan object from
OpenGL. Overall, it improves performance and fixes some bugs present on
the old cache. There are still some edge cases hit by some games that
harm performance on some vendors, this are planned to be fixed in later
commits.
2021-02-13 02:17:22 -03:00
ReinUsesLisp a39d9c5194 vulkan_common: Expose interop and headless devices 2021-02-13 02:16:21 -03:00
ReinUsesLisp 47d5ec6cfc vulkan_common: Make interop extensions mandatory 2021-02-13 02:16:21 -03:00
ReinUsesLisp 40ed0cb920 vulkan_device: Enable robust buffers 2021-02-13 02:16:21 -03:00
ReinUsesLisp 1a987054c5 vulkan_device: Use designated initializers for features 2021-02-13 02:16:21 -03:00
ReinUsesLisp 79afdeaf08 vulkan_wrapper: Add memory barrier pipeline barrier helper 2021-02-13 02:16:21 -03:00
ReinUsesLisp 004a8d6a7a vulkan_device: Fix formatting of constants 2021-02-13 02:16:21 -03:00
ReinUsesLisp 16f97ded21 vulkan_wrapper: Add interop functions 2021-02-13 02:16:21 -03:00
ReinUsesLisp 9735c34f5d vulkan_instance: Initialize Vulkan instance in a separate thread
Workaround an issue on Nvidia where creating a Vulkan instance from an
active OpenGL thread disables threaded optimization on the driver.
This optimization is important to have good performance on Nvidia
OpenGL.
2021-02-13 02:16:21 -03:00
ReinUsesLisp dde19e7d75 vulkan_wrapper: Pull Windows symbols 2021-02-13 02:16:21 -03:00
ReinUsesLisp 75ccd9959c gpu: Report renderer errors with exceptions
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.
2021-02-13 02:16:19 -03:00
ReinUsesLisp 19156292a3 tests/buffer_base: Add cached CPU writes tests
Ensure the behavior of the previous commit in tests.
2021-02-13 02:15:29 -03:00
ReinUsesLisp 9d8ca6cc4a buffer_base: Add support for cached CPU writes
Some games usually write memory pages currently used by the GPU, causing
rendering issues (e.g. flashing geometry and shadows on Link's
Awakening). To workaround this issue, Guest CPU writes are delayed until
the command buffer finishes processing, but the pages are updated
immediately.

The overall behavior is:
- CPU writes are cached until they are flushed, they update the page
  state, but don't change the modification state. Cached writes stop
  pages from being flushed, in case games have meaningful data in it.
- Command processing writes (e.g. push constants) update the page state
  and are marked to the command processor as dirty. They don't remove
  the state of cached writes.
2021-02-13 02:15:29 -03:00
ameerj 069afcc633 maxwell_to_gl: Remove unused code
Removes unused declarations in maxwell_to_gl.h
2021-02-12 23:01:09 -05:00
Chloe Marcec 7ad63ea542 revert to std::sin and std::cos 2021-02-12 18:48:10 -08:00
Chloe Marcec d28b942458 address issues 2021-02-12 18:48:10 -08:00
Chloe Marcec 4a7fd91857 audren: Implement I3dl2Reverb
Most notable fix is the voices in Fire Emblem Three Houses
2021-02-12 18:48:10 -08:00
bunnei c86d770af9
Merge pull request #5877 from ameerj/res-limit-usage
kernel: More accurately utilize resource_limit
2021-02-12 18:21:30 -08:00
ameerj ec9b6641b1 kernel: More accurately reserve and release resources 2021-02-12 19:05:24 -05:00
ameerj 5fa6b15215 kernel: KScopedReservation implementation
This implements KScopedReservation, allowing resource limit reservations to be more HW accurate, and release upon failure without requiring too many conditionals.
2021-02-12 18:57:34 -05:00
Chloe 37939482fb
kernel: Unify result codes (#5890)
* kernel: Unify result codes

Drop the usage of ERR_NAME convention in kernel for ResultName. Removed seperation between svc_results.h & errors.h as we mainly include both most of the time anyways.

* oops

* rename errors to svc_results
2021-02-12 15:43:01 -08:00
lat9nq dcc0617cc2 yuzu: Create screenshot path before capture
Allows screenshots in cases where the screenshots path doesn't already
exist.
2021-02-12 17:26:01 -05:00
bunnei a0379c2db5
Merge pull request #5902 from lioncash/core-warn
core: Silence various warnings on Clang 12
2021-02-11 18:57:23 -08:00
bunnei e53b6ecc76
Merge pull request #5869 from german77/mousePanning
input_common: Add mouse panning
2021-02-11 09:58:23 -08:00
bunnei f06c3f4907
Merge pull request #5908 from Morph1984/swkbd-finalize
software_keyboard: Implement Finalize request command
2021-02-10 21:49:53 -08:00
Morph 886043a6d2 software_keyboard: Implement Finalize request command 2021-02-10 21:42:49 -05:00
bunnei 3e6e0d8f13
Merge pull request #5893 from lioncash/input
configure_input_player_widget: Minor cleanup
2021-02-10 10:55:59 -08:00
LC dee133ab3d
Merge pull request #5904 from lat9nq/common-sized-dealloc
common: Add -fsized-deallocation as a Clang flag
2021-02-09 23:45:52 -05:00
LC 3c22ce035b
Merge pull request #5905 from lat9nq/core-sized-dealloc
core: Add -fsized-dealloction as a Clang flag
2021-02-09 23:45:36 -05:00
LC a5e184e948
Merge pull request #5903 from lat9nq/config-silence-warns
configure_input_player_widget: Silence unused variable warnings
2021-02-09 23:44:58 -05:00
lat9nq c44ab0f8f6 cmake: Update FFmpeg to 4.3.1
Download FFmpeg package version 4.3.1. Uses a file defined within the
package to determine with DLLs to copy.

Also corrects a submodule name.
2021-02-09 22:17:22 -05:00
lat9nq 0e004269a9 configure_input_player_widget: Silence unused variable warnings
Prevents clang 11 from throwing an error since these variables are
unused.
2021-02-09 22:09:23 -05:00