* GPU: Remove CPU region handle containers.
Another one for the "I don't know why I didn't do this earlier" pile.
This removes the "Cpu" prefixed region handle classes, which each mirror a region handle type from Ryujinx.Memory.
Originally, not all projects had a reference to Ryujinx.Memory, so these classes were introduced to bridge the gap. Someone else crossed that bridge since, so these classes don't have much of a purpose anymore.
This PR replaces all uses of CpuRegionHandle etc to their direct Ryujinx.Memory versions.
RegionHandle methods (specifically QueryModified) are about the hottest path there is in the entire emulator, so there is a nice boost from doing this.
* Add docs
* UI: Fix sections extraction
There is currently an issue when the update NCA doesn't contains the section we want to extract, this is fixed by adding a check.
I have fixed the inverted handler of ExeFs/Logo introduced in #4755.
Fixes#4521
* Addresses feedback
* Allow any shader SSBO constant buffer slot and offset
* Fix slot value passed to SetUsedStorageBuffer on fallback case
* Shader cache version
* Ensure that the storage buffer source constant buffer offset is word aligned
* Fix FirstBinding on GetUniformBufferDescriptors
* GPU: Allow granular buffer updates from the constant buffer updater
Sometimes, constant buffer updates can't be avoided, either due to a cb0 access that cannot be eliminated, or the game updating a buffer between draws to the detriment of everyone.
To avoid uploading the full 4096 bytes each time, this PR remembers the offset and size containing all constant buffer updates since the last sync. It will then upload that range after sync.
* Allow clearing the dirty range
* Always use precise
Might want to not do this if distance between the existing range and new one is too high.
* Use old force dirty mechanism when distance between regions is too great
* Update src/Ryujinx.Graphics.Gpu/Memory/Buffer.cs
Co-authored-by: gdkchan <gab.dark.100@gmail.com>
* Fix inheritance of _dirtyStart and _dirtyEnd
---------
Co-authored-by: gdkchan <gab.dark.100@gmail.com>
* Fix case sensitivity for mod subdirectories
* Small refactoring of ModLoader
* Don't share instruction list between all cheats
Co-authored-by: riperiperi <rhy3756547@hotmail.com>
---------
Co-authored-by: riperiperi <rhy3756547@hotmail.com>
* fix: linux launcher breaks when there are spaces in the directory path
* Add quotes around $0 as well
---------
Co-authored-by: TSRBerry <20988865+TSRBerry@users.noreply.github.com>
* UI: Move ApplicationContextMenu in a separated class
This PR remove duplicated code related to the context menu on the Application list/grid by create a control for the menu which include related handler.
I've renamed "GameList/GameGrid" by "Application" for consistencies. And I've removed all uneeded field from the project file too.
While I cleaned up things, I've found an issue about purging Ptc/Shader cache, both methods list files even if the user say "No", shader cache is purged even if the user say "No". It's fixed.
* Adresses feedbacks
Our Vulkan backend inserts image barriers when a texture is sampled after it is rendered. This is done via a "modification flag" which is set when a render target is unbound (presuming that a texture has finished drawing to it).
Imagine the following scenario:
- Game sets render target to texture A
- Game renders to texture A
- (render pass ends)
- Game binds texture A to a sampler
- Game sets render target to texture B
- Renders to texture B using texture A (barrier required)
Because of the previous behaviour, the check to add a barrier for sampling a texture actually happens before it is registered as modified, meaning no barrier was added at all. This isn't always the case, but it was definitely causing issues in Xenoblade 2.
This doesn't fix any more complicated issues where a texture is repeatedly sampled while it is currently being rendered.
Fixes visual glitches at lower resolutions in Xenoblade 2. May fix other cases.
* Add hide-cursor command line argument
* gtk: Adjust SettingsWindow for hide cursor options
* ava: Adjust SettingsWindow for hide cursor options
* ava: Add override check for HideCursor arg
* Remove copy&paste sins
* ava: Leave a little more room between the options
* gtk: Fix hide cursor issues
* ava: Only hide cursor if it's within the embedded window
* GPU: Keep sampled textures without any pool references alive
Occasionally games are very wasteful and clear/write to a texture without ever sampling it. As rendered textures in NVN games seem to all have overlapping memory ranges, the texture will eventually get overwritten.
Normally, this would trigger a removal from the auto delete cache, but a pool entry would keep the texture alive. However, with these textures that are never used, they will get deleted immediately and recreated on the next frame.
This change makes it so the ShortTextureCache can keep textures that have naver had a pool reference alive for a few frames, so they're not constantly being created and deleted.
This improves performance in Zelda BOTW a little.
* Cleanup
* WIP texture pre-flush
Improve performance of TextureView GetData to buffer
Fix copy/sync ordering
Fix minor bug
Make this actually work
WIP host mapping stuff
* Fix usage flags
* message
* Cleanup 1
* Fix rebase
* Fix
* Improve pre-flush rules
* Fix pre-flush
* A lot of cleanup
* Use the host memory bits
* Select the correct memory type
* Cleanup TextureGroupHandle
* Missing comment
* Remove debugging logs
* Revert BufferHandle _value access modifier
* One interrupt action at a time.
* Support D32S8 to D24S8 conversion, safeguards
* Interrupt cannot happen in sync handle's lock
Waitable needs to be checked twice now, but this should stop it from deadlocking.
* Remove unused using
* Address some feedback
* Address feedback
* Address more feedback
* Address more feedback
* Improve sync rules
Should allow for faster sync in some cases.
* GPU: Fix errors handling texture remapping
- Fixes an error where a pool entry and memory mapping changing at the same time could cause a texture to rebind its data from the wrong GPU VA (data swaps)
- Fixes an error where the texture pool could act on a mapping change before the mapping has actually been changed ("Unmapped" event happens before change, we need to signal it changed _after_ it completes)
TODO: remove textures from partially mapped list... if they aren't.
* Add Remap actions for handling post-mapping behaviours
* Remove unused code.
* Address feedback
* Nit
* Refactor attribute handling on the shader generator
* Implement gl_ViewportMask[]
* Add back the Intel FrontFacing bug workaround
* Fix GLSL transform feedback outputs mistmatch with fragment stage
* Shader cache version bump
* Fix geometry shader recognition
* PR feedback
* Delete GetOperandDef and GetOperandUse
* Remove replacements that are no longer needed on GLSL compilation on Vulkan
* Fix incorrect load for per-patch outputs
* Fix build
* Use vector transform feedback outputs with fragment shaders
* Shader cache version bump
* Fix missing outputs when vector transform feedback outputs are used
* use ArrayPool, avoid 6000-7000 allocs/sec of runtime
* use ArrayPool, avoid ~7k allocs/second during game execution
* use ArrayPool, avoid ~3000 allocs/sec during game execution
* use MemoryPool, reduce 0.5 MB/sec of new allocations during game execution
* avoid over-allocation by setting List<> Capacity when known
* remove LINQ in KTimeManager.UnscheduleFutureInvocation
* KTimeManager - avoid spinning one more time when the time has arrived
* KTimeManager - let SpinWait decide when to Thread.Yield(), and don't SpinOnce() immediately after Thread.Yield()
* use MemoryPool, reduce ~175k bytes/sec allocation during game execution
* IpcService - call commands via dynamic methods instead of reflection .Invoke(). Faster to call and with fewer allocations because parameters can be passed directly instead of as an array
* Make ButtonMappingEntry a record struct to avoid allocations. Set the List<ButtonMappingEntry> capacity according to use.
* add MemoryBuffer type for working with MemoryPool<byte>
* update changes to use MemoryBuffer
* make parameter ReadOnlySpan instead of Span
* whitespace fix
* Revert "IpcService - call commands via dynamic methods instead of reflection .Invoke(). Faster to call and with fewer allocations because parameters can be passed directly instead of as an array"
This reverts commit f2c698bdf65f049e8481c9f2ec7138d9b9a8261d.
* tweak KTimeManager spin behavior
* replace MemoryBuffer with ByteMemoryPool modeled after System.Buffers.ArrayMemoryPool<T>
* make ByteMemoryPoolBuffer responsible for renting memory