Compare commits

...

21 Commits

Author SHA1 Message Date
e235d5e7bb Fix resolution scale values not being updated (#3514) 2022-08-02 23:58:56 +02:00
ed0b10c81f Fix geometry shader passthrough fallback being used when feature is supported (#3525)
* Fix geometry shader passthrough fallback being used when feature is supported

* Shader cache version bump
2022-08-02 08:44:30 +02:00
f92650fcff SPIR-V: Initialize undefined variables with 0 (#3526)
* SPIR-V: Initialize undefined variables with a value

Changes undefined values on spir-v shaders (caused by phi nodes) to be initialized instead of truly undefined.

Fixes an issue with NVIDIA gpus seemingly not liking when a variable is _potentially_ undefined. Not sure about the details at the moment.

Fixes:
- Tilt shift blur effect in Link's Awakening (bottom of the screen)
- Potentially block flickering on newer NVIDIA gpus in Splatoon 2? Needs testing.

Testing is welcome.

* Update Ryujinx.Graphics.Shader/CodeGen/Spirv/CodeGenContext.cs

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

Co-authored-by: gdkchan <gab.dark.100@gmail.com>
2022-08-02 08:11:10 +02:00
712361f6e1 vk: Workaround XCB not availaible on FlatHub build (#3515)
Update SPB to 0.0.4-build24 which hopefully fix the issue by checking
libX11-xcb presence.
2022-08-01 08:46:19 +02:00
2232e4ae87 Vulkan backend (#2518)
* 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>
2022-07-31 18:26:06 -03:00
14ce9e1567 Move partial unmap handler to the native signal handler (#3437)
* Initial commit with a lot of testing stuff.

* Partial Unmap Cleanup Part 1

* Fix some minor issues, hopefully windows tests.

* Disable partial unmap tests on macos for now

Weird issue.

* Goodbye magic number

* Add COMPlus_EnableAlternateStackCheck for tests

`COMPlus_EnableAlternateStackCheck` is needed for NullReferenceException handling to work on linux after registering the signal handler, due to how dotnet registers its own signal handler.

* Address some feedback

* Force retry when memory is mapped in memory tracking

This case existed before, but returning `false` no longer retries, so it would crash immediately after unprotecting the memory... Now, we return `true` to deliberately retry.

This case existed before (was just broken by this change) and I don't really want to look into fixing the issue right now. Technically, this means that on guest code partial unmaps will retry _due to this_ rather than hitting the handler. I don't expect this to cause any issues.

This should fix random crashes in Xenoblade Chronicles 2.

* Use IsRangeMapped

* Suppress MockMemoryManager.UnmapEvent warning

This event is not signalled by the mock memory manager.

* Remove 4kb mapping
2022-07-29 19:16:29 -03:00
952d013c67 Avalonia changes (#3497)
Co-authored-by: RNA <wQSZSQS2UQf5zun>
2022-07-29 01:14:37 +00:00
46c8129bf5 Avalonia: Another Cleanup (#3494)
* 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
2022-07-29 00:41:34 +02:00
8cfec5de4b Avalonia: Cleanup UserEditor a bit (#3492)
This PR cleanup the UserEditor code a bit, 2 texts are added for "Name" and "User Id", because when you create a new profile, the textbox is empty without any hints. `axaml` files are autoformated too.
2022-07-28 14:16:23 -03:00
37b6e081da Fix DMA linear texture copy fast path (#3496)
* Fix DMA linear texture copy fast path

* Formatting
2022-07-28 13:46:12 -03:00
3c3bcd82fe Add a sampler pool cache and improve texture pool cache (#3487)
* Add a sampler pool cache and improve texture pool cache

* Increase disposal timestamp delta more to be on the safe side

* Nits

* Use abstract class for PoolCache, remove factory callback
2022-07-27 21:07:48 -03:00
a00c59a46c update settings and main window tooltips (#3488) 2022-07-25 23:02:17 +02:00
1825bd87b4 misc: Reformat Ryujinx.Audio with dotnet-format (#3485)
This is the first commit of a series of reformat around the codebase as
discussed internally some weeks ago.

This project being one that isn't touched that much, it shouldn't cause
conflict with any opened PRs.
2022-07-25 15:46:33 -03:00
62f8ceb60b Resolution scaling hotkeys (#3185)
* hotkeys

* comments

* update implementation to include custom scales

* copypasta

* review changes

* hotkeys

* comments

* update implementation to include custom scales

* copypasta

* review changes

* Remove outdated configuration and force hotkeys unbound

* Add avalonia support

* Fix configuration file

* Update GTK implementation and fix config... again.

* Remove legacy implementation + nits

* Avalonia locales (DeepL)

* review

* Remove colon from chinese locale

* Update ConfigFile

* locale fix
2022-07-24 15:44:47 -03:00
1a888ae087 Add support for conditional (with CC) shader Exit instructions (#3470)
* Add support for conditional (with CC) shader Exit instructions

* Shader cache version bump

* Make CSM conditions default to false for EXIT.CC
2022-07-24 15:33:30 -03:00
84d0ca5645 feat: add traditional chinese translate (Avalonia) (#3474)
* feat: add traditional chinese translate

* update translate
2022-07-24 15:18:21 -03:00
31b8d413d5 Change MenuHeaders to embedded textblocks (#3469) 2022-07-24 14:50:06 -03:00
6e02cac952 Avalonia - Use content dialog for user profile manager (#3455)
* remove content dialog placeholder from all windows

* remove redundant window argument

* redesign user profile window

* wip

* use avalonia auto name generator

* add edit and new user options

* move profile image selection to content dialog

* remove usings

* fix updater

* address review

* adjust avatar dialog size

* add validation for user editor

* fix typo

* Shorten some labels
2022-07-24 14:38:38 -03:00
3a3380fa25 fix: Ensure to load latest version of ffmpeg libraries first (#3473)
Fix a possible crash related to older version of ffmpeg being loaded
instewad of the one shipped with the emulator.
2022-07-24 11:39:56 +02:00
2d252db0a7 GTK & Avalonia changes (#3480) 2022-07-23 12:05:51 -03:00
7f8a3541eb Fix decoding of block after shader BRA.CC instructions without predicate (#3472)
* Fix decoding of block after BRA.CC instructions without predicate

* Shader cache version bump
2022-07-23 11:53:14 -03:00
594 changed files with 43184 additions and 6019 deletions

View File

@ -197,12 +197,29 @@ namespace ARMeilleure.Signal
// Only call tracking if in range.
context.BranchIfFalse(nextLabel, inRange, BasicBlockFrequency.Cold);
context.Copy(inRegionLocal, Const(1));
Operand offset = context.BitwiseAnd(context.Subtract(faultAddress, rangeAddress), Const(~PageMask));
// Call the tracking action, with the pointer's relative offset to the base address.
Operand trackingActionPtr = context.Load(OperandType.I64, Const((ulong)signalStructPtr + rangeBaseOffset + 20));
context.Call(trackingActionPtr, OperandType.I32, offset, Const(PageSize), isWrite, Const(0));
context.Copy(inRegionLocal, Const(0));
Operand skipActionLabel = Label();
// Tracking action should be non-null to call it, otherwise assume false return.
context.BranchIfFalse(skipActionLabel, trackingActionPtr);
Operand result = context.Call(trackingActionPtr, OperandType.I32, offset, Const(PageSize), isWrite, Const(0));
context.Copy(inRegionLocal, result);
context.MarkLabel(skipActionLabel);
// If the tracking action returns false or does not exist, it might be an invalid access due to a partial overlap on Windows.
if (OperatingSystem.IsWindows())
{
context.BranchIfTrue(endLabel, inRegionLocal);
context.Copy(inRegionLocal, WindowsPartialUnmapHandler.EmitRetryFromAccessViolation(context));
}
context.Branch(endLabel);

View File

@ -0,0 +1,84 @@
using ARMeilleure.IntermediateRepresentation;
using ARMeilleure.Translation;
using System;
using static ARMeilleure.IntermediateRepresentation.Operand.Factory;
namespace ARMeilleure.Signal
{
public struct NativeWriteLoopState
{
public int Running;
public int Error;
}
public static class TestMethods
{
public delegate bool DebugPartialUnmap();
public delegate int DebugThreadLocalMapGetOrReserve(int threadId, int initialState);
public delegate void DebugNativeWriteLoop(IntPtr nativeWriteLoopPtr, IntPtr writePtr);
public static DebugPartialUnmap GenerateDebugPartialUnmap()
{
EmitterContext context = new EmitterContext();
var result = WindowsPartialUnmapHandler.EmitRetryFromAccessViolation(context);
context.Return(result);
// Compile and return the function.
ControlFlowGraph cfg = context.GetControlFlowGraph();
OperandType[] argTypes = new OperandType[] { OperandType.I64 };
return Compiler.Compile(cfg, argTypes, OperandType.I32, CompilerOptions.HighCq).Map<DebugPartialUnmap>();
}
public static DebugThreadLocalMapGetOrReserve GenerateDebugThreadLocalMapGetOrReserve(IntPtr structPtr)
{
EmitterContext context = new EmitterContext();
var result = WindowsPartialUnmapHandler.EmitThreadLocalMapIntGetOrReserve(context, structPtr, context.LoadArgument(OperandType.I32, 0), context.LoadArgument(OperandType.I32, 1));
context.Return(result);
// Compile and return the function.
ControlFlowGraph cfg = context.GetControlFlowGraph();
OperandType[] argTypes = new OperandType[] { OperandType.I64 };
return Compiler.Compile(cfg, argTypes, OperandType.I32, CompilerOptions.HighCq).Map<DebugThreadLocalMapGetOrReserve>();
}
public static DebugNativeWriteLoop GenerateDebugNativeWriteLoop()
{
EmitterContext context = new EmitterContext();
// Loop a write to the target address until "running" is false.
Operand structPtr = context.Copy(context.LoadArgument(OperandType.I64, 0));
Operand writePtr = context.Copy(context.LoadArgument(OperandType.I64, 1));
Operand loopLabel = Label();
context.MarkLabel(loopLabel);
context.Store(writePtr, Const(12345));
Operand running = context.Load(OperandType.I32, structPtr);
context.BranchIfTrue(loopLabel, running);
context.Return();
// Compile and return the function.
ControlFlowGraph cfg = context.GetControlFlowGraph();
OperandType[] argTypes = new OperandType[] { OperandType.I64 };
return Compiler.Compile(cfg, argTypes, OperandType.None, CompilerOptions.HighCq).Map<DebugNativeWriteLoop>();
}
}
}

View File

@ -0,0 +1,186 @@
using ARMeilleure.IntermediateRepresentation;
using ARMeilleure.Translation;
using Ryujinx.Common.Memory.PartialUnmaps;
using System;
using static ARMeilleure.IntermediateRepresentation.Operand.Factory;
namespace ARMeilleure.Signal
{
/// <summary>
/// Methods to handle signals caused by partial unmaps. See the structs for C# implementations of the methods.
/// </summary>
internal static class WindowsPartialUnmapHandler
{
public static Operand EmitRetryFromAccessViolation(EmitterContext context)
{
IntPtr partialRemapStatePtr = PartialUnmapState.GlobalState;
IntPtr localCountsPtr = IntPtr.Add(partialRemapStatePtr, PartialUnmapState.LocalCountsOffset);
// Get the lock first.
EmitNativeReaderLockAcquire(context, IntPtr.Add(partialRemapStatePtr, PartialUnmapState.PartialUnmapLockOffset));
IntPtr getCurrentThreadId = WindowsSignalHandlerRegistration.GetCurrentThreadIdFunc();
Operand threadId = context.Call(Const((ulong)getCurrentThreadId), OperandType.I32);
Operand threadIndex = EmitThreadLocalMapIntGetOrReserve(context, localCountsPtr, threadId, Const(0));
Operand endLabel = Label();
Operand retry = context.AllocateLocal(OperandType.I32);
Operand threadIndexValidLabel = Label();
context.BranchIfFalse(threadIndexValidLabel, context.ICompareEqual(threadIndex, Const(-1)));
context.Copy(retry, Const(1)); // Always retry when thread local cannot be allocated.
context.Branch(endLabel);
context.MarkLabel(threadIndexValidLabel);
Operand threadLocalPartialUnmapsPtr = EmitThreadLocalMapIntGetValuePtr(context, localCountsPtr, threadIndex);
Operand threadLocalPartialUnmaps = context.Load(OperandType.I32, threadLocalPartialUnmapsPtr);
Operand partialUnmapsCount = context.Load(OperandType.I32, Const((ulong)IntPtr.Add(partialRemapStatePtr, PartialUnmapState.PartialUnmapsCountOffset)));
context.Copy(retry, context.ICompareNotEqual(threadLocalPartialUnmaps, partialUnmapsCount));
Operand noRetryLabel = Label();
context.BranchIfFalse(noRetryLabel, retry);
// if (retry) {
context.Store(threadLocalPartialUnmapsPtr, partialUnmapsCount);
context.Branch(endLabel);
context.MarkLabel(noRetryLabel);
// }
context.MarkLabel(endLabel);
// Finally, release the lock and return the retry value.
EmitNativeReaderLockRelease(context, IntPtr.Add(partialRemapStatePtr, PartialUnmapState.PartialUnmapLockOffset));
return retry;
}
public static Operand EmitThreadLocalMapIntGetOrReserve(EmitterContext context, IntPtr threadLocalMapPtr, Operand threadId, Operand initialState)
{
Operand idsPtr = Const((ulong)IntPtr.Add(threadLocalMapPtr, ThreadLocalMap<int>.ThreadIdsOffset));
Operand i = context.AllocateLocal(OperandType.I32);
context.Copy(i, Const(0));
// (Loop 1) Check all slots for a matching Thread ID (while also trying to allocate)
Operand endLabel = Label();
Operand loopLabel = Label();
context.MarkLabel(loopLabel);
Operand offset = context.Multiply(i, Const(sizeof(int)));
Operand idPtr = context.Add(idsPtr, context.SignExtend32(OperandType.I64, offset));
// Check that this slot has the thread ID.
Operand existingId = context.CompareAndSwap(idPtr, threadId, threadId);
// If it was already the thread ID, then we just need to return i.
context.BranchIfTrue(endLabel, context.ICompareEqual(existingId, threadId));
context.Copy(i, context.Add(i, Const(1)));
context.BranchIfTrue(loopLabel, context.ICompareLess(i, Const(ThreadLocalMap<int>.MapSize)));
// (Loop 2) Try take a slot that is 0 with our Thread ID.
context.Copy(i, Const(0)); // Reset i.
Operand loop2Label = Label();
context.MarkLabel(loop2Label);
Operand offset2 = context.Multiply(i, Const(sizeof(int)));
Operand idPtr2 = context.Add(idsPtr, context.SignExtend32(OperandType.I64, offset2));
// Try and swap in the thread id on top of 0.
Operand existingId2 = context.CompareAndSwap(idPtr2, Const(0), threadId);
Operand idNot0Label = Label();
// If it was 0, then we need to initialize the struct entry and return i.
context.BranchIfFalse(idNot0Label, context.ICompareEqual(existingId2, Const(0)));
Operand structsPtr = Const((ulong)IntPtr.Add(threadLocalMapPtr, ThreadLocalMap<int>.StructsOffset));
Operand structPtr = context.Add(structsPtr, context.SignExtend32(OperandType.I64, offset2));
context.Store(structPtr, initialState);
context.Branch(endLabel);
context.MarkLabel(idNot0Label);
context.Copy(i, context.Add(i, Const(1)));
context.BranchIfTrue(loop2Label, context.ICompareLess(i, Const(ThreadLocalMap<int>.MapSize)));
context.Copy(i, Const(-1)); // Could not place the thread in the list.
context.MarkLabel(endLabel);
return context.Copy(i);
}
private static Operand EmitThreadLocalMapIntGetValuePtr(EmitterContext context, IntPtr threadLocalMapPtr, Operand index)
{
Operand offset = context.Multiply(index, Const(sizeof(int)));
Operand structsPtr = Const((ulong)IntPtr.Add(threadLocalMapPtr, ThreadLocalMap<int>.StructsOffset));
return context.Add(structsPtr, context.SignExtend32(OperandType.I64, offset));
}
private static void EmitThreadLocalMapIntRelease(EmitterContext context, IntPtr threadLocalMapPtr, Operand threadId, Operand index)
{
Operand offset = context.Multiply(index, Const(sizeof(int)));
Operand idsPtr = Const((ulong)IntPtr.Add(threadLocalMapPtr, ThreadLocalMap<int>.ThreadIdsOffset));
Operand idPtr = context.Add(idsPtr, context.SignExtend32(OperandType.I64, offset));
context.CompareAndSwap(idPtr, threadId, Const(0));
}
private static void EmitAtomicAddI32(EmitterContext context, Operand ptr, Operand additive)
{
Operand loop = Label();
context.MarkLabel(loop);
Operand initial = context.Load(OperandType.I32, ptr);
Operand newValue = context.Add(initial, additive);
Operand replaced = context.CompareAndSwap(ptr, initial, newValue);
context.BranchIfFalse(loop, context.ICompareEqual(initial, replaced));
}
private static void EmitNativeReaderLockAcquire(EmitterContext context, IntPtr nativeReaderLockPtr)
{
Operand writeLockPtr = Const((ulong)IntPtr.Add(nativeReaderLockPtr, NativeReaderWriterLock.WriteLockOffset));
// Spin until we can acquire the write lock.
Operand spinLabel = Label();
context.MarkLabel(spinLabel);
// Old value must be 0 to continue (we gained the write lock)
context.BranchIfTrue(spinLabel, context.CompareAndSwap(writeLockPtr, Const(0), Const(1)));
// Increment reader count.
EmitAtomicAddI32(context, Const((ulong)IntPtr.Add(nativeReaderLockPtr, NativeReaderWriterLock.ReaderCountOffset)), Const(1));
// Release write lock.
context.CompareAndSwap(writeLockPtr, Const(1), Const(0));
}
private static void EmitNativeReaderLockRelease(EmitterContext context, IntPtr nativeReaderLockPtr)
{
// Decrement reader count.
EmitAtomicAddI32(context, Const((ulong)IntPtr.Add(nativeReaderLockPtr, NativeReaderWriterLock.ReaderCountOffset)), Const(-1));
}
}
}

View File

@ -1,9 +1,10 @@
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace ARMeilleure.Signal
{
class WindowsSignalHandlerRegistration
unsafe class WindowsSignalHandlerRegistration
{
[DllImport("kernel32.dll")]
private static extern IntPtr AddVectoredExceptionHandler(uint first, IntPtr handler);
@ -11,6 +12,14 @@ namespace ARMeilleure.Signal
[DllImport("kernel32.dll")]
private static extern ulong RemoveVectoredExceptionHandler(IntPtr handle);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Ansi)]
static extern IntPtr LoadLibrary([MarshalAs(UnmanagedType.LPStr)] string lpFileName);
[DllImport("kernel32.dll", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
private static extern IntPtr GetProcAddress(IntPtr hModule, string procName);
private static IntPtr _getCurrentThreadIdPtr;
public static IntPtr RegisterExceptionHandler(IntPtr action)
{
return AddVectoredExceptionHandler(1, action);
@ -20,5 +29,17 @@ namespace ARMeilleure.Signal
{
return RemoveVectoredExceptionHandler(handle) != 0;
}
public static IntPtr GetCurrentThreadIdFunc()
{
if (_getCurrentThreadIdPtr == IntPtr.Zero)
{
IntPtr handle = LoadLibrary("kernel32.dll");
_getCurrentThreadIdPtr = GetProcAddress(handle, "GetCurrentThreadId");
}
return _getCurrentThreadIdPtr;
}
}
}

View File

@ -129,4 +129,4 @@ namespace Ryujinx.Audio
}
}
}
}
}

View File

@ -23,4 +23,4 @@ namespace Ryujinx.Audio.Backends.Common
return bufferSize / GetSampleSize(format) / channelCount;
}
}
}
}

View File

@ -163,4 +163,4 @@ namespace Ryujinx.Audio.Backends.Common
}
}
}
}
}

View File

@ -76,4 +76,4 @@ namespace Ryujinx.Audio.Backends.Common
public virtual void UnregisterBuffer(AudioBuffer buffer) { }
}
}
}

View File

@ -133,4 +133,4 @@ namespace Ryujinx.Audio.Backends.CompatLayer
return direction == Direction.Input || direction == Direction.Output;
}
}
}
}

View File

@ -81,7 +81,7 @@ namespace Ryujinx.Audio.Backends.CompatLayer
{
BufferTag = buffer.BufferTag,
DataPointer = buffer.DataPointer,
DataSize = (ulong)downmixedBuffer.Length
DataSize = (ulong)downmixedBuffer.Length
};
bool result = _realSession.RegisterBuffer(fakeBuffer, downmixedBuffer);
@ -120,4 +120,4 @@ namespace Ryujinx.Audio.Backends.CompatLayer
return _realSession.WasBufferFullyConsumed(buffer);
}
}
}
}

