Commit graph

1703 commits

Author SHA1 Message Date
Mary
0644db02ad
kernel: Implement MapTransferMemory and UnmapTransferMemory (#2386)
Based on my reversing of kernel 12.0.0
2021-06-23 21:52:11 +02:00
Ac_K
50ba233ac6
ipc: Remove size checks for buffer type 0x21/0x22 (#2387)
* ipc: Remove size checks for buffer type 0x21/0x22

Since original IPC implementation doesn't check the buffers size, there is no reason to check them so I've removed it. Checking the buffers addresses could prevent to unexpected behaviors.

That's fix a bsd service issue with some homebrew and some games like Knockout City (https://github.com/Ryujinx/Ryujinx-Games-List/issues/3622) which is now bootable:

* addresses gdkchan's review
2021-06-22 19:32:22 +02:00
Ac_K
992ab77f1f
account: Fix wrong condition in TrySelectUserWithoutInteraction (#2384)
* account: Fix wrong condition in TrySelectUserWithoutInteraction

Since the implementation of User Profiles, we can get more than one profile stored. This PR fixes a wrong condition in `TrySelectUserWithoutInteraction`.

Closes #2320

* Some cleanup
2021-06-21 14:20:28 -03:00
Ac_K
aca1c37d4b
am: Add all known AppletMessage (#2378)
This PR add all known AppletMessage values for accuracy, nothing more.
`MessageInfo` is renamed to the right `AppletMessage` name.
2021-06-21 13:41:37 -03:00
gdkchan
65fee49e8a
Fix separate bindless sampler at offset 0 (#2360) 2021-06-20 20:48:12 +02:00
LukeFZ
afd3153ca4
hid/irs: Stub IsFirmwareUpdateAvailableForSixAxisSensor and CheckFirmwareVersion (#2371)
* Stub two services

Stubs IHidServer::IsFirmwareUpdateAvailableForSixAxisSensor and IIrSensorServer::CheckFirmwareVersion

* Apply suggestions from code review

Also changed PackedMcuVersion to be two shorts instead of two bytes, because that's its actual type

* Apply new code review suggestions

Degroup field from previous assignation + Add padding after SixAxisSensorHandle
2021-06-19 13:53:18 +02:00
Mary
39b25dc124
Miria: Make default profile loads Pro Controller by default (#2368)
This was a regression introduced by Miria.
2021-06-17 03:48:55 +02:00
riperiperi
7ff1f9aa12
End shader decoding when reaching a block that starts with an infinite loop (after BRX) (#2367)
* End shader decoding when reaching an infinite loop

The NV shader compiler puts these at the end of shaders.

* Update shader cache version
2021-06-15 02:09:59 +02:00
emmauss
bfcc6a8ad6
Add TouchScreen Manager (#2333) 2021-06-14 08:42:55 +02:00
EmulationFanatic
b898bc84ce
Increase height of Settings Window (#2355) 2021-06-10 13:15:41 +02:00
Mary
afd68d4c6c
GAL: Fix sampler leaks on exit (#2353)
Before this, all samplers instance were leaking on exit because the
dispose method was never getting called.

This fix this issue by making TextureBindingsManager disposable and
calling the dispose method in the TextureManager.
2021-06-09 01:00:28 +02:00
Mary
60cf3dfebc
Do not clear gpu subchannel state on BindChannel (#2348)
This fixes a regression caused by #980, that was causing a crash on New
Super Lucky's Tale.

As always, this need feedback on possible regression on any games.

Fix #2343.
2021-06-09 00:50:18 +02:00
gdkchan
02e2e561ac
Support bindless textures with separate constant buffers for texture and sampler (#2339) 2021-06-09 00:42:25 +02:00
EmulationFanatic
8588586062
Add SDL2 information & updated game compatibility stats (#2337) 2021-06-03 01:43:23 +02:00
gdkchan
3b90adcd1d
Fix shaders with mixed PBK and SSY addresses on the stack (#2329)
* Fix shaders with mixed PBK and SSY addresses on the stack

* Address PR feedback and nits
2021-06-03 01:41:53 +02:00
gdkchan
b84ba43406
Fix texture blit off-by-one errors (#2335) 2021-06-03 01:30:48 +02:00
Mary
534a45d6e8 Reactivate DInput on SDL2
Seems more people than expected use DInput in 2021, will find another
way to fix the latency issue I suppose.
2021-06-02 19:50:21 +02:00
Mary
98916a4f90
Update SDL2-CS (#2327)
Changelog:
- SDL2 was updated to lastest master
- DInput was disabled from build configuration (Close #2238)
- HIDAPI was forced enabled on Linux and libusb library name was fixed (Close #2226)

NOTE about HIDAPI support on Linux:
Make sure that your gamepad is accesible to your user for it to be detected by HIDAPI. This can be done via a udev rule like:

```
KERNEL=="hidraw*", MODE="0660", TAG+="uaccess"
```

**NOTE: This rule is given as an example, this can present a security
risk. Make sure to filter by vendor and product ids.**
2021-06-02 13:50:48 +02:00
riperiperi
fe29aff266
Use Quads on OpenGL host when supported. (#2331)
Improves OpenGL performance on FAST RMX and Xenoblade DE/2. Will probably only work on NVIDIA GPUs, but the emulated quads path will still be valid for other GPUs. Note: SLOW RMX gets a bit faster in handheld mode.

I'd recommend checking on platforms without supported host quads to make sure a GL error is actually thrown when attempting GL.Begin(PrimitiveType.Quads)
2021-06-02 13:27:30 +02:00
Mary
7527c5b906
Avoid clearing alpha channel by handle when presenting (#2323)
* Avoid clearning alpha channel by handle when presenting

Previous code was binding then blitting while the framebuffer was bound
and then clearing the alpha channel by its handle.

This ended up triggering a bug since AMD driver 21.4.1 ending up
clearing the whole framebuffer as a result.

New code fix this weird logic by applying the clear on the bound
framebuffer.

Close #2236.

* Address rip's comments

* Fix AMD being broken once again
2021-06-01 09:29:01 +02:00
gdkchan
79b3243f54
Do not attempt to normalize SNORM image buffers on shaders (#2317)
* Do not attempt to normalize SNORM image buffers on shaders

* Shader cache version bump
2021-05-31 21:59:23 +02:00
gdkchan
91fdaea39b
Fix guest stack trace inexistent function names (#2326) 2021-05-30 20:53:02 +02:00
gdkchan
f6fcef483f
Fix inverted low/high mask value on GetThreadCoreMask32 syscall (#2325) 2021-05-30 20:44:59 +02:00
FICTURE7
9d7627af64
Add multi-level function table (#2228)
* Add AddressTable<T>

* Use AddressTable<T> for dispatch

* Remove JumpTable & co.

* Add fallback for out of range addresses

* Add PPTC support

* Add documentation to `AddressTable<T>`

* Make AddressTable<T> configurable

* Fix table walk

* Fix IsMapped check

* Remove CountTableCapacity

* Add PPTC support for fast path

* Rename IsMapped to IsValid

* Remove stale comment

* Change format of address in exception message

* Add TranslatorStubs

* Split DispatchStub

Avoids recompilation of stubs during tests.

* Add hint for 64bit or 32bit

* Add documentation to `Symbol`

* Add documentation to `TranslatorStubs`

Make `TranslatorStubs` disposable as well.

* Add documentation to `SymbolType`

* Add `AddressTableEventSource` to monitor function table size

Add an EventSource which measures the amount of unmanaged bytes
allocated by AddressTable<T> instances.

 dotnet-counters monitor -n Ryujinx --counters ARMeilleure

* Add `AllowLcqInFunctionTable` optimization toggle

This is to reduce the impact this change has on the test duration.
Before everytime a test was ran, the FunctionTable would be initialized
and populated so that the newly compiled test would get registered to
it.

* Implement unmanaged dispatcher

Uses the DispatchStub to dispatch into the next translation, which
allows execution to stay in unmanaged for longer and skips a
ConcurrentDictionary look up when the target translation has been
registered to the FunctionTable.

* Remove redundant null check

* Tune levels of FunctionTable

Uses 5 levels instead of 4 and change unit of AddressTableEventSource
from KB to MB.

* Use 64-bit function table

Improves codegen for direct branches:

    mov qword [rax+0x408],0x10603560
 -  mov rcx,sub_10603560_OFFSET
 -  mov ecx,[rcx]
 -  mov ecx,ecx
 -  mov rdx,JIT_CACHE_BASE
 -  add rdx,rcx
 +  mov rcx,sub_10603560
 +  mov rdx,[rcx]
    mov rcx,rax

Improves codegen for dispatch stub:

    and rax,byte +0x1f
 -  mov eax,[rcx+rax*4]
 -  mov eax,eax
 -  mov rcx,JIT_CACHE_BASE
 -  lea rax,[rcx+rax]
 +  mov rax,[rcx+rax*8]
    mov rcx,rbx

* Remove `JitCacheSymbol` & `JitCache.Offset`

* Turn `Translator.Translate` into an instance method

We do not have to add more parameter to this method and related ones as
new structures are added & needed for translation.

* Add symbol only when PTC is enabled

Address LDj3SNuD's feedback

* Change `NativeContext.Running` to a 32-bit integer

* Fix PageTable symbol for host mapped
2021-05-29 18:06:28 -03:00
Mary
f3b0b4831c
amadeus: Update to REV9 (#2309)
* amadeus: Update to REV9

This implements all the changes made with REV9 on 12.0.0.

* Address Ac_k's comments
2021-05-25 19:01:09 +02:00
riperiperi
54ea2285f0
POWER - Performance Optimizations With Extensive Ramifications (#2286)
* Refactoring of KMemoryManager class

* Replace some trivial uses of DRAM address with VA

* Get rid of GetDramAddressFromVa

* Abstracting more operations on derived page table class

* Run auto-format on KPageTableBase

* Managed to make TryConvertVaToPa private, few uses remains now

* Implement guest physical pages ref counting, remove manual freeing

* Make DoMmuOperation private and call new abstract methods only from the base class

* Pass pages count rather than size on Map/UnmapMemory

* Change memory managers to take host pointers

* Fix a guest memory leak and simplify KPageTable

* Expose new methods for host range query and mapping

* Some refactoring of MapPagesFromClientProcess to allow proper page ref counting and mapping without KPageLists

* Remove more uses of AddVaRangeToPageList, now only one remains (shared memory page checking)

* Add a SharedMemoryStorage class, will be useful for host mapping

* Sayonara AddVaRangeToPageList, you served us well

* Start to implement host memory mapping (WIP)

* Support memory tracking through host exception handling

* Fix some access violations from HLE service guest memory access and CPU

* Fix memory tracking

* Fix mapping list bugs, including a race and a error adding mapping ranges

* Simple page table for memory tracking

* Simple "volatile" region handle mode

* Update UBOs directly (experimental, rough)

* Fix the overlap check

* Only set non-modified buffers as volatile

* Fix some memory tracking issues

* Fix possible race in MapBufferFromClientProcess (block list updates were not locked)

* Write uniform update to memory immediately, only defer the buffer set.

* Fix some memory tracking issues

* Pass correct pages count on shared memory unmap

* Armeilleure Signal Handler v1 + Unix changes

Unix currently behaves like windows, rather than remapping physical

* Actually check if the host platform is unix

* Fix decommit on linux.

* Implement windows 10 placeholder shared memory, fix a buffer issue.

* Make PTC version something that will never match with master

* Remove testing variable for block count

* Add reference count for memory manager, fix dispose

Can still deadlock with OpenAL

* Add address validation, use page table for mapped check, add docs

Might clean up the page table traversing routines.

* Implement batched mapping/tracking.

* Move documentation, fix tests.

* Cleanup uniform buffer update stuff.

* Remove unnecessary assignment.

* Add unsafe host mapped memory switch

On by default. Would be good to turn this off for untrusted code (homebrew, exefs mods) and give the user the option to turn it on manually, though that requires some UI work.

* Remove C# exception handlers

They have issues due to current .NET limitations, so the meilleure one fully replaces them for now.

* Fix MapPhysicalMemory on the software MemoryManager.

* Null check for GetHostAddress, docs

* Add configuration for setting memory manager mode (not in UI yet)

* Add config to UI

* Fix type mismatch on Unix signal handler code emit

* Fix 6GB DRAM mode.

The size can be greater than `uint.MaxValue` when the DRAM is >4GB.

* Address some feedback.

* More detailed error if backing memory cannot be mapped.

* SetLastError on all OS functions for consistency

* Force pages dirty with UBO update instead of setting them directly.

Seems to be much faster across a few games. Need retesting.

* Rebase, configuration rework, fix mem tracking regression

* Fix race in FreePages

* Set memory managers null after decrementing ref count

* Remove readonly keyword, as this is now modified.

* Use a local variable for the signal handler rather than a register.

* Fix bug with buffer resize, and index/uniform buffer binding.

Should fix flickering in games.

* Add InvalidAccessHandler to MemoryTracking

Doesn't do anything yet

* Call invalid access handler on unmapped read/write.

Same rules as the regular memory manager.

* Make unsafe mapped memory its own MemoryManagerType

* Move FlushUboDirty into UpdateState.

* Buffer dirty cache, rather than ubo cache

Much cleaner, may be reusable for Inline2Memory updates.

* This doesn't return anything anymore.

* Add sigaction remove methods, correct a few function signatures.

* Return empty list of physical regions for size 0.

* Also on AddressSpaceManager

Co-authored-by: gdkchan <gab.dark.100@gmail.com>
2021-05-24 22:52:44 +02:00
gdkchan
fb65f392d1
Improve accuracy of reciprocal step instructions (#2305)
* Improve accuracy of reciprocal step instructions

* Fix small mistake on RECPE rounding, nits, PTC version bump
2021-05-24 20:20:07 +10:00
gdkchan
3fd6b55f04
Fix value of constant vertex attributes (#2307) 2021-05-24 17:38:38 +10:00
riperiperi
79092310fa
Compare aligned size for largest mip level when considering sampler resize (#2306)
* Compare aligned size for largest mip level when considering sampler resize

When selecting a texture that's a view for a sampler resize, we should take care that resizing it doesn't change the aligned size of any larger mip levels.

This PR covers two cases:
- When creating a view of the texture, we check that the aligned size of the view shifted up to level 0 still matches the aligned size of the container. If it does not, a copy dependency is created rather than resizing.
- When searching for a texture for sampler, textures that do _not_ match our aligned size when both are shifted up by its base level are not considered an exact match, as resizing the found texture will cause the mip 0 aligned size to change. It will create a copy dependency view instead.

Fixes graphical errors and crashes (on flush) in various Unity games that use render-to-texture.

* Move shared code to its own method.
2021-05-24 17:35:26 +10:00
gdkchan
e9c15d32cb
Use a different method for out of bounds blit (#2302)
* Use a different method for out of bounds blit

* This is not needed
2021-05-22 01:26:49 +02:00
gdkchan
a03bbef4d6
Add another Depth32F texture format (#2304) 2021-05-22 01:15:08 +02:00
gdkchan
f0add129e2
Fix non-independent blend state not being updated (#2303)
* Fix non-independent blend state not being updated

* Actually, this is not needed
2021-05-22 01:08:00 +02:00
Somebody Whoisbored
26e5b5acff
Extend info printed when guest crashes/breaks execution (#1845)
* Add CPU register printout when guest crashes/breaks execution

* Print out registers when undefined instruction is hit

* Apply suggestions from code review

Co-authored-by: Ac_K <Acoustik666@gmail.com>

* Fixes after rebase

* Address gdkchan's comments

Co-authored-by: Ac_K <Acoustik666@gmail.com>
Co-authored-by: Mary <me@thog.eu>
2021-05-21 01:27:16 +02:00
Mary
2c3dab6986
input: Implement a SDL2 keyboard backend (#2277)
* input: Implement a SDL2 keyboard backend

Add a new keyboard backend to the Ryujinx.Input.SDL2 project.

This is currently unused.

* Address Ac_k's comments

* Address gdkchan's comments
2021-05-21 01:16:34 +02:00
riperiperi
5271cfe70b
Fix dimensions check for scale eligibility (#2301) 2021-05-21 01:09:18 +02:00
gdkchan
12533e5c9d
Fix buffer and texture uses not being propagated for vertex A/B shaders (#2300)
* Fix buffer and texture uses not being propagated for vertex A/B shaders

* Shader cache version bump
2021-05-20 21:43:23 +02:00
gdkchan
b34c0a47b4
Fix constant buffer array size when indexing is used and other buffer descriptor and resolution scale regressions (#2298)
* Fix constant buffer array size when indexing is used

* Change default QueryConstantBufferUse value

* Fix more regressions

* Ensure proper order
2021-05-20 15:12:15 -03:00
Ac_K
7b8ad1c36c
ffmpeg: Attempt to fix RootPath on some linux distributions (#2292)
* fix ffmpeg lib path

* Check if ffmpeg isn't found

* Move code to FFmpegContext

* Call it in static constructor

* revert static instance

* rollback

* lazy initialization

* Revert "lazy initialization"

This reverts commit f675d26a5d.
2021-05-20 18:28:18 +02:00
riperiperi
c316c059ef
Assign _backgroundContext before starting its worker thread. (#2299)
Fixes a random crash when starting an embedded game.
2021-05-20 15:29:10 +02:00
FICTURE7
65ac00833a
Use branch instead of tailcall for recursive calls (#2282)
* Use branch instead of tailcall for recursive calls

Use a branch instead of doing a tailcall for recursive calls. This
avoids having to store the dispatch address, setting up the epilogue and
keeps guest registers in host registers for longer.

The rejit check is moved down into the entry block so that the rejit
behaviour remains the same as before.

* Set PTC version

Co-authored-by: gdkchan <gab.dark.100@gmail.com>
2021-05-20 09:31:45 -03:00
FICTURE7
0181068016
Add BIC/ORR Vd.T, #imm fast path (#2279)
* Add fast path for BIC Vd.T, #imm

* Add fast path for ORR Vd.T, #imm

* Set PTC version

* Fixup Exception to InvalidOperationException
2021-05-20 09:09:17 -03:00
gdkchan
49745cfa37
Move shader resource descriptor creation out of the backend (#2290)
* Move shader resource descriptor creation out of the backend

* Remove now unused code, and other nits

* Shader cache version bump

* Nits

* Set format for bindless image load/store

* Fix buffer write flag
2021-05-19 23:15:26 +02:00
EmulationFanatic
b5c72b44de
Merge pull request #2177 from riperiperi/feature/parallel-shader-cache
Allow parallel shader compilation when loading a shader cache
2021-05-19 11:39:19 -07:00
riperiperi
778011c12a Remove ForceDedicatedGpu, as the driver utilities will now do that. 2021-05-19 19:26:23 +01:00
riperiperi
0129250c2e
Pass CbufSlot when getting info from the texture descriptor (#2291)
* Pass CbufSlot when getting info from the texture descriptor

Fixes some issues with bindless textures, when CbufSlot is not equal to the current TextureBufferIndex.

Specifically fixes a random chance of full screen colour flickering in Super Mario Party.

* Apply suggestions from code review

Oops

Co-authored-by: gdkchan <gab.dark.100@gmail.com>

Co-authored-by: gdkchan <gab.dark.100@gmail.com>
2021-05-19 20:05:43 +02:00
FICTURE7
c805542b29
Allow LocalVariable to be assigned more than once (#2288)
* Allow `LocalVariable` to be assigned more than once

This allows us to write flow controls like loops and if-elses with
LocalVariables participating in phi nodes.

* Add `GetLocalNumber` to operand
2021-05-17 01:54:53 +02:00
riperiperi
212e472c9f
Use copy dependencies for the Intel/AMD view format workaround (#2144)
* This might help AMD a bit

* Removal of old workaround.
2021-05-16 20:43:27 +02:00
Mary
bec67dbef7
misc: Move configuration management to the Ryujinx project (#2269)
* Decouple configuration from Ryujinx.HLE and Ryujinx.Input

* Move Configuration to the Ryujinx project
2021-05-16 17:12:14 +02:00
Mary
f48828351c ci: Do not enforce userid on nightly PR comment
This avoid issues when two different users work on a single PR.
2021-05-14 11:08:46 +02:00
gdkchan
e318022b89
Fold constant offsets and group constant addresses (#2285)
* Fold constant offsets and group constant addresses

* PPTC version bump
2021-05-13 21:26:57 +02:00