* WIP Vulkan implementation
* No need to initialize attributes on the SPIR-V backend anymore
* Allow multithreading shaderc and vkCreateShaderModule
You'll only really see the benefit here with threaded-gal or parallel shader cache compile.
Fix shaderc multithreaded changes
Thread safety for shaderc Options constructor
Dunno how they managed to make a constructor not thread safe, but you do you. May avoid some freezes.
* Support multiple levels/layers for blit.
Fixes MK8D when scaled, maybe a few other games. AMD software "safe" blit not supported right now.
* TextureStorage should hold a ref of the foreign storage, otherwise it might be freed while in use
* New depth-stencil blit method for AMD
* Workaround for AMD driver bug
* Fix some tessellation related issues (still doesn't work?)
* Submit command buffer before Texture GetData. (UE4 fix)
* DrawTexture support
* Fix BGRA on OpenGL backend
* Fix rebase build break
* Support format aliasing on SetImage
* Fix uniform buffers being lost when bindings are out of order
* Fix storage buffers being lost when bindings are out of order
(also avoid allocations when changing bindings)
* Use current command buffer for unscaled copy (perf)
Avoids flushing commands and renting a command buffer when fulfilling copy dependencies and when games do unscaled copies.
* Update to .net6
* Update Silk.NET to version 2.10.1
Somehow, massive performance boost. Seems like their vtable for looking up vulkan methods was really slow before.
* Fix PrimitivesGenerated query, disable Transform Feedback queries for now
Lets Splatoon 2 work on nvidia. (mostly)
* Update counter queue to be similar to the OGL one
Fixes softlocks when games had to flush counters.
* Don't throw when ending conditional rendering for now
This should be re-enabled when conditional rendering is enabled on nvidia etc.
* Update findMSB/findLSB to match master's instruction enum
* Fix triangle overlay on SMO, Captain Toad, maybe others?
* Don't make Intel Mesa pay for Intel Windows bugs
* Fix samplers with MinFilter Linear or Nearest (fixes New Super Mario Bros U Deluxe black borders)
* Update Spv.Generator
* Add alpha test emulation on shader (but no shader specialisation yet...)
* Fix R4G4B4A4Unorm texture format permutation
* Validation layers should be enabled for any log level other than None
* Add barriers around vkCmdCopyImage
Write->Read barrier for src image (we want to wait for a write to read it)
Write->Read barrier for dst image (we want to wait for the copy to complete before use)
* Be a bit more careful with texture access flags, since it can be used for anything
* Device local mapping for all buffers
May avoid issues with drivers with NVIDIA on linux/older gpus on windows when using large buffers (?)
Also some performance things and fixes issues with opengl games loading textures weird.
* Cleanup, disable device local buffers for now.
* Add single queue support
Multiqueue seems to be a bit more responsive on NVIDIA. Should fix texture flush on intel. AMD has been forced to single queue for an experiment.
* Fix some validation errors around extended dynamic state
* Remove Intel bug workaround, it was fixed on the latest driver
* Use circular queue for checking consumption on command buffers
Speeds up games that spam command buffers a little. Avoids checking multiple command buffers if multiple are active at once.
* Use SupportBufferUpdater, add single layer flush
* Fix counter queue leak when game decides to use host conditional rendering
* Force device local storage for textures (fixes linux performance)
* Port #3019
* Insert barriers around vkCmdBlitImage (may fix some amd flicker)
* Fix transform feedback on Intel, gl_Position feedback and clears to inexistent depth buffers
* Don't pause transform feedback for multi draw
* Fix draw outside of render pass and missing capability
* Workaround for wrong last attribute on AMD (affects FFVII, STRIKERS1945, probably more)
* Better workaround for AMD vertex buffer size alignment issue
* More instructions + fixes on SPIR-V backend
* Allow custom aspect ratio on Vulkan
* Correct GTK UI status bar positions
* SPIR-V: Functions must always end with a return
* SPIR-V: Fix ImageQuerySizeLod
* SPIR-V: Set DepthReplacing execution mode when FragDepth is modified
* SPIR-V: Implement LoopContinue IR instruction
* SPIR-V: Geometry shader support
* SPIR-V: Use correct binding number on storage buffers array
* Reduce allocations for Spir-v serialization
Passes BinaryWriter instead of the stream to Write and WriteOperand
- Removes creation of BinaryWriter for each instruction
- Removes allocations for literal string
* Some optimizations to Spv.Generator
- Dictionary for lookups of type declarations, constants, extinst
- LiteralInteger internal data format -> ushort
- Deterministic HashCode implementation to avoid spirv result not being the same between runs
- Inline operand list instead of List<T>, falls back to array if many operands. (large performance boost)
TODO: improve instruction allocation, structured program creator, ssa?
* Pool Spv.Generator resources, cache delegates, spv opts
- Pools for Instructions and LiteralIntegers. Can be passed in when creating the generator module.
- NewInstruction is called instead of new Instruction()
- Ryujinx SpirvGenerator passes in some pools that are static. The idea is for these to be shared between threads eventually.
- Estimate code size when creating the output MemoryStream
- LiteralInteger pools using ThreadStatic pools that are initialized before and after creation... not sure of a better way since the way these are created is via implicit cast.
Also, cache delegates for Spv.Generator for functions that are passed around to GenerateBinary etc, since passing the function raw creates a delegate on each call.
TODO: update python spv cs generator to make the coregrammar with NewInstruction and the `params` overloads.
* LocalDefMap for Ssa Rewriter
Rather than allocating a large array of all registers for each block in the shader, allocate one array of all registers and clear it between blocks. Reduces allocations in the shader translator.
* SPIR-V: Transform feedback support
* SPIR-V: Fragment shader interlock support (and image coherency)
* SPIR-V: Add early fragment tests support
* SPIR-V: Implement SwizzleAdd, add missing Triangles ExecutionMode for geometry shaders, remove SamplerType field from TextureMeta
* Don't pass depth clip state right now (fix decals)
Explicitly disabling it is incorrect. OpenGL currently automatically disables based on depth clamp, which is the behaviour if this state is omitted.
* Multisampling support
* Multisampling: Use resolve if src samples count > dst samples count
* Multisampling: We can only resolve for unscaled copies
* SPIR-V: Only add FSI exec mode if used.
* SPIR-V: Use ConstantComposite for Texture Offset Vector
Fixes a bunch of freezes with SPIR-V on AMD hardware, and validation errors. Note: Obviously assumes input offsets are constant, which they currently are.
* SPIR-V: Don't OpReturn if we already OpExit'ed
Fixes spir-v parse failure and stack smashing in RADV (obviously you still need bolist)
* SPIR-V: Only use input attribute type for input attributes
Output vertex attributes should always be of type float.
* Multithreaded Pipeline Compilation
* Address some feedback
* Make this 32
* Update topology with GpuAccessorState
* Cleanup for merge (note: disables spir-v)
* Make more robust to shader compilation failure
- Don't freeze when GLSL compilation fails
- Background SPIR-V pipeline compile failure results in skipped draws, similar to GLSL compilation failure.
* Fix Multisampling
* Only update fragment scale count if a vertex texture needs a scale.
Fixes a performance regression introduced by texture scaling in the vertex stage where support buffer updates would be very frequent, even at 1x, if any textures were used on the vertex stage.
This check doesn't exactly look cheap (a flag in the shader stage would probably be preferred), but it is much cheaper than uploading scales in both vulkan and opengl, so it will do for now.
* Use a bitmap to do granular tracking for buffer uploads.
This path is only taken if the much faster check of "is the buffer rented at all" is triggered, so it doesn't actually end up costing too much, and the time saved by not ending render passes (and on gpu for not waiting on barriers) is probably helpful.
Avoids ending render passes to update buffer data (not all the time)
- 140-180 to 35-45 in SMO metro kingdom (these updates are in the UI)
- Very variable 60-150(!) to 16-25 in mario kart 8 (these updates are in the UI)
As well as allowing more data to be preloaded persistently, this will also allow more data to be loaded in the preload buffer, which should be faster as it doesn't need to insert barriers between draws. (and on tbdr, does not need to flush and reload tile memory)
Improves performance in GPU limited scenarios. Should notably improve performance on TBDR gpus. Still a lot more to do here.
* Copy query results after RP ends, rather than ending to copy
We need to end the render pass to get the data (submit command buffer) anyways...
Reduces render passes created in games that use queries.
* Rework Query stuff a bit to avoid render pass end
Tries to reset returned queries in background when possible, rather than ending the render pass.
Still ends render pass when resetting a counter after draws, but maybe that can be solved too. (by just pulling an empty object off the pool?)
* Remove unnecessary lines
Was for testing
* Fix validation error for query reset
Need to think of a better way to do this.
* SPIR-V: Fix SwizzleAdd and some validation errors
* SPIR-V: Implement attribute indexing and StoreAttribute
* SPIR-V: Fix TextureSize for MS and Buffer sampler types
* Fix relaunch issues
* SPIR-V: Implement LogicalExclusiveOr
* SPIR-V: Constant buffer indexing support
* Ignore unsupported attributes rather than throwing (matches current GLSL behaviour)
* SPIR-V: Implement tessellation support
* SPIR-V: Geometry shader passthrough support
* SPIR-V: Implement StoreShader8/16 and StoreStorage8/16
* SPIR-V: Resolution scale support and fix TextureSample multisample with LOD bug
* SPIR-V: Fix field index for scale count
* SPIR-V: Fix another case of wrong field index
* SPIRV/GLSL: More scaling related fixes
* SPIR-V: Fix ImageLoad CompositeExtract component type
* SPIR-V: Workaround for Intel FrontFacing bug
* Enable SPIR-V backend by default
* Allow null samplers (samplers are not required when only using texelFetch to access the texture)
* Fix some validation errors related to texel block view usage flag and invalid image barrier base level
* Use explicit subgroup size if we can (might fix some block flickering on AMD)
* Take componentMask and scissor into account when clearing framebuffer attachments
* Add missing barriers around CmdFillBuffer (fixes Monster Hunter Rise flickering on NVIDIA)
* Use ClampToEdge for Clamp sampler address mode on Vulkan (fixes Hollow Knight)
Clamp is unsupported on Vulkan, but ClampToEdge behaves almost the same. ClampToBorder on the other hand (which was being used before) is pretty different
* Shader specialization for new Vulkan required state (fixes remaining alpha test issues, vertex stretching on AMD on Crash Bandicoot, etc)
* Check if the subgroup size is supported before passing a explicit size
* Only enable ShaderFloat64 if the GPU supports it
* We don't need to recompile shaders if alpha test state changed but alpha test is disabled
* Enable shader cache on Vulkan and implement MultiplyHighS32/U32 on SPIR-V (missed those before)
* Fix pipeline state saving before it is updated.
This should fix a few warnings and potential stutters due to bad pipeline states being saved in the cache. You may need to clear your guest cache.
* Allow null samplers on OpenGL backend
* _unit0Sampler should be set only for binding 0
* Remove unused PipelineConverter format variable (was causing IOR)
* Raise textures limit to 64 on Vulkan
* No need to pack the shader binaries if shader cache is disabled
* Fix backbuffer not being cleared and scissor not being re-enabled on OpenGL
* Do not clear unbound framebuffer color attachments
* Geometry shader passthrough emulation
* Consolidate UpdateDepthMode and GetDepthMode implementation
* Fix A1B5G5R5 texture format and support R4G4 on Vulkan
* Add barrier before use of some modified images
* Report 32 bit query result on AMD windows (smo issue)
* Add texture recompression support (disabled for now)
It recompresses ASTC textures into BC7, which might reduce VRAM usage significantly on games that uses ASTC textures
* Do not report R4G4 format as supported on Vulkan
It was causing mario head to become white on Super Mario 64 (???)
* Improvements to -1 to 1 depth mode.
- Transformation is only applied on the last stage in the vertex pipeline.
- Should fix some issues with geometry and tessellation (hopefully)
- Reading back FragCoord Z on fragment will transform back to -1 to 1.
* Geometry Shader index count from ThreadsPerInputPrimitive
Generally fixes SPIR-V emitting too many triangles, may change games in OpenGL
* Remove gl_FragDepth scaling
This is always 0-1; the other two issues were causing the problems. Fixes regression with Xenoblade.
* Add Gl StencilOp enum values to Vulkan
* Update guest cache to v1.1 (due to specialization state changes)
This will explode your shader cache from earlier vulkan build, but it must be done. 😔
* Vulkan/SPIR-V support for viewport inverse
* Fix typo
* Don't create query pools for unsupported query types
* Return of the Vector Indexing Bug
One day, everyone will get this right.
* Check for transform feedback query support
Sometimes transform feedback is supported without the query type.
* Fix gl_FragCoord.z transformation
FragCoord.z is always in 0-1, even when the real depth range is -1 to 1. Turns out the only bug was geo and tess stage outputs.
Fixes Pokemon Sword/Shield, possibly others.
* Fix Avalonia Rebase
Vulkan is currently not available on Avalonia, but the build does work and you can use opengl.
* Fix headless build
* Add support for BC6 and BC7 decompression, decompress all BC formats if they are not supported by the host
* Fix BCn 4/5 conversion, GetTextureTarget
BCn 4/5 could generate invalid data when a line's size in bytes was not divisible by 4, which both backends expect.
GetTextureTarget was not creating a view with the replacement format.
* Fix dependency
* Fix inverse viewport transform vector type on SPIR-V
* Do not require null descriptors support
* If MultiViewport is not supported, do not try to set more than one viewport/scissor
* Bounds check on bitmap add.
* Flush queries on attachment change rather than program change
Occlusion queries are usually used in a depth only pass so the attachments changing is a better indication of the query block ending.
Write mask changes are also considered since some games do depth only pass by setting 0 write mask on all the colour targets.
* Add support for avalonia (#6)
* add avalonia support
* only lock around skia flush
* addressed review
* cleanup
* add fallback size if avalonia attempts to render but the window size is 0. read desktop scale after enabling dpi check
* fix getting window handle on linux. skip render is size is 0
* Combine non-buffer with buffer image descriptor sets
* Support multisample texture copy with automatic resolve on Vulkan
* Remove old CompileShader methods from the Vulkan backend
* Add minimal pipeline layouts that only contains used bindings
They are used by helper shaders, the intention is avoiding needing to recompile the shaders (from GLSL to SPIR-V) if the bindings changes on the translated guest shaders
* Pre-compile helper shader as SPIR-V, and some fixes
* Remove pre-compiled shaderc binary for Windows as its no longer needed by default
* Workaround RADV crash
Enabling the descriptor indexing extension, even if it is not used, forces the radv driver to use "bolist".
* Use RobustBufferAccess on NVIDIA gpus
Avoids the SMO waterfall triangle on older NVIDIA gpus.
* Implement GPU selector and expose texture recompression on the UI and config
* Fix and enable background compute shader compilation
Also disables warnings from shader cache pipeline misses.
* Fix error due to missing subpass dependency when Attachment Write -> Shader Read barriers are added
* If S8D24 is not supported, use D32FS8
* Ensure all fences are destroyed on dispose
* Pre-allocate arrays up front on DescriptorSetUpdater, allows the removal of some checks
* Add missing clear layer parameter after rebase
* Use selected gpu from config for avalonia (#7)
* use configured device
* address review
* Fix D32S8 copy workaround (AMD)
Fixes water in Pokemon Legends Arceus on AMD GPUs. Possibly fixes other things.
* Use push descriptors for uniform buffer updates (disabled for now)
* Push descriptor support check, buffer redundancy checks
Should make push descriptors faster, needs more testing though.
* Increase light command buffer pool to 2 command buffers, throw rather than returning invalid cbs
* Adjust bindings array sizes
* Force submit command buffers if memory in use by its resources is high
* Add workaround for AMD GCN cubemap view sins
`ImageCreateCubeCompatibleBit` seems to generally break 2D array textures with mipmaps... even if they are eventually aliased as a cubemap with mipmaps. Forcing a copy here works around the issue.
This could be used in future if enabling this bit reduces performance on certain GPUs. (mobile class is generally a worry)
Currently also enabled on Linux as I don't know if they managed to dodge this bug (someone please tell me). Not enabled on Vega at the moment, but easy to add if the issue is there.
* Add mobile, non-RX variants to the GCN regex.
Also make sure that the 3 digit ones only include numbers starting with 7 or 8.
* Increase image limit per stage from 8 to 16
Xenoblade Chronicles 2 was hiting the limit of 8
* Minor code cleanup
* Fix NRE caused by SupportBufferUpdater calling pipeline ClearBuffer
* Add gpu selector to Avalonia (#8)
* Add gpu selector to avalonia settings
* show backend label on window
* some fixes
* address review
* Minor changes to the Avalonia UI
* Update graphics window UI and locales. (#9)
* Update xaml and update locales
* locale updates
Did my best here but likely needs to be checked by native speakers, especially the use of ampersands in greek, russian and turkish?
* Fix locales with more (?) correct translations.
* add separator to render widget
* fix spanish and portuguese
* Add new IdList, replaces buffer list that could not remove elements and had unbounded growth
* Don't crash the settings window if Vulkan is not supported
* Fix Actions menu not being clickable on GTK UI after relaunch
* Rename VulkanGraphicsDevice to VulkanRenderer and Renderer to OpenGLRenderer
* Fix IdList and make it not thread safe
* Revert useless OpenGL format table changes
* Fix headless project build
* List throws ArgumentOutOfRangeException
* SPIR-V: Fix tessellation
* Increase shader cache version due to tessellation fix
* Reduce number of Sync objects created (improves perf in some specific titles)
* Fix vulkan validation errors for NPOT compressed upload and GCN workaround.
* Add timestamp to the shader cache and force rebuild if host cache is outdated
* Prefer Mail box present mode for popups (#11)
* Prefer Mail box present mode
* fix debug
* switch present mode when vsync is toggled
* only disable vsync on the main window
* SPIR-V: Fix geometry shader input load with transform feedback
* BC7 Encoder: Prefer more precision on alpha rather than RGB when alpha is 0
* Fix Avalonia build
* Address initial PR feedback
* Only set transform feedback outputs on last vertex stage
* Address riperiperi PR feedback
* Remove outdated comment
* Remove unused constructor
* Only throw for negative results
* Throw for QueueSubmit and other errors
No point in delaying the inevitable
* Transform feedback decorations inside gl_PerVertex struct breaks the NVIDIA compiler
* Fix some resolution scale issues
* No need for two UpdateScale calls
* Fix comments on SPIR-V generator project
* Try to fix shader local memory size
On DOOM, a shader is using local memory, but both Low and High size are 0, CRS size is 1536, it seems to store on that region?
* Remove RectangleF that is now unused
* Fix ImageGather with multiple offsets
Needs ImageGatherExtended capability, and must use `ConstantComposite` instead of `CompositeConstruct`
* Address PR feedback from jD in all projects except Avalonia
* Address most of jD PR feedback on Avalonia
* Remove unsafe
* Fix VulkanSkiaGpu
* move present mode request out of Create Swapchain method
* split more parts of create swapchain
* addressed reviews
* addressed review
* Address second batch of jD PR feedback
* Fix buffer <-> image copy row length and height alignment
AlignUp helper does not support NPOT alignment, and ASTC textures can have NPOT block sizes
* Better fix for NPOT alignment issue
* Use switch expressions on Vulkan EnumConversion
Thanks jD
* Fix Avalonia build
* Add Vulkan selection prompt on startup
* Grammar fixes on Vulkan prompt message
* Add missing Vulkan migration flag
Co-authored-by: riperiperi <rhy3756547@hotmail.com>
Co-authored-by: Emmanuel Hansen <emmausssss@gmail.com>
Co-authored-by: MutantAura <44103205+MutantAura@users.noreply.github.com>
* Avalonia: Another Cleanup
This PR is a cleanup to the avalonia code recently added:
- Some XAML file are autoformatted like a previous PR.
- Dlc is renamed to DownloadableContent (Locale exclude).
- DownloadableContentManagerWindow is a bit improved (Fixes#3491).
- Some nits here and there.
* Fix GTK
* Remove AttachDebugDevTools
* Fix last warning
* Fix JSON fields
* add settings windows and children views
* Expose hotkeys configuration on the UI
* Remove double spacing from locale JSON
* simplify button assigner
* add cemuhook buttons and title to locale
* move common button assigner to own class
* cancel button assigner when window is closed
* remove unused setting
* address review. fix controller profile not loading default when switching devices
* fix updater file name
* Input cleanup (#37)
* addressed review
* add device type to controller device checks
* change accessibility modifier of public classes to internal
* Update Ryujinx.Ava/Ui/ViewModels/ControllerSettingsViewModel.cs
Co-authored-by: gdkchan <gab.dark.100@gmail.com>
* Update de_DE.json
* Update de_DE.json
* Update tr_TR.json
Translated newly added lines
* Update it_IT.json
* fix rebase
* update avalonia
* fix wrong key used for button text
* Align settings window elements
* Tabs to spaces
* Update brazilian portuguese translation
* Minor improvement on brazilian portuguese translation
* fix turkish translation
* remove unused text
* change view related classes to public
* unsubscribe from deferred event if dialog is closed
* Load the default language before loading any other when switching languages
* Make controller settings more compact
* increase default width of settings window, reduce profile buttons width
Co-authored-by: gdk <gab.dark.100@gmail.com>
Co-authored-by: MutantAura <44103205+MutantAura@users.noreply.github.com>
Co-authored-by: Niwu34 <67392333+Niwu34@users.noreply.github.com>
Co-authored-by: aegiff <99728970+aegiff@users.noreply.github.com>
Co-authored-by: Antonio Brugnolo <36473846+AntoSkate@users.noreply.github.com>
* Add the ability to toggle mute in the status bar.
* Add the ability to toggle mute in the status bar.
* Formatting fixes
* Add hotkey (F2) to mute
* Add default hotkey to config.json
* Add ability to change volume via slider.
* Fix Headless
* Fix SDL2 Problem : Credits to d3xMachina
* Remove unnecessary work
* Address gdk comments
* Toggling with Hotkey now properly restores volume to original level.
* Toggling with Hotkey now properly restores volume to original level.
* Update UI to show Volume % instead of Muted/Unmuted
* Clean up the volume ui a bit.
* Undo unintentionally committed code.
* Implement AudRen Support
* Restore intiial volume level in function definition.
* Finalize UI
* Finalize UI
* Use clamp for bounds check
* Use Math.Clamp for volume in soundio
* Address comments by gdkchan
* Address remaining comments
* Fix missing semicolon
* Address remaining gdkchan comment
* Fix comment
* Change /* to //
* Allow volume slider to change volume immediately.
Also force label text to cast to int to prevent decimals from showing in status bar
* Remove blank line
* Undo setting of volume level when "Cancel" is pressed.
* Fix allignment for settings window code
* 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
* 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. 😌
* 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>
* First working vibration implementation
* Fix Infinite Rumble in SDL2Mouse
* Stop ignoring one vibValues every 2
* Remove RumbleInfinity as suggested
* Reworked all the vibration handle / calculation
* Revert HidVibrationDevicePosition changes
* Add UI to enable and tune rumble
* Remove some stub logs
* Add PlayerIndex in rumble debug log
* Fix all requested changes
* Implements hid::GetVibrationDeviceInfo
* Better implements HidVibrationValue.Equals/GetHashCode
* Added requested changes from code review
* Last fixes from review
* Update configuration file version for rebase
* 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>
* audio: Implement a SDL2 backend
This adds support to SDL2 as an audio backend.
It has the same compatibility level as OpenAL without its issues.
I also took the liberty of restructuring the SDL2 code to have one
shared project between audio and input.
The configuration version was also incremented.
* Address gdkchan's comments
* Fix update logic
* Add an heuristic to pick the correct target sample count wanted by the game
* Address gdkchan's comments
* Address Ac_k's comments
* Fix audren output
* Address gdkchan's comments
* openal: Update to OpenTK 4
* Ryujinx.Graphics.OpenGL: Update to OpenTK 4
* Entirely removed OpenTK 3, still wip
* Use SPB for context creation and handling
Still need to test on GLX and readd input support
* Start implementing a new input system
So far only gamepad are supported, no configuration possible via UI but detected via hotplug/removal
Button mapping backend is implemented
TODO: front end, configuration handling and configuration migration
TODO: keyboard support
* Enforce RGB only framebuffer on the GLWidget
Fix possible transparent window
* Implement UI gamepad frontend
Also fix bad mapping of minus button and ensure gamepad config is updated in real time
* Handle controller being disconnected and reconnected again
* Revert "Enforce RGB only framebuffer on the GLWidget"
This reverts commit 0949715d1a03ec793e35e37f7b610cbff2d63965.
* Fix first color clear
* Filter SDL2 events a bit
* Start working on the keyboard detail
- Rework configuration classes a bit to be more clean.
- Integrate fully the keyboard configuration to the front end (TODO: assigner)
- Start skeleton for the GTK3 keyboard driver
* Add KeyboardStateSnapshot and its integration
* Implement keyboard assigner and GTK3 key mapping
TODO: controller configuration mapping and IGamepad implementation for keyboard
* Add missing SR and SL definitions
* Fix copy pasta mistake on config for previous commit
* Implement IGamepad interface for GTK3 keyboard
* Fix some implementation still being commented in the controller ui for keyboard
* Port screen handle code
* Remove all configuration management code and move HidNew to Hid
* Rename InputConfigNew to InputConfig
* Add a version field to the input config
* Prepare serialization and deserialization of new input config and migrate profile loading and saving
* Support input configuration saving to config and bump config version to 23.
* Clean up in ConfigurationState
* Reference SPB via a nuget package
* Move new input system to Ryujinx.Input project and SDL2 detail to Ryujinx.Input.SDL2
* move GTK3 input to the right directory
* Fix triggers on SDL2
* Update to SDL2 2.0.14 via our own fork
* Update buttons definition for SDL2 2.0.14 and report gamepad features
* Implement motion support again with SDL2
TODO: cemu hooks integration
* Switch to latest of nightly SDL2
* SDL2: Fix bugs in gamepad id matching allowing different gamepad to match on the same device index
* Ensure values are set in UI when the gamepad get hot plugged
* Avoid trying to add controllers in the Update method and don't open SDL2 gamepad instance before checking ids
This fixes permanent rumble of pro controller in some hotplug scenario
* Fix more UI bugs
* Move legcay motion code around before reintegration
* gamecontroller UI tweaks here and there
* Hide Motion on non motion configurations
* Update the TODO grave
Some TODO were fixed long time ago or are quite oudated...
* Integrate cemu hooks motion configuration
* Integrate cemu hooks configuration options to the UI again
* cemuhooks => cemuhooks
* Add cemu hook support again
* Fix regression on normal motion and fix some very nasty bugs around
* Fix for XCB multithreads issue on Linux
* Enable motion by default
* Block inputs in the main view when in the controller configuration window
* Some fixes for the controller ui again
* Add joycon support and fixes other hints
* Bug fixes and clean up
- Invert default mapping if not a Nintendo controller
- Keep alive the controller being selected on the controller window (allow to avoid big delay for controller needing time to init when doing button assignment)
- Clean up hints in use
- Remove debug logs around
- Fixes potential double free with SDL2Gamepad
* Move the button assigner and motion logic to the Ryujinx.Input project
* Reimplement raw keyboard hle input
Also move out the logic of the hotkeys
* Move all remaining Input manager stuffs to the Ryujinx.Input project
* Increment configuration version yet again because of master changes
* Ensure input config isn't null when not present
* Fixes for VS not being nice
* Fix broken gamepad caching logic causing crashes on ui
* Ensure the background context is destroyed
* Update dependencies
* Readd retrocompat with old format of the config to avoid parsing and crashes on those versions
Also updated the debug Config.json
* Document new input APIs
* Isolate SDL2Driver to the project and remove external export of it
* Add support for external gamepad db mappings on SDL2
* Last clean up before PR
* Addresses first part of comments
* Address gdkchan's comments
* Do not use JsonException
* Last comment fixes
* Restore removed text
* Adds more items to logs:
- Remove #1942
* Further removal of changes from #1942
* Removes hardcoded config state variables for logging
- Adds Configuration logging
* Decoupled logging from ReactiveObject
- Event handler added to Configuration state to handle logging of value changes
* Decoupled logging from ReactiveObject
- Event handler added to Configuration state to handle logging of value changes
* Implement friendlier portable mode
* Remove first run dialog
* Disable updates in portable mode for now
* Convert relative custom paths to absolute ones
Also, fix a regression when custom path doesn't exist
* Implement "Hide Cursor On Idle" option
Adds a general option to autohide the cursor after 8s have elapsed.
* Fix cursor not hiding on Windows and dispose it
* Don't dispose cursor, fix var names
* Abide by the GNOME documentation
* Fix nits
* Disabled by default, make it so it doesn't utilize any timer
* Remove *NIX time and extra lines
* Don't calculate if option is disabled
* Move if case
* Fix alignment
- Bind toggle events after setting up their current values. This fixes the issue where the config is saved 10 times when the main window is opened 😬
- Write to disk immediately to decrease the chances of corruption
* Enable Profiled Persistent Translation Cache (PPTC) by default
Enables PPTC by default. Enough time has passed and enough games tested that it should be the preferred setting for 99.9% of games. In case we are worried about PPTC files being put on the user's disk, shader cache already does this by default and generates about the same size files on average, so this should no longer be a concern.
* Update config.json with PTC set to true
* Updated _schema.json to set PPTC to true.
* Rewrite scheduler context switch code
* Fix race in UnmapIpcRestorePermission
* Fix thread exit issue that could leave the scheduler in a invalid state
* Change context switch method to not wait on guest thread, remove spin wait, use SignalAndWait to pass control
* Remove multi-core setting (it is always on now)
* Re-enable assert
* Remove multicore from default config and schema
* Fix race in KTimeManager
Here come Salieri, my implementation of a disk shader cache!
"I'm sure you know why I named it that."
"It doesn't really mean anything."
This implementation collects shaders at runtime and cache them to be later compiled when starting a game.
* Allow launching with custom data directories
Don't load alternate keys when using custom directory
* Address gdkchan's comments
* Misc fixes to log levels
Added more enabled log levels by default
Moved successful config updation to Notice as
1. It's not a warning
2. Warnings could've been disabled by the config load and hence message
would be lost
* Logger class changes only
Now compile-time checking is possible with the help of Nullable Value
types.
* Misc formatting
* Manual optimizations
PrintGuestLog
PrintGuestStackTrace
Surfaceflinger DequeueBuffer
* Reduce SendVibrationXX log level to Debug
* Add Notice log level
This level is always enabled and used to print system info, etc...
Also, rewrite LogColor to switch expression as colors are static
* Unify unhandled exception event handlers
* Print enabled LogLevels during init
* Re-add App Exit disposes in proper order
nit: switch case spacing
* Revert PrintGuestStackTrace to Info logs due to #1407
PrintGuestStackTrace is now called in some critical error handlers
so revert to old behavior as KThread isn't part of Guest.
* Batch replace Logger statements
* Initial implementation of Render Target Scaling
Works with most games I have. No GUI option right now, it is hardcoded.
Missing handling for texelFetch operation.
* Realtime Configuration, refactoring.
* texelFetch scaling on fragment shader (WIP)
* Improve Shader-Side changes.
* Fix potential crash when no color/depth bound
* Workaround random uses of textures in compute.
This was blacklisting textures in a few games despite causing no bugs. Will eventually add full support so this doesn't break anything.
* Fix scales oscillating when changing between non-native scales.
* Scaled textures on compute, cleanup, lazier uniform update.
* Cleanup.
* Fix stupidity
* Address Thog Feedback.
* Cover most of GDK's feedback (two comments remain)
* Fix bad rename
* Move IsDepthStencil to FormatExtensions, add docs.
* Fix default config, square texture detection.
* Three final fixes:
- Nearest copy when texture is integer format.
- Texture2D -> Texture3D copy correctly blacklists the texture before trying an unscaled copy (caused driver error)
- Discount small textures.
* Remove scale threshold.
Not needed right now - we'll see if we run into problems.
* All CPU modification blacklists scale.
* Fix comment.
* Implement audio backend configuration option
* Use OpenAL by default
* Increment version number in config.json
and add 30px to the height of the settings window
* nits
* capitalise audio backend names
* Separate hotkey settings from emulated input settings
* Remember gui column sort
* nit
* fix schema
* nit
* Remove unused SaveDataPath to speed up game list loading
* Reset the vertical scrollbar to the top when titles finish loading
* Delete DelegateTypes.cs
* Delete DelegateCache.cs
* Add files via upload
* Update Horizon.cs
* Update Program.cs
* Update MainWindow.cs
* Update Aot.cs
* Update RelocEntry.cs
* Update Translator.cs
* Update MemoryManager.cs
* Update InstEmitMemoryHelper.cs
* Update Delegates.cs
* Nit.
* Nit.
* Nit.
* 10 fewer MSIL bytes for us
* Add comment. Nits.
* Update Translator.cs
* Update Aot.cs
* Nits.
* Opt..
* Opt..
* Opt..
* Opt..
* Allow to change compression level.
* Update MemoryManager.cs
* Update Translator.cs
* Manage corner cases during the save phase. Nits.
* Update Aot.cs
* Translator response tweak for Aot disabled. Nit.
* Nit.
* Nits.
* Create DelegateHelpers.cs
* Update Delegates.cs
* Nit.
* Nit.
* Nits.
* Fix due to #784.
* Fixes due to #757 & #841.
* Fix due to #846.
* Fix due to #847.
* Use MethodInfo for managed method calls.
Use IR methods instead of managed methods about Max/Min (S/U).
Follow-ups & Nits.
* Add missing exception messages.
Reintroduce slow path for Fmov_Vi.
Implement slow path for Fmov_Si.
* Switch to the new folder structure.
Nits.
* Impl. index-based relocation information. Impl. cache file version field.
* Nit.
* Address gdkchan comments.
Mainly:
- fixed cache file corruption issue on exit; - exposed a way to disable AOT on the GUI.
* Address AcK77 comment.
* Address Thealexbarney, jduncanator & emmauss comments.
Header magic, CpuId (FI) & Aot -> Ptc.
* Adaptation to the new application reloading system.
Improvements to the call system of managed methods.
Follow-ups.
Nits.
* Get the same boot times as on master when PTC is disabled.
* Profiled Aot.
* A32 support (#897).
* #975 support (1 of 2).
* #975 support (2 of 2).
* Rebase fix & nits.
* Some fixes and nits (still one bug left).
* One fix & nits.
* Tests fix (by gdk) & nits.
* Support translations not only in high quality and rejit.
Nits.
* Added possibility to skip translations and continue execution, using `ESC` key.
* Update SettingsWindow.cs
* Update GLRenderer.cs
* Update Ptc.cs
* Disabled Profiled PTC by default as requested in the past by gdk.
* Fix rejit bug. Increased number of parallel translations. Add stack unwinding stuffs support (1 of 2).
Nits.
* Add stack unwinding stuffs support (2 of 2). Tuned number of parallel translations.
* Restored the ability to assemble jumps with 8-bit offset when Profiled PTC is disabled or during profiling.
Modifications due to rebase.
Nits.
* Limited profiling of the functions to be translated to the addresses belonging to the range of static objects only.
* Nits.
* Nits.
* Update Delegates.cs
* Nit.
* Update InstEmitSimdArithmetic.cs
* Address riperiperi comments.
* Fixed the issue of unjustifiably longer boot times at the second boot than at the first boot, measured at the same time or reference point and with the same number of translated functions.
* Implemented a simple redundant load/save mechanism.
Halved the value of Decoder.MaxInstsPerFunction more appropriate for the current performance of the Translator.
Replaced by Logger.PrintError to Logger.PrintDebug in TexturePool.cs about the supposed invalid texture format to avoid the spawn of the log.
Nits.
* Nit.
Improved Logger.PrintError in TexturePool.cs to avoid log spawn.
Added missing code for FZ handling (in output) for fp max/min instructions (slow paths).
* Add configuration migration for PTC
Co-authored-by: Thog <me@thog.eu>
This remove Utf8son and JsonPrettyPrinter dependencies.
NOTE: the standard JSON parser doesn't support configurable
indentation, as a result, all the pretty printed JSON are indented with 2
spaces.