View File

@ -24,11 +24,11 @@ namespace Ryujinx.Audio.Backends.CompatLayer
public short Right;
}
private const int Q15Bits = 16;
private const int RawQ15One = 1 << Q15Bits;
private const int RawQ15HalfOne = (int)(0.5f * RawQ15One);
private const int Minus3dBInQ15 = (int)(0.707f * RawQ15One);
private const int Minus6dBInQ15 = (int)(0.501f * RawQ15One);
private const int Q15Bits = 16;
private const int RawQ15One = 1 << Q15Bits;
private const int RawQ15HalfOne = (int)(0.5f * RawQ15One);
private const int Minus3dBInQ15 = (int)(0.707f * RawQ15One);
private const int Minus6dBInQ15 = (int)(0.501f * RawQ15One);
private const int Minus12dBInQ15 = (int)(0.251f * RawQ15One);
private static readonly int[] DefaultSurroundToStereoCoefficients = new int[4]
@ -46,8 +46,8 @@ namespace Ryujinx.Audio.Backends.CompatLayer
};
private const int SurroundChannelCount = 6;
private const int StereoChannelCount = 2;
private const int MonoChannelCount = 1;
private const int StereoChannelCount = 2;
private const int MonoChannelCount = 1;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static ReadOnlySpan<Channel51FormatPCM16> GetSurroundBuffer(ReadOnlySpan<short> data)
@ -86,7 +86,7 @@ namespace Ryujinx.Audio.Backends.CompatLayer
{
Channel51FormatPCM16 channel = channels[i];
downmixedBuffer[i * 2] = DownMixSurroundToStereo(coefficients, channel.BackLeft, channel.LowFrequency, channel.FrontCenter, channel.FrontLeft);
downmixedBuffer[i * 2] = DownMixSurroundToStereo(coefficients, channel.BackLeft, channel.LowFrequency, channel.FrontCenter, channel.FrontLeft);
downmixedBuffer[i * 2 + 1] = DownMixSurroundToStereo(coefficients, channel.BackRight, channel.LowFrequency, channel.FrontCenter, channel.FrontRight);
}
@ -122,4 +122,4 @@ namespace Ryujinx.Audio.Backends.CompatLayer
return DownMixSurroundToStereo(DefaultSurroundToStereoCoefficients, data);
}
}
}
}

