Commit graph

332 commits

Author SHA1 Message Date
ameerj
f8339cd703 vk_texture_cache: Fix early returns on unsupported scales 2021-11-16 22:11:30 +01:00
ameerj
31478c6c1b video_core: Misc resolution scaling related refactoring 2021-11-16 22:11:30 +01:00
ameerj
88ef04dbaf texture_cache: Refactor scaled image size calculation 2021-11-16 22:11:30 +01:00
Fernando Sahmkow
237a43004f Texture Cache: Fix calculations when scaling. 2021-11-16 22:11:30 +01:00
Fernando Sahmkow
ea82bd4b7e Texture Cache: Fix Rescaling on Multisample 2021-11-16 22:11:30 +01:00
Fernando Sahmkow
19ca0c9ab5 TextureCache: Base fixes on rescaling. 2021-11-16 22:11:30 +01:00
ameerj
6000fe69a4 image_info: Mark MSAA textures as non-rescalable
Blitting or resolving multisampled images requires the dimensions of the src and dst to be equal for valid usage, making them difficult for resolution scaling using the current implementation.
2021-11-16 22:11:30 +01:00
ameerj
68e038404c shader, video_core: Fix GCC build errors 2021-11-16 22:11:29 +01:00
Fernando Sahmkow
d7c9792169 TextureCache: Fix Buffer Views Scaling. 2021-11-16 22:11:29 +01:00
Fernando Sahmkow
4b1393a691 Texture Cache: Correctly fix Blits Rescaling. 2021-11-16 22:11:29 +01:00
ameerj
ed675cfd8c texture_cache: Disable dst_image scaling in BlitImage
Fixes scaling in Super Mario Party
2021-11-16 22:11:29 +01:00
ReinUsesLisp
c7a1cbad44 texture_cache: Add getter to query if image view is rescaled 2021-11-16 22:11:29 +01:00
ReinUsesLisp
2182d25750 texture_cache: Fix blacklists on compute 2021-11-16 22:11:28 +01:00
ReinUsesLisp
56ccda1d99 texture_cache: Simplify image view queries and blacklisting 2021-11-16 22:11:28 +01:00
Fernando Sahmkow
07c564f38b Texture Cache: Implement Rating System. 2021-11-16 22:11:28 +01:00
Fernando Sahmkow
0e8cf38f39 Texture Cache: Implement Blacklisting. 2021-11-16 22:11:28 +01:00
ReinUsesLisp
74efa57c1b texture_cache: Add image getters 2021-11-16 22:11:28 +01:00
ameerj
d5143c83a9 texture_cache: Fix typo in aliased image rescaling 2021-11-16 22:11:28 +01:00
Fernando Sahmkow
dfc65cd0a3 Texture Cache: Implement Rescaling on Aliases and Blits. 2021-11-16 22:11:27 +01:00
Fernando Sahmkow
8704c93913 TextureCache: Fix rescaling of ImageCopies 2021-11-16 22:11:27 +01:00
Fernando Sahmkow
778700ff9d TextureCache: Modify Viewports/Scissors according to Rescale. 2021-11-16 22:11:27 +01:00
Fernando Sahmkow
84f2aea896 Texture Cache: More rescaling fixes. 2021-11-16 22:11:27 +01:00
Fernando Sahmkow
ba18047e8d Texture Cache: Implement Vulkan UpScaling & DownScaling 2021-11-16 22:11:27 +01:00
Fernando Sahmkow
22f4b290b6 VideoCore: Initial Setup for the Resolution Scaler. 2021-11-16 22:11:27 +01:00
Ameer J
494e34af6a
Merge pull request #7070 from FernandoS27/want-you-bad
Vulkan Rasterizer: Correct DepthBias/PolygonOffset on Vulkan.
2021-10-23 18:02:23 -04:00
ameerj
427bf76e62 gpu: Migrate implementation to the cpp file 2021-10-03 00:35:57 -04:00
ameerj
73666fb262 general: Update style to clang-format-12 2021-09-24 15:52:05 -04:00
Fernando Sahmkow
60a3980561 Vulkan Rasterizer: Correct DepthBias/PolygonOffset on Vulkan. 2021-09-23 03:49:10 +02:00
Morph
76abf55f25 slot_vector: Add missing <algorithm> include 2021-09-11 17:19:15 -04:00
Fernando Sahmkow
fe0acec539 Garbage Collection: Make it more agressive on high priority mode. 2021-08-29 18:57:17 +02:00
Fernando Sahmkow
ff48f06fb9 Garbage Collection: Adress Feedback. 2021-08-29 18:19:53 +02:00
Fernando Sahmkow
ba82bb359b Garbage Collection: enable as default, eliminate option. 2021-08-28 17:55:37 +02:00
Fernando Sahmkow
d540d284b5 VideoCore: Rework Garbage Collection. 2021-08-28 17:54:12 +02:00
yzct12345
c4eafcc861
texture_cache: Address ameerj's review 2021-08-08 11:02:51 +00:00
yzct12345
e80323b8b0
texture_cache: Address ameerj's review 2021-08-07 01:27:47 +00:00
yzct12345
02e98f6c93
texture_cache: Don't change copyright year 2021-08-05 20:52:12 +00:00
yzct12345
5566f3dbc0
texture_cache: Address ameerj's review 2021-08-05 20:46:24 +00:00
yzct12345
f9563c8f24
texture_cache: Split templates out 2021-08-05 13:52:30 +00:00
Lioncash
00e100de08 render_target: Add missing initializer for size extent
Everything else has a default constructor that does the straightforward
thing of initializing most members to a default value, except for the
size.

