Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New test PR #22

Open
wants to merge 111 commits into
base: github-script-test
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
d0cc13c
UI: Fix some MainWindow bugs and implement menubar items to change wi…
MutantAura May 1, 2024
ab12fbe
Fix system dateTime loading in avalonia LoadCurrentConfiguration (#6676)
nico-abram May 2, 2024
a23d8cb
Replace "List.ForEach" for "foreach" (#6783)
marco-carvalho May 8, 2024
1a676ee
Update DotSettings (#6535)
IsaacMarovitz May 14, 2024
6e40b64
Add linux specific files to local builds (#6762)
TSRBerry May 14, 2024
e9edf0a
Update outdated Windows version warning (#6481)
LukeWarnut May 14, 2024
cada4d0
HID: Stub IHidServer: 134 (SetNpadAnalogStickUseCenterClamp) (#6664)
Tsubasa0504 May 14, 2024
44dbab3
discordRPC: Truncate game title and details if they exceed discord by…
MutantAura May 14, 2024
3a3b518
Add support for bindless textures from storage buffer on Vulkan (#6721)
gdkchan May 14, 2024
0755752
Update compatibility information in README.md (#6801)
zyonse May 14, 2024
2b6cc4b
Add the "Auto" theme option in setting (#6611)
yell0wsuit May 14, 2024
2ef4f92
Make TextureGroup.ClearModified thread safe (#6686)
gdkchan May 14, 2024
a3dc295
Disable keyboard controller input while swkbd is open (foreground) (#…
TSRBerry May 14, 2024
cd78adf
Add missing lock on texture cache UpdateMapping method (#6657)
gdkchan May 14, 2024
47639e6
Bump Avalonia.Svg (#6603)
IsaacMarovitz May 14, 2024
2ca0b17
New Crowdin updates (#6590)
AcK77 May 14, 2024
cdccf89
Revert "Disable keyboard controller input while swkbd is open (foregr…
gdkchan May 15, 2024
3aea194
Add Enhancement label to Feature Requests (#6804)
IsaacMarovitz May 15, 2024
091230a
Improves some log messages and fixes a typo (#6773)
SamusAranX May 15, 2024
9ec8b2c
Change Deflate compression level to `Fastest`. (#6812)
MutantAura May 16, 2024
4d84df9
Update audio renderer to REV12: Add support for splitter biquad filte…
gdkchan May 17, 2024
8f51938
Disable keyboard controller input while swkbd is open (foreground) (s…
TSRBerry May 17, 2024
2f427de
Fix another NullReferenceException (#6826)
TSRBerry May 17, 2024
eb1ce41
GPU: Migrate buffers on GPU project, pre-emptively flush device local…
riperiperi May 19, 2024
c634eb4
Updating Concentus dependency to speed up Opus decoding (#6757)
lostromb May 20, 2024
c1ed150
Kernel: Wake cores from idle directly rather than through a host thre…
riperiperi May 22, 2024
e65effc
Workaround AMD bug on logic op with float framebuffer (#6852)
gdkchan May 23, 2024
c98b7fc
Workaround bug on logic op with float framebuffer (#6858)
piplup55 May 24, 2024
4cc00bb
nuget: bump Microsoft.IdentityModel.JsonWebTokens from 7.5.1 to 7.5.2…
dependabot[bot] May 25, 2024
53d096e
Allow texture arrays to use separate descriptor sets on Vulkan (#6870)
gdkchan May 26, 2024
2ebe929
misc: Change disk shader cache compression algorithm to `Brotli` (RFC…
MutantAura May 26, 2024
c41fddd
Vulkan: Extend full bindless to cover cases with phi nodes (#6853)
gdkchan May 26, 2024
971d24a
nuget: bump Microsoft.IdentityModel.JsonWebTokens from 7.5.2 to 7.6.0…
dependabot[bot] Jun 2, 2024
888402e
Avoid inexact read with 'Stream.Read' (#6847)
marco-carvalho Jun 2, 2024
1ecc8fb
New pooled memory types (#6821)
jhorv Jun 3, 2024
d7c6474
GPU: Remove unused dynamic state and pipeline settings (#6796)
sunshineinabox Jun 3, 2024
c0f2491
Vulkan separate descriptor set fixes (#6895)
gdkchan Jun 3, 2024
1828bc9
nuget: bump Microsoft.IO.RecyclableMemoryStream from 3.0.0 to 3.0.1 (…
dependabot[bot] Jun 15, 2024
5a878ae
replace `ByteMemoryPool` use with `MemoryOwner<byte>` and `SpanOwner<…
jhorv Jun 15, 2024
3193ef1
Extend bindless elimination to catch a few more specific cases (#6921)
gdkchan Jun 16, 2024
311ca3c
fix: for pooled memory used for reference types, clear it on return t…
jhorv Jun 16, 2024
d25a084
JIT: Ensure entry block has no predecessors on RegisterUsage pass (#6…
gdkchan Jun 19, 2024
0afa8f2
JIT: Coalesce copies on LSRA with simple register preferencing (#6950)
gdkchan Jun 19, 2024
0c34219
SetProcessMemoryPermission address and size are always 64-bit (#6977)
rafadotmoe Jun 25, 2024
a94445b
nuget: bump Microsoft.IdentityModel.JsonWebTokens from 7.6.0 to 7.6.2…
dependabot[bot] Jun 26, 2024
bd3335c
Make sure the string is long enough before performing basic trim (#6982)
TSRBerry Jun 26, 2024
1a0a351
Resolve some Vulkan validation errors (#6915)
sunshineinabox Jun 26, 2024
c525d7d
Force Vulkan swapchain re-creation when window size changes (#7003)
gdkchan Jul 7, 2024
cfc75d7
Disable descriptor set template updates for buffer textures on Adreno…
gdkchan Jul 7, 2024
a830eb6
Disallow concurrent fence waits on Adreno (#7001)
gdkchan Jul 7, 2024
1668ba9
Force dynamic state update after rasterizer discard disable (#7007)
gdkchan Jul 10, 2024
07435ad
Use draw clear on Adreno, instead of vkCmdClearAttachments (#7013)
gdkchan Jul 10, 2024
595e514
Use SkiaSharp for Avalonia in place of ImageSharp (#6269)
sunshineinabox Jul 14, 2024
a6dbb2a
replace ByteMemoryPool usage in Ryujinx.HLE (#6953)
jhorv Jul 15, 2024
eb212aa
misc: Re-order and manually update DriverID to name. (#7027)
MutantAura Jul 15, 2024
5605c29
Add default values to ApplicationData directly
TSRBerry Aug 26, 2023
893a88e
Refactor application loading
TSRBerry Aug 26, 2023
62ef779
Only include program NCAs where at least one tuple item is not null
TSRBerry Aug 26, 2023
312aca3
Get application data by title id and add programIndex check back
TSRBerry Aug 27, 2023
2c7b480
Refactor application loading again and remove duplicate code
TSRBerry Aug 27, 2023
ba0e786
Actually use patch ncas for updates
TSRBerry Aug 28, 2023
ee7fea9
Fix number of applications found with multi game xcis
TSRBerry Aug 28, 2023
cb4616a
Don't load bundled updates from multi game xcis
TSRBerry Aug 28, 2023
0e8c22c
Change ApplicationData.TitleId type to ulong & Add TitleIdString prop…
TSRBerry Aug 30, 2023
6276435
Use cnmt files and ContentCollection to load programs
TSRBerry Aug 30, 2023
93467b0
Ava: Add updates and DLCs from gamecarts
TSRBerry Aug 30, 2023
684cf74
Get the cnmt file from its NCA
TSRBerry Aug 30, 2023
ff8ddc6
Ava: Identify bundled updates in updater window
TSRBerry Aug 30, 2023
3866d54
Fix the (hopefully) last few bugs
TSRBerry Aug 30, 2023
9871ad5
Add idOffset parameter to GetNcaByType
TSRBerry Sep 1, 2023
ec5e844
Handle missing file for dlc.json
TSRBerry Sep 1, 2023
5d80b6d
Ava: Shorten error message for invalid files
TSRBerry Sep 1, 2023
8a0b62a
Gtk: Add additional string for bundled updates in TitleUpdateWindow
TSRBerry Sep 1, 2023
89dd1d2
Hopefully fix DLC issues
TSRBerry Sep 1, 2023
3127446
Apply formatting
TSRBerry Sep 1, 2023
a624fea
Finally fix DLC issues
TSRBerry Sep 1, 2023
084aec3
Adjust property names and fileSize field
TSRBerry Sep 3, 2023
00fd606
Read the correct update file
TSRBerry Sep 3, 2023
c2c8b0b
Fix wrong casing for application id strings
TSRBerry Sep 3, 2023
3eb9f76
Rename TitleId to ApplicationId
TSRBerry Sep 14, 2023
e3d8db6
Address review comments
TSRBerry Sep 14, 2023
5c2583e
Apply suggestions from code review
TSRBerry Oct 7, 2023
d6fd609
Gracefully fail when loading pfs for update and dlc window
TSRBerry Oct 28, 2023
ffc85d1
Fix applications with multiple programs
TSRBerry Oct 29, 2023
4736d0c
Fix DLCWindow crash on GTK
TSRBerry Oct 30, 2023
cec6f31
Fix some GUI issues
TSRBerry Oct 30, 2023
9d62c76
Remove IsXci again
TSRBerry Nov 11, 2023
bf09d98
Don't add duplicates to update/dlc windows
TSRBerry Mar 16, 2024
8f0dcbd
Avoid double lookup
TSRBerry Mar 16, 2024
6be52a7
Preserve DLC enabled state for bundled DLCs
TSRBerry Mar 17, 2024
84cc592
Fix DLCWindow not opening using GTK
TSRBerry Mar 17, 2024
af1fc63
Fix missing information when loading applications from file
TSRBerry Mar 17, 2024
203564e
Address review feedback
TSRBerry Mar 17, 2024
c802a0e
Fix re-adding bundled DLCs every time
TSRBerry Mar 17, 2024
28d0f9b
Fix bundled DLCs disappearing
TSRBerry Mar 17, 2024
b5fd61f
Abstract common code to open application pfs
TSRBerry Mar 17, 2024
832adb6
Remove unused imports
TSRBerry Mar 17, 2024
56ac789
Fix file exists check when loading DLCs
TSRBerry Mar 17, 2024
4eb9acb
Load bundled DLCs only using dlc.json
TSRBerry Mar 17, 2024
13716f2
Load AoC items correctly
TSRBerry Mar 17, 2024
6e90835
Add all DLCs from a PFS
TSRBerry Mar 23, 2024
5229a35
Add argument to launch a specific application id
TSRBerry Apr 21, 2024
e2bdc2b
Use application-id argument for shortcuts if necessary
TSRBerry Apr 21, 2024
0dd062c
Return the application id from the control NCA if possible
TSRBerry Apr 28, 2024
5f8f569
GetApplicationInformation: Don't overwrite application ids
TSRBerry Apr 29, 2024
90bbcc3
Get application ids from CNMT again
TSRBerry Apr 29, 2024
3211df4
Revert erroneous axaml change from adca8900
TSRBerry May 3, 2024
cb95f57
Rename title to application
TSRBerry May 20, 2024
025fa82
Wrap nsp/pfs0 case with curly braces
TSRBerry May 20, 2024
7dd7fc5
Check if _applicationData.ControlHolder.ByteSpan is zeros only once
TSRBerry Jul 16, 2024
794a2c6
Catch exceptions while loading applications from nsps
TSRBerry Jul 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Feature Request
description: Suggest a new feature for Ryujinx.
title: "[Feature Request]"
labels: enhancement
body:
- type: textarea
id: overview
Expand Down
12 changes: 6 additions & 6 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
<PackageVersion Include="Avalonia.Desktop" Version="11.0.10" />
<PackageVersion Include="Avalonia.Diagnostics" Version="11.0.10" />
<PackageVersion Include="Avalonia.Markup.Xaml.Loader" Version="11.0.10" />
<PackageVersion Include="Avalonia.Svg" Version="11.0.0.16" />
<PackageVersion Include="Avalonia.Svg.Skia" Version="11.0.0.16" />
<PackageVersion Include="Avalonia.Svg" Version="11.0.0.18" />
<PackageVersion Include="Avalonia.Svg.Skia" Version="11.0.0.18" />
<PackageVersion Include="CommandLineParser" Version="2.9.1" />
<PackageVersion Include="Concentus" Version="1.1.7" />
<PackageVersion Include="Concentus" Version="2.2.0" />
<PackageVersion Include="DiscordRichPresence" Version="1.2.1.24" />
<PackageVersion Include="DynamicData" Version="8.4.1" />
<PackageVersion Include="FluentAvaloniaUI" Version="2.0.5" />
Expand All @@ -20,9 +20,9 @@
<PackageVersion Include="LibHac" Version="0.19.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.9.2" />
<PackageVersion Include="Microsoft.IdentityModel.JsonWebTokens" Version="7.5.1" />
<PackageVersion Include="Microsoft.IdentityModel.JsonWebTokens" Version="7.6.2" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageVersion Include="Microsoft.IO.RecyclableMemoryStream" Version="3.0.0" />
<PackageVersion Include="Microsoft.IO.RecyclableMemoryStream" Version="3.0.1" />
<PackageVersion Include="MsgPack.Cli" Version="1.0.1" />
<PackageVersion Include="NetCoreServer" Version="8.0.7" />
<PackageVersion Include="NUnit" Version="3.13.3" />
Expand All @@ -49,4 +49,4 @@
<PackageVersion Include="System.Management" Version="8.0.0" />
<PackageVersion Include="UnicornEngine.Unicorn" Version="2.0.2-rc1-fb78016" />
</ItemGroup>
</Project>
</Project>
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@

## Compatibility

As of October 2023, Ryujinx has been tested on approximately 4,200 titles;
over 4,150 boot past menus and into gameplay, with roughly 3,500 of those being considered playable.
As of May 2024, Ryujinx has been tested on approximately 4,300 titles;
over 4,100 boot past menus and into gameplay, with roughly 3,550 of those being considered playable.

You can check out the compatibility list [here](https://github.com/Ryujinx/Ryujinx-Games-List/issues).

Expand Down
2 changes: 2 additions & 0 deletions Ryujinx.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<s:String x:Key="/Default/CodeStyle/CSharpVarKeywordUsage/ForOtherTypes/@EntryValue">UseExplicitType</s:String>
<s:String x:Key="/Default/CodeStyle/CSharpVarKeywordUsage/ForSimpleTypes/@EntryValue">UseExplicitType</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=TypesAndNamespaces/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb"&gt;&lt;ExtraRule Prefix="I" Suffix="" Style="AaBb" /&gt;&lt;/Policy&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=a0b4bc4d_002Dd13b_002D4a37_002Db37e_002Dc9c6864e4302/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Any" AccessRightKinds="Any" Description="Types and namespaces"&gt;&lt;ElementKinds&gt;&lt;Kind Name="NAMESPACE" /&gt;&lt;Kind Name="CLASS" /&gt;&lt;Kind Name="STRUCT" /&gt;&lt;Kind Name="ENUM" /&gt;&lt;Kind Name="DELEGATE" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="" Suffix="" Style="AaBb"&gt;&lt;ExtraRule Prefix="I" Suffix="" Style="AaBb" /&gt;&lt;/Policy&gt;&lt;/Policy&gt;</s:String>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EPredefinedNamingRulesToUserRulesUpgrade/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=ASET/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Astc/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Luma/@EntryIndexedValue">True</s:Boolean>
Expand Down
2 changes: 1 addition & 1 deletion src/ARMeilleure/CodeGen/Arm64/CodeGenContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ private long WriteConstantPool()
long originalPosition = _stream.Position;

_stream.Seek(0, SeekOrigin.Begin);
_stream.Read(code, 0, code.Length);
_stream.ReadExactly(code, 0, code.Length);
_stream.Seek(originalPosition, SeekOrigin.Begin);

RelocInfo relocInfo;
Expand Down
39 changes: 34 additions & 5 deletions src/ARMeilleure/CodeGen/RegisterAllocators/LinearScanAllocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,20 @@ private bool TryAllocateRegWithoutSpill(AllocationContext context, LiveInterval
}
}

int selectedReg = GetHighestValueIndex(freePositions);
// If this is a copy destination variable, we prefer the register used for the copy source.
// If the register is available, then the copy can be eliminated later as both source
// and destination will use the same register.
int selectedReg;

if (current.TryGetCopySourceRegister(out int preferredReg) && freePositions[preferredReg] >= current.GetEnd())
{
selectedReg = preferredReg;
}
else
{
selectedReg = GetHighestValueIndex(freePositions);
}

int selectedNextUse = freePositions[selectedReg];

// Intervals starts and ends at odd positions, unless they span an entire
Expand Down Expand Up @@ -431,7 +444,7 @@ private void AllocateRegWithSpill(AllocationContext context, LiveInterval curren
}
}

private static int GetHighestValueIndex(Span<int> span)
private static int GetHighestValueIndex(ReadOnlySpan<int> span)
{
int highest = int.MinValue;

Expand Down Expand Up @@ -798,12 +811,12 @@ private void NumberLocals(ControlFlowGraph cfg, int registersCount)
// The "visited" state is stored in the MSB of the local's value.
const ulong VisitedMask = 1ul << 63;

bool IsVisited(Operand local)
static bool IsVisited(Operand local)
{
return (local.GetValueUnsafe() & VisitedMask) != 0;
}

void SetVisited(Operand local)
static void SetVisited(Operand local)
{
local.GetValueUnsafe() |= VisitedMask;
}
Expand All @@ -826,9 +839,25 @@ void SetVisited(Operand local)
{
dest.NumberLocal(_intervals.Count);

_intervals.Add(new LiveInterval(dest));
LiveInterval interval = new LiveInterval(dest);
_intervals.Add(interval);

SetVisited(dest);

// If this is a copy (or copy-like operation), set the copy source interval as well.
// This is used for register preferencing later on, which allows the copy to be eliminated
// in some cases.
if (node.Instruction == Instruction.Copy || node.Instruction == Instruction.ZeroExtend32)
{
Operand source = node.GetSource(0);

if (source.Kind == OperandKind.LocalVariable &&
source.GetLocalNumber() > 0 &&
(node.Instruction == Instruction.Copy || source.Type == OperandType.I32))
{
interval.SetCopySource(_intervals[source.GetLocalNumber()]);
}
}
}
}
}
Expand Down
21 changes: 21 additions & 0 deletions src/ARMeilleure/CodeGen/RegisterAllocators/LiveInterval.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ private struct Data
public LiveRange CurrRange;

public LiveInterval Parent;
public LiveInterval CopySource;

public UseList Uses;
public LiveIntervalList Children;
Expand All @@ -37,6 +38,7 @@ private struct Data
private ref LiveRange CurrRange => ref _data->CurrRange;
private ref LiveRange PrevRange => ref _data->PrevRange;
private ref LiveInterval Parent => ref _data->Parent;
private ref LiveInterval CopySource => ref _data->CopySource;
private ref UseList Uses => ref _data->Uses;
private ref LiveIntervalList Children => ref _data->Children;

Expand Down Expand Up @@ -78,6 +80,25 @@ public LiveInterval(Register register) : this(local: default, parent: default)
Register = register;
}

public void SetCopySource(LiveInterval copySource)
{
CopySource = copySource;
}

public bool TryGetCopySourceRegister(out int copySourceRegIndex)
{
if (CopySource._data != null)
{
copySourceRegIndex = CopySource.Register.Index;

return true;
}

copySourceRegIndex = 0;

return false;
}

public void Reset()
{
PrevRange = default;
Expand Down
2 changes: 1 addition & 1 deletion src/ARMeilleure/CodeGen/X86/Assembler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1444,7 +1444,7 @@ void SetRegisterHighBit(Register reg, int bit)

Span<byte> buffer = new byte[jump.JumpPosition - _stream.Position];

_stream.Read(buffer);
_stream.ReadExactly(buffer);
_stream.Seek(ReservedBytesForJump, SeekOrigin.Current);

codeStream.Write(buffer);
Expand Down
11 changes: 10 additions & 1 deletion src/ARMeilleure/Translation/ControlFlowGraph.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class ControlFlowGraph
private int[] _postOrderMap;

public int LocalsCount { get; private set; }
public BasicBlock Entry { get; }
public BasicBlock Entry { get; private set; }
public IntrusiveList<BasicBlock> Blocks { get; }
public BasicBlock[] PostOrderBlocks => _postOrderBlocks;
public int[] PostOrderMap => _postOrderMap;
Expand All @@ -34,6 +34,15 @@ public Operand AllocateLocal(OperandType type)
return result;
}

public void UpdateEntry(BasicBlock newEntry)
{
newEntry.AddSuccessor(Entry);

Entry = newEntry;
Blocks.AddFirst(newEntry);
Update();
}

public void Update()
{
RemoveUnreachableBlocks(Blocks);
Expand Down
12 changes: 9 additions & 3 deletions src/ARMeilleure/Translation/PTC/Ptc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Ptc : IPtcLoadState
private const string OuterHeaderMagicString = "PTCohd\0\0";
private const string InnerHeaderMagicString = "PTCihd\0\0";

private const uint InternalVersion = 6634; //! To be incremented manually for each change to the ARMeilleure project.
private const uint InternalVersion = 6950; //! To be incremented manually for each change to the ARMeilleure project.

private const string ActualDir = "0";
private const string BackupDir = "1";
Expand Down Expand Up @@ -857,8 +857,14 @@ void TranslateFuncs()

Stopwatch sw = Stopwatch.StartNew();

threads.ForEach((thread) => thread.Start());
threads.ForEach((thread) => thread.Join());
foreach (var thread in threads)
{
thread.Start();
}
foreach (var thread in threads)
{
thread.Join();
}

threads.Clear();

Expand Down
13 changes: 12 additions & 1 deletion src/ARMeilleure/Translation/RegisterUsage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,17 @@ public override int GetHashCode()

public static void RunPass(ControlFlowGraph cfg, ExecutionMode mode)
{
if (cfg.Entry.Predecessors.Count != 0)
{
// We expect the entry block to have no predecessors.
// This is required because we have a implicit context load at the start of the function,
// but if there is a jump to the start of the function, the context load would trash the modified values.
// Here we insert a new entry block that will jump to the existing entry block.
BasicBlock newEntry = new BasicBlock(cfg.Blocks.Count);

cfg.UpdateEntry(newEntry);
}

// Compute local register inputs and outputs used inside blocks.
RegisterMask[] localInputs = new RegisterMask[cfg.Blocks.Count];
RegisterMask[] localOutputs = new RegisterMask[cfg.Blocks.Count];
Expand Down Expand Up @@ -201,7 +212,7 @@ public static void RunPass(ControlFlowGraph cfg, ExecutionMode mode)

// The only block without any predecessor should be the entry block.
// It always needs a context load as it is the first block to run.
if (block.Predecessors.Count == 0 || hasContextLoad)
if (block == cfg.Entry || hasContextLoad)
{
long vecMask = globalInputs[block.Index].VecMask;
long intMask = globalInputs[block.Index].IntMask;
Expand Down
4 changes: 2 additions & 2 deletions src/Ryujinx.Audio.Backends.SDL2/SDL2HardwareDeviceSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ private unsafe void Update(IntPtr userdata, IntPtr stream, int streamLength)
return;
}

using IMemoryOwner<byte> samplesOwner = ByteMemoryPool.Rent(frameCount * _bytesPerFrame);
using SpanOwner<byte> samplesOwner = SpanOwner<byte>.Rent(frameCount * _bytesPerFrame);

Span<byte> samples = samplesOwner.Memory.Span;
Span<byte> samples = samplesOwner.Span;

_ringBuffer.Read(samples, 0, samples.Length);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ private unsafe void Update(int minFrameCount, int maxFrameCount)

int channelCount = areas.Length;

using IMemoryOwner<byte> samplesOwner = ByteMemoryPool.Rent(frameCount * bytesPerFrame);
using SpanOwner<byte> samplesOwner = SpanOwner<byte>.Rent(frameCount * bytesPerFrame);

Span<byte> samples = samplesOwner.Memory.Span;
Span<byte> samples = samplesOwner.Span;

_ringBuffer.Read(samples, 0, samples.Length);

Expand Down
6 changes: 3 additions & 3 deletions src/Ryujinx.Audio/Backends/Common/DynamicRingBuffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class DynamicRingBuffer

private readonly object _lock = new();

private IMemoryOwner<byte> _bufferOwner;
private MemoryOwner<byte> _bufferOwner;
private Memory<byte> _buffer;
private int _size;
private int _headOffset;
Expand All @@ -24,7 +24,7 @@ public class DynamicRingBuffer

public DynamicRingBuffer(int initialCapacity = RingBufferAlignment)
{
_bufferOwner = ByteMemoryPool.RentCleared(initialCapacity);
_bufferOwner = MemoryOwner<byte>.RentCleared(initialCapacity);
_buffer = _bufferOwner.Memory;
}

Expand Down Expand Up @@ -62,7 +62,7 @@ public void Clear(int size)

private void SetCapacityLocked(int capacity)
{
IMemoryOwner<byte> newBufferOwner = ByteMemoryPool.RentCleared(capacity);
MemoryOwner<byte> newBufferOwner = MemoryOwner<byte>.RentCleared(capacity);
Memory<byte> newBuffer = newBufferOwner.Memory;

if (_size > 0)
Expand Down
1 change: 0 additions & 1 deletion src/Ryujinx.Audio/Renderer/Common/VoiceUpdateState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public struct VoiceUpdateState
{
public const int Align = 0x10;
public const int BiquadStateOffset = 0x0;
public const int BiquadStateSize = 0x10;

/// <summary>
/// The state of the biquad filters of this voice.
Expand Down
Loading