View File

@ -84,4 +84,4 @@ namespace Ryujinx.Audio.Backends.Dummy
return channelCount == 1 || channelCount == 2 || channelCount == 6;
}
}
}
}

View File

@ -64,4 +64,4 @@ namespace Ryujinx.Audio.Backends.Dummy
return true;
}
}
}
}

View File

@ -34,4 +34,4 @@ namespace Ryujinx.Audio.Common
/// </summary>
public byte[] Data;
}
}
}

View File

@ -513,4 +513,4 @@ namespace Ryujinx.Audio.Common
}
}
}
}
}

View File

@ -15,4 +15,4 @@ namespace Ryujinx.Audio.Common
/// </summary>
Stopped
}
}
}

View File

@ -26,4 +26,4 @@ namespace Ryujinx.Audio.Common
/// </summary>
private ushort _reserved;
}
}
}

View File

@ -34,4 +34,4 @@ namespace Ryujinx.Audio.Common
/// </summary>
public AudioDeviceState AudioOutState;
}
}
}

View File

@ -33,4 +33,4 @@ namespace Ryujinx.Audio.Common
/// </summary>
public ulong DataOffset;
}
}
}

View File

@ -40,4 +40,4 @@ namespace Ryujinx.Audio.Common
/// </summary>
Adpcm = 6
}
}
}