We explicitly initialize the size (and others, for consistency), to
prevent potential uninitialized reads from occurring. Particularly given
the largeish surface area that this struct is used in.
2021-07-27 07:41:21 -04:00
ReinUsesLisp
56d4a9ebde texture_cache: Reduce invalid image/sampler error severity 2021-07-22 21:51:34 -04:00
ReinUsesLisp
d621e96d0d shader: Initial OpenGL implementation 2021-07-22 21:51:30 -04:00
ReinUsesLisp
7cb2ab3585 shader: Implement SULD and SUST 2021-07-22 21:51:26 -04:00
ReinUsesLisp
e9a91bc5cc shader: Interact texture buffers with buffer cache 2021-07-22 21:51:26 -04:00
Fernando S
053860d9cb
Merge pull request #6670 from ReinUsesLisp/prepare-rt
texture_cache: Always prepare image views on render targets
2021-07-19 03:21:25 +02:00
ReinUsesLisp
6d9f347e22 texture_cache/util: Fix size calculations of multisampled images
On the texture cache we handle multisampled images by keeping their real
size in samples (e.g. 1920x1080 with 4 samples is 3840x2160).

This works nicely with size matches and other comparisons, but the
calculation for guest sizes was not having this in mind, and the size
was being multiplied (again) by the number of samples per dimension.
For example a 3840x2160 texture cache image had its width and height
multiplied by 2, resulting in a much larger texture.

Fix this issue.

- Fixes performance regression on cooking related titles when an
  unrelated bug was fixed.
2021-07-18 01:15:48 -03:00
ReinUsesLisp
cb08e5bdd2 texture_cache: Always prepare image views on render targets
Images used as render targets were not being "prepared", causing
desynchronizations on the texture cache. Needs #6669 to avoid
performance regressions on certain cooking titles.

