This fixes a longstanding issue with resolution scale that could result in flickering graphics, typically the first frame something is drawn, or on camera cuts in cutscenes.
The root cause of the issue is that texture scale can be changed when binding textures or images. This typically happens because a texture becomes a view of a larger texture, such as a 400x225 texture becoming a view of a 800x450 texture with two levels. If the 400x225 texture is bound as a render target and has state [1x Undesired], but the storage texture is [2x Scaled], the render target texture's scale is changed to [2x Scaled] to match its new storage. This means the scale changed after the render target state was processed...
This can cause a number of issues. When render target state is processed, texture scales are examined and potentially changed so that they are all the same value. If one texture is scaled, all textures must be. If one texture is blacklisted from scaling, all of them must be. This results in a single resolution scale value being assigned to the TextureManager, which also scales the scissor and viewport values.
If the scale is chosen as 1x, and a later texture binding changes one of the textures to be 2x, the scale in TextureManager no longer matches all of the bound textures. What's worse, the scales in these textures could mismatch entirely. This typically results in the support buffer scale, viewport and scissor being wrong for at least one of the bound render targets.
This PR fixes the issue by re-evaluating render target state if any scale mismatches the expected scale after texture bindings happen. This can actually cause scale to change again, so it must loop back to perform texture bindings again. This can happen as many times as it needs to, but I don't expect it to happen more than once. Problematic bindings will just result in a blacklist, which will propagate to other bound targets.
* WIP: Separate guest/host tracking + unaligned protection
Allow memory manager to define support for single byte guest tracking
* Formatting
* Improve docs
* Properly handle cases where the address space bits are too low
* Address feedback
* - add new abstract class `VirtualMemoryManagerBase`
- rename `MemoryManagerBase` to `VirtualMemoryManagerRefCountedBase` and derive from `VirtualMemoryManagerBase`
- change `AddressSpaceManager`, `HvMemoryManager`, `MemoryManager`, and `MemoryManagerHostMapped` to implement abstract members and use the inherited `void VirtualMemoryManagerBase.Read(TVirtual va, Span<byte> data)` implementation.
* move property `AddressSpaceSize` up by the other properties
* nuget: bump SixLabors.ImageSharp from 1.0.4 to 2.1.3 (#3976)
* nuget: bump SixLabors.ImageSharp from 1.0.4 to 2.1.3
Bumps [SixLabors.ImageSharp](https://github.com/SixLabors/ImageSharp) from 1.0.4 to 2.1.3.
- [Release notes](https://github.com/SixLabors/ImageSharp/releases)
- [Commits](https://github.com/SixLabors/ImageSharp/compare/v1.0.4...v2.1.3)
---
updated-dependencies:
- dependency-name: SixLabors.ImageSharp
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
* Update for 2.x changes
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Mary <mary@mary.zone>
* Update SixLabors.ImageSharp to 2.1.7
This is the latest version we can update to without the license change.
* Update SixLabors.ImageSharp.Drawing to v1.0.0
This is the latest version we can update to without the license change.
---------
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Mary <mary@mary.zone>
* LightningJit: Disable some cache ops and CTR_EL0 access on Windows Arm
* Format whitespace
* Delete unused code
* Fix typo
Co-authored-by: riperiperi <rhy3756547@hotmail.com>
---------
Co-authored-by: riperiperi <rhy3756547@hotmail.com>
* misc: Move Ryujinx project to Ryujinx.Gtk3
This breaks release CI for now but that's fine.
Signed-off-by: Mary Guillemard <mary@mary.zone>
* misc: Move Ryujinx.Ava project to Ryujinx
This breaks CI for now, but it's fine.
Signed-off-by: Mary Guillemard <mary@mary.zone>
* infra: Make Avalonia the default UI
Should fix CI after the previous changes.
GTK3 isn't build by the release job anymore, only by PR CI.
This also ensure that the test-ava update package is still generated to
allow update from the old testing channel.
Signed-off-by: Mary Guillemard <mary@mary.zone>
* Fix missing copy in create_app_bundle.sh
Signed-off-by: Mary Guillemard <mary@mary.zone>
* Fix syntax error
Signed-off-by: Mary Guillemard <mary@mary.zone>
---------
Signed-off-by: Mary Guillemard <mary@mary.zone>
* HipcGenerator: skip do-nothing call to MemoryMarshal.Cast<byte, byte>() in generated code
* HipcGenerator: fix method name typos
* HipcGenerator: make generated methods use stackalloc for `isBufferMapAlias` bool array
* HipcGenerator: make generated GetCommandHandlers() method return a FrozenDictionary<int, CommandHandler>
* HipcGenerator: return `FrozenDictionary<,>.Empty` when there are no command implementations, otherwise create `FrozenDictionary` from a `IEnumerable<KeyValuePair<,>>`` instead of a `Dictionary<,>``
* OpenGL: Mask out all color outputs with no fragment shader
This appears to match Vulkan's behaviour, which is needed for stencil shadows in Penny's Big Breakaway. It's far from the only issue, you can try the Full Bindless PR if you want to see it in a more intact state.
* Remove unused member
* Implement virtual buffer copies
* Introduce TranslateAndCreateMultiBuffersPhysicalOnly, use it for copy and clear
* Rename VirtualBufferCache to VirtualRangeCache
* Fix potential issue where virtual range could exist in the cache, without a physical buffer
* Fix bug that could cause copy with negative size on CopyToDependantVirtualBuffer
* Remove virtual copy back for SyncAction
* GetData XML docs
* Make field readonly
* Fix virtual buffer modification tracking
* Remove CopyFromDependantVirtualBuffers from ExternalFlush
* Move things around a little to avoid perf impact
- Inline null check for CopyFromDependantVirtualBuffers
- Remove extra method call for SynchronizeMemoryWithVirtualCopyBack, prefer calling CopyFromDependantVirtualBuffers separately
* Fix up XML doc
---------
Co-authored-by: riperiperi <rhy3756547@hotmail.com>
Disables push descriptors on older NVIDIA GPUs (10xx and below), since it is clearly broken beyond comprehension. The existing workaround wasn't good enough and a more thorough one will probably cost more performance than the feature gains. The workaround has been removed.
Fixes#6331.
If more than 16 barriers were queued at one time, the _queuedBarrierCount would no longer match the number of remaining barriers, because when breaking out of the loop consuming them it deleted all barriers, not just the 16 that were consumed.
Should fix freezes that started occurring with #6240. Fixes issue #6338.
Enable input focus proxy, makes WM_TAKE_FOCUS capability to be exposed.
This fix menu on gamescope, for real this time....
Signed-off-by: Mary Guillemard <mary@mary.zone>
* WIP barrier batch
* Add store op to image usage barrier
* Dispose the barrier batch
* Fix encoding?
* Handle read and write on the load op barrier.
Load op consumes read accesses but does not add one, as the only other operation that can read is another load.
* Simplify null check
* Insert barriers on program change in case stale bindings are reintroduced
* Not sure how I messed this one up
* Improve location of bindings barrier update
This is also important for emergency deferred clear
* Update src/Ryujinx.Graphics.Vulkan/BarrierBatch.cs
Co-authored-by: Mary Guillemard <thog@protonmail.com>
---------
Co-authored-by: Mary Guillemard <thog@protonmail.com>
* Fix Push Descriptors
* Use push descriptor templates
* Use reserved bindings
* Formatting
* Disable when using MVK
("my heart will go on" starts playing as thousands of mac users shed a tear in unison)
* Introduce limit on push descriptor binding number
The bitmask used for updating push descriptors is ulong, so only 64 bindings can be tracked for now.
* Address feedback
* Fix logic for binding rejection
Should only offset limit when reserved bindings are less than the requested one.
* Workaround pascal and older nv bug
* Add GPU number detection for nvidia
* Only do workaround if it's valid to do so.
* macOS: Stop storing user data in Documents for some users; fix symlinks
* Use SupportedOSPlatform tag, catch exceptions, log warning instead of error
* Provide best path hints to user if symlink fixup fails
---------
Co-authored-by: jcm <butt@butts.com>
* Update About Window like requested in PR #6267
* Feedback
* Apply suggestions from code review
Co-authored-by: Isaac Marovitz <42140194+IsaacMarovitz@users.noreply.github.com>
* Fix indents
---------
Co-authored-by: Isaac Marovitz <42140194+IsaacMarovitz@users.noreply.github.com>
* Add missing RID exclusions for linux-arm64
Signed-off-by: Mary Guillemard <mary@mary.zone>
* Remove libsoundio.so from linux-arm64 deployment
This is a x86_64 library.
Signed-off-by: Mary Guillemard <mary@mary.zone>
---------
Signed-off-by: Mary Guillemard <mary@mary.zone>
* ci: Enable Linux ARM64 on build and release
Signed-off-by: Mary <mary@mary.zone>
* Address gdkchan comment
Signed-off-by: Mary <mary@mary.zone>
---------
Signed-off-by: Mary <mary@mary.zone>
Previously we were only doing it for Vulkan, but it turns out that
not setting it when PROGRAM_POINT_SIZE is set is considered UB
on OpenGL Core.
Signed-off-by: Mary <mary@mary.zone>
This makes IOpenGLContext.HasContext not static and be implementable.
By doing this, we can support more than WGL and WGL.
This also allows the SDL2 headless version to run under Wayland.
Signed-off-by: Mary <mary@mary.zone>
* Write/read guest state to context for sync points, stop reserving stack for them
* Fix UsedGprsMask not being updated when allocating with preferencing
* POP should be also considered a return
* Switch from using Flex panel to a Wrap panel for Grid view. This allows keyboard navigation.
* Stop using Flex panel in favor of Avalonia Wrap Panel.
* Redact usernames from logs
* Changed internal vars to private and applied naming rules
* Use Directory.GetParent() instead of DirectoryInfo
* Update src/Ryujinx.Common/Logging/Logger.cs
---------
Co-authored-by: Ac_K <Acoustik666@gmail.com>
* AccountService: Cache token data
This method appears to indicate that the token returned should be cached. I've made it so that it generates a token that lasts until its expiration time, and reuses it on subsequent calls.
* Private naming convention
* Vulkan: Add Render Pass / Framebuffer Cache
Cache is owned by each texture view.
- Window's way of getting framebuffer cache for swapchain images is really messy - it creates a TextureView out of just a vk image view, with invalid info and no storage.
* Clear up limited use of alternate TextureView constructor
* Formatting and messages
* More formatting and messages
I apologize for `_colorsCanonical[index]?.Storage?.InsertReadToWriteBarrier`, the compiler made me do it
* Self review, change GetFramebuffer to GetPassAndFramebuffer
* Avoid allocations on Remove for HashTableSlim
* Member can be readonly
* Generate texture create info for swapchain images
* Improve hashcode
* Remove format, samples, size and isDepthStencil when possible
Tested in a number of games, seems fine.
* Removed load op barriers
These can be introduced later.
* Reintroduce UpdateModifications
Technically meant to be replaced by load op stuff.
* Cpu: Implement Vpadal and Vrintr instructions
This PR superseed last instructions left in #2242.
Since I'm not a CPU guy I've just ported the code and nothing more.
Please be precise during review if there are some changes to be done.
It should fixes#1781
Co-Authored-By: Piyachet Kanda <piyachetk@gmail.com>
* Addresses gdkchan's feedback
* Addresses gdkchan's feedback 2
* Apply suggestions from code review
Co-authored-by: gdkchan <gab.dark.100@gmail.com>
* another fix
* Update InstEmitSimdHelper32.cs
* Correct fix
* Addresses gdkchan's feedback
* Update CpuTestSimdCvt32.cs
---------
Co-authored-by: Piyachet Kanda <piyachetk@gmail.com>
Co-authored-by: gdkchan <gab.dark.100@gmail.com>
Updates `Avalonia.Svg` from 11.0.0.10 to 11.0.0.13
Updates `Avalonia.Svg.Skia` from 11.0.0.10 to 11.0.0.13
And reflect update changes as dependabot can't do it.
Superseed #6209
* Migrate friends service to new IPC
* Add a note that the pointer buffer size and domain counts are wrong
* Wrong length
* Format whitespace
* PR feedback
* Fill in structs from PR feedback
* Missed that one
* Somehow forgot to save that one
* Fill in enums from PR review
* Language enum, NotificationTime
* Format whitespace
* Fix the warning
* Remove GetBaseApplicationDirectory() & Move logs directory to user base path
We should assume the application directory might be write-protected.
* Use Ryujinx.sh in Ryujinx.desktop
This desktop file isn't really used right now,
so this changes effectively nothing.
* Use properties in ReleaseInformation.cs and add ConfigName property
* Configure config filename in Github workflows
* Add a separate config step for macOS
Because they use BSD sed instead of GNU sed
* Keep log directory at the old location for dev environments
* Add FileSystemUtils since Directory.Move() doesn't work across filesystems
Steal CopyDirectory code from https://learn.microsoft.com/en-us/dotnet/standard/io/how-to-copy-directories
* Fix "Open Logs folder" button pointing to the wrong directory
* Add execute permissions to Ryujinx.sh
* Fix missing newlines
* AppDataManager: Use FileSystemUtils.MoveDirectory()
* Make dotnet format happy
* Add a fallback for the logging directory
* Mod: Do LayeredFs loading Parallel to improve speed
This fixes and superseed #5672 due to inactivity, nothing more.
(See original PR for description)
Testing are welcome.
Close#5661
* Addresses gdkchan's feedback
* commit to test mako change
* Revert "commit to test mako change"
This reverts commit 8b0caa8a21.
* Allow skipping draws with broken pipeline variants on Vulkan
* Move IsLinked check to CreatePipeline
* Restore throw on error behaviour for background compile
* Can't remove SetAlphaTest pragmas yet
* Double new line
* Fs: Log when Commit fails due to PathAlreadyInUse
This fixes and superseed #5418, nothing more.
(See original PR for description)
Co-Authored-By: James R T <jamestiotio@gmail.com>
* Update IFileSystem.cs
---------
Co-authored-by: James R T <jamestiotio@gmail.com>
* Replace vendor id lookup with driver name
* Create separate field for driver name, handle OpenGL
* Document changes in VulkanPhysicalDevice.cs
* Always display driver over vendor
* Replace Vulkan 1.2 requirement with VK_KHR_driver_properties
* Remove empty line
* Remove redundant unsafe block
* Apply suggestions from code review
---------
Co-authored-by: Ac_K <Acoustik666@gmail.com>
* ssl: Retrieve remote hostnames if the provided hostname is empty
This avoids crashing with an AuthenticationException.
* ssl: Remove unused variable from RetrieveHostName
* Vulkan: Use staging buffer for temporary constants
Helper shaders and post processing effects typically need some parameters to tell them what to do, which we pass via constant buffers that are created and destroyed each time.
This can vary in cost between different Vulkan drivers. It shows up on profiles on mesa and MoltenVK, so it's worth avoiding. Some games only do it once (BlitColor for present), others multiple times. It's also done for post processing filters and FSR upscaling, which creates two buffers.
For mirrors, I added the ability to reserve a range on the staging buffer for use as any type of binding. This PR allows these constant buffers to be instead temporarily allocated on the staging buffer, skipping allocation and buffer management costs entirely.
Two temporary allocations do remain:
- DrawTexture, because it doesn't have access to the command buffer scope
- Index buffer indirect conversion, because one of them is a storage buffer and thus is a little more complicated.
There's a small cost in that the uniform buffer takes up more space due to alignment requirements. At worst that's 256 bytes (on a GTX 1070) but more modern GPUs should have a better time.
Worth testing across different games and post effects to make sure they still work.
* Use temporary buffer for ConvertIndexBufferIndirect
* Simplify alignment passing for now
* Fix shader params length for CopyIncompatibleFormats
* Set data for helpershaders without overlap checks
The data is in the staging buffer, so its usage range is guarded using that.
Turns out that ElementAt for Queue<T> runs the default implementation as it doesn't implement IList, which enumerates elements of the queue up to the given index. This code was creating `count` enumerators and iterating way more queue items than it needed to at higher counts. The solution is just to use one enumerator and break out of the loop when we get the count that we need.
3.5% of backend time was being spent _just_ enumerating at the usual spot in SMO.
* Fix architecture preference for MacOS game shortcuts
* Detect arch and then pass it to script
Co-authored-by: jcm <john.moody@coloradocollege.edu>
* Remove old script write call in `CreateShortcutMacos`
* Turn launch script into EmbeddedResource
* Added final newline
---------
Co-authored-by: jcm <john.moody@coloradocollege.edu>
* Add a separate device memory manager
* Still need this
* Device writes are always tracked
* Device writes are always tracked (2)
* Rename more instances of gmm to mm
* Input: Improve controller identification
Controllers were identified before by a combination of their _global_ index in the list of controllers and their GUID. The problem is, disconnecting and reconnecting a controller can change its global index; the controller can appear at the end. This would give it another ID, and the controller would need to be reconfigured.
This happened to me a lot with a switch pro controller and a USB game controller, it was essentially random which appeared first. Now, it consistently detects them.
This PR changes the controller identification to be a combination of an index of controllers with the same GUID (generally 0), and its GUID. It also reworks managing the list of controllers to properly consider instance IDs.
This also changes the NpadManager to attempt to reuse old controllers when refreshing input configuration, which can prevent input from going dead for seconds whenever a controller connects or disconnects (and the switch pro controller just entirely dying).
Testing with different controller types, OS and Avalonia is welcome. Remember that the target is connecting a ton of controllers, and pulling/reconnecting them.
* Remove double empty line
* Implement a new JIT for Arm devices
* Auto-format
* Make a lot of Assembler members read-only
* More read-only
* Fix more warnings
* ObjectDisposedException.ThrowIf
* New JIT cache for platforms that enforce W^X, currently unused
* Remove unused using
* Fix assert
* Pass memory manager type around
* Safe memory manager mode support + other improvements
* Actual safe memory manager mode masking support
* PR feedback