View File

@ -172,4 +172,4 @@ namespace Ryujinx.Audio
0.707f,
};
}
}
}

View File

@ -214,9 +214,9 @@ namespace Ryujinx.Audio.Input
outputDeviceName = audioIn.DeviceName;
outputConfiguration = new AudioOutputConfiguration
{
ChannelCount = audioIn.ChannelCount,
SampleFormat = audioIn.SampleFormat,
SampleRate = audioIn.SampleRate,
ChannelCount = audioIn.ChannelCount,
SampleFormat = audioIn.SampleFormat,
SampleRate = audioIn.SampleRate,
AudioOutState = audioIn.GetState(),
};
@ -263,4 +263,4 @@ namespace Ryujinx.Audio.Input
}
}
}
}
}

View File

@ -389,4 +389,4 @@ namespace Ryujinx.Audio.Input
}
}
}
}
}

View File

@ -32,8 +32,8 @@ namespace Ryujinx.Audio.Integration
_session.QueueBuffer(new AudioBuffer
{
DataPointer = _currentBufferTag++,
Data = _buffer,
DataSize = (ulong)_buffer.Length,
Data = _buffer,
DataSize = (ulong)_buffer.Length,
});
_currentBufferTag = _currentBufferTag % 4;
@ -72,4 +72,4 @@ namespace Ryujinx.Audio.Integration
}
}
}
}
}