- Fixes black shadows on Age of Calamity.
2021-07-18 00:49:32 -03:00
Fernando Sahmkow
0e4d4b4beb Buffer Cache: Fix High Downloads and don't predownload on Extreme. 2021-07-09 22:20:36 +02:00
c7ad195fd3
Out of bound blit (#6531)
* Fix out of bound blit error

* Fix code read

* Fix ci error

Co-authored-by: Feng Chen <chen.feng@gloritysolutions.com>
2021-07-08 11:06:09 -07:00
bunnei
eb3cb3af35
Merge pull request #6497 from FernandoS27/scotty-doesnt-know
GPU Memory Manager - Correct handling of non continuous backing memory.
2021-07-06 17:26:21 -07:00
bunnei
bf50345d4c
Merge pull request #6537 from Morph1984/warnings
general: Enforce multiple warnings in MSVC
2021-07-05 17:09:23 -07:00
Fernando Sahmkow
c6a9e91784 Texture Cache: Fix collision with multiple overlaps of the same sparse texture. 2021-07-04 22:32:36 +02:00
Fernando Sahmkow
a8a0927d42 Texture Cache: Fix GCC & Clang. 2021-07-04 22:32:35 +02:00
Fernando Sahmkow
8f9f142956 Texture Cache: Address feedback. 2021-07-04 22:32:35 +02:00
Fernando Sahmkow
fd98fcf7f0 Texture Cache: Improve accuracy of sparse texture detection. 2021-07-04 22:32:35 +02:00
Fernando Sahmkow
38165fb7e3 Texture Cache: Initial Implementation of Sparse Textures. 2021-07-04 22:32:03 +02:00
Fernando Sahmkow
ebaa7e391c TextureCache: Fix 1D to 2D overlapps. 2021-07-03 14:01:54 +02:00
Morph
d3d6613d33 video_core: Silence signed/unsigned mismatch warnings 2021-06-28 09:21:42 -04:00
ReinUsesLisp
b4894faeae buffer_cache/texture_cache: Make GC functions private 2021-06-26 02:17:36 -03:00
Wunkolo
4569f39c7c common: Replace common_sizes into user-literals
Removes common_sizes.h in favor of having `_KiB`, `_MiB`, `_GiB`, etc
user-literals within literals.h.

To keep the global namespace clean, users will have to use:

```
using namespace Common::Literals;
```

to access these literals.
2021-06-24 09:27:40 -07:00
Mai M
17fff10e06
Merge pull request #6465 from FernandoS27/sex-on-the-beach
GPU: Implement a garbage collector for GPU Caches (project Reaper+)
2021-06-23 08:03:01 -04:00
Fernando Sahmkow
f9b940a442 Reaper: Set minimum cleaning limit on OGL. 2021-06-22 22:07:17 +02:00
Fernando Sahmkow
569a1962c0 Reaper: Guarantee correct deletion. 2021-06-20 19:11:41 +02:00
Ameer J
c5b517aa5f
Merge pull request #6469 from ReinUsesLisp/blit-view-compat
texture_cache/util: Avoid relaxed image views on different bytes per block
2021-06-16 21:08:07 -04:00
Fernando Sahmkow
ca6f47c686 Reaper: Change memory restrictions on TC depending on host memory on VK. 2021-06-17 00:29:48 +02:00
Fernando Sahmkow
0dd98842bf Reaper: Address Feedback. 2021-06-16 21:35:03 +02:00
Fernando Sahmkow
954ad2a61e Reaper: Setup settings and final tuning. 2021-06-16 21:35:03 +02:00
Fernando Sahmkow
d8ad6aa187 Reaper: Tune it up to be an smart GC. 2021-06-16 21:35:02 +02:00
ReinUsesLisp
a11bc4a382 Initial Reaper Setup
WIP
2021-06-16 21:35:02 +02:00
ameerj
c4ff7ecf51 textures: Reintroduce CPU ASTC decoder
Users may want to fall back to the CPU ASTC texture decoder due to hangs
and crashes that may be caused by keeping the GPU under compute heavy
loads for extended periods of time. This is especially the case in games
such as Astral Chain which make extensive use of ASTC textures.
2021-06-15 20:19:00 -04:00
ReinUsesLisp
3d89398b84 texture_cache/util: Avoid relaxed image views on different bytes per pixel
Avoids API usage errors on UE4 titles leading to crashes.
2021-06-14 21:03:57 -03:00
Markus Wick
6755025310 Fix GCC undefined behavior sanitizer.
* Wrong alignment in u64 LOG_DEBUG -> memcpy.
* Huge shift exponent in stride calculation for linear buffer, unused result -> skipped.
* Large shift in buffer cache if word = 0, skip checking for set bits.

Non of those were critical, so this should not change any behavior.
At least with the assumption, that the last one used masking behavior, which always yield continuous_bits = 0.
2021-06-10 21:07:27 +02:00
ameerj
3671fd0a97 texture_cache: Handle out of bound texture blits
Some games interleave a texture blit using regions which are out-of-bounds. This addresses the interleaving to avoid oob reads from the src texture.
2021-05-07 22:14:21 -04:00
Lioncash
17b7f0389a texture_cache/util: Fix src being used instead of dst within DeduceBlitImages
This line can only ever be reached if src is null, so dereferencing it
here is a logic bug that slipped through.

Instead, we dereference dst instead which is guaranteed to be valid.
2021-04-19 13:01:50 -04:00
bunnei
a4c6712a4b common: Move settings to common from core.
- Removes a dependency on core and input_common from common.
2021-04-14 16:24:03 -07:00
Lioncash
fddb278aa3 texure_cache/util: Resolve implicit sign conversions with std::reduce
Amends implicit sign conversions occurring with usages of std::reduce
and also relocates it to its own utility function to reduce verbosity a
little bit.
2021-04-12 05:21:53 -04:00
ameerj
2f83d9a61b astc_decoder: Refactor for style and more efficient memory use 2021-03-25 16:53:51 -04:00
ameerj
20eb368e14 renderer_vulkan: Accelerate ASTC decoding
Co-Authored-By: Rodrigo Locatti <reinuseslisp@airmail.cc>
2021-03-13 12:16:03 -05:00
ameerj
5213f70230 texture_cache: Blacklist BGRA8 copies and views on OpenGL
In order to force the BGRA8 conversion on Nvidia using OpenGL, we need to forbid texture copies and views with other formats.

This commit also adds a boolean relating to this, as this needs to be done only for the OpenGL api, Vulkan must remain unchanged.
2021-03-04 14:14:49 -05: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
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
Lioncash
783dc9e112 texture_cache/util: Remove unused functions
Silences a few warnings on clang 12.
2021-02-09 17:30:20 -05:00
ReinUsesLisp
1b76e7e890 video_core: Silence -Wmissing-field-initializers warnings 2021-01-24 04:32:19 -03:00
Lioncash
5f4e7c77bd texture_cache/util: Resolve -Wsign-compare warning
Resolves a -Wsign-compare warning on Clang.
2021-01-17 02:47:48 -05:00
ReinUsesLisp
fe494a0ccd common/alignment: Rename AlignBits to AlignUpLog2
AlignUpLog2 describes what the function does better than AlignBits.
2021-01-15 04:13:33 -03:00
MerryMage
aace20afc7 texture_cache: Replace PAGE_SHIFT with PAGE_BITS
PAGE_SHIFT is a #define in system headers that leaks into user code on some systems
2021-01-07 16:51:34 +00:00
ReinUsesLisp
7d904fef2e gl_texture_cache: Avoid format views on Intel and AMD
Intel and AMD proprietary drivers are incapable of rendering to texture
views of different formats than the original texture. Avoid creating
these at a cache level. This will consume more memory, emulating them
with copies.
2021-01-04 02:06:40 -03:00
ReinUsesLisp
9764c13d6d video_core: Rewrite the texture cache
The current texture cache has several points that hurt maintainability
and performance. It's easy to break unrelated parts of the cache
when doing minor changes. The cache can easily forget valuable
information about the cached textures by CPU writes or simply by its
normal usage.The current texture cache has several points that hurt
maintainability and performance. It's easy to break unrelated parts
of the cache when doing minor changes. The cache can easily forget
valuable information about the cached textures by CPU writes or simply
by its normal usage.

This commit aims to address those issues.
2020-12-30 03:38:50 -03:00
Lioncash
4c5f5c9bf3 video_core: Remove unnecessary enum class casting in logging messages
fmt now automatically prints the numeric value of an enum class member
by default, so we don't need to use casts any more.

Reduces the line noise a bit.
2020-12-07 00:41:50 -05:00
Lioncash
f95602f152 video_core: Resolve more variable shadowing scenarios pt.3
Cleans out the rest of the occurrences of variable shadowing and makes
any further occurrences of shadowing compiler errors.
2020-12-05 16:02:23 -05:00
Lioncash
414a87a4f4 video_core: Resolve more variable shadowing scenarios pt.2
Migrates the video core code closer to enabling variable shadowing
warnings as errors.

This primarily sorts out shadowing occurrences within the Vulkan code.
2020-12-05 06:39:35 -05:00
Lioncash
5553bd3ba2 General: Resolve a few missing initializer warnings
Resolves a few -Wmissing-initializer warnings.
2020-10-29 19:37:07 -04:00
Lioncash
ff45c39578 General: Make use of std::nullopt where applicable
Allows some implementations to avoid completely zeroing out the internal
buffer of the optional, and instead only set the validity byte within
the structure.

This also makes it consistent how we return empty optionals.
2020-09-22 17:32:33 -04:00
ReinUsesLisp
9e87193725 video_core: Remove all Core::System references in renderer
Now that the GPU is initialized when video backends are initialized,
it's no longer needed to query components once the game is running: it
can be done when yuzu is booting.

This allows us to pass components between constructors and in the
process remove all Core::System references in the video backend.
2020-09-06 05:28:48 -03:00
bunnei
5429ea0e69
Merge pull request #4389 from ogniK5377/redundant-format-type
video_core: Remove redundant pixel format type
2020-08-07 09:33:58 -04:00
bunnei
4c0f6f1bc8
Merge pull request #4396 from lioncash/comma
surface_params: Replace questionable usages of the comma operator with semicolons
2020-07-29 19:55:44 -04:00
bunnei
1d7de0a8ee
Merge pull request #4394 from lioncash/unused6
video_core: Remove unused variables
2020-07-23 19:54:59 -07:00
Lioncash
82b7e5c8ee surface_params: Make use of designated initializers where applicable
Provides a convenient way to avoid unnecessary zero initializing.
2020-07-21 02:27:22 -04:00
Lioncash
bd9545a3a8 surface_params: Remove redundant assignment
This is a redundant assignment that can be removed.
2020-07-21 02:26:49 -04:00
Lioncash
c705a1db96 surface_params: Replace questionable usages of the comma operator with semicolons
These are bugs waiting to happen.
2020-07-21 02:26:48 -04:00
Lioncash
e17fb5ee97 video_core: Remove unused variables
Silences several compiler warnings about unused variables.
2020-07-21 00:57:25 -04:00