aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-09-19Implement and use an Interval Tree for the MultiRangeList (#2641)riperiperi
* Implement and use an Interval Tree for the MultiRangeList * Feedback * Address Feedback * Missed this somehow
2021-09-19Use shader subgroup extensions if shader ballot is not supported (#2627)gdkchan
* Use shader subgroup extensions if shader ballot is not supported * Shader cache version bump + cleanup * The type is still required on the table
2021-09-19Array based RangeList that caches Address/EndAddress (#2642)riperiperi
* Array based RangeList that caches Address/EndAddress In isolation, this was more than 2x faster than the RangeList that checks using the interface. In practice I'm seeing much better results than I expected. The array is used because checking it is slightly faster than using a list, which loses time to struct copies, but I still want that data locality. A method has been added to the list to update the cached end address, as some users of the RangeList currently modify it dynamically. Greatly improves performance in Super Mario Odyssey, Xenoblade and any other GPU limited games. * Address Feedback
2021-09-19Set texture/image bindings in place rather than allocating and passing an ↵riperiperi
array (#2647) * Remove allocations for texture bindings and state * Rent rather than stackalloc + copy A bit faster.
2021-09-19amadeus: Fix regression from #2654 on ListAudioDeviceNameMary
2021-09-19vi: Unify resolutions values and accurate implementation of them. (#2640)Ac_K
* vi: Unify resolutions values and accurate implementation of them. To continue what was made in #2618, I've REd `vi` service a bit. Now values and checks related to displays are more accurate. - `am` GetDefaultDisplayResolution / GetDefaultDisplayResolutionChangeEvent have more informations on what the service does. - `vi:u/vi:m/vi:s` GetDisplayService are now accurate. - `IApplicationDisplay` GetRelayService, GetSystemDisplayService, GetManagerDisplayService, GetIndirectDisplayTransactionService, ListDisplays, OpenDisplay, OpenDefaultDisplay, CloseDisplay, GetDisplayResolution are now properly implemented. - Some other calls are cleaned or have extra checks accordingly to RE. Additionnaly, `IFriendService` have some wrong aligned things, and `pm:info` service placeholder was missing. * just use _openedDisplayInfo.Remove() * use context.Memory.Fill() * fix some casting * remove unneeded comment * cleanup * uses TryAdd * displayId > ulong * GetDisplayResolution > ulong * UL
2021-09-19amadeus: Update to REV10 (#2654)Mary
* amadeus: Update to REV10 This implements all the changes made with REV10 on 13.0.0. * Address Ack's comment * Address gdkchan's comment
2021-09-18Fix problems added by Pause (#2645)mpnico
* Disable Pause/Resume menu instead of trying to hide them * Fix Resume menu being active before renderer starts * Fix emulator not being able to close properly
2021-09-16gui: Hotfix for FileChooserNative during section extraction (#2644)Ac_K
Fix a regression introduced in #2633, FileChooserNative parent can't be set to null because it's running in modal.
2021-09-15Adjustments to framerate metric and addition of frametime (#2638)MutantAura
* Adjust framerate data and add frametime * Update PerformanceStatistics.cs * Revert deletions of average framerate * Update Ryujinx.csproj * Remove separate GTK column * Increase FPS precision * general cleanup * even generaler cleanup * fix dumb * Remove legacy code * Update PerformanceStatistics.cs * Update PerformanceStatistics.cs
2021-09-15Add Linux Unicorn patch + desc. (#2609)Michael Gielda
2021-09-15hos: Cleanup the project (#2634)Ac_K
* hos: Cleanup the project Since a lot of changes has been done on the HOS project, there are some leftover here and there, or class just used in one service, things at wrong places, and more. This PR fixes that, additionnally to that, I've realigned some vars because I though it make the code more readable. * Address gdkchan feedback * addresses Thog feedback * Revert ElfSymbol
2021-09-14gui: Replace FileChooserDialog by FileChooserNative (#2633)Ac_K
We currently use the FileChooser from GTK, which is a bit mess. Instead of it we could use the native FileChooser from all specifics OS. This is what this PR attempt to fix. It could be nice to get a test under linux since I've only tested it under Windows without any issues. Fixes #2584
2021-09-14Refactor `PtcInfo` (#2625)FICTURE7
* Refactor `PtcInfo` This change reduces the coupling of `PtcInfo` by moving relocation tracking to the backend. `RelocEntry`s remains as `RelocEntry`s through out the pipeline until it actually needs to be written to the PTC streams. Keeping this representation makes inspecting and manipulating relocations after compilations less painful. This is something I needed to do to patch relocations to 0 to diff dumps. Contributes to #1125. * Turn `Symbol` & `RelocInfo` into readonly structs * Add documentation to `CompiledFunction` * Remove `Compiler.Compile<T>` Remove `Compiler.Compile<T>` and replace it by `Map<T>` of the `CompiledFunction` returned.
2021-09-11Account for negative strides on DMA copy (#2623)gdkchan
* Account for negative strides on DMA copy * Should account for non-zero Y
2021-09-11Implement GetVaRegions on nvservices (#2621)gdkchan
* Implement GetVaRegions on nvservices * This would just result in 0
2021-09-11Report 1080p resolution when in docked mode (#2618)gdkchan
2021-09-11Implement a "Pause Emulation" option & hotkey (#2428)mpnico
* Add a "Pause Emulation" option and hotkey Closes Ryujinx#1604 * Refactoring how pause is handled * Applied suggested changes from review * Applied suggested fixes * Pass correct suspend type to threads for suspend/resume * Fix NRE after stoping emulation * Removing SimulateWakeUpMessage call after resuming emulation * Skip suspending non game process * Pause the tickCounter in the ExecutionContext * Refactoring tickCounter pause/resume as suggested * Fix Config migration to add pause hotkey * Fixed pausing only application threads * Fix exiting emulator while paused * Avoid pause/resume while already paused/resumed * Cleanup unused code * Avoid restarting audio if stopping emulation while in pause. * Added suggested changes * Fix ConfigurationState
2021-09-11Lift textures in the AutoDeleteCache for all modifications. (#2615)riperiperi
* Lift textures in the AutoDeleteCache for all modifications. Before, this would only apply to render targets and texture blit. Now it applies to image stores, the fast dma copy path and any other type of modification. Image store always at least has one reference in the texture pool, so the function of the AutoDeleteCache keeping textures _alive_ is not useful, but a very important function for a while has been its use to flush textures in order of modification when they are dereferenced, so that their data is not lost. Before, textures populated using image stores were being dereferenced and reloaded as garbage. Now, when these textures are dereferenced, their data will be put back into memory, and everything stays intact. Fixes lighting breaking when switching levels in THPS1+2, and potentially some more UE4 games. I've tested a bunch more games for regressions and performance impact, but they all seem fine. * Lift copy srcTexture so that it doesn't remain referenceless * Perform lift before reference count change on unbind. It's important to lift on unbind as that is the moment the texture was truly last modified, but definitely not after releasing every single reference.
2021-09-11Fix GTK3 mapping for single quote key (#2612)Agustin Insua
2021-09-11Update game metadata when stopping emulation (#2610)Agustin Insua
* Update game metadata when stopping emulation * Fix formatting
2021-09-11Remove file error popup (#2547)bobhope
* Added check to detect if application file is more than zero bytes long * Removed file error popup * Removed unnecessary usings * Added empty lines
2021-09-02Fix TXQ for 3D textures. (#2613)riperiperi
* Fix TXQ for 3D textures. Assumes the texture is 3D if the component mask contains Z. This fixes a bug in UE4 games where parts of the map had garbage pointers to lighting voxels, as the lookup 3D texture was not being initialized. Most notable game is THPS1+2. May need another PR to keep image store data alive and properly flush it in order using the AutoDeleteCache. * Get sampler type for TextureSize from bound textures.
2021-08-31Implement Shader Instructions SUATOM and SURED (#2090)riperiperi
* Initial Implementation * Further improvements (no support for float/64-bit types) * Merge atomic and reduce instructions, add missing format switch * Fix rebase issues. * Not used. * Whoops. Fixed. * Partial implementation of inc/dec, cleanup and TODOs * Remove testing path * Address Feedback
2021-08-30Fix out-of-bounds shader thread shuffle (#2605)gdkchan
* Fix out-of-bounds shader thread shuffle * Shader cache version bump
2021-08-29Handle indirect draw counts with non-zero draw starts properly (#2593)gdkchan
2021-08-29Avoid deleting textures when their data does not overlap. (#2601)riperiperi
* Avoid deleting textures when their data does not overlap. It's possible that while two textures start and end addresses indicate an overlap, that the actual data contained within them is sparse due to a layer stride. One such possibility is array slices of a cubemap at different mip levels - they overlap on a whole, but the actual texture data fills the gaps between each other's layers rather than actually overlapping. This fixes issues with UE4 games having incorrect lighting (solid white screen or really dark shadows). There are still remaining issues with games that use the 3D texture prebaked lighting, such as THPS1+2. This PR also fixes a bug with TexturePool's resized texture handling where the base level in the descriptor was not considered. * AllRegions granularity for 3d textures is now by level rather than by slice. * Address feedback
2021-08-29Ensure that all threads wait for a read tracking action to complete. (#2597)riperiperi
* Lock around tracking action consume + execute. Not particularly fast. * Lock around preaction registration and use * Create a lock object * Nit
2021-08-27Only reupload the texture scale array if it changes. (#2595)riperiperi
* Only reupload the texture scale array if it changes. Before, this would be called all the time if any shader needed a scale value. The cost of doing this has increased with threaded-gal, as the scale array is copied to a span pool, and it's was called on pretty much every draw sometimes. This improves GPU performance in games, scaled or not. Most affected game seems to be Xenoblade Chronicles: Definitive Edition. * Just use = instead of |=
2021-08-27Initial support for shader attribute indexing (#2546)gdkchan
* Initial support for shader attribute indexing * Support output indexing too, other improvements * Fix order * Address feedback
2021-08-27Add a Multithreading layer for the GAL, multi-thread shader compilation at ↵riperiperi
runtime (#2501) * Initial Implementation About as fast as nvidia GL multithreading, can be improved with faster command queuing. * Struct based command list Speeds up a bit. Still a lot of time lost to resource copy. * Do shader init while the render thread is active. * Introduce circular span pool V1 Ideally should be able to use structs instead of references for storing these spans on commands. Will try that next. * Refactor SpanRef some more Use a struct to represent SpanRef, rather than a reference. * Flush buffers on background thread * Use a span for UpdateRenderScale. Much faster than copying the array. * Calculate command size using reflection * WIP parallel shaders * Some minor optimisation * Only 2 max refs per command now. The command with 3 refs is gone. :relieved: * Don't cast on the GPU side * Remove redundant casts, force sync on window present * Fix Shader Cache * Fix host shader save. * Fixup to work with new renderer stuff * Make command Run static, use array of delegates as lookup Profile says this takes less time than the previous way. * Bring up to date * Add settings toggle. Fix Muiltithreading Off mode. * Fix warning. * Release tracking lock for flushes * Fix Conditional Render fast path with threaded gal * Make handle iteration safe when releasing the lock This is mostly temporary. * Attempt to set backend threading on driver Only really works on nvidia before launching a game. * Fix race condition with BufferModifiedRangeList, exceptions in tracking actions * Update buffer set commands * Some cleanup * Only use stutter workaround when using opengl renderer non-threaded * Add host-conditional reservation of counter events There has always been the possibility that conditional rendering could use a query object just as it is disposed by the counter queue. This change makes it so that when the host decides to use host conditional rendering, the query object is reserved so that it cannot be deleted. Counter events can optionally start reserved, as the threaded implementation can reserve them before the backend creates them, and there would otherwise be a short amount of time where the counter queue could dispose the event before a call to reserve it could be made. * Address Feedback * Make counter flush tracked again. Hopefully does not cause any issues this time. * Wait for FlushTo on the main queue thread. Currently assumes only one thread will want to FlushTo (in this case, the GPU thread) * Add SDL2 headless integration * Add HLE macro commands. Co-authored-by: Mary <mary@mary.zone>
2021-08-27Implement MSR instruction for A32 (#2585)Mary
* Implement MSR instruction Fix #1342. Now Pocket Rumble is playable. * Address gdkchan's comments * Address gdkchan's comments * Address gdkchan's comment
2021-08-26Add support for HLE macros and accelerate MultiDrawElementsIndirectCount #2 ↵mpnico
(#2557) * Add support for HLE macros and accelerate MultiDrawElementsIndirectCount * Add missing barrier * Fix index buffer count * Add support check for each macro hle before use * Add missing xml doc Co-authored-by: gdkchan <gab.dark.100@gmail.com>
2021-08-26Fix Unicorn Warnings (#2575)VocalFan
2021-08-26Bugfix LibHac update to 0.13.3 and remove SD card workaround (#2579)Alex Barney
2021-08-26Added fallbacks for all Audio Backends (#2582)VocalFan
* Added fallbacks for all Audio Backends * Commit Suggestion Co-authored-by: gdkchan <gab.dark.100@gmail.com> * Resolve elses. * Revert "Resolve elses." This reverts commit 9aec3e9e7750803e5626da3d01d7e57fabe19f65. * Suggestions completed Co-authored-by: gdkchan <gab.dark.100@gmail.com>
2021-08-26Swap BGR565 components by changing the format (#2577)gdkchan
2021-08-26sdl2: Update to Ryujinx.SDL2-CS 2.0.17 (#2553)Mary
* sdl2: Update to Ryujinx.SDL2-CS 2.0.17 Update to latest SDL2 commit * Update to Ryujinx.SDL2-CS 2.0.17-build18
2021-08-21Ignore exceptions when cleaning the SD card saves (#2576)Alex Barney
2021-08-20Seeing if there are any other spelling errors to correct. (#2572)VocalFan
* "Informations" -> "Information" * Your -> You * will use -> using (Plus more detailed Appveyor error msg.) * Did a dumb thing, fixed it.
2021-08-20Swap BGR components for 16-bit BGR texture formats (#2567)gdkchan
2021-08-20Change disabled vertex attribute value to (0, 0, 0, 1) (#2573)riperiperi
This seems to be the default value when the vertex attribute is disabled, or components aren't defined. This fixes a regression from #2307 in SMO where a plant in the Wooded Kingdom would draw slightly differently in the depth prepass, leading to depth test failing later on. GDK has stated that the specific case in Gundam only expects x and y to be 0, and Vulkan's undefined value for z does appear to be 0 when a vertex attribute type does not have that component, hence the value (0, 0, 0, 1). This worked in Vulkan despite also providing an all 0s attribute due to the vertex attribute binding being R32Float, so the other values were undefined. It should be changed there separately.
2021-08-20Remove pool cache entries for incompatible overlapping textures (#2568)riperiperi
This greatly reduces memory usage in games that aggressively reuse memory without removing dead textures from the pool, such as the Xenoblade games, UE3 games, and to a lesser extent, UE4/unity games. This change stops memory usage from ballooning in xenoblade and some other games. It will also reduce texture view/dependency complexity in some games - for example in MK8D it will reduce the number of surface copies between lighting cubemaps generated for actors. There shouldn't be any performance impact from doing this, though the deletion and creation of textures could be improved by improving the OpenGL texture storage cache, which is very simple and limited right now. This will be improved in future. Another potential error has been fixed with the texture cache, which could prevent data loss when data is interchangably written to textures from both the GPU and CPU. It was possible that the dirty flag for a texture would be consumed without the data being synchronized on next use, due to the old overlap check. This check no longer consumes the dirty flag. Please test a bunch of games to make sure they still work, and there are no performance regressions.
2021-08-20Clean the SD card save directory when opening the emulator (#2564)Alex Barney
Cleans "sdcard:/Nintendo/save" and deletes "sdcard:/save" when opening the emulator. Works around invalid encryption when keys or the SD card encryption seed are changed.
2021-08-20Fix GetHandleInformation for mipmapped 3d textures (#2569)riperiperi
Got this the wrong way round - was causing games to try synchronize mipmap levels of like 52 on a 3d texture with 6 levels. Also, corrected the variable name in the method that _was_ working.
2021-08-20Fix type mismatch in `BitwiseAnd` simplification (#2571)FICTURE7
* Fix type mismatch in `BitwiseAnd` simplification `TryEliminateBitwiseAnd` would turn the `BitwiseAnd` operation into a copy of the wrong type. E.g: Before `Simplification`: ```llvm i64 %0 = BitwiseAnd i64 0x0, %1 ``` After `Simplication`: ```llvm i64 %0 = Copy i32 0x0 ``` Since the with the changes in #2515, we iterate in reverse order and `Simplication`, `ConstantFolding` does not indicate if it modified the CFG, the second pass to "retype" the copy into the proper destination type does not happen. This also blocked copy propagation since its destination type did not match with its source type. But in the cases I've seen, the `PreAllocator` would insert a copy for the propagated constant, which results in no diffs. Since the copy remained as is, asserts are fired when generating it. * Set PPTC version
2021-08-17Reduce JIT GC allocations (#2515)FICTURE7
* Turn `MemoryOperand` into a struct * Remove `IntrinsicOperation` * Remove `PhiNode` * Remove `Node` * Turn `Operand` into a struct * Turn `Operation` into a struct * Clean up pool management methods * Add `Arena` allocator * Move `OperationHelper` to `Operation.Factory` * Move `OperandHelper` to `Operand.Factory` * Optimize `Operation` a bit * Fix `Arena` initialization * Rename `NativeList<T>` to `ArenaList<T>` * Reduce `Operand` size from 88 to 56 bytes * Reduce `Operation` size from 56 to 40 bytes * Add optimistic interning of Register & Constant operands * Optimize `RegisterUsage` pass a bit * Optimize `RemoveUnusedNodes` pass a bit Iterating in reverse-order allows killing dependency chains in a single pass. * Fix PPTC symbols * Optimize `BasicBlock` a bit Reduce allocations from `_successor` & `DominanceFrontiers` * Fix `Operation` resize * Make `Arena` expandable Change the arena allocator to be expandable by allocating in pages, with some of them being pooled. Currently 32 pages are pooled. An LRU removal mechanism should probably be added to it. Apparently MHR can allocate bitmaps large enough to exceed the 16MB limit for the type. * Move `Arena` & `ArenaList` to `Common` * Remove `ThreadStaticPool` & co * Add `PhiOperation` * Reduce `Operand` size from 56 from 48 bytes * Add linear-probing to `Operand` intern table * Optimize `HybridAllocator` a bit * Add `Allocators` class * Tune `ArenaAllocator` sizes * Add page removal mechanism to `ArenaAllocator` Remove pages which have not been used for more than 5s after each reset. I am on fence if this would be better using a Gen2 callback object like the one in System.Buffers.ArrayPool<T>, to trim the pool. Because right now if a large translation happens, the pages will be freed only after a reset. This reset may not happen for a while because no new translation is hit, but the arena base sizes are rather small. * Fix `OOM` when allocating larger than page size in `ArenaAllocator` Tweak resizing mechanism for Operand.Uses and Assignemnts. * Optimize `Optimizer` a bit * Optimize `Operand.Add<T>/Remove<T>` a bit * Clean up `PreAllocator` * Fix phi insertion order Reduce codegen diffs. * Fix code alignment * Use new heuristics for degree of parallelism * Suppress warnings * Address gdkchan's feedback Renamed `GetValue()` to `GetValueUnsafe()` to make it more clear that `Operand.Value` should usually not be modified directly. * Add fast path to `ArenaAllocator` * Assembly for `ArenaAllocator.Allocate(ulong)`: .L0: mov rax, [rcx+0x18] lea r8, [rax+rdx] cmp r8, [rcx+0x10] ja short .L2 .L1: mov rdx, [rcx+8] add rax, [rdx+8] mov [rcx+0x18], r8 ret .L2: jmp ArenaAllocator.AllocateSlow(UInt64) A few variable/field had to be changed to ulong so that RyuJIT avoids emitting zero-extends. * Implement a new heuristic to free pooled pages. If an arena is used often, it is more likely that its pages will be needed, so the pages are kept for longer (e.g: during PPTC rebuild or burst sof compilations). If is not used often, then it is more likely that its pages will not be needed (e.g: after PPTC rebuild or bursts of compilations). * Address riperiperi's feedback * Use `EqualityComparer<T>` in `IntrusiveList<T>` Avoids a potential GC hole in `Equals(T, T)`.
2021-08-17Always use an all-zeros key for AES-XTS file systems (#2561)Alex Barney
2021-08-17Enable transform feedback buffer flush (#2552)gdkchan
2021-08-12Update to LibHac 0.13.1 (#2475)Alex Barney
* Update to LibHac 0.13.1 * Recreate directories for indexed saves if they're missing on emulator start