View File

@ -52,4 +52,4 @@ namespace Ryujinx.Audio.Integration
return channelCount != Constants.ChannelCountMax;
}
}
}
}

View File

@ -31,4 +31,4 @@ namespace Ryujinx.Audio.Integration
return this;
}
}
}
}

View File

@ -25,4 +25,4 @@ namespace Ryujinx.Audio.Integration
void PrepareToClose();
}
}
}

View File

@ -15,4 +15,4 @@ namespace Ryujinx.Audio.Integration
/// </summary>
void Clear();
}
}
}

View File

@ -209,9 +209,9 @@ namespace Ryujinx.Audio.Output
outputDeviceName = audioOut.DeviceName;
outputConfiguration = new AudioOutputConfiguration
{
ChannelCount = audioOut.ChannelCount,
SampleFormat = audioOut.SampleFormat,
SampleRate = audioOut.SampleRate,
ChannelCount = audioOut.ChannelCount,
SampleFormat = audioOut.SampleFormat,
SampleRate = audioOut.SampleRate,
AudioOutState = audioOut.GetState(),
};
@ -293,4 +293,4 @@ namespace Ryujinx.Audio.Output
}
}
}
}
}

View File

@ -169,7 +169,7 @@ namespace Ryujinx.Audio.Output
}
SampleFormat = sampleFormat;
SampleRate = Constants.TargetSampleRate;
SampleRate = Constants.TargetSampleRate;
}
return result;
@ -187,9 +187,9 @@ namespace Ryujinx.Audio.Output
{
AudioBuffer buffer = new AudioBuffer
{
BufferTag = bufferTag,
BufferTag = bufferTag,
DataPointer = userBuffer.Data,
DataSize = userBuffer.DataSize
DataSize = userBuffer.DataSize
};
if (_session.AppendBuffer(buffer))
@ -291,7 +291,7 @@ namespace Ryujinx.Audio.Output
{
lock (_parentLock)
{
_session.SetVolume(volume);
_session.SetVolume(volume);
}
}
@ -362,4 +362,4 @@ namespace Ryujinx.Audio.Output
}
}
}
}
}

