Commit graph

6882 commits

Author SHA1 Message Date
comex
85d77f636c Fixes and workarounds to make UBSan happier on macOS
There are still some other issues not addressed here, but it's a start.

Workarounds for false-positive reports:

- `RasterizerAccelerated`: Put a gigantic array behind a `unique_ptr`,
  because UBSan has a [hardcoded limit](https://stackoverflow.com/questions/64531383/c-runtime-error-using-fsanitize-undefined-object-has-a-possibly-invalid-vp)
  of how big it thinks objects can be, specifically when dealing with
  offset-to-top values used with multiple inheritance.  Hopefully this
  doesn't have a performance impact.

- `QueryCacheBase::QueryCacheBase`: Avoid an operation that UBSan thinks
  is UB even though it at least arguably isn't.  See the link in the
  comment for more information.

Fixes for correct reports:

- `PageTable`, `Memory`: Use `uintptr_t` values instead of pointers to
  avoid UB from pointer overflow (when pointer arithmetic wraps around
  the address space).

- `KScheduler::Reload`: `thread->GetOwnerProcess()` can be `nullptr`;
  avoid calling methods on it in this case.  (The existing code returns
  a garbage reference to a field, which is then passed into
  `LoadWatchpointArray`, and apparently it's never used, so it's
  harmless in practice but still triggers UBSan.)

- `KAutoObject::Close`: This function calls `this->Destroy()`, which
  overwrites the beginning of the object with junk (specifically a free
  list pointer).  Then it calls `this->UnregisterWithKernel()`.  UBSan
  complains about a type mismatch because the vtable has been
  overwritten, and I believe this is indeed UB.  `UnregisterWithKernel`
  also loads `m_kernel` from the 'freed' object, which seems to be
  technically safe (the overwriting doesn't extend as far as that
  field), but seems dubious.  Switch to a `static` method and load
  `m_kernel` in advance.
2023-07-15 12:00:28 -07:00
Alexandre Bouvier
dad3ef76a2 cmake: allow using system VMA library 2023-07-12 04:51:45 +02:00
bunnei
ab18aeb500 Merge pull request #10996 from Kelebek1/readblock_optimisation
Use spans over guest memory where possible instead of copying data
2023-07-10 18:54:19 -07:00
liamwhite
5688b55070 Merge pull request #10994 from liamwhite/ue4-preferred
vulkan_common: use device local preferred for image memory
2023-07-05 09:23:56 -04:00
liamwhite
81a137aa71 Merge pull request #11012 from gidoly/metroid-fix
Fix regression by unreal engine fix pr #11009
2023-07-05 09:23:34 -04:00
bunnei
66a20ecbc7 video_core: vulkan_device: Disable timeline semaphore on Turnip, fix qcom version check. 2023-07-03 19:25:06 -07:00
bunnei
d8cda2c0b6 Merge pull request #10964 from bunnei/gpu-remove-qcom-check
video_core: vulkan_device: Fix S8Gen2 dynamic state checks.
2023-07-03 16:59:29 -07:00
bunnei
3bf2a14213 video_core: vulkan_device: Change to driver version check. 2023-07-03 14:25:06 -07:00
gidoly
66cb683f1e oops re open 2023-07-03 20:25:23 +09:00
Kelebek1
42638691b5 Use spans over guest memory where possible instead of copying data. 2023-07-02 23:09:48 +01:00
liamwhite
d81539ed2d Merge pull request #10479 from GPUCode/format-list
Add support for VK_KHR_image_format_list
2023-07-02 17:38:21 -04:00
liamwhite
1bd420593c Merge pull request #10942 from FernandoS27/android-is-a-pain-in-the-a--
Memory Tracking: Add mechanism to register small writes when gpu page is contested by GPU
2023-07-02 11:29:01 -04:00
Liam
aa2743de67 vulkan_common: use device local preferred for image memory 2023-07-01 23:44:57 -04:00
Liam
c9cbfadcdc Revert "texture_cache: Fix incorrect logic for AccelerateDMA"
This reverts commit e9c07146d8.
2023-07-01 23:37:50 -04:00
liamwhite
2a11936fa3 Merge pull request #10984 from comex/cob
Minor cleanup in BufferCacheRuntime::ReserveNullBuffer
2023-07-01 22:38:33 -04:00
liamwhite
004b9609b0 Merge pull request #10974 from Steveice10/macos_vk
vulkan: Improvements to macOS surface creation
2023-07-01 22:38:26 -04:00
liamwhite
ab339d1af3 Merge pull request #10970 from Morph1984/thing
general: Misc changes that did not deserve their own PRs
2023-07-01 22:38:18 -04:00
comex
1e1b0dccaf Minor cleanup in BufferCacheRuntime::ReserveNullBuffer
As far as I can tell, there is no reason to OR this bit in separately.
2023-07-01 12:00:25 -07:00
GPUCode
4270b443f8 renderer_vulkan: Fix some missing view formats
* Many times the format itself wouldn't have been added to the list causing device losses for nvidia GPUs

* Also account for ASTC acceleration storage views
2023-07-01 16:03:35 +03:00
GPUCode
b7e726669e renderer_vulkan: Add support for VK_KHR_image_format_list 2023-07-01 16:03:29 +03:00
Steveice10
19a0345f69 vulkan: Use newer VK_EXT_metal_surface to create surface for MoltenVK. 2023-06-30 23:46:03 -07:00
Morph
10f95299eb maxwell_dma: Specify dst_operand.pitch instead of a temp var 2023-06-30 21:49:59 -04:00
Morph
b8004b2472 general: Use ScratchBuffer where possible 2023-06-30 21:49:59 -04:00
Fernando S
9cb5d582d6 Merge pull request #10953 from FernandoS27/oh-oopsies-yfc
Texture cache: Fix YFC regression due to code testing
2023-06-30 20:25:09 +02:00
Fernando S
068fdeb0e8 Merge pull request #10956 from FernandoS27/pikmin-another-game-ill-hate
AccelerateDMA: Don't accelerate 3D texture DMA operations
2023-06-30 09:37:07 +02:00
bunnei
bdf171633f video_core: vulkan_device: Scope S8Gen2 checks to just Qualcomm. 2023-06-29 18:41:38 -07:00
bunnei
de534a8b82 video_core: vulkan_device: Fix S8Gen2 dynamic state checks. 2023-06-29 17:37:42 -07:00
Fernando Sahmkow
71c38a6eb3 AccelerateDMA: Don't accelerate 3D texture DMA operations 2023-06-29 17:23:29 +02:00
Fernando Sahmkow
8efc8dba3e Texture cache: Fix YFC regression due to code testing 2023-06-29 11:58:45 +02:00
Matías Locatti
64640b6d07 Blacklist EDS3 blending from new AMD drivers 2023-06-28 20:10:27 -03:00
Fernando Sahmkow
4f68a8f45a Memory Tracking: Optimize tracking to only use atomic writes when contested with the host GPU 2023-06-28 21:32:45 +02:00
Fernando Sahmkow
7ae0cdbb09 MemoryTracking: Initial setup of atomic writes. 2023-06-28 19:34:21 +02:00
GPUCode
9e58301aec renderer_vulkan: Prevent crashes when blitting depth stencil 2023-06-27 18:00:09 -07:00
GPUCode
5196f05cec video_core: Add BCn decoding support 2023-06-27 18:00:09 -07:00
GPUCode
8a829a12b6 renderer_vulkan: Add more feature checking 2023-06-27 18:00:09 -07:00
GPUCode
d8a98f124a renderer_vulkan: Don't assume debug tool with debug renderer
* Causes crashes because mali drivers don't support debug utils
2023-06-27 18:00:09 -07:00
GPUCode
5011526a94 renderer_vulkan: Bump minimum SPIRV version
* 1.3 is guaranteed on all 1.1 drivers
2023-06-27 18:00:09 -07:00
GPUCode
035b4eaf46 renderer_vulkan: Respect viewport limit 2023-06-27 18:00:09 -07:00
GPUCode
1af4dc2ed7 renderer_vulkan: Don't add transform feedback flag if unsupported 2023-06-27 18:00:09 -07:00
GPUCode
843d93b951 renderer_vulkan: Add suport for debug report callback 2023-06-27 18:00:09 -07:00
liamwhite
8a679be44b Merge pull request #10867 from Kelebek1/dma_safe
Use safe reads in DMA engine
2023-06-27 11:21:47 -04:00
liamwhite
4f21c05522 Merge pull request #10473 from GPUCode/vma
Use vulkan memory allocator
2023-06-27 11:21:36 -04:00
GPUCode
7a8631cd45 externals: Use cmake subdirectory 2023-06-26 18:59:24 +03:00
Kelebek1
c80b6bfb83 Use safe reads in DMA engine 2023-06-26 11:34:02 +01:00
ameerj
5ae4d9983b OpenGL: Limit lmem warmup to NVIDIA
🐸
2023-06-25 19:06:51 -04:00
ameerj
28cecc6cd8 shaders: Track local memory usage 2023-06-25 18:59:33 -04:00
ameerj
b2349d75f4 OpenGL: Add Local Memory warmup shader 2023-06-25 18:43:23 -04:00
liamwhite
fa8419f54e Merge pull request #10859 from liamwhite/no-more-atomic-wait
general: remove atomic signal and wait
2023-06-23 09:27:14 -04:00
GPUCode
c813876c5a vulkan_common: Remove required flags
* Allows VMA to fallback to system RAM instead of crashing
2023-06-22 20:03:12 +03:00
Liam
db40a2f430 general: remove atomic signal and wait 2023-06-22 09:25:23 -04:00