Commit graph

18606 commits

Author SHA1 Message Date
Fernando Sahmkow
ec9f0f064e Shader decompiler: Fix storage tracking in deko3d. 2022-03-13 17:41:16 +01:00
bunnei
8decc8d1a5
Merge pull request #8007 from ameerj/vs-2022-errors
emit_spirv, vk_compute_pass: Resolve VS2022 compiler errors
2022-03-13 03:43:06 -07:00
ameerj
6b164a80a1 config: Write dynarmic exclusive memory configs
Ensures the configs are written and saved between boots
2022-03-12 03:42:50 -05:00
ameerj
f87f8d4610 rescaling_pass: Fix rescaling Color2DArray ImageFetch offsets
ImageFetch offsets for 2D array coordinates have a different composite size than the coordinates. The rescaling pass was not taking this into account.

Fixes broken shaders when scaling is enabled in Astral Chain, and likely other titles.
2022-03-12 03:31:56 -05:00
ameerj
e8c50e709e emit_spirv, vk_compute_pass: Resolve VS2022 compiler errors 2022-03-12 02:54:33 -05:00
Liam
56c646d82c Maxwell3D: Restrict topology override effect to after the register is set 2022-03-11 19:42:12 -05:00
Wunkolo
d248c1203e cpu_detect: Add additional x86 flags and telemetry
Adds detection of additional CPU flags to cpu_detect and additions to telemetry output.

This is not exhaustive but guided by features that [dynarmic utilizes](bcfe377aaa/src/dynarmic/backend/x64/host_feature.h (L12-L33)) as well as features that are currently utilized but not reported to telemetry(invariant_tsc). This is intended to guide future optimizations.