View File

@ -10,4 +10,4 @@ namespace Ryujinx.Audio.Renderer.Common
public ulong ReturnBufferInfo;
public ulong ReturnBufferInfoBase;
}
}
}

View File

@ -47,4 +47,4 @@ namespace Ryujinx.Audio.Renderer.Common
public ulong ExtraErrorInfo;
}
}
}
}

View File

@ -147,4 +147,4 @@ namespace Ryujinx.Audio.Renderer.Common
return _nodeCount;
}
}
}
}

View File

@ -50,4 +50,4 @@ namespace Ryujinx.Audio.Renderer.Common
/// </summary>
CaptureBuffer
}
}
}

View File

@ -40,4 +40,4 @@ namespace Ryujinx.Audio.Renderer.Common
/// </summary>
Released = 6
}
}
}

View File

@ -25,4 +25,4 @@ namespace Ryujinx.Audio.Renderer.Common
return (nodeId >> 16) & 0xFFF;
}
}
}
}

View File

@ -30,4 +30,4 @@ namespace Ryujinx.Audio.Renderer.Common
/// </summary>
Performance = 15
}
}
}

View File

@ -226,4 +226,4 @@ namespace Ryujinx.Audio.Renderer.Common
return true;
}
}
}
}

View File

@ -16,4 +16,4 @@ namespace Ryujinx.Audio.Renderer.Common
Limiter,
CaptureBuffer
}
}
}

View File

@ -8,4 +8,4 @@ namespace Ryujinx.Audio.Renderer.Common
FinalMix,
Sink
}
}
}

View File

@ -20,4 +20,4 @@ namespace Ryujinx.Audio.Renderer.Common
/// </summary>
Pause
}
}
}

View File

@ -30,4 +30,4 @@ namespace Ryujinx.Audio.Renderer.Common
/// </summary>
Disabled
}
}
}

View File

@ -35,4 +35,4 @@ namespace Ryujinx.Audio.Renderer.Common
/// </summary>
Limit = NoDelay
}
}
}

View File

@ -20,4 +20,4 @@ namespace Ryujinx.Audio.Renderer.Common
/// </summary>
CircularBuffer
}
}
}

View File

@ -30,4 +30,4 @@ namespace Ryujinx.Audio.Renderer.Common
TotalSize = (uint)Unsafe.SizeOf<UpdateDataHeader>();
}
}
}
}

View File

@ -101,4 +101,4 @@ namespace Ryujinx.Audio.Renderer.Common
}
}
}
}
}

View File

@ -79,4 +79,4 @@ namespace Ryujinx.Audio.Renderer.Common
/// </summary>
private ushort _padding;
}
}
}

View File

@ -41,7 +41,7 @@ namespace Ryujinx.Audio.Renderer.Common
return Memory<byte>.Empty;
}
public Memory<T> Allocate<T>(ulong count, int align) where T: unmanaged
public Memory<T> Allocate<T>(ulong count, int align) where T : unmanaged
{
Memory<byte> allocatedMemory = Allocate((ulong)Unsafe.SizeOf<T>() * count, align);
@ -53,9 +53,9 @@ namespace Ryujinx.Audio.Renderer.Common
return SpanMemoryManager<T>.Cast(allocatedMemory);
}
public static ulong GetTargetSize<T>(ulong currentSize, ulong count, int align) where T: unmanaged
public static ulong GetTargetSize<T>(ulong currentSize, ulong count, int align) where T : unmanaged
{
return BitUtils.AlignUp(currentSize, align) + (ulong)Unsafe.SizeOf<T>() * count;
}
}
}
}

View File

@ -86,4 +86,4 @@ namespace Ryujinx.Audio.Renderer.Device
return Name;
}
}
}
}

View File

@ -24,4 +24,4 @@ namespace Ryujinx.Audio.Renderer.Device
Device = virtualDevice;
}
}
}
}

View File

@ -59,4 +59,4 @@ namespace Ryujinx.Audio.Renderer.Device
return virtualDeviceSession;
}
}
}
}

View File

@ -199,4 +199,4 @@ namespace Ryujinx.Audio.Renderer.Dsp
return decodedCount;
}
}
}
}

View File

@ -268,4 +268,4 @@ namespace Ryujinx.Audio.Renderer.Dsp
}
}
}
}
}

View File

@ -80,4 +80,4 @@ namespace Ryujinx.Audio.Renderer.Dsp
}
}
}
}
}

View File

@ -72,4 +72,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
DataSourceHelper.ProcessWaveBuffers(context.MemoryManager, outputBuffer, ref info, WaveBuffers, ref State.Span[0], context.SampleRate, (int)context.SampleCount);
}
}
}
}

View File

@ -170,4 +170,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
}
}
}
}
}

View File

@ -49,4 +49,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
BiquadFilterHelper.ProcessBiquadFilter(ref _parameter, ref state, outputBuffer, inputBuffer, context.SampleCount);
}
}
}
}

View File

@ -134,4 +134,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
}
}
}
}
}

View File

@ -74,4 +74,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
}
}
}
}
}

View File

@ -21,4 +21,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
context.ClearBuffers();
}
}
}
}

View File

@ -153,4 +153,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
_buffersMemoryHandle.Dispose();
}
}
}
}

View File

@ -33,4 +33,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
GroupedBiquadFilter,
CaptureBuffer
}
}
}

View File

@ -29,4 +29,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
context.CopyBuffer(OutputBufferIndex, InputBufferIndex);
}
}
}
}

View File

@ -105,4 +105,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
DataSourceHelper.ProcessWaveBuffers(context.MemoryManager, outputBuffer, ref info, WaveBuffers, ref State.Span[0], context.SampleRate, (int)context.SampleCount);
}
}
}
}

View File

@ -87,7 +87,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
float dryGain = FixedPointHelper.ToFloat(Parameter.DryGain, FixedPointPrecision);
float outGain = FixedPointHelper.ToFloat(Parameter.OutGain, FixedPointPrecision);
Matrix2x2 delayFeedback = new Matrix2x2(delayFeedbackBaseGain , delayFeedbackCrossGain,
Matrix2x2 delayFeedback = new Matrix2x2(delayFeedbackBaseGain, delayFeedbackCrossGain,
delayFeedbackCrossGain, delayFeedbackBaseGain);
for (int i = 0; i < sampleCount; i++)
@ -124,10 +124,10 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
float dryGain = FixedPointHelper.ToFloat(Parameter.DryGain, FixedPointPrecision);
float outGain = FixedPointHelper.ToFloat(Parameter.OutGain, FixedPointPrecision);
Matrix4x4 delayFeedback = new Matrix4x4(delayFeedbackBaseGain , delayFeedbackCrossGain, delayFeedbackCrossGain, 0.0f,
delayFeedbackCrossGain, delayFeedbackBaseGain , 0.0f , delayFeedbackCrossGain,
delayFeedbackCrossGain, 0.0f , delayFeedbackBaseGain , delayFeedbackCrossGain,
0.0f , delayFeedbackCrossGain, delayFeedbackCrossGain, delayFeedbackBaseGain);
Matrix4x4 delayFeedback = new Matrix4x4(delayFeedbackBaseGain, delayFeedbackCrossGain, delayFeedbackCrossGain, 0.0f,
delayFeedbackCrossGain, delayFeedbackBaseGain, 0.0f, delayFeedbackCrossGain,
delayFeedbackCrossGain, 0.0f, delayFeedbackBaseGain, delayFeedbackCrossGain,
0.0f, delayFeedbackCrossGain, delayFeedbackCrossGain, delayFeedbackBaseGain);
for (int i = 0; i < sampleCount; i++)
@ -149,7 +149,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
};
Vector4 temp = MatrixHelper.Transform(ref channelInput, ref delayFeedback) + channelInput * inGain;
state.UpdateLowPassFilter(ref Unsafe.As<Vector4, float>(ref temp), channelCount);
*((float*)outputBuffers[0] + i) = (channelInput.X * dryGain + delayLineValues.X * outGain) / 64;
@ -171,12 +171,12 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
float dryGain = FixedPointHelper.ToFloat(Parameter.DryGain, FixedPointPrecision);
float outGain = FixedPointHelper.ToFloat(Parameter.OutGain, FixedPointPrecision);
Matrix6x6 delayFeedback = new Matrix6x6(delayFeedbackBaseGain , 0.0f , 0.0f , 0.0f , delayFeedbackCrossGain, delayFeedbackCrossGain,
0.0f , delayFeedbackBaseGain , 0.0f , delayFeedbackCrossGain, delayFeedbackCrossGain, 0.0f ,
delayFeedbackCrossGain, 0.0f , delayFeedbackBaseGain , delayFeedbackCrossGain, 0.0f , 0.0f ,
0.0f , delayFeedbackCrossGain, delayFeedbackCrossGain, delayFeedbackBaseGain , 0.0f , 0.0f ,
delayFeedbackCrossGain, delayFeedbackCrossGain, 0.0f , 0.0f , delayFeedbackBaseGain , 0.0f ,
0.0f , 0.0f , 0.0f , 0.0f , 0.0f , feedbackGain);
Matrix6x6 delayFeedback = new Matrix6x6(delayFeedbackBaseGain, 0.0f, 0.0f, 0.0f, delayFeedbackCrossGain, delayFeedbackCrossGain,
0.0f, delayFeedbackBaseGain, 0.0f, delayFeedbackCrossGain, delayFeedbackCrossGain, 0.0f,
delayFeedbackCrossGain, 0.0f, delayFeedbackBaseGain, delayFeedbackCrossGain, 0.0f, 0.0f,
0.0f, delayFeedbackCrossGain, delayFeedbackCrossGain, delayFeedbackBaseGain, 0.0f, 0.0f,
delayFeedbackCrossGain, delayFeedbackCrossGain, 0.0f, 0.0f, delayFeedbackBaseGain, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, feedbackGain);
for (int i = 0; i < sampleCount; i++)
{
@ -277,4 +277,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
ProcessDelay(context, ref state);
}
}
}
}