AVX512 in particular is broken up into its individual subsets and some other processor features such as [sha](https://en.wikipedia.org/wiki/Intel_SHA_extensions) and [gfni](https://en.wikipedia.org/wiki/AVX-512#GFNI) are added to have some forward-facing data-points.

What used to be a single `CPU_Extension_x64_AVX512` telemetry field
is also broken up into individual `CPU_Extension_x64_AVX512{F,VL,CD,...}` fields.
2022-03-11 10:27:00 -08:00
Wunkolo
29a7a61806 common/telemetry: Update AddField name type to string_view
Non-owning `string_view` is flexable and
avoids some of the many redundant copies made over `std::string`
2022-03-11 10:26:59 -08:00
Liam
70e632f153 Maxwell3D: mark index buffers as dirty after updating counts 2022-03-11 08:51:22 -05:00
Liam
82c3042c0f TextureCacheRuntime: allow converting D24S8 to ABGR8
I can't see how this would be useful, but Galaxy uses it.
2022-03-10 20:25:34 -05:00
Liam
f1521183f8 Maxwell3D: read small-index draw and primitive topology override registers
This allows Galaxy and Sunshine to render for the first time.
2022-03-10 19:21:04 -05:00
Merry
22f50c6bc1 backend: Ensure backend_thread is destructed before message_queue
Ensures that stop_token signals that stop has been requested before destruction of conditional_variable
2022-03-10 10:49:15 +00:00
Wunkolo
d9b1199ffb cpu_detect: Revert __cpuid{ex} array-type argument
Restores compatibility with MSVC's `__cpuid` intrinsic.
2022-03-09 19:50:01 -08:00
Wunkolo
873a9fa7e5 cpu_detect: Add missing lzcnt detection 2022-03-09 13:57:47 -08:00
Wunkolo
ec5f3351b6 cpu_detect: Refactor cpu/manufacturer identification
Set the zero-enum value to Unknown
Move the Manufacterer enum into the CPUCaps structure namespace
Add "ParseManufacturer" utility-function
Fix cpu/brand string buffer sizes(!)
2022-03-09 13:57:47 -08:00
Wunkolo
86e9e60f07 cpu_detect: Update array-types to span and array
Update some uses of `int` into some more explicitly sized types as well
2022-03-09 13:57:47 -08:00
Wunkolo
3c33ba7f18 cpu_detect: Utilize Bit<N> utility function 2022-03-09 13:57:47 -08:00
Wunkolo
d233de8194 cpu_detect: Compact capability fields
As this structure gets more explicit, bools can be bitfields and
small enums can use smaller types for their span of values.
2022-03-09 13:57:47 -08:00
Wunkolo
add2cfcb96 bit_util: Add bit utility function
Extracts a singular bit, as a bool, from the specified compile-time index.
2022-03-09 13:57:47 -08:00
bunnei
853e58e593 hle: service: ldr: Use deterministic addresses when mapping NROs.
- Instead of randomization, choose in-order addresses for where to map NROs into memory.
- This results in predictable behavior when debugging and consistent behavior when reproducing issues.
2022-03-08 17:38:20 -08:00
bunnei
f2743b41b0
Merge pull request #7986 from lat9nq/vk-callback
core, video_core: Fix two crashes when failing to create the emulated GPU instance
2022-03-08 12:36:57 -08:00
Markus Wick
c78c8190d5 shader_recompiler/LOP3: Use brute force python results within switch/case.
Thanks to @asLody for optimizing this function. This raised the focus that this function should be optimized more.

The current table assumes that the host GPU is able to invert for free, so only AND,OR,XOR are accumulated in the performance metrik.

Performance results:

Instructions
0: 8
1: 30
2: 114
3: 80
4: 24

Latency
0: 8
1: 30
2: 194
3: 24
2022-03-08 09:44:28 +01:00
bunnei
749f76e6fe hle: kernel: KPageTable: Improve implementations of MapCodeMemory and UnmapCodeMemory.
- This makes these functions more accurate to the real HOS implementations.
- Fixes memory access issues in Super Smash Bros. Ultimate that occur when un/mapping NROs.
2022-03-07 17:18:20 -08:00
lat9nq
b5e60ae1b0 video_core: Cancel Scoped's exit call on GPU failure
When CreateRenderer fails, the GraphicsContext that was std::move'd into
it is destroyed before the Scoped that was created to manage its
currency. In that case, the GraphicsContext::Scoped will still call its
destructor at the ending of the function. And because the context is
destroyed, the Scoped will cause a crash as it attempts to call a
destroyed object's DoneCurrent function.

Since we know when the call would be invalid, call the Scoped's Cancel
method. This prevents it from calling a method on a destroyed object.
2022-03-07 18:21:56 -05:00
lat9nq
1f24a4e520 emu_window: Create a way to Cancel the exit of a Scoped
If a GraphicsContext is destroyed before its Scoped is destroyed, this
causes a crash as the Scoped tries to call a method in the destroyed
context on exit.

Add a way to Cancel the call when we know that calling the
GraphicsContext will not work.
2022-03-07 18:21:56 -05:00
Fernando S
58b52f4884
Merge pull request #7930 from asLody/dma-semaphore
MaxwellDMA: Implement semaphore operations
2022-03-07 21:53:38 +01:00
lat9nq
381f1dd2c9 core: Don't shutdown a null GPU
When CreateGPU fails, yuzu would try and shutdown the GPU instance
regardless of whether any instance was actually created.

Check for nullptr before calling its methods to prevent a crash.
2022-03-07 15:25:20 -05:00
Lody
4498908e72 MaxwellDMA: Implement semaphore operations 2022-03-07 13:46:18 +08:00
Ameer J
370e480c8c
gl_graphics_pipeline: Improve shader builder synchronization using fences (#7969)
* gl_graphics_pipeline: Improve shader builder synchronization

Make use of GLsync objects to ensure better synchronization between shader builder threads and the main context

* gl_graphics_pipeline: Make built_fence access threadsafe

* gl_graphics_pipeline: Use GLsync objects only when building in parallel

* gl_graphics_pipeline: Replace GetSync calls with non-blocking waits

The spec states that a ClientWait on a Fence object ensures the changes propagate to the calling context
2022-03-06 16:46:49 +01:00
Fernando S
5192c64991
Merge pull request #7973 from Morph1984/debug-crash
host_memory: Fix fastmem crashes in debug builds
2022-03-06 04:49:27 +01:00
bunnei
a31c195749
Merge pull request #7935 from Wunkolo/logging-join-fix
logging: Convert `backend_thread` into an `std::jthread`
2022-03-02 19:09:26 -08:00
bunnei
3ab82e7582
Merge pull request #7956 from bunnei/improve-mem-manager
Kernel Memory Updates (Part 4): Revamp KMemoryManager & other fixes
2022-03-02 17:55:51 -08:00
Morph
b33f23cc46 host_memory: Fix fastmem crashes in debug builds
It is possible for virtual_offset to not be 0 when the iterator is at the beginning, and thus, std::prev(it) may be evaluated, leading to a crash in debug mode.

Co-Authored-By: Fernando S. <1731197+FernandoS27@users.noreply.github.com>
2022-03-02 18:36:59 -05:00
Fernando S
e06a133717
Merge pull request #7959 from merryhime/cmpxchg
dynarmic: Inline exclusive memory accesses
2022-03-01 22:50:52 +01:00
german77
03d671fabc applet: mii: Simple implementation of mii applet 2022-02-28 18:53:41 -06:00
bunnei
14d28a043d hle: kernel: Re-create memory layout at initialization.
- As this can only be derived once.
2022-02-27 18:00:09 -08:00
bunnei
16e5954fcb hle: kernel: Remove unused pool locals. 2022-02-27 18:00:09 -08:00
bunnei
f87f076162 hle: kernel: k_memory_manager: Rework for latest kernel behavior.
- Updates the KMemoryManager implementation against latest documentation.
- Reworks KMemoryLayout to be accessed throughout the kernel.
- Fixes an issue with pool sizes being incorrectly reported.
2022-02-27 18:00:09 -08:00
Wunkolo
913c2bd2cb logging: Convert backend_thread into an std::jthread
Was getting an unhandled `invalid_argument` [exception](https://en.cppreference.com/w/cpp/thread/thread/join) during
shutdown on my linux machine. This removes the need for a `StopBackendThread` function entirely since `jthread`
[automatically handles both checking if the thread is joinable and stopping the token before attempting to join](https://en.cppreference.com/w/cpp/thread/jthread/~jthread) in the case that `StartBackendThread` was never called.
2022-02-27 16:23:52 -08:00
ameerj
7f7df43da2 gl_fence_manager: Minor optimization to signal querying
Per the spec, bufSize is the number of integers that will be written, in this case, 1.

Also, the length argument is optional if the information of the number of elements written is not needed.
2022-02-27 17:57:33 -05:00
merry
16784e5bb3 dynarmic: Inline exclusive memory accesses
Inlines implementation of exclusive instructions into JITted code,
improving performance of applications relying heavily on these
instructions.

We also fastmem these instructions for additional speed, with
support for appropriate recompilation on fastmem failure.

An unsafe optimization to disable the intercore global_monitor is also
provided, should one wish to rely solely on cmpxchg semantics for
safety.

See also: merryhime/dynarmic#664
2022-02-27 19:40:05 +00:00
bunnei
adbb9c2b00 hle: kernel: k_page_heap: GetPhysicalAddr can be const. 2022-02-27 10:34:02 -08:00
bunnei
f7e65eb971 hle: kernel: k_page_heap: Remove superfluous consexpr. 2022-02-27 10:34:02 -08:00
bunnei
06e2b76c75 hle: kernel: k_page_heap: Various updates and improvements.
- KPageHeap tracks physical addresses, not virtual addresses.
- Various updates and improvements to match latest documentation for this type.
2022-02-27 10:34:02 -08:00
bunnei
5d1a81520c hle: kernel: Add initial_process.h header. 2022-02-27 10:34:02 -08:00
bunnei
a6496deeed hle: kernel: board: nx: Add k_memory_layout.h header. 2022-02-27 10:34:02 -08:00
bunnei
9b5e7971dc hle: kernel: k_system_control: Add GetRealMemorySize and update GetKernelPhysicalBaseAddress. 2022-02-27 10:34:02 -08:00
bunnei
18e77a54c3 hle: kernel: k_memory_layout: Add GetPhysicalLinearRegion. 2022-02-27 10:34:02 -08:00
bunnei
06a21ac229 hle: kernel: k_memory_region_types: Update for new regions. 2022-02-27 10:34:02 -08:00
bunnei
20e9501b0d
Merge pull request #7932 from bunnei/extended-mem-layout
Add extended memory layout (6GB) support and improve KResourceLimit management
2022-02-26 01:41:08 -08:00
bunnei
56d9052b73
Merge pull request #7953 from ameerj/radv-rdna2-crash
vulkan_device: Blacklist RADV on RDNA2 from VK_EXT_vertex_input_dynamic_state
2022-02-26 01:19:13 -08:00
Mai M
91d802f68d
Merge pull request #7948 from Morph1984/11-11-10-float
maxwell_to_(gl/vk): Add 11_11_10 float vertex format
2022-02-26 00:09:44 -05:00
Ameer J
5f8d6bc504 vulkan_device: Blacklist RADV on RDNA2 from VK_EXT_vertex_input_dynamic_state
RDNA2 devices running under the RADV driver were crashing when VK_EXT_vertex_input_dynamic_state was enabled.

Blacklisting these devices until a proper fix is established.
2022-02-25 23:09:03 -05:00
Morph
e292b2d991 maxwell_to_(gl/vk): Add 11_11_10 float vertex format
- Used by パワプロクンポケットR
2022-02-25 17:11:17 -05:00
bunnei
6c9b9b72da
Merge pull request #7939 from asLody/fb-format-gbra8
vk_blit_screen: Add missing framebuffer format
2022-02-25 00:58:28 -08:00
bunnei
f582a4482d
Merge pull request #7927 from german77/amiibo
yuzu: Disconnect amiibos on drag and drop
2022-02-24 23:13:32 -08:00
bunnei
1079215871
Merge pull request #7859 from german77/battery_again
input_common: Remove battery duplicated struct and update every button press
2022-02-24 11:42:51 -08:00
Lody
6978093404 vk_blit_screen: Add missing format bgra8 2022-02-24 19:25:39 +08:00
Narr the Reg
d44464829b service: am: Update enum names to match documentation 2022-02-21 18:00:50 -06:00
bunnei
efe50d88ec
Merge pull request #7913 from voidanix/anv-fix
vulkan_device: fix missing format in ANV
2022-02-21 14:34:27 -07:00
bunnei
71f62a346d hle: kernel: KSystemControl: Use 6GB memory layout when "use_extended_memory_layout" setting is enabled.
- This uses a larger 6GB DRAM memory layout, which is useful for some mods that require more memory.
2022-02-21 13:07:19 -08:00
bunnei
c0e45a3c78 core: device_memory: Use memory size reported by KSystemControl.
- That way, we can consolidate the memory layout to one place.
2022-02-21 13:07:19 -08:00
bunnei
70482e6b26 settings: Add a new "use_extended_memory_layout" setting.
- This will be used to enable emulation of a larger memory arrangement.
2022-02-21 13:07:19 -08:00
bunnei
ca5e843bf6 core: hle: kernel: Remove resource limit hack for PhysicalMemory.
- With prior changes, we now report the correct amount of physical memory available to the emulated process.
2022-02-21 12:41:31 -08:00
bunnei
a74fddc98f core: hle: kernel: KProcess: Pass in KResourceLimit on process creation.
- This allows us to have a resource limit per process, rather than use the global system resource limit.
2022-02-21 12:41:31 -08:00
bunnei
57ebcbf2c4 core: hle: kernel: KEvent: Pass in owner KProcess on event creation.
- This is necessary to ensure resource limits are freed from the right process.
2022-02-21 12:41:06 -08:00
bunnei
c7019db6f4 core: hle: kernel: KResourceLimit: Add a helper function for creating a KResourceLimit for a process. 2022-02-21 12:40:09 -08:00
bunnei
21f5912ec9
Merge pull request #7919 from bunnei/phys-mem-updates
core: hle: kernel: KPageTable: Improve Un/MapPhysicalMemory.
2022-02-21 13:39:05 -07:00
bunnei
8d46c3cc66
Merge pull request #7920 from bunnei/fix-unmap-pages
core: hle: kernel: KPageTable: Fix UnmapPages.
2022-02-21 13:38:52 -07:00
voidanix
7712e46d64
vulkan_device: fix missing format in ANV
Currently Mesa's ANV driver does not support
VK_FORMAT_B5G6R5_UNORM_PACK16, implement an alternative for it.
2022-02-21 09:21:41 +01:00
german77
b504df9d02 yuzu: Remove amiibos on drag and drop 2022-02-20 14:28:21 -06:00
bunnei
92b2e92620 fixup! core: hle: kernel: KPageTable: Improve Un/MapPhysicalMemory. 2022-02-19 00:14:27 -08:00
bunnei
2984695265
Merge pull request #7867 from german77/amiibo
nfp: Improve amiibo support
2022-02-19 00:57:47 -07:00
bunnei
c9260a75f6 core: hle: kernel: KPageTable: Fix UnmapPages.
- Fixes a logic bug in KPageTable::UnmapPages.
2022-02-18 23:48:16 -08:00
bunnei
1a16d055df core: hle: kernel: KPageTable: Improve Un/MapPhysicalMemory.
- Improves the implementations of MapPhysicalMemory and UnmapPhysicalMemory to more closely reflect latest HOS.
2022-02-18 23:42:27 -08:00
bunnei
83a84f1c2d
Merge pull request #7900 from german77/enter
yuzu: config: Fix mapping issues with the enter key
2022-02-18 15:47:34 -07:00
Wunkolo
768fdb269e common: Add NullVisitor default constructor
Addresses https://github.com/yuzu-emu/yuzu/issues/7881 to fix linux
builds.

`YUZU_NON_COPYABLE` deletes the `T(const T&)` constructor which will
cause the implicitly defined default ctor/dtor to no-longer generate.
2022-02-17 06:28:19 -08:00
Mai M
c48b9668f0
Merge pull request #7866 from xerpi/svc-OutputDebugString32-CreateCodeMemory32-ControlCodeMemory32
kernel: svc: Add OutputDebugString32, CreateCodeMemory32, ControlCodeMemory32
2022-02-16 22:49:56 -05:00
bunnei
027ff7847c
Merge pull request #7878 from german77/mnpp
service/mnpp: Stub mnpp_app
2022-02-16 18:42:49 -07:00
Morph
4514325b9c
Merge pull request #7899 from Kelebek1/test
file_sys: Dump patched exefs rather than base
2022-02-16 16:37:09 -05:00
bunnei
b5fd9c58cd
Merge pull request #7877 from lat9nq/upd_rev
audio_core: Update current process revision
2022-02-15 13:08:40 -07:00
bunnei
910a0fa58e
Merge pull request #7891 from Morph1984/buffer_to_string_view
common: fs_util: Add buffer to string view utility functions
2022-02-15 12:02:23 -07:00
Narr the Reg
1e21f5f872 yuzu: config: Fix mapping issues with the enter key 2022-02-15 11:08:11 -06:00
Kelebek1
e1201abc1e Dump patched exefs rather than base 2022-02-15 04:52:28 +00:00
Sergi Granell
c3242abe95 kernel: svc: Add OutputDebugString32, CreateCodeMemory32, ControlCodeMemory32
Very straightforward, they are just wrappers to the 64-bit version of
the SVC.
2022-02-15 00:45:19 +01:00
bunnei
d81cdd9114
Merge pull request #7871 from german77/svc2
svc: Set unique names for function tables
2022-02-14 16:32:54 -07:00
Morph
4390370a19 common: fs_util: Add buffer to string view utility functions
These functions allow to construct a string view from an input buffer, avoiding the copy done by the non string view counterparts. However, callers must be cognizant of the viewed buffer's lifetime to avoid a use-after-free.
2022-02-13 18:53:21 -05:00
Morph
54c7af9902 debugger: console: Set console output codepage to UTF-8
This allows the console to display multi-byte encoded characters.
2022-02-13 18:18:05 -05:00
german77
b57d61010f nfp: Allow files without password data 2022-02-13 13:52:34 -06:00
lat9nq
c5d22952bf hid: Stub IsUsbFullKeyControllerEnabled
Used by Splatoon 2, when opening the inventory from a LAN battle lobby.

Reference: https://switchbrew.org/wiki/HID_services
2022-02-12 15:42:50 -05:00
lat9nq
81806603eb audio_core: Update current process revision
Update CURRENT_PROCESS_REVISION from REV9 to REVA.

Used by Nintendo Entertainment System - Nintendo Switch Online 6.0.0 and
Super Nintendo Entertainment System - Nintendo Switch Online 3.0.0.
2022-02-11 00:56:13 -05:00
bunnei
ca9da569ce
Merge pull request #7852 from Morph1984/new-uuid
common: Revise and fix the UUID implementation
2022-02-10 21:52:13 -07:00
Narr the Reg
6705439cf3 service/mnpp: Stub mnpp_app
Used in Super Nintendo Entertainment System™ - Nintendo Switch Online
2022-02-10 21:55:28 -06:00
Morph
3799c820ca common: uuid: Use sizeof(u64) instead of 8 in Hash() 2022-02-10 15:03:49 -05:00
bunnei
1105614b86
Merge pull request #7861 from german77/user_features
yuzu: New hotkeys and mute audio on background
2022-02-10 10:06:58 -07:00
Narr the Reg
6a1ad03153 nfp: Separate nfc tag from amiibo data 2022-02-10 10:58:37 -06:00
bunnei
fc01074f89
Merge pull request #7860 from german77/no-more-drift
yuzu: Add auto center on right click
2022-02-09 17:52:39 -07:00
Narr the Reg
d0c7c3f64f svc: Set unique names for function tables 2022-02-08 21:03:31 -06:00
bunnei
862dddf8c9
hle: kernel: KCodeMemory: Remove unused QueryMemory. 2022-02-08 18:49:41 -08:00
bunnei
d134ca68c6
hle: kernel: KCodeMemory: Correct m_page_group number of pages.
Credits to @xerpi for finding this issue and pointing it out on #7519.
2022-02-08 18:47:11 -08:00