View File

@ -90,4 +90,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
}
}
}
}
}

View File

@ -54,4 +54,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
}
}
}
}
}

View File

@ -88,4 +88,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
}
}
}
}
}

View File

@ -65,4 +65,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
context.ClearBuffer(OutputBufferIndices[5]);
}
}
}
}

View File

@ -60,4 +60,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
}
}
}
}
}

View File

@ -17,4 +17,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
return false;
}
}
}
}

View File

@ -143,4 +143,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
}
}
}
}
}

View File

@ -162,4 +162,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
}
}
}
}
}

View File

@ -134,4 +134,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
ProcessMix(outputBuffer, inputBuffer);
}
}
}
}

View File

@ -65,4 +65,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
State.Span[0].LastSamples[LastSampleIndex] = ProcessMixRamp(outputBuffer, inputBuffer, (int)context.SampleCount);
}
}
}
}

View File

@ -88,4 +88,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
}
}
}
}
}

View File

@ -71,4 +71,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
DataSourceHelper.ProcessWaveBuffers(context.MemoryManager, outputBuffer, ref info, WaveBuffers, ref State.Span[0], context.SampleRate, (int)context.SampleCount);
}
}
}
}

View File

@ -71,4 +71,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
DataSourceHelper.ProcessWaveBuffers(context.MemoryManager, outputBuffer, ref info, WaveBuffers, ref State.Span[0], context.SampleRate, (int)context.SampleCount);
}
}
}
}

View File

@ -44,4 +44,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
}
}
}
}
}

View File

@ -251,4 +251,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
ProcessReverb3d(context, ref state);
}
}
}
}

View File

@ -276,4 +276,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
ProcessReverb(context, ref state);
}
}
}
}

View File

@ -66,4 +66,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
}
}
}
}
}

View File

@ -134,4 +134,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
ProcessVolume(outputBuffer, inputBuffer);
}
}
}
}

View File

@ -53,4 +53,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
ProcessVolumeRamp(outputBuffer, inputBuffer, (int)context.SampleCount);
}
}
}
}

View File

@ -463,4 +463,4 @@ namespace Ryujinx.Audio.Renderer.Dsp
}
}
}
}
}

View File

@ -49,4 +49,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.Effect
return _delayLine.Tap(sampleIndex);
}
}
}
}

View File

@ -75,4 +75,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.Effect
return TapUnsafe(sampleIndex, -1);
}
}
}
}

View File

@ -73,4 +73,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.Effect
return TapUnsafe(sampleIndex, -1);
}
}
}
}

View File

@ -34,4 +34,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.Effect
return (uint)MathF.Round(sampleRate * delayTime);
}
}
}
}

View File

@ -30,4 +30,4 @@ namespace Ryujinx.Audio.Renderer.Dsp
return ToInt(value + half, qBits);
}
}
}
}

View File

@ -64,4 +64,4 @@ namespace Ryujinx.Audio.Renderer.Dsp
return MathF.Sin(DegreesToRadians(value));
}
}
}
}

View File

@ -75,4 +75,4 @@ namespace Ryujinx.Audio.Renderer.Dsp
return (short)value;
}
}
}
}

View File

@ -627,4 +627,4 @@ namespace Ryujinx.Audio.Renderer.Dsp
}
}
}
}
}

View File

@ -9,4 +9,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.State
public short History0;
public short History1;
}
}
}

View File

@ -71,4 +71,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.State
public AuxiliaryBufferInfo CpuBufferInfo;
public AuxiliaryBufferInfo DspBufferInfo;
}
}
}

View File

@ -10,4 +10,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.State
public float State2;
public float State3;
}
}
}

View File

@ -64,4 +64,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.State
}
}
}
}
}

View File

@ -25,6 +25,6 @@ namespace Ryujinx.Audio.Renderer.Dsp.State
UpdateParameter(ref parameter);
}
public void UpdateParameter(ref LimiterParameter parameter) {}
public void UpdateParameter(ref LimiterParameter parameter) { }
}
}
}

View File

@ -116,4 +116,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.State
}
}
}
}
}

View File

@ -201,4 +201,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.State
}
}
}
}
}

Some files were not shown because too many files have changed in this diff Show More