Compare commits
20 Commits
Author | SHA1 | Date | |
---|---|---|---|
f5235fff29 | |||
eba682b767 | |||
b994dafe7a | |||
54421760c3 | |||
88a0e720cb | |||
53cc9e0561 | |||
7defc59b9d | |||
951700fdd8 | |||
eb6430f103 | |||
80a879cb44 | |||
2197f41506 | |||
c8f9292bab | |||
0ec933a615 | |||
2135b6a51a | |||
00e35d9bf6 | |||
6dfb6ccf8c | |||
e87e8b012c | |||
e8f1ca8427 | |||
ad47bd2d4e | |||
a5ff0024fb |
@ -58,7 +58,6 @@ namespace ARMeilleure.CodeGen.Linking
|
|||||||
/// <param name="a">First instance</param>
|
/// <param name="a">First instance</param>
|
||||||
/// <param name="b">Second instance</param>
|
/// <param name="b">Second instance</param>
|
||||||
/// <returns><see langword="true"/> if not equal; otherwise <see langword="false"/></returns>
|
/// <returns><see langword="true"/> if not equal; otherwise <see langword="false"/></returns>
|
||||||
/// <inheritdoc/>
|
|
||||||
public static bool operator !=(Symbol a, Symbol b)
|
public static bool operator !=(Symbol a, Symbol b)
|
||||||
{
|
{
|
||||||
return !(a == b);
|
return !(a == b);
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
using ARMeilleure.Common;
|
|
||||||
using ARMeilleure.IntermediateRepresentation;
|
using ARMeilleure.IntermediateRepresentation;
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace ARMeilleure.CodeGen.RegisterAllocators
|
namespace ARMeilleure.CodeGen.RegisterAllocators
|
||||||
{
|
{
|
||||||
|
@ -4,6 +4,11 @@ namespace ARMeilleure.CodeGen.X86
|
|||||||
{
|
{
|
||||||
partial class Assembler
|
partial class Assembler
|
||||||
{
|
{
|
||||||
|
public static bool SupportsVexPrefix(X86Instruction inst)
|
||||||
|
{
|
||||||
|
return _instTable[(int)inst].Flags.HasFlag(InstructionFlags.Vex);
|
||||||
|
}
|
||||||
|
|
||||||
private const int BadOp = 0;
|
private const int BadOp = 0;
|
||||||
|
|
||||||
[Flags]
|
[Flags]
|
||||||
@ -152,6 +157,7 @@ namespace ARMeilleure.CodeGen.X86
|
|||||||
Add(X86Instruction.Paddd, new InstructionInfo(BadOp, BadOp, BadOp, BadOp, 0x00000ffe, InstructionFlags.Vex | InstructionFlags.Prefix66));
|
Add(X86Instruction.Paddd, new InstructionInfo(BadOp, BadOp, BadOp, BadOp, 0x00000ffe, InstructionFlags.Vex | InstructionFlags.Prefix66));
|
||||||
Add(X86Instruction.Paddq, new InstructionInfo(BadOp, BadOp, BadOp, BadOp, 0x00000fd4, InstructionFlags.Vex | InstructionFlags.Prefix66));
|
Add(X86Instruction.Paddq, new InstructionInfo(BadOp, BadOp, BadOp, BadOp, 0x00000fd4, InstructionFlags.Vex | InstructionFlags.Prefix66));
|
||||||
Add(X86Instruction.Paddw, new InstructionInfo(BadOp, BadOp, BadOp, BadOp, 0x00000ffd, InstructionFlags.Vex | InstructionFlags.Prefix66));
|
Add(X86Instruction.Paddw, new InstructionInfo(BadOp, BadOp, BadOp, BadOp, 0x00000ffd, InstructionFlags.Vex | InstructionFlags.Prefix66));
|
||||||
|
Add(X86Instruction.Palignr, new InstructionInfo(BadOp, BadOp, BadOp, BadOp, 0x000f3a0f, InstructionFlags.Vex | InstructionFlags.Prefix66));
|
||||||
Add(X86Instruction.Pand, new InstructionInfo(BadOp, BadOp, BadOp, BadOp, 0x00000fdb, InstructionFlags.Vex | InstructionFlags.Prefix66));
|
Add(X86Instruction.Pand, new InstructionInfo(BadOp, BadOp, BadOp, BadOp, 0x00000fdb, InstructionFlags.Vex | InstructionFlags.Prefix66));
|
||||||
Add(X86Instruction.Pandn, new InstructionInfo(BadOp, BadOp, BadOp, BadOp, 0x00000fdf, InstructionFlags.Vex | InstructionFlags.Prefix66));
|
Add(X86Instruction.Pandn, new InstructionInfo(BadOp, BadOp, BadOp, BadOp, 0x00000fdf, InstructionFlags.Vex | InstructionFlags.Prefix66));
|
||||||
Add(X86Instruction.Pavgb, new InstructionInfo(BadOp, BadOp, BadOp, BadOp, 0x00000fe0, InstructionFlags.Vex | InstructionFlags.Prefix66));
|
Add(X86Instruction.Pavgb, new InstructionInfo(BadOp, BadOp, BadOp, BadOp, 0x00000fe0, InstructionFlags.Vex | InstructionFlags.Prefix66));
|
||||||
@ -234,6 +240,9 @@ namespace ARMeilleure.CodeGen.X86
|
|||||||
Add(X86Instruction.Rsqrtss, new InstructionInfo(BadOp, BadOp, BadOp, BadOp, 0x00000f52, InstructionFlags.Vex | InstructionFlags.PrefixF3));
|
Add(X86Instruction.Rsqrtss, new InstructionInfo(BadOp, BadOp, BadOp, BadOp, 0x00000f52, InstructionFlags.Vex | InstructionFlags.PrefixF3));
|
||||||
Add(X86Instruction.Sar, new InstructionInfo(0x070000d3, 0x070000c1, BadOp, BadOp, BadOp, InstructionFlags.None));
|
Add(X86Instruction.Sar, new InstructionInfo(0x070000d3, 0x070000c1, BadOp, BadOp, BadOp, InstructionFlags.None));
|
||||||
Add(X86Instruction.Setcc, new InstructionInfo(BadOp, BadOp, BadOp, BadOp, 0x00000f90, InstructionFlags.Reg8Dest));
|
Add(X86Instruction.Setcc, new InstructionInfo(BadOp, BadOp, BadOp, BadOp, 0x00000f90, InstructionFlags.Reg8Dest));
|
||||||
|
Add(X86Instruction.Sha256Msg1, new InstructionInfo(BadOp, BadOp, BadOp, BadOp, 0x000f38cc, InstructionFlags.None));
|
||||||
|
Add(X86Instruction.Sha256Msg2, new InstructionInfo(BadOp, BadOp, BadOp, BadOp, 0x000f38cd, InstructionFlags.None));
|
||||||
|
Add(X86Instruction.Sha256Rnds2, new InstructionInfo(BadOp, BadOp, BadOp, BadOp, 0x000f38cb, InstructionFlags.None));
|
||||||
Add(X86Instruction.Shl, new InstructionInfo(0x040000d3, 0x040000c1, BadOp, BadOp, BadOp, InstructionFlags.None));
|
Add(X86Instruction.Shl, new InstructionInfo(0x040000d3, 0x040000c1, BadOp, BadOp, BadOp, InstructionFlags.None));
|
||||||
Add(X86Instruction.Shr, new InstructionInfo(0x050000d3, 0x050000c1, BadOp, BadOp, BadOp, InstructionFlags.None));
|
Add(X86Instruction.Shr, new InstructionInfo(0x050000d3, 0x050000c1, BadOp, BadOp, BadOp, InstructionFlags.None));
|
||||||
Add(X86Instruction.Shufpd, new InstructionInfo(BadOp, BadOp, BadOp, BadOp, 0x00000fc6, InstructionFlags.Vex | InstructionFlags.Prefix66));
|
Add(X86Instruction.Shufpd, new InstructionInfo(BadOp, BadOp, BadOp, BadOp, 0x00000fc6, InstructionFlags.Vex | InstructionFlags.Prefix66));
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
namespace ARMeilleure.CodeGen.X86
|
namespace ARMeilleure.CodeGen.X86
|
||||||
{
|
{
|
||||||
|
@ -12,21 +12,28 @@ namespace ARMeilleure.CodeGen.X86
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
(_, _, int ecx, int edx) = X86Base.CpuId(0x00000001, 0x00000000);
|
(int maxNum, _, _, _) = X86Base.CpuId(0x00000000, 0x00000000);
|
||||||
|
|
||||||
FeatureInfoEdx = (FeatureFlagsEdx)edx;
|
(_, _, int ecx1, int edx1) = X86Base.CpuId(0x00000001, 0x00000000);
|
||||||
FeatureInfoEcx = (FeatureFlagsEcx)ecx;
|
FeatureInfo1Edx = (FeatureFlags1Edx)edx1;
|
||||||
|
FeatureInfo1Ecx = (FeatureFlags1Ecx)ecx1;
|
||||||
|
|
||||||
|
if (maxNum >= 7)
|
||||||
|
{
|
||||||
|
(_, int ebx7, _, _) = X86Base.CpuId(0x00000007, 0x00000000);
|
||||||
|
FeatureInfo7Ebx = (FeatureFlags7Ebx)ebx7;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Flags]
|
[Flags]
|
||||||
public enum FeatureFlagsEdx
|
public enum FeatureFlags1Edx
|
||||||
{
|
{
|
||||||
Sse = 1 << 25,
|
Sse = 1 << 25,
|
||||||
Sse2 = 1 << 26
|
Sse2 = 1 << 26
|
||||||
}
|
}
|
||||||
|
|
||||||
[Flags]
|
[Flags]
|
||||||
public enum FeatureFlagsEcx
|
public enum FeatureFlags1Ecx
|
||||||
{
|
{
|
||||||
Sse3 = 1 << 0,
|
Sse3 = 1 << 0,
|
||||||
Pclmulqdq = 1 << 1,
|
Pclmulqdq = 1 << 1,
|
||||||
@ -40,21 +47,31 @@ namespace ARMeilleure.CodeGen.X86
|
|||||||
F16c = 1 << 29
|
F16c = 1 << 29
|
||||||
}
|
}
|
||||||
|
|
||||||
public static FeatureFlagsEdx FeatureInfoEdx { get; }
|
[Flags]
|
||||||
public static FeatureFlagsEcx FeatureInfoEcx { get; }
|
public enum FeatureFlags7Ebx
|
||||||
|
{
|
||||||
|
Avx2 = 1 << 5,
|
||||||
|
Sha = 1 << 29
|
||||||
|
}
|
||||||
|
|
||||||
public static bool SupportsSse => FeatureInfoEdx.HasFlag(FeatureFlagsEdx.Sse);
|
public static FeatureFlags1Edx FeatureInfo1Edx { get; }
|
||||||
public static bool SupportsSse2 => FeatureInfoEdx.HasFlag(FeatureFlagsEdx.Sse2);
|
public static FeatureFlags1Ecx FeatureInfo1Ecx { get; }
|
||||||
public static bool SupportsSse3 => FeatureInfoEcx.HasFlag(FeatureFlagsEcx.Sse3);
|
public static FeatureFlags7Ebx FeatureInfo7Ebx { get; } = 0;
|
||||||
public static bool SupportsPclmulqdq => FeatureInfoEcx.HasFlag(FeatureFlagsEcx.Pclmulqdq);
|
|
||||||
public static bool SupportsSsse3 => FeatureInfoEcx.HasFlag(FeatureFlagsEcx.Ssse3);
|
public static bool SupportsSse => FeatureInfo1Edx.HasFlag(FeatureFlags1Edx.Sse);
|
||||||
public static bool SupportsFma => FeatureInfoEcx.HasFlag(FeatureFlagsEcx.Fma);
|
public static bool SupportsSse2 => FeatureInfo1Edx.HasFlag(FeatureFlags1Edx.Sse2);
|
||||||
public static bool SupportsSse41 => FeatureInfoEcx.HasFlag(FeatureFlagsEcx.Sse41);
|
public static bool SupportsSse3 => FeatureInfo1Ecx.HasFlag(FeatureFlags1Ecx.Sse3);
|
||||||
public static bool SupportsSse42 => FeatureInfoEcx.HasFlag(FeatureFlagsEcx.Sse42);
|
public static bool SupportsPclmulqdq => FeatureInfo1Ecx.HasFlag(FeatureFlags1Ecx.Pclmulqdq);
|
||||||
public static bool SupportsPopcnt => FeatureInfoEcx.HasFlag(FeatureFlagsEcx.Popcnt);
|
public static bool SupportsSsse3 => FeatureInfo1Ecx.HasFlag(FeatureFlags1Ecx.Ssse3);
|
||||||
public static bool SupportsAesni => FeatureInfoEcx.HasFlag(FeatureFlagsEcx.Aes);
|
public static bool SupportsFma => FeatureInfo1Ecx.HasFlag(FeatureFlags1Ecx.Fma);
|
||||||
public static bool SupportsAvx => FeatureInfoEcx.HasFlag(FeatureFlagsEcx.Avx);
|
public static bool SupportsSse41 => FeatureInfo1Ecx.HasFlag(FeatureFlags1Ecx.Sse41);
|
||||||
public static bool SupportsF16c => FeatureInfoEcx.HasFlag(FeatureFlagsEcx.F16c);
|
public static bool SupportsSse42 => FeatureInfo1Ecx.HasFlag(FeatureFlags1Ecx.Sse42);
|
||||||
|
public static bool SupportsPopcnt => FeatureInfo1Ecx.HasFlag(FeatureFlags1Ecx.Popcnt);
|
||||||
|
public static bool SupportsAesni => FeatureInfo1Ecx.HasFlag(FeatureFlags1Ecx.Aes);
|
||||||
|
public static bool SupportsAvx => FeatureInfo1Ecx.HasFlag(FeatureFlags1Ecx.Avx);
|
||||||
|
public static bool SupportsAvx2 => FeatureInfo7Ebx.HasFlag(FeatureFlags7Ebx.Avx2) && SupportsAvx;
|
||||||
|
public static bool SupportsF16c => FeatureInfo1Ecx.HasFlag(FeatureFlags1Ecx.F16c);
|
||||||
|
public static bool SupportsSha => FeatureInfo7Ebx.HasFlag(FeatureFlags7Ebx.Sha);
|
||||||
|
|
||||||
public static bool ForceLegacySse { get; set; }
|
public static bool ForceLegacySse { get; set; }
|
||||||
|
|
||||||
|
@ -82,6 +82,7 @@ namespace ARMeilleure.CodeGen.X86
|
|||||||
Add(Intrinsic.X86Paddd, new IntrinsicInfo(X86Instruction.Paddd, IntrinsicType.Binary));
|
Add(Intrinsic.X86Paddd, new IntrinsicInfo(X86Instruction.Paddd, IntrinsicType.Binary));
|
||||||
Add(Intrinsic.X86Paddq, new IntrinsicInfo(X86Instruction.Paddq, IntrinsicType.Binary));
|
Add(Intrinsic.X86Paddq, new IntrinsicInfo(X86Instruction.Paddq, IntrinsicType.Binary));
|
||||||
Add(Intrinsic.X86Paddw, new IntrinsicInfo(X86Instruction.Paddw, IntrinsicType.Binary));
|
Add(Intrinsic.X86Paddw, new IntrinsicInfo(X86Instruction.Paddw, IntrinsicType.Binary));
|
||||||
|
Add(Intrinsic.X86Palignr, new IntrinsicInfo(X86Instruction.Palignr, IntrinsicType.TernaryImm));
|
||||||
Add(Intrinsic.X86Pand, new IntrinsicInfo(X86Instruction.Pand, IntrinsicType.Binary));
|
Add(Intrinsic.X86Pand, new IntrinsicInfo(X86Instruction.Pand, IntrinsicType.Binary));
|
||||||
Add(Intrinsic.X86Pandn, new IntrinsicInfo(X86Instruction.Pandn, IntrinsicType.Binary));
|
Add(Intrinsic.X86Pandn, new IntrinsicInfo(X86Instruction.Pandn, IntrinsicType.Binary));
|
||||||
Add(Intrinsic.X86Pavgb, new IntrinsicInfo(X86Instruction.Pavgb, IntrinsicType.Binary));
|
Add(Intrinsic.X86Pavgb, new IntrinsicInfo(X86Instruction.Pavgb, IntrinsicType.Binary));
|
||||||
@ -151,6 +152,9 @@ namespace ARMeilleure.CodeGen.X86
|
|||||||
Add(Intrinsic.X86Roundss, new IntrinsicInfo(X86Instruction.Roundss, IntrinsicType.BinaryImm));
|
Add(Intrinsic.X86Roundss, new IntrinsicInfo(X86Instruction.Roundss, IntrinsicType.BinaryImm));
|
||||||
Add(Intrinsic.X86Rsqrtps, new IntrinsicInfo(X86Instruction.Rsqrtps, IntrinsicType.Unary));
|
Add(Intrinsic.X86Rsqrtps, new IntrinsicInfo(X86Instruction.Rsqrtps, IntrinsicType.Unary));
|
||||||
Add(Intrinsic.X86Rsqrtss, new IntrinsicInfo(X86Instruction.Rsqrtss, IntrinsicType.Unary));
|
Add(Intrinsic.X86Rsqrtss, new IntrinsicInfo(X86Instruction.Rsqrtss, IntrinsicType.Unary));
|
||||||
|
Add(Intrinsic.X86Sha256Msg1, new IntrinsicInfo(X86Instruction.Sha256Msg1, IntrinsicType.Binary));
|
||||||
|
Add(Intrinsic.X86Sha256Msg2, new IntrinsicInfo(X86Instruction.Sha256Msg2, IntrinsicType.Binary));
|
||||||
|
Add(Intrinsic.X86Sha256Rnds2, new IntrinsicInfo(X86Instruction.Sha256Rnds2, IntrinsicType.Ternary));
|
||||||
Add(Intrinsic.X86Shufpd, new IntrinsicInfo(X86Instruction.Shufpd, IntrinsicType.TernaryImm));
|
Add(Intrinsic.X86Shufpd, new IntrinsicInfo(X86Instruction.Shufpd, IntrinsicType.TernaryImm));
|
||||||
Add(Intrinsic.X86Shufps, new IntrinsicInfo(X86Instruction.Shufps, IntrinsicType.TernaryImm));
|
Add(Intrinsic.X86Shufps, new IntrinsicInfo(X86Instruction.Shufps, IntrinsicType.TernaryImm));
|
||||||
Add(Intrinsic.X86Sqrtpd, new IntrinsicInfo(X86Instruction.Sqrtpd, IntrinsicType.Unary));
|
Add(Intrinsic.X86Sqrtpd, new IntrinsicInfo(X86Instruction.Sqrtpd, IntrinsicType.Unary));
|
||||||
|
@ -308,11 +308,13 @@ namespace ARMeilleure.CodeGen.X86
|
|||||||
|
|
||||||
case Instruction.Extended:
|
case Instruction.Extended:
|
||||||
{
|
{
|
||||||
|
bool isBlend = node.Intrinsic == Intrinsic.X86Blendvpd ||
|
||||||
|
node.Intrinsic == Intrinsic.X86Blendvps ||
|
||||||
|
node.Intrinsic == Intrinsic.X86Pblendvb;
|
||||||
|
|
||||||
// BLENDVPD, BLENDVPS, PBLENDVB last operand is always implied to be XMM0 when VEX is not supported.
|
// BLENDVPD, BLENDVPS, PBLENDVB last operand is always implied to be XMM0 when VEX is not supported.
|
||||||
if ((node.Intrinsic == Intrinsic.X86Blendvpd ||
|
// SHA256RNDS2 always has an implied XMM0 as a last operand.
|
||||||
node.Intrinsic == Intrinsic.X86Blendvps ||
|
if ((isBlend && !HardwareCapabilities.SupportsVexEncoding) || node.Intrinsic == Intrinsic.X86Sha256Rnds2)
|
||||||
node.Intrinsic == Intrinsic.X86Pblendvb) &&
|
|
||||||
!HardwareCapabilities.SupportsVexEncoding)
|
|
||||||
{
|
{
|
||||||
Operand xmm0 = Xmm(X86Register.Xmm0, OperandType.V128);
|
Operand xmm0 = Xmm(X86Register.Xmm0, OperandType.V128);
|
||||||
|
|
||||||
@ -1297,11 +1299,15 @@ namespace ARMeilleure.CodeGen.X86
|
|||||||
{
|
{
|
||||||
if (IsIntrinsic(operation.Instruction))
|
if (IsIntrinsic(operation.Instruction))
|
||||||
{
|
{
|
||||||
|
IntrinsicInfo info = IntrinsicTable.GetInfo(operation.Intrinsic);
|
||||||
|
|
||||||
|
bool hasVex = HardwareCapabilities.SupportsVexEncoding && Assembler.SupportsVexPrefix(info.Inst);
|
||||||
|
|
||||||
bool isUnary = operation.SourcesCount < 2;
|
bool isUnary = operation.SourcesCount < 2;
|
||||||
|
|
||||||
bool hasVecDest = operation.Destination != default && operation.Destination.Type == OperandType.V128;
|
bool hasVecDest = operation.Destination != default && operation.Destination.Type == OperandType.V128;
|
||||||
|
|
||||||
return !HardwareCapabilities.SupportsVexEncoding && !isUnary && hasVecDest;
|
return !hasVex && !isUnary && hasVecDest;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -98,6 +98,7 @@ namespace ARMeilleure.CodeGen.X86
|
|||||||
Paddd,
|
Paddd,
|
||||||
Paddq,
|
Paddq,
|
||||||
Paddw,
|
Paddw,
|
||||||
|
Palignr,
|
||||||
Pand,
|
Pand,
|
||||||
Pandn,
|
Pandn,
|
||||||
Pavgb,
|
Pavgb,
|
||||||
@ -180,6 +181,9 @@ namespace ARMeilleure.CodeGen.X86
|
|||||||
Rsqrtss,
|
Rsqrtss,
|
||||||
Sar,
|
Sar,
|
||||||
Setcc,
|
Setcc,
|
||||||
|
Sha256Msg1,
|
||||||
|
Sha256Msg2,
|
||||||
|
Sha256Rnds2,
|
||||||
Shl,
|
Shl,
|
||||||
Shr,
|
Shr,
|
||||||
Shufpd,
|
Shufpd,
|
||||||
|
@ -206,7 +206,7 @@ namespace ARMeilleure.Common
|
|||||||
/// <typeparam name="T">Type of elements</typeparam>
|
/// <typeparam name="T">Type of elements</typeparam>
|
||||||
/// <param name="length">Number of elements</param>
|
/// <param name="length">Number of elements</param>
|
||||||
/// <param name="fill">Fill value</param>
|
/// <param name="fill">Fill value</param>
|
||||||
/// <param name="leaf"><see langword="true"/> if leaf; otherwise <see langword=""="false"/></param>
|
/// <param name="leaf"><see langword="true"/> if leaf; otherwise <see langword="false"/></param>
|
||||||
/// <returns>Allocated block</returns>
|
/// <returns>Allocated block</returns>
|
||||||
private IntPtr Allocate<T>(int length, T fill, bool leaf) where T : unmanaged
|
private IntPtr Allocate<T>(int length, T fill, bool leaf) where T : unmanaged
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Threading;
|
|
||||||
|
|
||||||
namespace ARMeilleure.Common
|
namespace ARMeilleure.Common
|
||||||
{
|
{
|
||||||
|
@ -9,6 +9,9 @@ namespace ARMeilleure.Common
|
|||||||
class Counter<T> : IDisposable where T : unmanaged
|
class Counter<T> : IDisposable where T : unmanaged
|
||||||
{
|
{
|
||||||
private bool _disposed;
|
private bool _disposed;
|
||||||
|
/// <summary>
|
||||||
|
/// Index in the <see cref="EntryTable{T}"/>
|
||||||
|
/// </summary>
|
||||||
private readonly int _index;
|
private readonly int _index;
|
||||||
private readonly EntryTable<T> _countTable;
|
private readonly EntryTable<T> _countTable;
|
||||||
|
|
||||||
@ -17,7 +20,6 @@ namespace ARMeilleure.Common
|
|||||||
/// <see cref="EntryTable{T}"/> instance and index.
|
/// <see cref="EntryTable{T}"/> instance and index.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="countTable"><see cref="EntryTable{T}"/> instance</param>
|
/// <param name="countTable"><see cref="EntryTable{T}"/> instance</param>
|
||||||
/// <param name="index">Index in the <see cref="EntryTable{T}"/></param>
|
|
||||||
/// <exception cref="ArgumentNullException"><paramref name="countTable"/> is <see langword="null"/></exception>
|
/// <exception cref="ArgumentNullException"><paramref name="countTable"/> is <see langword="null"/></exception>
|
||||||
/// <exception cref="ArgumentException"><typeparamref name="T"/> is unsupported</exception>
|
/// <exception cref="ArgumentException"><typeparamref name="T"/> is unsupported</exception>
|
||||||
public Counter(EntryTable<T> countTable)
|
public Counter(EntryTable<T> countTable)
|
||||||
@ -68,7 +70,7 @@ namespace ARMeilleure.Common
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Releases all unmanaged and optionally managed resources used by the <see cref="Counter{T}"/> instance.
|
/// Releases all unmanaged and optionally managed resources used by the <see cref="Counter{T}"/> instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="disposing"><see langword="true"/> to dispose managed resources also; otherwise just unmanaged resouces</param>
|
/// <param name="disposing"><see langword="true"/> to dispose managed resources also; otherwise just unmanaged resources</param>
|
||||||
protected virtual void Dispose(bool disposing)
|
protected virtual void Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
if (!_disposed)
|
if (!_disposed)
|
||||||
|
8
ARMeilleure/Decoders/IOpCode32MemRsImm.cs
Normal file
8
ARMeilleure/Decoders/IOpCode32MemRsImm.cs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
namespace ARMeilleure.Decoders
|
||||||
|
{
|
||||||
|
interface IOpCode32MemRsImm : IOpCode32Mem
|
||||||
|
{
|
||||||
|
int Rm { get; }
|
||||||
|
ShiftType ShiftType { get; }
|
||||||
|
}
|
||||||
|
}
|
@ -1,3 +1,5 @@
|
|||||||
|
using System.Numerics;
|
||||||
|
|
||||||
namespace ARMeilleure.Decoders
|
namespace ARMeilleure.Decoders
|
||||||
{
|
{
|
||||||
class OpCode32MemMult : OpCode32, IOpCode32MemMult
|
class OpCode32MemMult : OpCode32, IOpCode32MemMult
|
||||||
@ -23,14 +25,7 @@ namespace ARMeilleure.Decoders
|
|||||||
|
|
||||||
RegisterMask = opCode & 0xffff;
|
RegisterMask = opCode & 0xffff;
|
||||||
|
|
||||||
int regsSize = 0;
|
int regsSize = BitOperations.PopCount((uint)RegisterMask) * 4;
|
||||||
|
|
||||||
for (int index = 0; index < 16; index++)
|
|
||||||
{
|
|
||||||
regsSize += (RegisterMask >> index) & 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
regsSize *= 4;
|
|
||||||
|
|
||||||
if (!u)
|
if (!u)
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
namespace ARMeilleure.Decoders
|
namespace ARMeilleure.Decoders
|
||||||
{
|
{
|
||||||
class OpCode32MemRsImm : OpCode32Mem
|
class OpCode32MemRsImm : OpCode32Mem, IOpCode32MemRsImm
|
||||||
{
|
{
|
||||||
public int Rm { get; }
|
public int Rm { get; }
|
||||||
public ShiftType ShiftType { get; }
|
public ShiftType ShiftType { get; }
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
namespace ARMeilleure.Decoders
|
namespace ARMeilleure.Decoders
|
||||||
{
|
{
|
||||||
class OpCodeT16BImmCmp : OpCodeT16
|
class OpCodeT16BImmCmp : OpCodeT16, IOpCode32BImm
|
||||||
{
|
{
|
||||||
public int Rn { get; }
|
public int Rn { get; }
|
||||||
|
|
||||||
public int Immediate { get; }
|
public long Immediate { get; }
|
||||||
|
|
||||||
public static new OpCode Create(InstDescriptor inst, ulong address, int opCode) => new OpCodeT16BImmCmp(inst, address, opCode);
|
public static new OpCode Create(InstDescriptor inst, ulong address, int opCode) => new OpCodeT16BImmCmp(inst, address, opCode);
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection.Emit;
|
|
||||||
|
|
||||||
namespace ARMeilleure.Decoders
|
namespace ARMeilleure.Decoders
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
using ARMeilleure.Instructions;
|
namespace ARMeilleure.Decoders
|
||||||
|
|
||||||
namespace ARMeilleure.Decoders
|
|
||||||
{
|
{
|
||||||
class OpCodeT32BImm20 : OpCodeT32, IOpCode32BImm
|
class OpCodeT32BImm20 : OpCodeT32, IOpCode32BImm
|
||||||
{
|
{
|
||||||
|
31
ARMeilleure/Decoders/OpCodeT32MemImm8D.cs
Normal file
31
ARMeilleure/Decoders/OpCodeT32MemImm8D.cs
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
namespace ARMeilleure.Decoders
|
||||||
|
{
|
||||||
|
class OpCodeT32MemImm8D : OpCodeT32, IOpCode32Mem
|
||||||
|
{
|
||||||
|
public int Rt { get; }
|
||||||
|
public int Rt2 { get; }
|
||||||
|
public int Rn { get; }
|
||||||
|
public bool WBack { get; }
|
||||||
|
public bool IsLoad { get; }
|
||||||
|
public bool Index { get; }
|
||||||
|
public bool Add { get; }
|
||||||
|
public int Immediate { get; }
|
||||||
|
|
||||||
|
public new static OpCode Create(InstDescriptor inst, ulong address, int opCode) => new OpCodeT32MemImm8D(inst, address, opCode);
|
||||||
|
|
||||||
|
public OpCodeT32MemImm8D(InstDescriptor inst, ulong address, int opCode) : base(inst, address, opCode)
|
||||||
|
{
|
||||||
|
Rt2 = (opCode >> 8) & 0xf;
|
||||||
|
Rt = (opCode >> 12) & 0xf;
|
||||||
|
Rn = (opCode >> 16) & 0xf;
|
||||||
|
|
||||||
|
Index = ((opCode >> 24) & 1) != 0;
|
||||||
|
Add = ((opCode >> 23) & 1) != 0;
|
||||||
|
WBack = ((opCode >> 21) & 1) != 0;
|
||||||
|
|
||||||
|
Immediate = opCode & 0xff;
|
||||||
|
|
||||||
|
IsLoad = ((opCode >> 20) & 1) != 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
24
ARMeilleure/Decoders/OpCodeT32MemLdEx.cs
Normal file
24
ARMeilleure/Decoders/OpCodeT32MemLdEx.cs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
namespace ARMeilleure.Decoders
|
||||||
|
{
|
||||||
|
class OpCodeT32MemLdEx : OpCodeT32, IOpCode32MemEx
|
||||||
|
{
|
||||||
|
public int Rd => 0;
|
||||||
|
public int Rt { get; }
|
||||||
|
public int Rn { get; }
|
||||||
|
|
||||||
|
public bool WBack => false;
|
||||||
|
public bool IsLoad => true;
|
||||||
|
public bool Index => false;
|
||||||
|
public bool Add => false;
|
||||||
|
|
||||||
|
public int Immediate => 0;
|
||||||
|
|
||||||
|
public new static OpCode Create(InstDescriptor inst, ulong address, int opCode) => new OpCodeT32MemLdEx(inst, address, opCode);
|
||||||
|
|
||||||
|
public OpCodeT32MemLdEx(InstDescriptor inst, ulong address, int opCode) : base(inst, address, opCode)
|
||||||
|
{
|
||||||
|
Rt = (opCode >> 12) & 0xf;
|
||||||
|
Rn = (opCode >> 16) & 0xf;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
52
ARMeilleure/Decoders/OpCodeT32MemMult.cs
Normal file
52
ARMeilleure/Decoders/OpCodeT32MemMult.cs
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
using System.Numerics;
|
||||||
|
|
||||||
|
namespace ARMeilleure.Decoders
|
||||||
|
{
|
||||||
|
class OpCodeT32MemMult : OpCodeT32, IOpCode32MemMult
|
||||||
|
{
|
||||||
|
public int Rn { get; }
|
||||||
|
|
||||||
|
public int RegisterMask { get; }
|
||||||
|
public int Offset { get; }
|
||||||
|
public int PostOffset { get; }
|
||||||
|
|
||||||
|
public bool IsLoad { get; }
|
||||||
|
|
||||||
|
public new static OpCode Create(InstDescriptor inst, ulong address, int opCode) => new OpCodeT32MemMult(inst, address, opCode);
|
||||||
|
|
||||||
|
public OpCodeT32MemMult(InstDescriptor inst, ulong address, int opCode) : base(inst, address, opCode)
|
||||||
|
{
|
||||||
|
Rn = (opCode >> 16) & 0xf;
|
||||||
|
|
||||||
|
bool isLoad = (opCode & (1 << 20)) != 0;
|
||||||
|
bool w = (opCode & (1 << 21)) != 0;
|
||||||
|
bool u = (opCode & (1 << 23)) != 0;
|
||||||
|
bool p = (opCode & (1 << 24)) != 0;
|
||||||
|
|
||||||
|
RegisterMask = opCode & 0xffff;
|
||||||
|
|
||||||
|
int regsSize = BitOperations.PopCount((uint)RegisterMask) * 4;
|
||||||
|
|
||||||
|
if (!u)
|
||||||
|
{
|
||||||
|
Offset -= regsSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (u == p)
|
||||||
|
{
|
||||||
|
Offset += 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (w)
|
||||||
|
{
|
||||||
|
PostOffset = u ? regsSize : -regsSize;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PostOffset = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
IsLoad = isLoad;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
30
ARMeilleure/Decoders/OpCodeT32MemRsImm.cs
Normal file
30
ARMeilleure/Decoders/OpCodeT32MemRsImm.cs
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
namespace ARMeilleure.Decoders
|
||||||
|
{
|
||||||
|
class OpCodeT32MemRsImm : OpCodeT32, IOpCode32MemRsImm
|
||||||
|
{
|
||||||
|
public int Rt { get; }
|
||||||
|
public int Rn { get; }
|
||||||
|
public int Rm { get; }
|
||||||
|
public ShiftType ShiftType => ShiftType.Lsl;
|
||||||
|
|
||||||
|
public bool WBack => false;
|
||||||
|
public bool IsLoad { get; }
|
||||||
|
public bool Index => true;
|
||||||
|
public bool Add => true;
|
||||||
|
|
||||||
|
public int Immediate { get; }
|
||||||
|
|
||||||
|
public new static OpCode Create(InstDescriptor inst, ulong address, int opCode) => new OpCodeT32MemRsImm(inst, address, opCode);
|
||||||
|
|
||||||
|
public OpCodeT32MemRsImm(InstDescriptor inst, ulong address, int opCode) : base(inst, address, opCode)
|
||||||
|
{
|
||||||
|
Rm = (opCode >> 0) & 0xf;
|
||||||
|
Rt = (opCode >> 12) & 0xf;
|
||||||
|
Rn = (opCode >> 16) & 0xf;
|
||||||
|
|
||||||
|
IsLoad = (opCode & (1 << 20)) != 0;
|
||||||
|
|
||||||
|
Immediate = (opCode >> 4) & 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
25
ARMeilleure/Decoders/OpCodeT32MemStEx.cs
Normal file
25
ARMeilleure/Decoders/OpCodeT32MemStEx.cs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
namespace ARMeilleure.Decoders
|
||||||
|
{
|
||||||
|
class OpCodeT32MemStEx : OpCodeT32, IOpCode32MemEx
|
||||||
|
{
|
||||||
|
public int Rd { get; }
|
||||||
|
public int Rt { get; }
|
||||||
|
public int Rn { get; }
|
||||||
|
|
||||||
|
public bool WBack => false;
|
||||||
|
public bool IsLoad => false;
|
||||||
|
public bool Index => false;
|
||||||
|
public bool Add => false;
|
||||||
|
|
||||||
|
public int Immediate => 0;
|
||||||
|
|
||||||
|
public new static OpCode Create(InstDescriptor inst, ulong address, int opCode) => new OpCodeT32MemStEx(inst, address, opCode);
|
||||||
|
|
||||||
|
public OpCodeT32MemStEx(InstDescriptor inst, ulong address, int opCode) : base(inst, address, opCode)
|
||||||
|
{
|
||||||
|
Rd = (opCode >> 0) & 0xf;
|
||||||
|
Rt = (opCode >> 12) & 0xf;
|
||||||
|
Rn = (opCode >> 16) & 0xf;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1070,14 +1070,19 @@ namespace ARMeilleure.Decoders
|
|||||||
SetT32("11110x011011xxxx0xxx1111xxxxxxxx", InstName.Cmp, InstEmit32.Cmp, OpCodeT32AluImm.Create);
|
SetT32("11110x011011xxxx0xxx1111xxxxxxxx", InstName.Cmp, InstEmit32.Cmp, OpCodeT32AluImm.Create);
|
||||||
SetT32("11101010100<xxxx0xxx<<<<xxxxxxxx", InstName.Eor, InstEmit32.Eor, OpCodeT32AluRsImm.Create);
|
SetT32("11101010100<xxxx0xxx<<<<xxxxxxxx", InstName.Eor, InstEmit32.Eor, OpCodeT32AluRsImm.Create);
|
||||||
SetT32("11110x00100<xxxx0xxx<<<<xxxxxxxx", InstName.Eor, InstEmit32.Eor, OpCodeT32AluImm.Create);
|
SetT32("11110x00100<xxxx0xxx<<<<xxxxxxxx", InstName.Eor, InstEmit32.Eor, OpCodeT32AluImm.Create);
|
||||||
|
SetT32("111010001101xxxxxxxx111111101111", InstName.Ldaex, InstEmit32.Ldaex, OpCodeT32MemLdEx.Create);
|
||||||
|
SetT32("1110100010x1xxxxxxxxxxxxxxxxxxxx", InstName.Ldm, InstEmit32.Ldm, OpCodeT32MemMult.Create);
|
||||||
|
SetT32("1110100100x1xxxxxxxxxxxxxxxxxxxx", InstName.Ldm, InstEmit32.Ldm, OpCodeT32MemMult.Create);
|
||||||
SetT32("111110000101xxxx<<<<10x1xxxxxxxx", InstName.Ldr, InstEmit32.Ldr, OpCodeT32MemImm8.Create);
|
SetT32("111110000101xxxx<<<<10x1xxxxxxxx", InstName.Ldr, InstEmit32.Ldr, OpCodeT32MemImm8.Create);
|
||||||
SetT32("111110000101xxxx<<<<1100xxxxxxxx", InstName.Ldr, InstEmit32.Ldr, OpCodeT32MemImm8.Create);
|
SetT32("111110000101xxxx<<<<1100xxxxxxxx", InstName.Ldr, InstEmit32.Ldr, OpCodeT32MemImm8.Create);
|
||||||
SetT32("111110000101xxxx<<<<11x1xxxxxxxx", InstName.Ldr, InstEmit32.Ldr, OpCodeT32MemImm8.Create);
|
SetT32("111110000101xxxx<<<<11x1xxxxxxxx", InstName.Ldr, InstEmit32.Ldr, OpCodeT32MemImm8.Create);
|
||||||
SetT32("111110001101xxxxxxxxxxxxxxxxxxxx", InstName.Ldr, InstEmit32.Ldr, OpCodeT32MemImm12.Create);
|
SetT32("111110001101xxxxxxxxxxxxxxxxxxxx", InstName.Ldr, InstEmit32.Ldr, OpCodeT32MemImm12.Create);
|
||||||
|
SetT32("111110000101<<<<xxxx000000xxxxxx", InstName.Ldr, InstEmit32.Ldr, OpCodeT32MemRsImm.Create);
|
||||||
SetT32("111110000001xxxx<<<<10x1xxxxxxxx", InstName.Ldrb, InstEmit32.Ldrb, OpCodeT32MemImm8.Create);
|
SetT32("111110000001xxxx<<<<10x1xxxxxxxx", InstName.Ldrb, InstEmit32.Ldrb, OpCodeT32MemImm8.Create);
|
||||||
SetT32("111110000001xxxx<<<<1100xxxxxxxx", InstName.Ldrb, InstEmit32.Ldrb, OpCodeT32MemImm8.Create);
|
SetT32("111110000001xxxx<<<<1100xxxxxxxx", InstName.Ldrb, InstEmit32.Ldrb, OpCodeT32MemImm8.Create);
|
||||||
SetT32("111110000001xxxx<<<<11x1xxxxxxxx", InstName.Ldrb, InstEmit32.Ldrb, OpCodeT32MemImm8.Create);
|
SetT32("111110000001xxxx<<<<11x1xxxxxxxx", InstName.Ldrb, InstEmit32.Ldrb, OpCodeT32MemImm8.Create);
|
||||||
SetT32("111110001001xxxxxxxxxxxxxxxxxxxx", InstName.Ldrb, InstEmit32.Ldrb, OpCodeT32MemImm12.Create);
|
SetT32("111110001001xxxxxxxxxxxxxxxxxxxx", InstName.Ldrb, InstEmit32.Ldrb, OpCodeT32MemImm12.Create);
|
||||||
|
SetT32("1110100>x1>1<<<<xxxxxxxxxxxxxxxx", InstName.Ldrd, InstEmit32.Ldrd, OpCodeT32MemImm8D.Create);
|
||||||
SetT32("111110000011xxxx<<<<10x1xxxxxxxx", InstName.Ldrh, InstEmit32.Ldrh, OpCodeT32MemImm8.Create);
|
SetT32("111110000011xxxx<<<<10x1xxxxxxxx", InstName.Ldrh, InstEmit32.Ldrh, OpCodeT32MemImm8.Create);
|
||||||
SetT32("111110000011xxxx<<<<1100xxxxxxxx", InstName.Ldrh, InstEmit32.Ldrh, OpCodeT32MemImm8.Create);
|
SetT32("111110000011xxxx<<<<1100xxxxxxxx", InstName.Ldrh, InstEmit32.Ldrh, OpCodeT32MemImm8.Create);
|
||||||
SetT32("111110000011xxxx<<<<11x1xxxxxxxx", InstName.Ldrh, InstEmit32.Ldrh, OpCodeT32MemImm8.Create);
|
SetT32("111110000011xxxx<<<<11x1xxxxxxxx", InstName.Ldrh, InstEmit32.Ldrh, OpCodeT32MemImm8.Create);
|
||||||
@ -1102,10 +1107,15 @@ namespace ARMeilleure.Decoders
|
|||||||
SetT32("11110x01110xxxxx0xxxxxxxxxxxxxxx", InstName.Rsb, InstEmit32.Rsb, OpCodeT32AluImm.Create);
|
SetT32("11110x01110xxxxx0xxxxxxxxxxxxxxx", InstName.Rsb, InstEmit32.Rsb, OpCodeT32AluImm.Create);
|
||||||
SetT32("11101011011xxxxx0xxxxxxxxxxxxxxx", InstName.Sbc, InstEmit32.Sbc, OpCodeT32AluRsImm.Create);
|
SetT32("11101011011xxxxx0xxxxxxxxxxxxxxx", InstName.Sbc, InstEmit32.Sbc, OpCodeT32AluRsImm.Create);
|
||||||
SetT32("11110x01011xxxxx0xxxxxxxxxxxxxxx", InstName.Sbc, InstEmit32.Sbc, OpCodeT32AluImm.Create);
|
SetT32("11110x01011xxxxx0xxxxxxxxxxxxxxx", InstName.Sbc, InstEmit32.Sbc, OpCodeT32AluImm.Create);
|
||||||
|
SetT32("111010001100xxxxxxxx11111110xxxx", InstName.Stlex, InstEmit32.Stlex, OpCodeT32MemStEx.Create);
|
||||||
|
SetT32("1110100010x0xxxx0xxxxxxxxxxxxxxx", InstName.Stm, InstEmit32.Stm, OpCodeT32MemMult.Create);
|
||||||
|
SetT32("1110100100x0xxxx0xxxxxxxxxxxxxxx", InstName.Stm, InstEmit32.Stm, OpCodeT32MemMult.Create);
|
||||||
SetT32("111110000100xxxxxxxx1<<>xxxxxxxx", InstName.Str, InstEmit32.Str, OpCodeT32MemImm8.Create);
|
SetT32("111110000100xxxxxxxx1<<>xxxxxxxx", InstName.Str, InstEmit32.Str, OpCodeT32MemImm8.Create);
|
||||||
SetT32("111110001100xxxxxxxxxxxxxxxxxxxx", InstName.Str, InstEmit32.Str, OpCodeT32MemImm12.Create);
|
SetT32("111110001100xxxxxxxxxxxxxxxxxxxx", InstName.Str, InstEmit32.Str, OpCodeT32MemImm12.Create);
|
||||||
|
SetT32("111110000100<<<<xxxx000000xxxxxx", InstName.Str, InstEmit32.Str, OpCodeT32MemRsImm.Create);
|
||||||
SetT32("111110000000xxxxxxxx1<<>xxxxxxxx", InstName.Strb, InstEmit32.Strb, OpCodeT32MemImm8.Create);
|
SetT32("111110000000xxxxxxxx1<<>xxxxxxxx", InstName.Strb, InstEmit32.Strb, OpCodeT32MemImm8.Create);
|
||||||
SetT32("111110001000xxxxxxxxxxxxxxxxxxxx", InstName.Strb, InstEmit32.Strb, OpCodeT32MemImm12.Create);
|
SetT32("111110001000xxxxxxxxxxxxxxxxxxxx", InstName.Strb, InstEmit32.Strb, OpCodeT32MemImm12.Create);
|
||||||
|
SetT32("1110100>x1>0<<<<xxxxxxxxxxxxxxxx", InstName.Strd, InstEmit32.Strd, OpCodeT32MemImm8D.Create);
|
||||||
SetT32("111110000010xxxxxxxx1<<>xxxxxxxx", InstName.Strh, InstEmit32.Strh, OpCodeT32MemImm8.Create);
|
SetT32("111110000010xxxxxxxx1<<>xxxxxxxx", InstName.Strh, InstEmit32.Strh, OpCodeT32MemImm8.Create);
|
||||||
SetT32("111110001010xxxxxxxxxxxxxxxxxxxx", InstName.Strh, InstEmit32.Strh, OpCodeT32MemImm12.Create);
|
SetT32("111110001010xxxxxxxxxxxxxxxxxxxx", InstName.Strh, InstEmit32.Strh, OpCodeT32MemImm12.Create);
|
||||||
SetT32("11101011101<xxxx0xxx<<<<xxxxxxxx", InstName.Sub, InstEmit32.Sub, OpCodeT32AluRsImm.Create);
|
SetT32("11101011101<xxxx0xxx<<<<xxxxxxxx", InstName.Sub, InstEmit32.Sub, OpCodeT32AluRsImm.Create);
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
using ARMeilleure.Decoders;
|
using ARMeilleure.Decoders;
|
||||||
using ARMeilleure.Translation;
|
using ARMeilleure.Translation;
|
||||||
|
|
||||||
using static ARMeilleure.Instructions.InstEmitFlowHelper;
|
|
||||||
using static ARMeilleure.IntermediateRepresentation.Operand.Factory;
|
using static ARMeilleure.IntermediateRepresentation.Operand.Factory;
|
||||||
|
|
||||||
namespace ARMeilleure.Instructions
|
namespace ARMeilleure.Instructions
|
||||||
|
@ -88,7 +88,7 @@ namespace ARMeilleure.Instructions
|
|||||||
{
|
{
|
||||||
OpCodeT16BImmCmp op = (OpCodeT16BImmCmp)context.CurrOp;
|
OpCodeT16BImmCmp op = (OpCodeT16BImmCmp)context.CurrOp;
|
||||||
|
|
||||||
Operand value = GetIntOrZR(context, op.Rn);
|
Operand value = GetIntA32(context, op.Rn);
|
||||||
Operand lblTarget = context.GetLabel((ulong)op.Immediate);
|
Operand lblTarget = context.GetLabel((ulong)op.Immediate);
|
||||||
|
|
||||||
if (onNotZero)
|
if (onNotZero)
|
||||||
|
@ -547,7 +547,7 @@ namespace ARMeilleure.Instructions
|
|||||||
{
|
{
|
||||||
switch (context.CurrOp)
|
switch (context.CurrOp)
|
||||||
{
|
{
|
||||||
case OpCode32MemRsImm op: return GetMShiftedByImmediate(context, op, setCarry);
|
case IOpCode32MemRsImm op: return GetMShiftedByImmediate(context, op, setCarry);
|
||||||
|
|
||||||
case IOpCode32MemReg op: return GetIntA32(context, op.Rm);
|
case IOpCode32MemReg op: return GetIntA32(context, op.Rm);
|
||||||
|
|
||||||
@ -564,7 +564,7 @@ namespace ARMeilleure.Instructions
|
|||||||
return new InvalidOperationException($"Invalid OpCode type \"{opCode?.GetType().Name ?? "null"}\".");
|
return new InvalidOperationException($"Invalid OpCode type \"{opCode?.GetType().Name ?? "null"}\".");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Operand GetMShiftedByImmediate(ArmEmitterContext context, OpCode32MemRsImm op, bool setCarry)
|
public static Operand GetMShiftedByImmediate(ArmEmitterContext context, IOpCode32MemRsImm op, bool setCarry)
|
||||||
{
|
{
|
||||||
Operand m = GetIntA32(context, op.Rm);
|
Operand m = GetIntA32(context, op.Rm);
|
||||||
|
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
using ARMeilleure.IntermediateRepresentation;
|
using ARMeilleure.IntermediateRepresentation;
|
||||||
using ARMeilleure.Translation;
|
using ARMeilleure.Translation;
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
|
||||||
|
|
||||||
using static ARMeilleure.Instructions.InstEmitFlowHelper;
|
using static ARMeilleure.Instructions.InstEmitFlowHelper;
|
||||||
using static ARMeilleure.Instructions.InstEmitHelper;
|
using static ARMeilleure.Instructions.InstEmitHelper;
|
||||||
using static ARMeilleure.Instructions.InstEmitSimdHelper;
|
using static ARMeilleure.Instructions.InstEmitSimdHelper;
|
||||||
|
@ -100,7 +100,7 @@ namespace ARMeilleure.Instructions
|
|||||||
Operand n = GetVec(op.Rn);
|
Operand n = GetVec(op.Rn);
|
||||||
Operand m = GetVec(op.Rm);
|
Operand m = GetVec(op.Rm);
|
||||||
|
|
||||||
Operand res = context.Call(typeof(SoftFallback).GetMethod(nameof(SoftFallback.HashLower)), d, n, m);
|
Operand res = InstEmitSimdHashHelper.EmitSha256h(context, d, n, m, part2: false);
|
||||||
|
|
||||||
context.Copy(GetVec(op.Rd), res);
|
context.Copy(GetVec(op.Rd), res);
|
||||||
}
|
}
|
||||||
@ -113,7 +113,7 @@ namespace ARMeilleure.Instructions
|
|||||||
Operand n = GetVec(op.Rn);
|
Operand n = GetVec(op.Rn);
|
||||||
Operand m = GetVec(op.Rm);
|
Operand m = GetVec(op.Rm);
|
||||||
|
|
||||||
Operand res = context.Call(typeof(SoftFallback).GetMethod(nameof(SoftFallback.HashUpper)), d, n, m);
|
Operand res = InstEmitSimdHashHelper.EmitSha256h(context, n, d, m, part2: true);
|
||||||
|
|
||||||
context.Copy(GetVec(op.Rd), res);
|
context.Copy(GetVec(op.Rd), res);
|
||||||
}
|
}
|
||||||
@ -125,7 +125,7 @@ namespace ARMeilleure.Instructions
|
|||||||
Operand d = GetVec(op.Rd);
|
Operand d = GetVec(op.Rd);
|
||||||
Operand n = GetVec(op.Rn);
|
Operand n = GetVec(op.Rn);
|
||||||
|
|
||||||
Operand res = context.Call(typeof(SoftFallback).GetMethod(nameof(SoftFallback.Sha256SchedulePart1)), d, n);
|
Operand res = InstEmitSimdHashHelper.EmitSha256su0(context, d, n);
|
||||||
|
|
||||||
context.Copy(GetVec(op.Rd), res);
|
context.Copy(GetVec(op.Rd), res);
|
||||||
}
|
}
|
||||||
@ -138,7 +138,7 @@ namespace ARMeilleure.Instructions
|
|||||||
Operand n = GetVec(op.Rn);
|
Operand n = GetVec(op.Rn);
|
||||||
Operand m = GetVec(op.Rm);
|
Operand m = GetVec(op.Rm);
|
||||||
|
|
||||||
Operand res = context.Call(typeof(SoftFallback).GetMethod(nameof(SoftFallback.Sha256SchedulePart2)), d, n, m);
|
Operand res = InstEmitSimdHashHelper.EmitSha256su1(context, d, n, m);
|
||||||
|
|
||||||
context.Copy(GetVec(op.Rd), res);
|
context.Copy(GetVec(op.Rd), res);
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ namespace ARMeilleure.Instructions
|
|||||||
Operand n = GetVecA32(op.Qn);
|
Operand n = GetVecA32(op.Qn);
|
||||||
Operand m = GetVecA32(op.Qm);
|
Operand m = GetVecA32(op.Qm);
|
||||||
|
|
||||||
Operand res = context.Call(typeof(SoftFallback).GetMethod(nameof(SoftFallback.HashLower)), d, n, m);
|
Operand res = InstEmitSimdHashHelper.EmitSha256h(context, d, n, m, part2: false);
|
||||||
|
|
||||||
context.Copy(GetVecA32(op.Qd), res);
|
context.Copy(GetVecA32(op.Qd), res);
|
||||||
}
|
}
|
||||||
@ -30,7 +30,7 @@ namespace ARMeilleure.Instructions
|
|||||||
Operand n = GetVecA32(op.Qn);
|
Operand n = GetVecA32(op.Qn);
|
||||||
Operand m = GetVecA32(op.Qm);
|
Operand m = GetVecA32(op.Qm);
|
||||||
|
|
||||||
Operand res = context.Call(typeof(SoftFallback).GetMethod(nameof(SoftFallback.HashUpper)), d, n, m);
|
Operand res = InstEmitSimdHashHelper.EmitSha256h(context, n, d, m, part2: true);
|
||||||
|
|
||||||
context.Copy(GetVecA32(op.Qd), res);
|
context.Copy(GetVecA32(op.Qd), res);
|
||||||
}
|
}
|
||||||
@ -42,7 +42,7 @@ namespace ARMeilleure.Instructions
|
|||||||
Operand d = GetVecA32(op.Qd);
|
Operand d = GetVecA32(op.Qd);
|
||||||
Operand m = GetVecA32(op.Qm);
|
Operand m = GetVecA32(op.Qm);
|
||||||
|
|
||||||
Operand res = context.Call(typeof(SoftFallback).GetMethod(nameof(SoftFallback.Sha256SchedulePart1)), d, m);
|
Operand res = InstEmitSimdHashHelper.EmitSha256su0(context, d, m);
|
||||||
|
|
||||||
context.Copy(GetVecA32(op.Qd), res);
|
context.Copy(GetVecA32(op.Qd), res);
|
||||||
}
|
}
|
||||||
@ -55,7 +55,7 @@ namespace ARMeilleure.Instructions
|
|||||||
Operand n = GetVecA32(op.Qn);
|
Operand n = GetVecA32(op.Qn);
|
||||||
Operand m = GetVecA32(op.Qm);
|
Operand m = GetVecA32(op.Qm);
|
||||||
|
|
||||||
Operand res = context.Call(typeof(SoftFallback).GetMethod(nameof(SoftFallback.Sha256SchedulePart2)), d, n, m);
|
Operand res = InstEmitSimdHashHelper.EmitSha256su1(context, d, n, m);
|
||||||
|
|
||||||
context.Copy(GetVecA32(op.Qd), res);
|
context.Copy(GetVecA32(op.Qd), res);
|
||||||
}
|
}
|
||||||
|
56
ARMeilleure/Instructions/InstEmitSimdHashHelper.cs
Normal file
56
ARMeilleure/Instructions/InstEmitSimdHashHelper.cs
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
using ARMeilleure.IntermediateRepresentation;
|
||||||
|
using ARMeilleure.Translation;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
using static ARMeilleure.IntermediateRepresentation.Operand.Factory;
|
||||||
|
|
||||||
|
namespace ARMeilleure.Instructions
|
||||||
|
{
|
||||||
|
static class InstEmitSimdHashHelper
|
||||||
|
{
|
||||||
|
public static Operand EmitSha256h(ArmEmitterContext context, Operand x, Operand y, Operand w, bool part2)
|
||||||
|
{
|
||||||
|
if (Optimizations.UseSha)
|
||||||
|
{
|
||||||
|
Operand src1 = context.AddIntrinsic(Intrinsic.X86Shufps, y, x, Const(0xbb));
|
||||||
|
Operand src2 = context.AddIntrinsic(Intrinsic.X86Shufps, y, x, Const(0x11));
|
||||||
|
Operand w2 = context.AddIntrinsic(Intrinsic.X86Punpckhqdq, w, w);
|
||||||
|
|
||||||
|
Operand round2 = context.AddIntrinsic(Intrinsic.X86Sha256Rnds2, src1, src2, w);
|
||||||
|
Operand round4 = context.AddIntrinsic(Intrinsic.X86Sha256Rnds2, src2, round2, w2);
|
||||||
|
|
||||||
|
Operand res = context.AddIntrinsic(Intrinsic.X86Shufps, round4, round2, Const(part2 ? 0x11 : 0xbb));
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
String method = part2 ? nameof(SoftFallback.HashUpper) : nameof(SoftFallback.HashLower);
|
||||||
|
return context.Call(typeof(SoftFallback).GetMethod(method), x, y, w);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Operand EmitSha256su0(ArmEmitterContext context, Operand x, Operand y)
|
||||||
|
{
|
||||||
|
if (Optimizations.UseSha)
|
||||||
|
{
|
||||||
|
return context.AddIntrinsic(Intrinsic.X86Sha256Msg1, x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
return context.Call(typeof(SoftFallback).GetMethod(nameof(SoftFallback.Sha256SchedulePart1)), x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Operand EmitSha256su1(ArmEmitterContext context, Operand x, Operand y, Operand z)
|
||||||
|
{
|
||||||
|
if (Optimizations.UseSha && Optimizations.UseSsse3)
|
||||||
|
{
|
||||||
|
Operand extr = context.AddIntrinsic(Intrinsic.X86Palignr, z, y, Const(4));
|
||||||
|
Operand tmp = context.AddIntrinsic(Intrinsic.X86Paddd, extr, x);
|
||||||
|
|
||||||
|
Operand res = context.AddIntrinsic(Intrinsic.X86Sha256Msg2, tmp, z);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
return context.Call(typeof(SoftFallback).GetMethod(nameof(SoftFallback.Sha256SchedulePart2)), x, y, z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -2,8 +2,6 @@ using ARMeilleure.Memory;
|
|||||||
using ARMeilleure.State;
|
using ARMeilleure.State;
|
||||||
using ARMeilleure.Translation;
|
using ARMeilleure.Translation;
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
namespace ARMeilleure.Instructions
|
namespace ARMeilleure.Instructions
|
||||||
{
|
{
|
||||||
|
@ -1129,7 +1129,7 @@ namespace ARMeilleure.Instructions
|
|||||||
return Sha256Hash(hash_abcd, hash_efgh, wk, part1: true);
|
return Sha256Hash(hash_abcd, hash_efgh, wk, part1: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static V128 HashUpper(V128 hash_efgh, V128 hash_abcd, V128 wk)
|
public static V128 HashUpper(V128 hash_abcd, V128 hash_efgh, V128 wk)
|
||||||
{
|
{
|
||||||
return Sha256Hash(hash_abcd, hash_efgh, wk, part1: false);
|
return Sha256Hash(hash_abcd, hash_efgh, wk, part1: false);
|
||||||
}
|
}
|
||||||
|
@ -71,6 +71,7 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||||||
X86Paddd,
|
X86Paddd,
|
||||||
X86Paddq,
|
X86Paddq,
|
||||||
X86Paddw,
|
X86Paddw,
|
||||||
|
X86Palignr,
|
||||||
X86Pand,
|
X86Pand,
|
||||||
X86Pandn,
|
X86Pandn,
|
||||||
X86Pavgb,
|
X86Pavgb,
|
||||||
@ -140,6 +141,9 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||||||
X86Roundss,
|
X86Roundss,
|
||||||
X86Rsqrtps,
|
X86Rsqrtps,
|
||||||
X86Rsqrtss,
|
X86Rsqrtss,
|
||||||
|
X86Sha256Msg1,
|
||||||
|
X86Sha256Msg2,
|
||||||
|
X86Sha256Rnds2,
|
||||||
X86Shufpd,
|
X86Shufpd,
|
||||||
X86Shufps,
|
X86Shufps,
|
||||||
X86Sqrtpd,
|
X86Sqrtpd,
|
||||||
|
@ -21,6 +21,7 @@ namespace ARMeilleure
|
|||||||
public static bool UseFmaIfAvailable { get; set; } = true;
|
public static bool UseFmaIfAvailable { get; set; } = true;
|
||||||
public static bool UseAesniIfAvailable { get; set; } = true;
|
public static bool UseAesniIfAvailable { get; set; } = true;
|
||||||
public static bool UsePclmulqdqIfAvailable { get; set; } = true;
|
public static bool UsePclmulqdqIfAvailable { get; set; } = true;
|
||||||
|
public static bool UseShaIfAvailable { get; set; } = true;
|
||||||
|
|
||||||
public static bool ForceLegacySse
|
public static bool ForceLegacySse
|
||||||
{
|
{
|
||||||
@ -40,5 +41,6 @@ namespace ARMeilleure
|
|||||||
internal static bool UseFma => UseFmaIfAvailable && HardwareCapabilities.SupportsFma;
|
internal static bool UseFma => UseFmaIfAvailable && HardwareCapabilities.SupportsFma;
|
||||||
internal static bool UseAesni => UseAesniIfAvailable && HardwareCapabilities.SupportsAesni;
|
internal static bool UseAesni => UseAesniIfAvailable && HardwareCapabilities.SupportsAesni;
|
||||||
internal static bool UsePclmulqdq => UsePclmulqdqIfAvailable && HardwareCapabilities.SupportsPclmulqdq;
|
internal static bool UsePclmulqdq => UsePclmulqdqIfAvailable && HardwareCapabilities.SupportsPclmulqdq;
|
||||||
|
internal static bool UseSha => UseShaIfAvailable && HardwareCapabilities.SupportsSha;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace ARMeilleure.Signal
|
namespace ARMeilleure.Signal
|
||||||
|
@ -14,7 +14,7 @@ namespace ARMeilleure.Translation
|
|||||||
public BasicBlock Entry { get; }
|
public BasicBlock Entry { get; }
|
||||||
public IntrusiveList<BasicBlock> Blocks { get; }
|
public IntrusiveList<BasicBlock> Blocks { get; }
|
||||||
public BasicBlock[] PostOrderBlocks => _postOrderBlocks;
|
public BasicBlock[] PostOrderBlocks => _postOrderBlocks;
|
||||||
public int[] PostOrderMap => _postOrderMap;
|
public int[] PostOrderMap => _postOrderMap;
|
||||||
|
|
||||||
public ControlFlowGraph(BasicBlock entry, IntrusiveList<BasicBlock> blocks, int localsCount)
|
public ControlFlowGraph(BasicBlock entry, IntrusiveList<BasicBlock> blocks, int localsCount)
|
||||||
{
|
{
|
||||||
|
@ -344,7 +344,7 @@ namespace ARMeilleure.Translation
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Removes the value from the dictionary after searching for it with <paramref name="key">.
|
/// Removes the value from the dictionary after searching for it with <paramref name="key"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="key">Key to search for</param>
|
/// <param name="key">Key to search for</param>
|
||||||
/// <returns>Number of deleted values</returns>
|
/// <returns>Number of deleted values</returns>
|
||||||
|
@ -27,7 +27,7 @@ namespace ARMeilleure.Translation.PTC
|
|||||||
private const string OuterHeaderMagicString = "PTCohd\0\0";
|
private const string OuterHeaderMagicString = "PTCohd\0\0";
|
||||||
private const string InnerHeaderMagicString = "PTCihd\0\0";
|
private const string InnerHeaderMagicString = "PTCihd\0\0";
|
||||||
|
|
||||||
private const uint InternalVersion = 3439; //! To be incremented manually for each change to the ARMeilleure project.
|
private const uint InternalVersion = 3585; //! To be incremented manually for each change to the ARMeilleure project.
|
||||||
|
|
||||||
private const string ActualDir = "0";
|
private const string ActualDir = "0";
|
||||||
private const string BackupDir = "1";
|
private const string BackupDir = "1";
|
||||||
@ -946,9 +946,12 @@ namespace ARMeilleure.Translation.PTC
|
|||||||
return BitConverter.IsLittleEndian;
|
return BitConverter.IsLittleEndian;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ulong GetFeatureInfo()
|
private static FeatureInfo GetFeatureInfo()
|
||||||
{
|
{
|
||||||
return (ulong)HardwareCapabilities.FeatureInfoEdx << 32 | (uint)HardwareCapabilities.FeatureInfoEcx;
|
return new FeatureInfo(
|
||||||
|
(uint)HardwareCapabilities.FeatureInfo1Ecx,
|
||||||
|
(uint)HardwareCapabilities.FeatureInfo1Edx,
|
||||||
|
(uint)HardwareCapabilities.FeatureInfo7Ebx);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static byte GetMemoryManagerMode()
|
private static byte GetMemoryManagerMode()
|
||||||
@ -968,7 +971,7 @@ namespace ARMeilleure.Translation.PTC
|
|||||||
return osPlatform;
|
return osPlatform;
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 1/*, Size = 50*/)]
|
[StructLayout(LayoutKind.Sequential, Pack = 1/*, Size = 54*/)]
|
||||||
private struct OuterHeader
|
private struct OuterHeader
|
||||||
{
|
{
|
||||||
public ulong Magic;
|
public ulong Magic;
|
||||||
@ -976,7 +979,7 @@ namespace ARMeilleure.Translation.PTC
|
|||||||
public uint CacheFileVersion;
|
public uint CacheFileVersion;
|
||||||
|
|
||||||
public bool Endianness;
|
public bool Endianness;
|
||||||
public ulong FeatureInfo;
|
public FeatureInfo FeatureInfo;
|
||||||
public byte MemoryManagerMode;
|
public byte MemoryManagerMode;
|
||||||
public uint OSPlatform;
|
public uint OSPlatform;
|
||||||
|
|
||||||
@ -999,6 +1002,9 @@ namespace ARMeilleure.Translation.PTC
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential, Pack = 1/*, Size = 12*/)]
|
||||||
|
private record struct FeatureInfo(uint FeatureInfo0, uint FeatureInfo1, uint FeatureInfo2);
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 1/*, Size = 128*/)]
|
[StructLayout(LayoutKind.Sequential, Pack = 1/*, Size = 128*/)]
|
||||||
private struct InnerHeader
|
private struct InnerHeader
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,6 @@ using Ryujinx.Memory;
|
|||||||
using Ryujinx.SDL2.Common;
|
using Ryujinx.SDL2.Common;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
using static Ryujinx.Audio.Integration.IHardwareDeviceDriver;
|
using static Ryujinx.Audio.Integration.IHardwareDeviceDriver;
|
||||||
|
@ -4,7 +4,6 @@ using Ryujinx.Common.Logging;
|
|||||||
using Ryujinx.Memory;
|
using Ryujinx.Memory;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
using static SDL2.SDL;
|
using static SDL2.SDL;
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using System;
|
namespace SoundIOSharp
|
||||||
namespace SoundIOSharp
|
|
||||||
{
|
{
|
||||||
public struct SoundIOSampleRateRange
|
public struct SoundIOSampleRateRange
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
using Ryujinx.Audio.Renderer.Dsp.State;
|
using Ryujinx.Audio.Renderer.Dsp.State;
|
||||||
using Ryujinx.Audio.Renderer.Parameter;
|
using Ryujinx.Audio.Renderer.Parameter;
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
|
|
||||||
namespace Ryujinx.Audio.Renderer.Dsp.Command
|
namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using Ryujinx.Audio.Renderer.Dsp.State;
|
using Ryujinx.Audio.Renderer.Dsp.State;
|
||||||
using Ryujinx.Audio.Renderer.Parameter;
|
|
||||||
using Ryujinx.Memory;
|
using Ryujinx.Memory;
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using Ryujinx.Audio.Renderer.Parameter.Sink;
|
using Ryujinx.Audio.Renderer.Parameter.Sink;
|
||||||
using Ryujinx.Audio.Renderer.Server.MemoryPool;
|
using Ryujinx.Audio.Renderer.Server.MemoryPool;
|
||||||
using System;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
|
||||||
namespace Ryujinx.Audio.Renderer.Dsp.Command
|
namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||||
|
@ -6,7 +6,6 @@ using Ryujinx.Memory;
|
|||||||
using System;
|
using System;
|
||||||
using System.Buffers;
|
using System.Buffers;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
namespace Ryujinx.Audio.Renderer.Dsp.Command
|
namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
namespace Ryujinx.Audio.Renderer.Dsp.Command
|
namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||||
{
|
{
|
||||||
public class CopyMixBufferCommand : ICommand
|
public class CopyMixBufferCommand : ICommand
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
namespace Ryujinx.Audio.Renderer.Dsp.Command
|
namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||||
|
@ -2,7 +2,6 @@ using Ryujinx.Audio.Renderer.Dsp.State;
|
|||||||
using Ryujinx.Audio.Renderer.Parameter.Effect;
|
using Ryujinx.Audio.Renderer.Parameter.Effect;
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
|
|
||||||
namespace Ryujinx.Audio.Renderer.Dsp.Command
|
namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,6 @@ using Ryujinx.Audio.Renderer.Parameter;
|
|||||||
using Ryujinx.Audio.Renderer.Parameter.Effect;
|
using Ryujinx.Audio.Renderer.Parameter.Effect;
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Ryujinx.Audio.Renderer.Dsp.Command
|
namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using Ryujinx.Audio.Renderer.Server.Upsampler;
|
using Ryujinx.Audio.Renderer.Server.Upsampler;
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
|
|
||||||
namespace Ryujinx.Audio.Renderer.Dsp.Command
|
namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||||
{
|
{
|
||||||
|
@ -76,7 +76,7 @@ namespace Ryujinx.Audio.Renderer.Dsp
|
|||||||
|
|
||||||
if (!info.DecodingBehaviour.HasFlag(DecodingBehaviour.SkipPitchAndSampleRateConversion))
|
if (!info.DecodingBehaviour.HasFlag(DecodingBehaviour.SkipPitchAndSampleRateConversion))
|
||||||
{
|
{
|
||||||
voiceState.Pitch.ToSpan().Slice(0, pitchMaxLength).CopyTo(tempBuffer);
|
voiceState.Pitch.AsSpan().Slice(0, pitchMaxLength).CopyTo(tempBuffer);
|
||||||
tempBufferIndex += pitchMaxLength;
|
tempBufferIndex += pitchMaxLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -239,7 +239,7 @@ namespace Ryujinx.Audio.Renderer.Dsp
|
|||||||
|
|
||||||
ResamplerHelper.Resample(outputBuffer, tempBuffer, sampleRateRatio, ref fraction, sampleCountToProcess, info.SrcQuality, y != sourceSampleCountToProcess || info.Pitch != 1.0f);
|
ResamplerHelper.Resample(outputBuffer, tempBuffer, sampleRateRatio, ref fraction, sampleCountToProcess, info.SrcQuality, y != sourceSampleCountToProcess || info.Pitch != 1.0f);
|
||||||
|
|
||||||
tempBuffer.Slice(sampleCountToDecode, pitchMaxLength).CopyTo(voiceState.Pitch.ToSpan());
|
tempBuffer.Slice(sampleCountToDecode, pitchMaxLength).CopyTo(voiceState.Pitch.AsSpan());
|
||||||
}
|
}
|
||||||
|
|
||||||
i += sampleCountToProcess;
|
i += sampleCountToProcess;
|
||||||
|
@ -24,8 +24,8 @@ namespace Ryujinx.Audio.Renderer.Parameter.Effect
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void Reset()
|
public void Reset()
|
||||||
{
|
{
|
||||||
InputMax.ToSpan().Fill(0.0f);
|
InputMax.AsSpan().Fill(0.0f);
|
||||||
CompressionGainMin.ToSpan().Fill(1.0f);
|
CompressionGainMin.AsSpan().Fill(1.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -7,7 +7,6 @@ using Ryujinx.Audio.Renderer.Server.Performance;
|
|||||||
using Ryujinx.Audio.Renderer.Server.Sink;
|
using Ryujinx.Audio.Renderer.Server.Sink;
|
||||||
using Ryujinx.Audio.Renderer.Server.Upsampler;
|
using Ryujinx.Audio.Renderer.Server.Upsampler;
|
||||||
using Ryujinx.Audio.Renderer.Server.Voice;
|
using Ryujinx.Audio.Renderer.Server.Voice;
|
||||||
using Ryujinx.Common.Memory;
|
|
||||||
using System;
|
using System;
|
||||||
using CpuAddress = System.UInt64;
|
using CpuAddress = System.UInt64;
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
Memory<byte> biquadStateRawMemory = SpanMemoryManager<byte>.Cast(state).Slice(VoiceUpdateState.BiquadStateOffset, VoiceUpdateState.BiquadStateSize * Constants.VoiceBiquadFilterCount);
|
Memory<byte> biquadStateRawMemory = SpanMemoryManager<byte>.Cast(state).Slice(VoiceUpdateState.BiquadStateOffset, VoiceUpdateState.BiquadStateSize * Constants.VoiceBiquadFilterCount);
|
||||||
Memory<BiquadFilterState> stateMemory = SpanMemoryManager<BiquadFilterState>.Cast(biquadStateRawMemory);
|
Memory<BiquadFilterState> stateMemory = SpanMemoryManager<BiquadFilterState>.Cast(biquadStateRawMemory);
|
||||||
|
|
||||||
_commandBuffer.GenerateGroupedBiquadFilter(baseIndex, voiceState.BiquadFilters.ToSpan(), stateMemory, bufferOffset, bufferOffset, voiceState.BiquadFilterNeedInitialization, nodeId);
|
_commandBuffer.GenerateGroupedBiquadFilter(baseIndex, voiceState.BiquadFilters.AsSpan(), stateMemory, bufferOffset, bufferOffset, voiceState.BiquadFilterNeedInitialization, nodeId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -337,8 +337,8 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
GeneratePerformance(ref performanceEntry, PerformanceCommand.Type.Start, nodeId);
|
GeneratePerformance(ref performanceEntry, PerformanceCommand.Type.Start, nodeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
GenerateVoiceMix(channelResource.Mix.ToSpan(),
|
GenerateVoiceMix(channelResource.Mix.AsSpan(),
|
||||||
channelResource.PreviousMix.ToSpan(),
|
channelResource.PreviousMix.AsSpan(),
|
||||||
dspStateMemory,
|
dspStateMemory,
|
||||||
mix.BufferOffset,
|
mix.BufferOffset,
|
||||||
mix.BufferCount,
|
mix.BufferCount,
|
||||||
@ -505,8 +505,8 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
BiquadFilterParameter parameter = new BiquadFilterParameter();
|
BiquadFilterParameter parameter = new BiquadFilterParameter();
|
||||||
|
|
||||||
parameter.Enable = true;
|
parameter.Enable = true;
|
||||||
effect.Parameter.Denominator.ToSpan().CopyTo(parameter.Denominator.ToSpan());
|
effect.Parameter.Denominator.AsSpan().CopyTo(parameter.Denominator.AsSpan());
|
||||||
effect.Parameter.Numerator.ToSpan().CopyTo(parameter.Numerator.ToSpan());
|
effect.Parameter.Numerator.AsSpan().CopyTo(parameter.Numerator.AsSpan());
|
||||||
|
|
||||||
for (int i = 0; i < effect.Parameter.ChannelCount; i++)
|
for (int i = 0; i < effect.Parameter.ChannelCount; i++)
|
||||||
{
|
{
|
||||||
@ -923,8 +923,8 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
if (useCustomDownMixingCommand)
|
if (useCustomDownMixingCommand)
|
||||||
{
|
{
|
||||||
_commandBuffer.GenerateDownMixSurroundToStereo(finalMix.BufferOffset,
|
_commandBuffer.GenerateDownMixSurroundToStereo(finalMix.BufferOffset,
|
||||||
sink.Parameter.Input.ToSpan(),
|
sink.Parameter.Input.AsSpan(),
|
||||||
sink.Parameter.Input.ToSpan(),
|
sink.Parameter.Input.AsSpan(),
|
||||||
sink.DownMixCoefficients,
|
sink.DownMixCoefficients,
|
||||||
Constants.InvalidNodeId);
|
Constants.InvalidNodeId);
|
||||||
}
|
}
|
||||||
@ -932,8 +932,8 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
else if (_rendererContext.ChannelCount == 2 && sink.Parameter.InputCount == 6)
|
else if (_rendererContext.ChannelCount == 2 && sink.Parameter.InputCount == 6)
|
||||||
{
|
{
|
||||||
_commandBuffer.GenerateDownMixSurroundToStereo(finalMix.BufferOffset,
|
_commandBuffer.GenerateDownMixSurroundToStereo(finalMix.BufferOffset,
|
||||||
sink.Parameter.Input.ToSpan(),
|
sink.Parameter.Input.AsSpan(),
|
||||||
sink.Parameter.Input.ToSpan(),
|
sink.Parameter.Input.AsSpan(),
|
||||||
Constants.DefaultSurroundToStereoCoefficients,
|
Constants.DefaultSurroundToStereoCoefficients,
|
||||||
Constants.InvalidNodeId);
|
Constants.InvalidNodeId);
|
||||||
}
|
}
|
||||||
@ -945,7 +945,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
_commandBuffer.GenerateUpsample(finalMix.BufferOffset,
|
_commandBuffer.GenerateUpsample(finalMix.BufferOffset,
|
||||||
sink.UpsamplerState,
|
sink.UpsamplerState,
|
||||||
sink.Parameter.InputCount,
|
sink.Parameter.InputCount,
|
||||||
sink.Parameter.Input.ToSpan(),
|
sink.Parameter.Input.AsSpan(),
|
||||||
commandList.BufferCount,
|
commandList.BufferCount,
|
||||||
commandList.SampleCount,
|
commandList.SampleCount,
|
||||||
commandList.SampleRate,
|
commandList.SampleRate,
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
using Ryujinx.Audio.Common;
|
|
||||||
using Ryujinx.Audio.Renderer.Dsp.Command;
|
using Ryujinx.Audio.Renderer.Dsp.Command;
|
||||||
using Ryujinx.Audio.Renderer.Parameter.Effect;
|
|
||||||
using System;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using static Ryujinx.Audio.Renderer.Parameter.VoiceInParameter;
|
|
||||||
|
|
||||||
namespace Ryujinx.Audio.Renderer.Server
|
namespace Ryujinx.Audio.Renderer.Server
|
||||||
{
|
{
|
||||||
|
@ -63,10 +63,10 @@ namespace Ryujinx.Audio.Renderer.Server.Sink
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
Parameter.DownMixParameterEnabled = inputDeviceParameter.DownMixParameterEnabled;
|
Parameter.DownMixParameterEnabled = inputDeviceParameter.DownMixParameterEnabled;
|
||||||
inputDeviceParameter.DownMixParameter.ToSpan().CopyTo(Parameter.DownMixParameter.ToSpan());
|
inputDeviceParameter.DownMixParameter.AsSpan().CopyTo(Parameter.DownMixParameter.AsSpan());
|
||||||
}
|
}
|
||||||
|
|
||||||
Parameter.DownMixParameter.ToSpan().CopyTo(DownMixCoefficients.AsSpan());
|
Parameter.DownMixParameter.AsSpan().CopyTo(DownMixCoefficients.AsSpan());
|
||||||
|
|
||||||
errorInfo = new BehaviourParameter.ErrorInfo();
|
errorInfo = new BehaviourParameter.ErrorInfo();
|
||||||
outStatus = new SinkOutStatus();
|
outStatus = new SinkOutStatus();
|
||||||
|
@ -119,7 +119,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
ref VoiceChannelResource resource = ref context.GetChannelResource(i);
|
ref VoiceChannelResource resource = ref context.GetChannelResource(i);
|
||||||
|
|
||||||
resource.Id = parameter.Id;
|
resource.Id = parameter.Id;
|
||||||
parameter.Mix.ToSpan().CopyTo(resource.Mix.ToSpan());
|
parameter.Mix.AsSpan().CopyTo(resource.Mix.AsSpan());
|
||||||
resource.IsUsed = parameter.IsUsed;
|
resource.IsUsed = parameter.IsUsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -587,7 +587,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
{
|
{
|
||||||
ref BehaviourErrorInfoOutStatus outStatus = ref SpanIOHelper.GetWriteRef<BehaviourErrorInfoOutStatus>(ref _output)[0];
|
ref BehaviourErrorInfoOutStatus outStatus = ref SpanIOHelper.GetWriteRef<BehaviourErrorInfoOutStatus>(ref _output)[0];
|
||||||
|
|
||||||
_behaviourContext.CopyErrorInfo(outStatus.ErrorInfos.ToSpan(), out outStatus.ErrorInfosCount);
|
_behaviourContext.CopyErrorInfo(outStatus.ErrorInfos.AsSpan(), out outStatus.ErrorInfosCount);
|
||||||
|
|
||||||
OutputHeader.BehaviourSize = (uint)Unsafe.SizeOf<BehaviourErrorInfoOutStatus>();
|
OutputHeader.BehaviourSize = (uint)Unsafe.SizeOf<BehaviourErrorInfoOutStatus>();
|
||||||
OutputHeader.TotalSize += OutputHeader.BehaviourSize;
|
OutputHeader.TotalSize += OutputHeader.BehaviourSize;
|
||||||
|
@ -34,7 +34,7 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
|
|||||||
|
|
||||||
public void UpdateState()
|
public void UpdateState()
|
||||||
{
|
{
|
||||||
Mix.ToSpan().CopyTo(PreviousMix.ToSpan());
|
Mix.AsSpan().CopyTo(PreviousMix.AsSpan());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -202,7 +202,7 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
|
|||||||
Pitch = 0.0f;
|
Pitch = 0.0f;
|
||||||
Volume = 0.0f;
|
Volume = 0.0f;
|
||||||
PreviousVolume = 0.0f;
|
PreviousVolume = 0.0f;
|
||||||
BiquadFilters.ToSpan().Fill(new BiquadFilterParameter());
|
BiquadFilters.AsSpan().Fill(new BiquadFilterParameter());
|
||||||
WaveBuffersCount = 0;
|
WaveBuffersCount = 0;
|
||||||
WaveBuffersIndex = 0;
|
WaveBuffersIndex = 0;
|
||||||
MixId = Constants.UnusedMixId;
|
MixId = Constants.UnusedMixId;
|
||||||
@ -288,7 +288,7 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
|
|||||||
ChannelsCount = parameter.ChannelCount;
|
ChannelsCount = parameter.ChannelCount;
|
||||||
Pitch = parameter.Pitch;
|
Pitch = parameter.Pitch;
|
||||||
Volume = parameter.Volume;
|
Volume = parameter.Volume;
|
||||||
parameter.BiquadFilters.ToSpan().CopyTo(BiquadFilters.ToSpan());
|
parameter.BiquadFilters.AsSpan().CopyTo(BiquadFilters.AsSpan());
|
||||||
WaveBuffersCount = parameter.WaveBuffersCount;
|
WaveBuffersCount = parameter.WaveBuffersCount;
|
||||||
WaveBuffersIndex = parameter.WaveBuffersIndex;
|
WaveBuffersIndex = parameter.WaveBuffersIndex;
|
||||||
|
|
||||||
@ -308,7 +308,7 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
|
|||||||
SplitterId = Constants.UnusedSplitterId;
|
SplitterId = Constants.UnusedSplitterId;
|
||||||
}
|
}
|
||||||
|
|
||||||
parameter.ChannelResourceIds.ToSpan().CopyTo(ChannelResourceIds.ToSpan());
|
parameter.ChannelResourceIds.AsSpan().CopyTo(ChannelResourceIds.AsSpan());
|
||||||
|
|
||||||
DecodingBehaviour behaviour = DecodingBehaviour.Default;
|
DecodingBehaviour behaviour = DecodingBehaviour.Default;
|
||||||
|
|
||||||
@ -638,7 +638,7 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
|
|||||||
|
|
||||||
voiceUpdateState.Offset = 0;
|
voiceUpdateState.Offset = 0;
|
||||||
voiceUpdateState.PlayedSampleCount = 0;
|
voiceUpdateState.PlayedSampleCount = 0;
|
||||||
voiceUpdateState.Pitch.ToSpan().Fill(0);
|
voiceUpdateState.Pitch.AsSpan().Fill(0);
|
||||||
voiceUpdateState.Fraction = 0;
|
voiceUpdateState.Fraction = 0;
|
||||||
voiceUpdateState.LoopContext = new Dsp.State.AdpcmLoopContext();
|
voiceUpdateState.LoopContext = new Dsp.State.AdpcmLoopContext();
|
||||||
}
|
}
|
||||||
@ -650,7 +650,7 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
|
|||||||
|
|
||||||
case Types.PlayState.Stopped:
|
case Types.PlayState.Stopped:
|
||||||
case Types.PlayState.Paused:
|
case Types.PlayState.Paused:
|
||||||
foreach (ref WaveBuffer wavebuffer in WaveBuffers.ToSpan())
|
foreach (ref WaveBuffer wavebuffer in WaveBuffers.AsSpan())
|
||||||
{
|
{
|
||||||
wavebuffer.BufferAddressInfo.GetReference(true);
|
wavebuffer.BufferAddressInfo.GetReference(true);
|
||||||
wavebuffer.ContextAddressInfo.GetReference(true);
|
wavebuffer.ContextAddressInfo.GetReference(true);
|
||||||
|
@ -12,6 +12,7 @@ using Ryujinx.Audio.Integration;
|
|||||||
using Ryujinx.Ava.Common;
|
using Ryujinx.Ava.Common;
|
||||||
using Ryujinx.Ava.Common.Locale;
|
using Ryujinx.Ava.Common.Locale;
|
||||||
using Ryujinx.Ava.Input;
|
using Ryujinx.Ava.Input;
|
||||||
|
using Ryujinx.Ava.Ui.Backend.Vulkan;
|
||||||
using Ryujinx.Ava.Ui.Controls;
|
using Ryujinx.Ava.Ui.Controls;
|
||||||
using Ryujinx.Ava.Ui.Models;
|
using Ryujinx.Ava.Ui.Models;
|
||||||
using Ryujinx.Ava.Ui.Vulkan;
|
using Ryujinx.Ava.Ui.Vulkan;
|
||||||
@ -334,6 +335,8 @@ namespace Ryujinx.Ava
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AvaloniaLocator.Current.GetService<VulkanPlatformInterface>()?.MainSurface.Display.ChangeVSyncMode(true);
|
||||||
|
|
||||||
_isStopped = true;
|
_isStopped = true;
|
||||||
_isActive = false;
|
_isActive = false;
|
||||||
}
|
}
|
||||||
@ -596,12 +599,13 @@ namespace Ryujinx.Ava
|
|||||||
if (Program.UseVulkan)
|
if (Program.UseVulkan)
|
||||||
{
|
{
|
||||||
var vulkan = AvaloniaLocator.Current.GetService<VulkanPlatformInterface>();
|
var vulkan = AvaloniaLocator.Current.GetService<VulkanPlatformInterface>();
|
||||||
|
|
||||||
renderer = new VulkanRenderer(vulkan.Instance.InternalHandle,
|
renderer = new VulkanRenderer(vulkan.Instance.InternalHandle,
|
||||||
vulkan.Device.InternalHandle,
|
vulkan.MainSurface.Device.InternalHandle,
|
||||||
vulkan.PhysicalDevice.InternalHandle,
|
vulkan.PhysicalDevice.InternalHandle,
|
||||||
vulkan.Device.Queue.InternalHandle,
|
vulkan.MainSurface.Device.Queue.InternalHandle,
|
||||||
vulkan.PhysicalDevice.QueueFamilyIndex,
|
vulkan.PhysicalDevice.QueueFamilyIndex,
|
||||||
vulkan.Device.Lock);
|
vulkan.MainSurface.Device.Lock);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -775,7 +779,10 @@ namespace Ryujinx.Ava
|
|||||||
Width = (int)e.Width;
|
Width = (int)e.Width;
|
||||||
Height = (int)e.Height;
|
Height = (int)e.Height;
|
||||||
|
|
||||||
SetRendererWindowSize(e);
|
if (!Program.UseVulkan)
|
||||||
|
{
|
||||||
|
SetRendererWindowSize(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MainLoop()
|
private void MainLoop()
|
||||||
@ -815,12 +822,11 @@ namespace Ryujinx.Ava
|
|||||||
|
|
||||||
_renderer.ScreenCaptured += Renderer_ScreenCaptured;
|
_renderer.ScreenCaptured += Renderer_ScreenCaptured;
|
||||||
|
|
||||||
if (!Program.UseVulkan)
|
(_renderer as OpenGLRenderer)?.InitializeBackgroundContext(SPBOpenGLContext.CreateBackgroundContext((Renderer as OpenGLRendererControl).GameContext));
|
||||||
{
|
|
||||||
(_renderer as OpenGLRenderer).InitializeBackgroundContext(SPBOpenGLContext.CreateBackgroundContext((Renderer as OpenGLRendererControl).GameContext));
|
|
||||||
|
|
||||||
Renderer.MakeCurrent();
|
Renderer.MakeCurrent();
|
||||||
}
|
|
||||||
|
AvaloniaLocator.Current.GetService<VulkanPlatformInterface>()?.MainSurface?.Display?.ChangeVSyncMode(Device.EnableDeviceVsync);
|
||||||
|
|
||||||
Device.Gpu.Renderer.Initialize(_glLogLevel);
|
Device.Gpu.Renderer.Initialize(_glLogLevel);
|
||||||
|
|
||||||
@ -837,8 +843,6 @@ namespace Ryujinx.Ava
|
|||||||
|
|
||||||
Renderer.Start();
|
Renderer.Start();
|
||||||
|
|
||||||
Renderer.QueueRender();
|
|
||||||
|
|
||||||
while (_isActive)
|
while (_isActive)
|
||||||
{
|
{
|
||||||
if (Device.WaitFifo())
|
if (Device.WaitFifo())
|
||||||
@ -889,6 +893,16 @@ namespace Ryujinx.Ava
|
|||||||
$"FIFO: {Device.Statistics.GetFifoPercent():00.00} %",
|
$"FIFO: {Device.Statistics.GetFifoPercent():00.00} %",
|
||||||
$"GPU: {_renderer.GetHardwareInfo().GpuVendor}"));
|
$"GPU: {_renderer.GetHardwareInfo().GpuVendor}"));
|
||||||
|
|
||||||
|
if (Program.UseVulkan)
|
||||||
|
{
|
||||||
|
var platformInterface = AvaloniaLocator.Current.GetService<VulkanPlatformInterface>();
|
||||||
|
if (platformInterface.MainSurface.Display.IsSurfaceChanged())
|
||||||
|
{
|
||||||
|
SetRendererWindowSize(new Size(Width, Height));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Renderer.Present(image);
|
Renderer.Present(image);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -970,6 +984,9 @@ namespace Ryujinx.Ava
|
|||||||
{
|
{
|
||||||
case KeyboardHotkeyState.ToggleVSync:
|
case KeyboardHotkeyState.ToggleVSync:
|
||||||
Device.EnableDeviceVsync = !Device.EnableDeviceVsync;
|
Device.EnableDeviceVsync = !Device.EnableDeviceVsync;
|
||||||
|
|
||||||
|
AvaloniaLocator.Current.GetService<VulkanPlatformInterface>()?.MainSurface?.Display?.ChangeVSyncMode(Device.EnableDeviceVsync);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case KeyboardHotkeyState.Screenshot:
|
case KeyboardHotkeyState.Screenshot:
|
||||||
ScreenshotRequested = true;
|
ScreenshotRequested = true;
|
||||||
|
@ -52,8 +52,8 @@
|
|||||||
"GameListContextMenuOpenModsDirectory": "Open Mods Directory",
|
"GameListContextMenuOpenModsDirectory": "Open Mods Directory",
|
||||||
"GameListContextMenuOpenModsDirectoryToolTip": "Opens the directory which contains Application's Mods",
|
"GameListContextMenuOpenModsDirectoryToolTip": "Opens the directory which contains Application's Mods",
|
||||||
"GameListContextMenuCacheManagement": "Cache Management",
|
"GameListContextMenuCacheManagement": "Cache Management",
|
||||||
"GameListContextMenuCacheManagementPurgePptc": "Purge PPTC Cache",
|
"GameListContextMenuCacheManagementPurgePptc": "Queue PPTC Rebuild",
|
||||||
"GameListContextMenuCacheManagementPurgePptcToolTip": "Deletes Application's PPTC cache",
|
"GameListContextMenuCacheManagementPurgePptcToolTip": "Trigger PPTC to rebuild at boot time on the next game launch",
|
||||||
"GameListContextMenuCacheManagementPurgeShaderCache": "Purge Shader Cache",
|
"GameListContextMenuCacheManagementPurgeShaderCache": "Purge Shader Cache",
|
||||||
"GameListContextMenuCacheManagementPurgeShaderCacheToolTip": "Deletes Application's shader cache",
|
"GameListContextMenuCacheManagementPurgeShaderCacheToolTip": "Deletes Application's shader cache",
|
||||||
"GameListContextMenuCacheManagementOpenPptcDirectory": "Open PPTC Directory",
|
"GameListContextMenuCacheManagementOpenPptcDirectory": "Open PPTC Directory",
|
||||||
@ -350,7 +350,7 @@
|
|||||||
"DialogProfileDeleteProfileTitle": "Deleting Profile",
|
"DialogProfileDeleteProfileTitle": "Deleting Profile",
|
||||||
"DialogProfileDeleteProfileMessage": "This action is irreversible, are you sure you want to continue?",
|
"DialogProfileDeleteProfileMessage": "This action is irreversible, are you sure you want to continue?",
|
||||||
"DialogWarning": "Warning",
|
"DialogWarning": "Warning",
|
||||||
"DialogPPTCDeletionMessage": "You are about to delete the PPTC cache for :\n\n{0}\n\nAre you sure you want to proceed?",
|
"DialogPPTCDeletionMessage": "You are about to queue a PPTC rebuild on the next boot of:\n\n{0}\n\nAre you sure you want to proceed?",
|
||||||
"DialogPPTCDeletionErrorMessage": "Error purging PPTC cache at {0}: {1}",
|
"DialogPPTCDeletionErrorMessage": "Error purging PPTC cache at {0}: {1}",
|
||||||
"DialogShaderDeletionMessage": "You are about to delete the Shader cache for :\n\n{0}\n\nAre you sure you want to proceed?",
|
"DialogShaderDeletionMessage": "You are about to delete the Shader cache for :\n\n{0}\n\nAre you sure you want to proceed?",
|
||||||
"DialogShaderDeletionErrorMessage": "Error purging Shader cache at {0}: {1}",
|
"DialogShaderDeletionErrorMessage": "Error purging Shader cache at {0}: {1}",
|
||||||
|
@ -24,7 +24,6 @@ using System.Buffers;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using static LibHac.Fs.ApplicationSaveDataManagement;
|
|
||||||
using Path = System.IO.Path;
|
using Path = System.IO.Path;
|
||||||
|
|
||||||
namespace Ryujinx.Ava.Common
|
namespace Ryujinx.Ava.Common
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Input;
|
using Avalonia.Input;
|
||||||
using Avalonia.Threading;
|
|
||||||
using Ryujinx.Input;
|
using Ryujinx.Input;
|
||||||
using System;
|
using System;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
@ -16,8 +16,6 @@ using Ryujinx.Graphics.Vulkan;
|
|||||||
using Ryujinx.Modules;
|
using Ryujinx.Modules;
|
||||||
using Ryujinx.Ui.Common;
|
using Ryujinx.Ui.Common;
|
||||||
using Ryujinx.Ui.Common.Configuration;
|
using Ryujinx.Ui.Common.Configuration;
|
||||||
using Silk.NET.Vulkan.Extensions.EXT;
|
|
||||||
using Silk.NET.Vulkan.Extensions.KHR;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
@ -94,7 +92,6 @@ namespace Ryujinx.Ava
|
|||||||
.With(new Ui.Vulkan.VulkanOptions()
|
.With(new Ui.Vulkan.VulkanOptions()
|
||||||
{
|
{
|
||||||
ApplicationName = "Ryujinx.Graphics.Vulkan",
|
ApplicationName = "Ryujinx.Graphics.Vulkan",
|
||||||
VulkanVersion = new Version(1, 2),
|
|
||||||
MaxQueueCount = 2,
|
MaxQueueCount = 2,
|
||||||
PreferDiscreteGpu = true,
|
PreferDiscreteGpu = true,
|
||||||
PreferredDevice = !PreviewerDetached ? "" : ConfigurationState.Instance.Graphics.PreferredGpu.Value,
|
PreferredDevice = !PreviewerDetached ? "" : ConfigurationState.Instance.Graphics.PreferredGpu.Value,
|
||||||
@ -181,6 +178,18 @@ namespace Ryujinx.Ava
|
|||||||
|
|
||||||
UseVulkan = PreviewerDetached ? ConfigurationState.Instance.Graphics.GraphicsBackend.Value == GraphicsBackend.Vulkan : false;
|
UseVulkan = PreviewerDetached ? ConfigurationState.Instance.Graphics.GraphicsBackend.Value == GraphicsBackend.Vulkan : false;
|
||||||
|
|
||||||
|
if (UseVulkan)
|
||||||
|
{
|
||||||
|
if (VulkanRenderer.GetPhysicalDevices().Length == 0)
|
||||||
|
{
|
||||||
|
UseVulkan = false;
|
||||||
|
|
||||||
|
ConfigurationState.Instance.Graphics.GraphicsBackend.Value = GraphicsBackend.OpenGl;
|
||||||
|
|
||||||
|
Logger.Warning?.PrintMsg(LogClass.Application, "A suitable Vulkan physical device is not available. Falling back to OpenGL");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (UseVulkan)
|
if (UseVulkan)
|
||||||
{
|
{
|
||||||
// With a custom gpu backend, avalonia doesn't enable dpi awareness, so the backend must handle it. This isn't so for the opengl backed,
|
// With a custom gpu backend, avalonia doesn't enable dpi awareness, so the backend must handle it. This isn't so for the opengl backed,
|
||||||
|
@ -10,7 +10,6 @@ using Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.ApplicationPr
|
|||||||
using Ryujinx.HLE.Ui;
|
using Ryujinx.HLE.Ui;
|
||||||
using System;
|
using System;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Ryujinx.Ava.Ui.Applet
|
namespace Ryujinx.Ava.Ui.Applet
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
using Avalonia.Markup.Xaml;
|
|
||||||
using Avalonia.Threading;
|
using Avalonia.Threading;
|
||||||
using Ryujinx.Ava.Common.Locale;
|
using Ryujinx.Ava.Common.Locale;
|
||||||
using Ryujinx.Ava.Ui.Windows;
|
using Ryujinx.Ava.Ui.Windows;
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Input;
|
using Avalonia.Input;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
using Avalonia.Markup.Xaml;
|
|
||||||
using Avalonia.Media;
|
using Avalonia.Media;
|
||||||
using FluentAvalonia.Core;
|
using FluentAvalonia.Core;
|
||||||
using FluentAvalonia.UI.Controls;
|
using FluentAvalonia.UI.Controls;
|
||||||
|
@ -7,7 +7,8 @@ namespace Ryujinx.Ava.Ui.Vulkan
|
|||||||
{
|
{
|
||||||
public static void ThrowOnError(this Result result)
|
public static void ThrowOnError(this Result result)
|
||||||
{
|
{
|
||||||
if (result != Result.Success)
|
// Only negative result codes are errors.
|
||||||
|
if ((int)result < (int)Result.Success)
|
||||||
{
|
{
|
||||||
throw new Exception($"Unexpected API error \"{result}\".");
|
throw new Exception($"Unexpected API error \"{result}\".");
|
||||||
}
|
}
|
||||||
|
@ -1,26 +1,90 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using Avalonia;
|
||||||
using Avalonia.Skia;
|
using Avalonia.Skia;
|
||||||
using Ryujinx.Ava.Ui.Vulkan;
|
using Ryujinx.Ava.Ui.Vulkan;
|
||||||
using Ryujinx.Ava.Ui.Vulkan.Surfaces;
|
using Ryujinx.Ava.Ui.Vulkan.Surfaces;
|
||||||
|
using Silk.NET.Vulkan;
|
||||||
using SkiaSharp;
|
using SkiaSharp;
|
||||||
|
|
||||||
namespace Ryujinx.Ava.Ui.Backend.Vulkan
|
namespace Ryujinx.Ava.Ui.Backend.Vulkan
|
||||||
{
|
{
|
||||||
internal class VulkanRenderTarget : ISkiaGpuRenderTarget
|
internal class VulkanRenderTarget : ISkiaGpuRenderTarget
|
||||||
{
|
{
|
||||||
public GRContext GrContext { get; set; }
|
public GRContext GrContext { get; private set; }
|
||||||
|
|
||||||
private readonly VulkanSurfaceRenderTarget _surface;
|
private readonly VulkanSurfaceRenderTarget _surface;
|
||||||
|
private readonly VulkanPlatformInterface _vulkanPlatformInterface;
|
||||||
private readonly IVulkanPlatformSurface _vulkanPlatformSurface;
|
private readonly IVulkanPlatformSurface _vulkanPlatformSurface;
|
||||||
|
private GRVkBackendContext _grVkBackend;
|
||||||
|
|
||||||
public VulkanRenderTarget(VulkanPlatformInterface vulkanPlatformInterface, IVulkanPlatformSurface vulkanPlatformSurface)
|
public VulkanRenderTarget(VulkanPlatformInterface vulkanPlatformInterface, IVulkanPlatformSurface vulkanPlatformSurface)
|
||||||
{
|
{
|
||||||
_surface = vulkanPlatformInterface.CreateRenderTarget(vulkanPlatformSurface);
|
_surface = vulkanPlatformInterface.CreateRenderTarget(vulkanPlatformSurface);
|
||||||
|
_vulkanPlatformInterface = vulkanPlatformInterface;
|
||||||
_vulkanPlatformSurface = vulkanPlatformSurface;
|
_vulkanPlatformSurface = vulkanPlatformSurface;
|
||||||
|
|
||||||
|
Initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Initialize()
|
||||||
|
{
|
||||||
|
GRVkGetProcedureAddressDelegate getProc = GetVulkanProcAddress;
|
||||||
|
|
||||||
|
_grVkBackend = new GRVkBackendContext()
|
||||||
|
{
|
||||||
|
VkInstance = _surface.Device.Handle,
|
||||||
|
VkPhysicalDevice = _vulkanPlatformInterface.PhysicalDevice.Handle,
|
||||||
|
VkDevice = _surface.Device.Handle,
|
||||||
|
VkQueue = _surface.Device.Queue.Handle,
|
||||||
|
GraphicsQueueIndex = _vulkanPlatformInterface.PhysicalDevice.QueueFamilyIndex,
|
||||||
|
GetProcedureAddress = getProc
|
||||||
|
};
|
||||||
|
|
||||||
|
GrContext = GRContext.CreateVulkan(_grVkBackend);
|
||||||
|
|
||||||
|
var gpu = AvaloniaLocator.Current.GetService<VulkanSkiaGpu>();
|
||||||
|
|
||||||
|
if (gpu.MaxResourceBytes.HasValue)
|
||||||
|
{
|
||||||
|
GrContext.SetResourceCacheLimit(gpu.MaxResourceBytes.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private IntPtr GetVulkanProcAddress(string name, IntPtr instanceHandle, IntPtr deviceHandle)
|
||||||
|
{
|
||||||
|
IntPtr addr;
|
||||||
|
|
||||||
|
if (deviceHandle != IntPtr.Zero)
|
||||||
|
{
|
||||||
|
addr = _vulkanPlatformInterface.Api.GetDeviceProcAddr(new Device(deviceHandle), name);
|
||||||
|
|
||||||
|
if (addr != IntPtr.Zero)
|
||||||
|
{
|
||||||
|
return addr;
|
||||||
|
}
|
||||||
|
|
||||||
|
addr = _vulkanPlatformInterface.Api.GetDeviceProcAddr(new Device(_surface.Device.Handle), name);
|
||||||
|
|
||||||
|
if (addr != IntPtr.Zero)
|
||||||
|
{
|
||||||
|
return addr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
addr = _vulkanPlatformInterface.Api.GetInstanceProcAddr(new Instance(_vulkanPlatformInterface.Instance.Handle), name);
|
||||||
|
|
||||||
|
if (addr == IntPtr.Zero)
|
||||||
|
{
|
||||||
|
addr = _vulkanPlatformInterface.Api.GetInstanceProcAddr(new Instance(instanceHandle), name);
|
||||||
|
}
|
||||||
|
|
||||||
|
return addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
|
_grVkBackend.Dispose();
|
||||||
|
GrContext.Dispose();
|
||||||
_surface.Dispose();
|
_surface.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,20 +109,22 @@ namespace Ryujinx.Ava.Ui.Backend.Vulkan
|
|||||||
{
|
{
|
||||||
GrContext.ResetContext();
|
GrContext.ResetContext();
|
||||||
|
|
||||||
|
var image = _surface.GetImage();
|
||||||
|
|
||||||
var imageInfo = new GRVkImageInfo()
|
var imageInfo = new GRVkImageInfo()
|
||||||
{
|
{
|
||||||
CurrentQueueFamily = disp.QueueFamilyIndex,
|
CurrentQueueFamily = disp.QueueFamilyIndex,
|
||||||
Format = _surface.ImageFormat,
|
Format = (uint)image.Format,
|
||||||
Image = _surface.Image.Handle,
|
Image = image.Handle,
|
||||||
ImageLayout = (uint)_surface.Image.CurrentLayout,
|
ImageLayout = (uint)image.CurrentLayout,
|
||||||
ImageTiling = (uint)_surface.Image.Tiling,
|
ImageTiling = (uint)image.Tiling,
|
||||||
ImageUsageFlags = _surface.UsageFlags,
|
ImageUsageFlags = _surface.UsageFlags,
|
||||||
LevelCount = _surface.MipLevels,
|
LevelCount = _surface.MipLevels,
|
||||||
SampleCount = 1,
|
SampleCount = 1,
|
||||||
Protected = false,
|
Protected = false,
|
||||||
Alloc = new GRVkAlloc()
|
Alloc = new GRVkAlloc()
|
||||||
{
|
{
|
||||||
Memory = _surface.Image.MemoryHandle,
|
Memory = image.MemoryHandle,
|
||||||
Flags = 0,
|
Flags = 0,
|
||||||
Offset = 0,
|
Offset = 0,
|
||||||
Size = _surface.MemorySize
|
Size = _surface.MemorySize
|
||||||
|
@ -13,71 +13,12 @@ namespace Ryujinx.Ava.Ui.Backend.Vulkan
|
|||||||
public class VulkanSkiaGpu : ISkiaGpu
|
public class VulkanSkiaGpu : ISkiaGpu
|
||||||
{
|
{
|
||||||
private readonly VulkanPlatformInterface _vulkan;
|
private readonly VulkanPlatformInterface _vulkan;
|
||||||
private readonly long? _maxResourceBytes;
|
public long? MaxResourceBytes { get; }
|
||||||
private GRVkBackendContext _grVkBackend;
|
|
||||||
private bool _initialized;
|
|
||||||
|
|
||||||
public GRContext GrContext { get; private set; }
|
|
||||||
|
|
||||||
public VulkanSkiaGpu(long? maxResourceBytes)
|
public VulkanSkiaGpu(long? maxResourceBytes)
|
||||||
{
|
{
|
||||||
_vulkan = AvaloniaLocator.Current.GetService<VulkanPlatformInterface>();
|
_vulkan = AvaloniaLocator.Current.GetService<VulkanPlatformInterface>();
|
||||||
_maxResourceBytes = maxResourceBytes;
|
MaxResourceBytes = maxResourceBytes;
|
||||||
}
|
|
||||||
|
|
||||||
private void Initialize()
|
|
||||||
{
|
|
||||||
if (_initialized)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_initialized = true;
|
|
||||||
GRVkGetProcedureAddressDelegate getProc = (string name, IntPtr instanceHandle, IntPtr deviceHandle) =>
|
|
||||||
{
|
|
||||||
IntPtr addr = IntPtr.Zero;
|
|
||||||
|
|
||||||
if (deviceHandle != IntPtr.Zero)
|
|
||||||
{
|
|
||||||
addr = _vulkan.Device.Api.GetDeviceProcAddr(new Device(deviceHandle), name);
|
|
||||||
|
|
||||||
if (addr != IntPtr.Zero)
|
|
||||||
{
|
|
||||||
return addr;
|
|
||||||
}
|
|
||||||
|
|
||||||
addr = _vulkan.Device.Api.GetDeviceProcAddr(new Device(_vulkan.Device.Handle), name);
|
|
||||||
|
|
||||||
if (addr != IntPtr.Zero)
|
|
||||||
{
|
|
||||||
return addr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
addr = _vulkan.Device.Api.GetInstanceProcAddr(new Instance(_vulkan.Instance.Handle), name);
|
|
||||||
|
|
||||||
if (addr == IntPtr.Zero)
|
|
||||||
{
|
|
||||||
addr = _vulkan.Device.Api.GetInstanceProcAddr(new Instance(instanceHandle), name);
|
|
||||||
}
|
|
||||||
|
|
||||||
return addr;
|
|
||||||
};
|
|
||||||
|
|
||||||
_grVkBackend = new GRVkBackendContext()
|
|
||||||
{
|
|
||||||
VkInstance = _vulkan.Device.Handle,
|
|
||||||
VkPhysicalDevice = _vulkan.PhysicalDevice.Handle,
|
|
||||||
VkDevice = _vulkan.Device.Handle,
|
|
||||||
VkQueue = _vulkan.Device.Queue.Handle,
|
|
||||||
GraphicsQueueIndex = _vulkan.PhysicalDevice.QueueFamilyIndex,
|
|
||||||
GetProcedureAddress = getProc
|
|
||||||
};
|
|
||||||
GrContext = GRContext.CreateVulkan(_grVkBackend);
|
|
||||||
if (_maxResourceBytes.HasValue)
|
|
||||||
{
|
|
||||||
GrContext.SetResourceCacheLimit(_maxResourceBytes.Value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ISkiaGpuRenderTarget TryCreateRenderTarget(IEnumerable<object> surfaces)
|
public ISkiaGpuRenderTarget TryCreateRenderTarget(IEnumerable<object> surfaces)
|
||||||
@ -106,10 +47,6 @@ namespace Ryujinx.Ava.Ui.Backend.Vulkan
|
|||||||
|
|
||||||
VulkanRenderTarget vulkanRenderTarget = new VulkanRenderTarget(_vulkan, window);
|
VulkanRenderTarget vulkanRenderTarget = new VulkanRenderTarget(_vulkan, window);
|
||||||
|
|
||||||
Initialize();
|
|
||||||
|
|
||||||
vulkanRenderTarget.GrContext = GrContext;
|
|
||||||
|
|
||||||
return vulkanRenderTarget;
|
return vulkanRenderTarget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using Avalonia;
|
using Avalonia;
|
||||||
|
using Ryujinx.Graphics.Vulkan;
|
||||||
using Silk.NET.Vulkan;
|
using Silk.NET.Vulkan;
|
||||||
|
|
||||||
namespace Ryujinx.Ava.Ui.Vulkan.Surfaces
|
namespace Ryujinx.Ava.Ui.Vulkan.Surfaces
|
||||||
@ -7,24 +8,35 @@ namespace Ryujinx.Ava.Ui.Vulkan.Surfaces
|
|||||||
internal class VulkanSurfaceRenderTarget : IDisposable
|
internal class VulkanSurfaceRenderTarget : IDisposable
|
||||||
{
|
{
|
||||||
private readonly VulkanPlatformInterface _platformInterface;
|
private readonly VulkanPlatformInterface _platformInterface;
|
||||||
|
|
||||||
private readonly Format _format;
|
private readonly Format _format;
|
||||||
|
|
||||||
public VulkanImage Image { get; private set; }
|
private VulkanCommandBufferPool.VulkanCommandBuffer _commandBuffer;
|
||||||
public bool IsCorrupted { get; private set; } = true;
|
private VulkanImage Image { get; set; }
|
||||||
|
private object _lock = new object();
|
||||||
|
|
||||||
public uint MipLevels => Image.MipLevels;
|
public uint MipLevels => Image.MipLevels;
|
||||||
|
public VulkanDevice Device { get; }
|
||||||
|
|
||||||
public VulkanSurfaceRenderTarget(VulkanPlatformInterface platformInterface, VulkanSurface surface)
|
public VulkanSurfaceRenderTarget(VulkanPlatformInterface platformInterface, VulkanSurface surface)
|
||||||
{
|
{
|
||||||
_platformInterface = platformInterface;
|
_platformInterface = platformInterface;
|
||||||
|
|
||||||
Display = VulkanDisplay.CreateDisplay(platformInterface.Instance, platformInterface.Device,
|
var device = VulkanInitialization.CreateDevice(platformInterface.Api,
|
||||||
platformInterface.PhysicalDevice, surface);
|
platformInterface.PhysicalDevice.InternalHandle,
|
||||||
|
platformInterface.PhysicalDevice.QueueFamilyIndex,
|
||||||
|
VulkanInitialization.GetSupportedExtensions(platformInterface.Api, platformInterface.PhysicalDevice.InternalHandle),
|
||||||
|
platformInterface.PhysicalDevice.QueueCount);
|
||||||
|
|
||||||
|
Device = new VulkanDevice(device, platformInterface.PhysicalDevice, platformInterface.Api);
|
||||||
|
|
||||||
|
Display = VulkanDisplay.CreateDisplay(
|
||||||
|
platformInterface.Instance,
|
||||||
|
Device,
|
||||||
|
platformInterface.PhysicalDevice,
|
||||||
|
surface);
|
||||||
Surface = surface;
|
Surface = surface;
|
||||||
|
|
||||||
// Skia seems to only create surfaces from images with unorm format
|
// Skia seems to only create surfaces from images with unorm format
|
||||||
|
|
||||||
IsRgba = Display.SurfaceFormat.Format >= Format.R8G8B8A8Unorm &&
|
IsRgba = Display.SurfaceFormat.Format >= Format.R8G8B8A8Unorm &&
|
||||||
Display.SurfaceFormat.Format <= Format.R8G8B8A8Srgb;
|
Display.SurfaceFormat.Format <= Format.R8G8B8A8Srgb;
|
||||||
|
|
||||||
@ -33,13 +45,13 @@ namespace Ryujinx.Ava.Ui.Vulkan.Surfaces
|
|||||||
|
|
||||||
public bool IsRgba { get; }
|
public bool IsRgba { get; }
|
||||||
|
|
||||||
public uint ImageFormat => (uint) _format;
|
public uint ImageFormat => (uint)_format;
|
||||||
|
|
||||||
public ulong MemorySize => Image.MemorySize;
|
public ulong MemorySize => Image.MemorySize;
|
||||||
|
|
||||||
public VulkanDisplay Display { get; }
|
public VulkanDisplay Display { get; private set; }
|
||||||
|
|
||||||
public VulkanSurface Surface { get; }
|
public VulkanSurface Surface { get; private set; }
|
||||||
|
|
||||||
public uint UsageFlags => Image.UsageFlags;
|
public uint UsageFlags => Image.UsageFlags;
|
||||||
|
|
||||||
@ -47,46 +59,76 @@ namespace Ryujinx.Ava.Ui.Vulkan.Surfaces
|
|||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_platformInterface.Device.WaitIdle();
|
lock (_lock)
|
||||||
DestroyImage();
|
{
|
||||||
Display?.Dispose();
|
DestroyImage();
|
||||||
Surface?.Dispose();
|
Display?.Dispose();
|
||||||
|
Surface?.Dispose();
|
||||||
|
Device?.Dispose();
|
||||||
|
|
||||||
|
Display = null;
|
||||||
|
Surface = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public VulkanSurfaceRenderingSession BeginDraw(float scaling)
|
public VulkanSurfaceRenderingSession BeginDraw(float scaling)
|
||||||
{
|
{
|
||||||
var session = new VulkanSurfaceRenderingSession(Display, _platformInterface.Device, this, scaling);
|
if (Image == null)
|
||||||
|
{
|
||||||
|
RecreateImage();
|
||||||
|
}
|
||||||
|
|
||||||
if (IsCorrupted)
|
_commandBuffer?.WaitForFence();
|
||||||
{
|
_commandBuffer = null;
|
||||||
IsCorrupted = false;
|
|
||||||
DestroyImage();
|
var session = new VulkanSurfaceRenderingSession(Display, Device, this, scaling);
|
||||||
CreateImage();
|
|
||||||
}
|
Image.TransitionLayout(ImageLayout.ColorAttachmentOptimal, AccessFlags.AccessNoneKhr);
|
||||||
else
|
|
||||||
{
|
|
||||||
Image.TransitionLayout(ImageLayout.ColorAttachmentOptimal, AccessFlags.AccessNoneKhr);
|
|
||||||
}
|
|
||||||
|
|
||||||
return session;
|
return session;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Invalidate()
|
public void RecreateImage()
|
||||||
{
|
{
|
||||||
IsCorrupted = true;
|
DestroyImage();
|
||||||
|
CreateImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CreateImage()
|
private void CreateImage()
|
||||||
{
|
{
|
||||||
Size = Display.Size;
|
Size = Display.Size;
|
||||||
|
|
||||||
Image = new VulkanImage(_platformInterface.Device, _platformInterface.PhysicalDevice, _platformInterface.Device.CommandBufferPool, ImageFormat, Size);
|
Image = new VulkanImage(Device, _platformInterface.PhysicalDevice, Display.CommandBufferPool, ImageFormat, Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DestroyImage()
|
private void DestroyImage()
|
||||||
{
|
{
|
||||||
_platformInterface.Device.WaitIdle();
|
_commandBuffer?.WaitForFence();
|
||||||
|
_commandBuffer = null;
|
||||||
Image?.Dispose();
|
Image?.Dispose();
|
||||||
|
Image = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public VulkanImage GetImage()
|
||||||
|
{
|
||||||
|
return Image;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void EndDraw()
|
||||||
|
{
|
||||||
|
lock (_lock)
|
||||||
|
{
|
||||||
|
if (Display == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_commandBuffer = Display.StartPresentation();
|
||||||
|
|
||||||
|
Display.BlitImageToCurrentImage(this, _commandBuffer.InternalHandle);
|
||||||
|
|
||||||
|
Display.EndPresentation(_commandBuffer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ namespace Ryujinx.Ava.Ui.Vulkan
|
|||||||
private readonly CommandPool _commandPool;
|
private readonly CommandPool _commandPool;
|
||||||
|
|
||||||
private readonly List<VulkanCommandBuffer> _usedCommandBuffers = new();
|
private readonly List<VulkanCommandBuffer> _usedCommandBuffers = new();
|
||||||
|
private readonly object _lock = new object();
|
||||||
|
|
||||||
public unsafe VulkanCommandBufferPool(VulkanDevice device, VulkanPhysicalDevice physicalDevice)
|
public unsafe VulkanCommandBufferPool(VulkanDevice device, VulkanPhysicalDevice physicalDevice)
|
||||||
{
|
{
|
||||||
@ -36,9 +37,12 @@ namespace Ryujinx.Ava.Ui.Vulkan
|
|||||||
Level = CommandBufferLevel.Primary
|
Level = CommandBufferLevel.Primary
|
||||||
};
|
};
|
||||||
|
|
||||||
_device.Api.AllocateCommandBuffers(_device.InternalHandle, commandBufferAllocateInfo, out var commandBuffer);
|
lock (_lock)
|
||||||
|
{
|
||||||
|
_device.Api.AllocateCommandBuffers(_device.InternalHandle, commandBufferAllocateInfo, out var commandBuffer);
|
||||||
|
|
||||||
return commandBuffer;
|
return commandBuffer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public VulkanCommandBuffer CreateCommandBuffer()
|
public VulkanCommandBuffer CreateCommandBuffer()
|
||||||
@ -48,7 +52,7 @@ namespace Ryujinx.Ava.Ui.Vulkan
|
|||||||
|
|
||||||
public void FreeUsedCommandBuffers()
|
public void FreeUsedCommandBuffers()
|
||||||
{
|
{
|
||||||
lock (_usedCommandBuffers)
|
lock (_lock)
|
||||||
{
|
{
|
||||||
foreach (var usedCommandBuffer in _usedCommandBuffers)
|
foreach (var usedCommandBuffer in _usedCommandBuffers)
|
||||||
{
|
{
|
||||||
@ -61,7 +65,7 @@ namespace Ryujinx.Ava.Ui.Vulkan
|
|||||||
|
|
||||||
private void DisposeCommandBuffer(VulkanCommandBuffer commandBuffer)
|
private void DisposeCommandBuffer(VulkanCommandBuffer commandBuffer)
|
||||||
{
|
{
|
||||||
lock (_usedCommandBuffers)
|
lock (_lock)
|
||||||
{
|
{
|
||||||
_usedCommandBuffers.Add(commandBuffer);
|
_usedCommandBuffers.Add(commandBuffer);
|
||||||
}
|
}
|
||||||
@ -69,8 +73,11 @@ namespace Ryujinx.Ava.Ui.Vulkan
|
|||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
FreeUsedCommandBuffers();
|
lock (_lock)
|
||||||
_device.Api.DestroyCommandPool(_device.InternalHandle, _commandPool, Span<AllocationCallbacks>.Empty);
|
{
|
||||||
|
FreeUsedCommandBuffers();
|
||||||
|
_device.Api.DestroyCommandPool(_device.InternalHandle, _commandPool, Span<AllocationCallbacks>.Empty);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class VulkanCommandBuffer : IDisposable
|
public class VulkanCommandBuffer : IDisposable
|
||||||
@ -80,6 +87,8 @@ namespace Ryujinx.Ava.Ui.Vulkan
|
|||||||
private readonly Fence _fence;
|
private readonly Fence _fence;
|
||||||
private bool _hasEnded;
|
private bool _hasEnded;
|
||||||
private bool _hasStarted;
|
private bool _hasStarted;
|
||||||
|
private bool _isDisposed;
|
||||||
|
private object _lock = new object();
|
||||||
|
|
||||||
public IntPtr Handle => InternalHandle.Handle;
|
public IntPtr Handle => InternalHandle.Handle;
|
||||||
|
|
||||||
@ -101,6 +110,22 @@ namespace Ryujinx.Ava.Ui.Vulkan
|
|||||||
device.Api.CreateFence(device.InternalHandle, fenceCreateInfo, null, out _fence);
|
device.Api.CreateFence(device.InternalHandle, fenceCreateInfo, null, out _fence);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void WaitForFence()
|
||||||
|
{
|
||||||
|
if (_isDisposed)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
lock (_lock)
|
||||||
|
{
|
||||||
|
if (!_isDisposed)
|
||||||
|
{
|
||||||
|
_device.Api.WaitForFences(_device.InternalHandle, 1, _fence, true, ulong.MaxValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void BeginRecording()
|
public void BeginRecording()
|
||||||
{
|
{
|
||||||
if (!_hasStarted)
|
if (!_hasStarted)
|
||||||
@ -173,9 +198,17 @@ namespace Ryujinx.Ava.Ui.Vulkan
|
|||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_device.Api.WaitForFences(_device.InternalHandle, 1, _fence, true, ulong.MaxValue);
|
lock (_lock)
|
||||||
_device.Api.FreeCommandBuffers(_device.InternalHandle, _commandBufferPool._commandPool, 1, InternalHandle);
|
{
|
||||||
_device.Api.DestroyFence(_device.InternalHandle, _fence, Span<AllocationCallbacks>.Empty);
|
if (!_isDisposed)
|
||||||
|
{
|
||||||
|
_isDisposed = true;
|
||||||
|
|
||||||
|
_device.Api.WaitForFences(_device.InternalHandle, 1, _fence, true, ulong.MaxValue);
|
||||||
|
_device.Api.FreeCommandBuffers(_device.InternalHandle, _commandBufferPool._commandPool, 1, InternalHandle);
|
||||||
|
_device.Api.DestroyFence(_device.InternalHandle, _fence, Span<AllocationCallbacks>.Empty);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,12 +14,9 @@ namespace Ryujinx.Ava.Ui.Vulkan
|
|||||||
|
|
||||||
api.GetDeviceQueue(apiHandle, physicalDevice.QueueFamilyIndex, 0, out var queue);
|
api.GetDeviceQueue(apiHandle, physicalDevice.QueueFamilyIndex, 0, out var queue);
|
||||||
|
|
||||||
var vulkanQueue = new VulkanQueue(this, queue);
|
Queue = new VulkanQueue(this, queue);
|
||||||
Queue = vulkanQueue;
|
|
||||||
|
|
||||||
PresentQueue = vulkanQueue;
|
PresentQueue = Queue;
|
||||||
|
|
||||||
CommandBufferPool = new VulkanCommandBufferPool(this, physicalDevice);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IntPtr Handle => InternalHandle.Handle;
|
public IntPtr Handle => InternalHandle.Handle;
|
||||||
@ -29,13 +26,12 @@ namespace Ryujinx.Ava.Ui.Vulkan
|
|||||||
|
|
||||||
public VulkanQueue Queue { get; private set; }
|
public VulkanQueue Queue { get; private set; }
|
||||||
public VulkanQueue PresentQueue { get; }
|
public VulkanQueue PresentQueue { get; }
|
||||||
public VulkanCommandBufferPool CommandBufferPool { get; }
|
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
WaitIdle();
|
WaitIdle();
|
||||||
CommandBufferPool?.Dispose();
|
|
||||||
Queue = null;
|
Queue = null;
|
||||||
|
Api.DestroyDevice(InternalHandle, Span<AllocationCallbacks>.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void Submit(SubmitInfo submitInfo, Fence fence = default)
|
internal void Submit(SubmitInfo submitInfo, Fence fence = default)
|
||||||
|
@ -3,7 +3,6 @@ using System.Linq;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Ryujinx.Ava.Ui.Vulkan.Surfaces;
|
using Ryujinx.Ava.Ui.Vulkan.Surfaces;
|
||||||
using Ryujinx.Ui.Common.Configuration;
|
|
||||||
using Silk.NET.Vulkan;
|
using Silk.NET.Vulkan;
|
||||||
using Silk.NET.Vulkan.Extensions.KHR;
|
using Silk.NET.Vulkan.Extensions.KHR;
|
||||||
|
|
||||||
@ -15,16 +14,19 @@ namespace Ryujinx.Ava.Ui.Vulkan
|
|||||||
private readonly VulkanInstance _instance;
|
private readonly VulkanInstance _instance;
|
||||||
private readonly VulkanPhysicalDevice _physicalDevice;
|
private readonly VulkanPhysicalDevice _physicalDevice;
|
||||||
private readonly VulkanSemaphorePair _semaphorePair;
|
private readonly VulkanSemaphorePair _semaphorePair;
|
||||||
|
private readonly VulkanDevice _device;
|
||||||
private uint _nextImage;
|
private uint _nextImage;
|
||||||
private readonly VulkanSurface _surface;
|
private readonly VulkanSurface _surface;
|
||||||
private SurfaceFormatKHR _surfaceFormat;
|
private SurfaceFormatKHR _surfaceFormat;
|
||||||
private SwapchainKHR _swapchain;
|
private SwapchainKHR _swapchain;
|
||||||
private Extent2D _swapchainExtent;
|
private Extent2D _swapchainExtent;
|
||||||
private Image[] _swapchainImages;
|
private Image[] _swapchainImages;
|
||||||
private VulkanDevice _device { get; }
|
private ImageView[] _swapchainImageViews = Array.Empty<ImageView>();
|
||||||
private ImageView[] _swapchainImageViews = new ImageView[0];
|
|
||||||
private bool _vsyncStateChanged;
|
private bool _vsyncStateChanged;
|
||||||
private bool _vsyncEnabled;
|
private bool _vsyncEnabled;
|
||||||
|
private bool _surfaceChanged;
|
||||||
|
|
||||||
|
public event EventHandler Presented;
|
||||||
|
|
||||||
public VulkanCommandBufferPool CommandBufferPool { get; set; }
|
public VulkanCommandBufferPool CommandBufferPool { get; set; }
|
||||||
|
|
||||||
@ -73,6 +75,14 @@ namespace Ryujinx.Ava.Ui.Vulkan
|
|||||||
CommandBufferPool.Dispose();
|
CommandBufferPool.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsSurfaceChanged()
|
||||||
|
{
|
||||||
|
var changed = _surfaceChanged;
|
||||||
|
_surfaceChanged = false;
|
||||||
|
|
||||||
|
return changed;
|
||||||
|
}
|
||||||
|
|
||||||
private static unsafe SwapchainKHR CreateSwapchain(VulkanInstance instance, VulkanDevice device,
|
private static unsafe SwapchainKHR CreateSwapchain(VulkanInstance instance, VulkanDevice device,
|
||||||
VulkanPhysicalDevice physicalDevice, VulkanSurface surface, out Extent2D swapchainExtent,
|
VulkanPhysicalDevice physicalDevice, VulkanSurface surface, out Extent2D swapchainExtent,
|
||||||
SwapchainKHR? oldswapchain = null, bool vsyncEnabled = true)
|
SwapchainKHR? oldswapchain = null, bool vsyncEnabled = true)
|
||||||
@ -193,22 +203,23 @@ namespace Ryujinx.Ava.Ui.Vulkan
|
|||||||
}
|
}
|
||||||
|
|
||||||
var modes = presentModes.ToList();
|
var modes = presentModes.ToList();
|
||||||
var presentMode = PresentModeKHR.PresentModeFifoKhr;
|
|
||||||
|
|
||||||
if (!vsyncEnabled && modes.Contains(PresentModeKHR.PresentModeImmediateKhr))
|
if (!vsyncEnabled && modes.Contains(PresentModeKHR.PresentModeImmediateKhr))
|
||||||
{
|
{
|
||||||
presentMode = PresentModeKHR.PresentModeImmediateKhr;
|
return PresentModeKHR.PresentModeImmediateKhr;
|
||||||
}
|
}
|
||||||
else if (modes.Contains(PresentModeKHR.PresentModeMailboxKhr))
|
else if (modes.Contains(PresentModeKHR.PresentModeMailboxKhr))
|
||||||
{
|
{
|
||||||
presentMode = PresentModeKHR.PresentModeMailboxKhr;
|
return PresentModeKHR.PresentModeMailboxKhr;
|
||||||
}
|
}
|
||||||
else if (modes.Contains(PresentModeKHR.PresentModeImmediateKhr))
|
else if (modes.Contains(PresentModeKHR.PresentModeFifoKhr))
|
||||||
{
|
{
|
||||||
presentMode = PresentModeKHR.PresentModeImmediateKhr;
|
return PresentModeKHR.PresentModeFifoKhr;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return PresentModeKHR.PresentModeImmediateKhr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return presentMode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static VulkanDisplay CreateDisplay(VulkanInstance instance, VulkanDevice device,
|
internal static VulkanDisplay CreateDisplay(VulkanInstance instance, VulkanDevice device,
|
||||||
@ -266,6 +277,8 @@ namespace Ryujinx.Ava.Ui.Vulkan
|
|||||||
_swapchain = CreateSwapchain(_instance, _device, _physicalDevice, _surface, out _swapchainExtent, _swapchain, _vsyncEnabled);
|
_swapchain = CreateSwapchain(_instance, _device, _physicalDevice, _surface, out _swapchainExtent, _swapchain, _vsyncEnabled);
|
||||||
|
|
||||||
CreateSwapchainImages();
|
CreateSwapchainImages();
|
||||||
|
|
||||||
|
_surfaceChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private unsafe ImageView CreateSwapchainImageView(Image swapchainImage, Format format)
|
private unsafe ImageView CreateSwapchainImageView(Image swapchainImage, Format format)
|
||||||
@ -306,7 +319,7 @@ namespace Ryujinx.Ava.Ui.Vulkan
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal VulkanCommandBufferPool.VulkanCommandBuffer StartPresentation(VulkanSurfaceRenderTarget renderTarget)
|
internal VulkanCommandBufferPool.VulkanCommandBuffer StartPresentation()
|
||||||
{
|
{
|
||||||
_nextImage = 0;
|
_nextImage = 0;
|
||||||
while (true)
|
while (true)
|
||||||
@ -346,8 +359,10 @@ namespace Ryujinx.Ava.Ui.Vulkan
|
|||||||
|
|
||||||
internal void BlitImageToCurrentImage(VulkanSurfaceRenderTarget renderTarget, CommandBuffer commandBuffer)
|
internal void BlitImageToCurrentImage(VulkanSurfaceRenderTarget renderTarget, CommandBuffer commandBuffer)
|
||||||
{
|
{
|
||||||
|
var image = renderTarget.GetImage();
|
||||||
|
|
||||||
VulkanMemoryHelper.TransitionLayout(_device, commandBuffer,
|
VulkanMemoryHelper.TransitionLayout(_device, commandBuffer,
|
||||||
renderTarget.Image.InternalHandle.Value, (ImageLayout)renderTarget.Image.CurrentLayout,
|
image.InternalHandle.Value, (ImageLayout)image.CurrentLayout,
|
||||||
AccessFlags.AccessNoneKhr,
|
AccessFlags.AccessNoneKhr,
|
||||||
ImageLayout.TransferSrcOptimal,
|
ImageLayout.TransferSrcOptimal,
|
||||||
AccessFlags.AccessTransferReadBit,
|
AccessFlags.AccessTransferReadBit,
|
||||||
@ -381,7 +396,7 @@ namespace Ryujinx.Ava.Ui.Vulkan
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
_device.Api.CmdBlitImage(commandBuffer, renderTarget.Image.InternalHandle.Value,
|
_device.Api.CmdBlitImage(commandBuffer, image.InternalHandle.Value,
|
||||||
ImageLayout.TransferSrcOptimal,
|
ImageLayout.TransferSrcOptimal,
|
||||||
_swapchainImages[_nextImage],
|
_swapchainImages[_nextImage],
|
||||||
ImageLayout.TransferDstOptimal,
|
ImageLayout.TransferDstOptimal,
|
||||||
@ -390,9 +405,9 @@ namespace Ryujinx.Ava.Ui.Vulkan
|
|||||||
Filter.Linear);
|
Filter.Linear);
|
||||||
|
|
||||||
VulkanMemoryHelper.TransitionLayout(_device, commandBuffer,
|
VulkanMemoryHelper.TransitionLayout(_device, commandBuffer,
|
||||||
renderTarget.Image.InternalHandle.Value, ImageLayout.TransferSrcOptimal,
|
image.InternalHandle.Value, ImageLayout.TransferSrcOptimal,
|
||||||
AccessFlags.AccessTransferReadBit,
|
AccessFlags.AccessTransferReadBit,
|
||||||
(ImageLayout)renderTarget.Image.CurrentLayout,
|
(ImageLayout)image.CurrentLayout,
|
||||||
AccessFlags.AccessNoneKhr,
|
AccessFlags.AccessNoneKhr,
|
||||||
renderTarget.MipLevels);
|
renderTarget.MipLevels);
|
||||||
}
|
}
|
||||||
@ -434,6 +449,8 @@ namespace Ryujinx.Ava.Ui.Vulkan
|
|||||||
}
|
}
|
||||||
|
|
||||||
CommandBufferPool.FreeUsedCommandBuffers();
|
CommandBufferPool.FreeUsedCommandBuffers();
|
||||||
|
|
||||||
|
Presented?.Invoke(this, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -148,20 +148,18 @@ namespace Ryujinx.Ava.Ui.Vulkan
|
|||||||
_currentAccessFlags = destinationAccessFlags;
|
_currentAccessFlags = destinationAccessFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TransitionLayout(uint destinationLayout, uint destinationAccessFlags)
|
public void Dispose()
|
||||||
{
|
{
|
||||||
TransitionLayout((ImageLayout)destinationLayout, (AccessFlags)destinationAccessFlags);
|
if (InternalHandle != null)
|
||||||
}
|
{
|
||||||
|
_device.Api.DestroyImageView(_device.InternalHandle, _imageView.Value, Span<AllocationCallbacks>.Empty);
|
||||||
|
_device.Api.DestroyImage(_device.InternalHandle, InternalHandle.Value, Span<AllocationCallbacks>.Empty);
|
||||||
|
_device.Api.FreeMemory(_device.InternalHandle, _imageMemory, Span<AllocationCallbacks>.Empty);
|
||||||
|
|
||||||
public unsafe void Dispose()
|
_imageView = default;
|
||||||
{
|
InternalHandle = null;
|
||||||
_device.Api.DestroyImageView(_device.InternalHandle, _imageView.Value, null);
|
_imageMemory = default;
|
||||||
_device.Api.DestroyImage(_device.InternalHandle, InternalHandle.Value, null);
|
}
|
||||||
_device.Api.FreeMemory(_device.InternalHandle, _imageMemory, null);
|
|
||||||
|
|
||||||
_imageView = default;
|
|
||||||
InternalHandle = default;
|
|
||||||
_imageMemory = default;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,8 +57,7 @@ namespace Ryujinx.Ava.Ui.Vulkan
|
|||||||
var applicationInfo = new ApplicationInfo
|
var applicationInfo = new ApplicationInfo
|
||||||
{
|
{
|
||||||
PApplicationName = (byte*)applicationName,
|
PApplicationName = (byte*)applicationName,
|
||||||
ApiVersion = new Version32((uint)options.VulkanVersion.Major, (uint)options.VulkanVersion.Minor,
|
ApiVersion = Vk.Version12.Value,
|
||||||
(uint)options.VulkanVersion.Build),
|
|
||||||
PEngineName = (byte*)engineName,
|
PEngineName = (byte*)engineName,
|
||||||
EngineVersion = new Version32(1, 0, 0),
|
EngineVersion = new Version32(1, 0, 0),
|
||||||
ApplicationVersion = new Version32(1, 0, 0)
|
ApplicationVersion = new Version32(1, 0, 0)
|
||||||
|
@ -11,11 +11,6 @@ namespace Ryujinx.Ava.Ui.Vulkan
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string ApplicationName { get; set; }
|
public string ApplicationName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Specifies the Vulkan API version to use
|
|
||||||
/// </summary>
|
|
||||||
public Version VulkanVersion { get; set; } = new Version(1, 1, 0);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Specifies additional extensions to enable if available on the instance
|
/// Specifies additional extensions to enable if available on the instance
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -18,13 +18,11 @@ namespace Ryujinx.Ava.Ui.Vulkan
|
|||||||
|
|
||||||
public VulkanPhysicalDevice PhysicalDevice { get; private set; }
|
public VulkanPhysicalDevice PhysicalDevice { get; private set; }
|
||||||
public VulkanInstance Instance { get; }
|
public VulkanInstance Instance { get; }
|
||||||
public VulkanDevice Device { get; set; }
|
|
||||||
public Vk Api { get; private set; }
|
public Vk Api { get; private set; }
|
||||||
public VulkanSurfaceRenderTarget MainSurface { get; set; }
|
public VulkanSurfaceRenderTarget MainSurface { get; set; }
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
Device?.Dispose();
|
|
||||||
Instance?.Dispose();
|
Instance?.Dispose();
|
||||||
Api?.Dispose();
|
Api?.Dispose();
|
||||||
}
|
}
|
||||||
@ -54,16 +52,9 @@ namespace Ryujinx.Ava.Ui.Vulkan
|
|||||||
{
|
{
|
||||||
var surface = VulkanSurface.CreateSurface(Instance, platformSurface);
|
var surface = VulkanSurface.CreateSurface(Instance, platformSurface);
|
||||||
|
|
||||||
if (Device == null)
|
if (PhysicalDevice == null)
|
||||||
{
|
{
|
||||||
PhysicalDevice = VulkanPhysicalDevice.FindSuitablePhysicalDevice(Instance, surface, _options.PreferDiscreteGpu, _options.PreferredDevice);
|
PhysicalDevice = VulkanPhysicalDevice.FindSuitablePhysicalDevice(Instance, surface, _options.PreferDiscreteGpu, _options.PreferredDevice);
|
||||||
var device = VulkanInitialization.CreateDevice(Instance.Api,
|
|
||||||
PhysicalDevice.InternalHandle,
|
|
||||||
PhysicalDevice.QueueFamilyIndex,
|
|
||||||
VulkanInitialization.GetSupportedExtensions(Instance.Api, PhysicalDevice.InternalHandle),
|
|
||||||
PhysicalDevice.QueueCount);
|
|
||||||
|
|
||||||
Device = new VulkanDevice(device, PhysicalDevice, Instance.Api);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var renderTarget = new VulkanSurfaceRenderTarget(this, surface);
|
var renderTarget = new VulkanSurfaceRenderTarget(this, surface);
|
||||||
@ -71,7 +62,6 @@ namespace Ryujinx.Ava.Ui.Vulkan
|
|||||||
if (MainSurface == null && surface != null)
|
if (MainSurface == null && surface != null)
|
||||||
{
|
{
|
||||||
MainSurface = renderTarget;
|
MainSurface = renderTarget;
|
||||||
MainSurface.Display.ChangeVSyncMode(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return renderTarget;
|
return renderTarget;
|
||||||
|
@ -9,7 +9,6 @@ namespace Ryujinx.Ava.Ui.Vulkan
|
|||||||
{
|
{
|
||||||
private readonly VulkanDevice _device;
|
private readonly VulkanDevice _device;
|
||||||
private readonly VulkanSurfaceRenderTarget _renderTarget;
|
private readonly VulkanSurfaceRenderTarget _renderTarget;
|
||||||
private VulkanCommandBufferPool.VulkanCommandBuffer _commandBuffer;
|
|
||||||
|
|
||||||
public VulkanSurfaceRenderingSession(VulkanDisplay display, VulkanDevice device,
|
public VulkanSurfaceRenderingSession(VulkanDisplay display, VulkanDevice device,
|
||||||
VulkanSurfaceRenderTarget renderTarget, float scaling)
|
VulkanSurfaceRenderTarget renderTarget, float scaling)
|
||||||
@ -32,17 +31,13 @@ namespace Ryujinx.Ava.Ui.Vulkan
|
|||||||
{
|
{
|
||||||
if (!Display.EnsureSwapchainAvailable())
|
if (!Display.EnsureSwapchainAvailable())
|
||||||
{
|
{
|
||||||
_renderTarget.Invalidate();
|
_renderTarget.RecreateImage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_commandBuffer = Display.StartPresentation(_renderTarget);
|
_renderTarget.EndDraw();
|
||||||
|
|
||||||
Display.BlitImageToCurrentImage(_renderTarget, _commandBuffer.InternalHandle);
|
|
||||||
|
|
||||||
Display.EndPresentation(_commandBuffer);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Markup.Xaml;
|
|
||||||
using FluentAvalonia.UI.Controls;
|
using FluentAvalonia.UI.Controls;
|
||||||
using Ryujinx.Ava.Common.Locale;
|
using Ryujinx.Ava.Common.Locale;
|
||||||
using Ryujinx.Ava.Ui.Models;
|
using Ryujinx.Ava.Ui.Models;
|
||||||
using Ryujinx.Ava.Ui.Windows;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Ryujinx.Ava.Ui.Controls
|
namespace Ryujinx.Ava.Ui.Controls
|
||||||
|
@ -37,7 +37,7 @@ namespace Ryujinx.Ava.Ui.Controls
|
|||||||
|
|
||||||
public override void DestroyBackgroundContext()
|
public override void DestroyBackgroundContext()
|
||||||
{
|
{
|
||||||
_image = null;
|
Image = null;
|
||||||
|
|
||||||
if (_fence != IntPtr.Zero)
|
if (_fence != IntPtr.Zero)
|
||||||
{
|
{
|
||||||
@ -57,6 +57,8 @@ namespace Ryujinx.Ava.Ui.Controls
|
|||||||
Dispatcher.UIThread.InvokeAsync(() =>
|
Dispatcher.UIThread.InvokeAsync(() =>
|
||||||
{
|
{
|
||||||
Image = (int)image;
|
Image = (int)image;
|
||||||
|
|
||||||
|
InvalidateVisual();
|
||||||
}).Wait();
|
}).Wait();
|
||||||
|
|
||||||
if (_fence != IntPtr.Zero)
|
if (_fence != IntPtr.Zero)
|
||||||
@ -66,7 +68,7 @@ namespace Ryujinx.Ava.Ui.Controls
|
|||||||
|
|
||||||
_fence = GL.FenceSync(SyncCondition.SyncGpuCommandsComplete, WaitSyncFlags.None);
|
_fence = GL.FenceSync(SyncCondition.SyncGpuCommandsComplete, WaitSyncFlags.None);
|
||||||
|
|
||||||
QueueRender();
|
InvalidateVisual();
|
||||||
|
|
||||||
_gameBackgroundWindow.SwapBuffers();
|
_gameBackgroundWindow.SwapBuffers();
|
||||||
}
|
}
|
||||||
|
@ -11,25 +11,7 @@ namespace Ryujinx.Ava.Ui.Controls
|
|||||||
{
|
{
|
||||||
internal abstract class RendererControl : Control
|
internal abstract class RendererControl : Control
|
||||||
{
|
{
|
||||||
protected object _image;
|
protected object Image { get; set; }
|
||||||
|
|
||||||
static RendererControl()
|
|
||||||
{
|
|
||||||
AffectsRender<RendererControl>(ImageProperty);
|
|
||||||
}
|
|
||||||
|
|
||||||
public readonly static StyledProperty<object> ImageProperty =
|
|
||||||
AvaloniaProperty.Register<RendererControl, object>(
|
|
||||||
nameof(Image),
|
|
||||||
0,
|
|
||||||
inherits: true,
|
|
||||||
defaultBindingMode: BindingMode.TwoWay);
|
|
||||||
|
|
||||||
protected object Image
|
|
||||||
{
|
|
||||||
get => _image;
|
|
||||||
set => SetAndRaise(ImageProperty, ref _image, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public event EventHandler<EventArgs> RendererInitialized;
|
public event EventHandler<EventArgs> RendererInitialized;
|
||||||
public event EventHandler<Size> SizeChanged;
|
public event EventHandler<Size> SizeChanged;
|
||||||
@ -60,8 +42,6 @@ namespace Ryujinx.Ava.Ui.Controls
|
|||||||
if (!rect.IsEmpty)
|
if (!rect.IsEmpty)
|
||||||
{
|
{
|
||||||
RenderSize = rect.Size * VisualRoot.RenderScaling;
|
RenderSize = rect.Size * VisualRoot.RenderScaling;
|
||||||
|
|
||||||
DrawOperation?.Dispose();
|
|
||||||
DrawOperation = CreateDrawOperation();
|
DrawOperation = CreateDrawOperation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -97,17 +77,11 @@ namespace Ryujinx.Ava.Ui.Controls
|
|||||||
RendererInitialized?.Invoke(this, EventArgs.Empty);
|
RendererInitialized?.Invoke(this, EventArgs.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void QueueRender()
|
|
||||||
{
|
|
||||||
Program.RenderTimer.TickNow();
|
|
||||||
}
|
|
||||||
|
|
||||||
internal abstract void Present(object image);
|
internal abstract void Present(object image);
|
||||||
|
|
||||||
internal void Start()
|
internal void Start()
|
||||||
{
|
{
|
||||||
IsStarted = true;
|
IsStarted = true;
|
||||||
QueueRender();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void Stop()
|
internal void Stop()
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
using Avalonia;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Markup.Xaml;
|
|
||||||
using Ryujinx.Ava.Ui.Windows;
|
using Ryujinx.Ava.Ui.Windows;
|
||||||
|
|
||||||
namespace Ryujinx.Ava.Ui.Controls
|
namespace Ryujinx.Ava.Ui.Controls
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using Avalonia;
|
using Avalonia;
|
||||||
|
using Avalonia.Media;
|
||||||
using Avalonia.Platform;
|
using Avalonia.Platform;
|
||||||
using Avalonia.Rendering.SceneGraph;
|
using Avalonia.Rendering.SceneGraph;
|
||||||
using Avalonia.Skia;
|
using Avalonia.Skia;
|
||||||
@ -11,20 +12,23 @@ using Silk.NET.Vulkan;
|
|||||||
using SkiaSharp;
|
using SkiaSharp;
|
||||||
using SPB.Windowing;
|
using SPB.Windowing;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Concurrent;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Ryujinx.Ava.Ui.Controls
|
namespace Ryujinx.Ava.Ui.Controls
|
||||||
{
|
{
|
||||||
internal class VulkanRendererControl : RendererControl
|
internal class VulkanRendererControl : RendererControl
|
||||||
{
|
{
|
||||||
|
private const int MaxImagesInFlight = 3;
|
||||||
|
|
||||||
private VulkanPlatformInterface _platformInterface;
|
private VulkanPlatformInterface _platformInterface;
|
||||||
|
private ConcurrentQueue<PresentImageInfo> _imagesInFlight;
|
||||||
|
private PresentImageInfo _currentImage;
|
||||||
|
|
||||||
public VulkanRendererControl(GraphicsDebugLevel graphicsDebugLevel) : base(graphicsDebugLevel)
|
public VulkanRendererControl(GraphicsDebugLevel graphicsDebugLevel) : base(graphicsDebugLevel)
|
||||||
{
|
{
|
||||||
_platformInterface = AvaloniaLocator.Current.GetService<VulkanPlatformInterface>();
|
_platformInterface = AvaloniaLocator.Current.GetService<VulkanPlatformInterface>();
|
||||||
|
|
||||||
|
_imagesInFlight = new ConcurrentQueue<PresentImageInfo>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void DestroyBackgroundContext()
|
public override void DestroyBackgroundContext()
|
||||||
@ -37,6 +41,40 @@ namespace Ryujinx.Ava.Ui.Controls
|
|||||||
return new VulkanDrawOperation(this);
|
return new VulkanDrawOperation(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e)
|
||||||
|
{
|
||||||
|
base.OnDetachedFromVisualTree(e);
|
||||||
|
|
||||||
|
_imagesInFlight.Clear();
|
||||||
|
|
||||||
|
if (_platformInterface.MainSurface.Display != null)
|
||||||
|
{
|
||||||
|
_platformInterface.MainSurface.Display.Presented -= Window_Presented;
|
||||||
|
}
|
||||||
|
|
||||||
|
_currentImage?.Put();
|
||||||
|
_currentImage = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
|
||||||
|
{
|
||||||
|
base.OnAttachedToVisualTree(e);
|
||||||
|
|
||||||
|
_platformInterface.MainSurface.Display.Presented += Window_Presented;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Window_Presented(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_platformInterface.MainSurface.Device.QueueWaitIdle();
|
||||||
|
_currentImage?.Put();
|
||||||
|
_currentImage = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Render(DrawingContext context)
|
||||||
|
{
|
||||||
|
base.Render(context);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void CreateWindow()
|
protected override void CreateWindow()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -51,12 +89,29 @@ namespace Ryujinx.Ava.Ui.Controls
|
|||||||
|
|
||||||
internal override void Present(object image)
|
internal override void Present(object image)
|
||||||
{
|
{
|
||||||
Dispatcher.UIThread.InvokeAsync(() =>
|
Image = image;
|
||||||
{
|
|
||||||
Image = image;
|
|
||||||
}).Wait();
|
|
||||||
|
|
||||||
QueueRender();
|
_imagesInFlight.Enqueue((PresentImageInfo)image);
|
||||||
|
|
||||||
|
if (_imagesInFlight.Count > MaxImagesInFlight)
|
||||||
|
{
|
||||||
|
_imagesInFlight.TryDequeue(out _);
|
||||||
|
}
|
||||||
|
|
||||||
|
Dispatcher.UIThread.Post(InvalidateVisual);
|
||||||
|
}
|
||||||
|
|
||||||
|
private PresentImageInfo GetImage()
|
||||||
|
{
|
||||||
|
lock (_imagesInFlight)
|
||||||
|
{
|
||||||
|
if (!_imagesInFlight.TryDequeue(out _currentImage))
|
||||||
|
{
|
||||||
|
_currentImage = (PresentImageInfo)Image;
|
||||||
|
}
|
||||||
|
|
||||||
|
return _currentImage;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class VulkanDrawOperation : ICustomDrawOperation
|
private class VulkanDrawOperation : ICustomDrawOperation
|
||||||
@ -64,6 +119,7 @@ namespace Ryujinx.Ava.Ui.Controls
|
|||||||
public Rect Bounds { get; }
|
public Rect Bounds { get; }
|
||||||
|
|
||||||
private readonly VulkanRendererControl _control;
|
private readonly VulkanRendererControl _control;
|
||||||
|
private bool _isDestroyed;
|
||||||
|
|
||||||
public VulkanDrawOperation(VulkanRendererControl control)
|
public VulkanDrawOperation(VulkanRendererControl control)
|
||||||
{
|
{
|
||||||
@ -73,7 +129,12 @@ namespace Ryujinx.Ava.Ui.Controls
|
|||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
|
if (_isDestroyed)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_isDestroyed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Equals(ICustomDrawOperation other)
|
public bool Equals(ICustomDrawOperation other)
|
||||||
@ -86,30 +147,33 @@ namespace Ryujinx.Ava.Ui.Controls
|
|||||||
return Bounds.Contains(p);
|
return Bounds.Contains(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Render(IDrawingContextImpl context)
|
public unsafe void Render(IDrawingContextImpl context)
|
||||||
{
|
{
|
||||||
if (_control.Image == null || _control.RenderSize.Width == 0 || _control.RenderSize.Height == 0)
|
if (_isDestroyed || _control.Image == null || _control.RenderSize.Width == 0 || _control.RenderSize.Height == 0 ||
|
||||||
|
context is not ISkiaDrawingContextImpl skiaDrawingContextImpl)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var image = (PresentImageInfo)_control.Image;
|
var image = _control.GetImage();
|
||||||
|
|
||||||
if (context is not ISkiaDrawingContextImpl skiaDrawingContextImpl)
|
if (!image.State.IsValid)
|
||||||
{
|
{
|
||||||
|
_control._currentImage = null;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_control._platformInterface.Device.QueueWaitIdle();
|
|
||||||
|
|
||||||
var gpu = AvaloniaLocator.Current.GetService<VulkanSkiaGpu>();
|
var gpu = AvaloniaLocator.Current.GetService<VulkanSkiaGpu>();
|
||||||
|
|
||||||
|
image.Get();
|
||||||
|
|
||||||
var imageInfo = new GRVkImageInfo()
|
var imageInfo = new GRVkImageInfo()
|
||||||
{
|
{
|
||||||
CurrentQueueFamily = _control._platformInterface.PhysicalDevice.QueueFamilyIndex,
|
CurrentQueueFamily = _control._platformInterface.PhysicalDevice.QueueFamilyIndex,
|
||||||
Format = (uint)Format.R8G8B8A8Unorm,
|
Format = (uint)Format.R8G8B8A8Unorm,
|
||||||
Image = image.Image.Handle,
|
Image = image.Image.Handle,
|
||||||
ImageLayout = (uint)ImageLayout.ColorAttachmentOptimal,
|
ImageLayout = (uint)ImageLayout.TransferSrcOptimal,
|
||||||
ImageTiling = (uint)ImageTiling.Optimal,
|
ImageTiling = (uint)ImageTiling.Optimal,
|
||||||
ImageUsageFlags = (uint)(ImageUsageFlags.ImageUsageColorAttachmentBit
|
ImageUsageFlags = (uint)(ImageUsageFlags.ImageUsageColorAttachmentBit
|
||||||
| ImageUsageFlags.ImageUsageTransferSrcBit
|
| ImageUsageFlags.ImageUsageTransferSrcBit
|
||||||
@ -127,13 +191,15 @@ namespace Ryujinx.Ava.Ui.Controls
|
|||||||
};
|
};
|
||||||
|
|
||||||
using var backendTexture = new GRBackendRenderTarget(
|
using var backendTexture = new GRBackendRenderTarget(
|
||||||
(int)_control.RenderSize.Width,
|
(int)image.Extent.Width,
|
||||||
(int)_control.RenderSize.Height,
|
(int)image.Extent.Height,
|
||||||
1,
|
1,
|
||||||
imageInfo);
|
imageInfo);
|
||||||
|
|
||||||
|
var vulkan = AvaloniaLocator.Current.GetService<VulkanPlatformInterface>();
|
||||||
|
|
||||||
using var surface = SKSurface.Create(
|
using var surface = SKSurface.Create(
|
||||||
gpu.GrContext,
|
skiaDrawingContextImpl.GrContext,
|
||||||
backendTexture,
|
backendTexture,
|
||||||
GRSurfaceOrigin.TopLeft,
|
GRSurfaceOrigin.TopLeft,
|
||||||
SKColorType.Rgba8888);
|
SKColorType.Rgba8888);
|
||||||
@ -143,10 +209,11 @@ namespace Ryujinx.Ava.Ui.Controls
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var rect = new Rect(new Point(), _control.RenderSize);
|
var rect = new Rect(new Point(), new Size(image.Extent.Width, image.Extent.Height));
|
||||||
|
|
||||||
using var snapshot = surface.Snapshot();
|
using var snapshot = surface.Snapshot();
|
||||||
skiaDrawingContextImpl.SkCanvas.DrawImage(snapshot, rect.ToSKRect(), _control.Bounds.ToSKRect(), new SKPaint());
|
skiaDrawingContextImpl.SkCanvas.DrawImage(snapshot, rect.ToSKRect(), _control.Bounds.ToSKRect(),
|
||||||
|
new SKPaint());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ using Avalonia.Controls;
|
|||||||
using Avalonia.Controls.ApplicationLifetimes;
|
using Avalonia.Controls.ApplicationLifetimes;
|
||||||
using Avalonia.Svg.Skia;
|
using Avalonia.Svg.Skia;
|
||||||
using Avalonia.Threading;
|
using Avalonia.Threading;
|
||||||
using Avalonia.VisualTree;
|
|
||||||
using Ryujinx.Ava.Common.Locale;
|
using Ryujinx.Ava.Common.Locale;
|
||||||
using Ryujinx.Ava.Input;
|
using Ryujinx.Ava.Input;
|
||||||
using Ryujinx.Ava.Ui.Controls;
|
using Ryujinx.Ava.Ui.Controls;
|
||||||
@ -24,7 +23,6 @@ using System.Collections.Generic;
|
|||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using ConfigGamepadInputId = Ryujinx.Common.Configuration.Hid.Controller.GamepadInputId;
|
using ConfigGamepadInputId = Ryujinx.Common.Configuration.Hid.Controller.GamepadInputId;
|
||||||
using ConfigStickInputId = Ryujinx.Common.Configuration.Hid.Controller.StickInputId;
|
using ConfigStickInputId = Ryujinx.Common.Configuration.Hid.Controller.StickInputId;
|
||||||
|
@ -38,6 +38,8 @@ namespace Ryujinx.Ava.Ui.ViewModels
|
|||||||
{
|
{
|
||||||
internal class MainWindowViewModel : BaseModel
|
internal class MainWindowViewModel : BaseModel
|
||||||
{
|
{
|
||||||
|
private const int HotKeyPressDelayMs = 500;
|
||||||
|
|
||||||
private readonly MainWindow _owner;
|
private readonly MainWindow _owner;
|
||||||
private ObservableCollection<ApplicationData> _applications;
|
private ObservableCollection<ApplicationData> _applications;
|
||||||
private string _aspectStatusText;
|
private string _aspectStatusText;
|
||||||
@ -54,6 +56,7 @@ namespace Ryujinx.Ava.Ui.ViewModels
|
|||||||
private bool _isLoading;
|
private bool _isLoading;
|
||||||
private int _progressMaximum;
|
private int _progressMaximum;
|
||||||
private int _progressValue;
|
private int _progressValue;
|
||||||
|
private long _lastFullscreenToggle = Environment.TickCount64;
|
||||||
private bool _showLoadProgress;
|
private bool _showLoadProgress;
|
||||||
private bool _showMenuAndStatusBar = true;
|
private bool _showMenuAndStatusBar = true;
|
||||||
private bool _showStatusSeparator;
|
private bool _showStatusSeparator;
|
||||||
@ -929,6 +932,13 @@ namespace Ryujinx.Ava.Ui.ViewModels
|
|||||||
|
|
||||||
public void ToggleFullscreen()
|
public void ToggleFullscreen()
|
||||||
{
|
{
|
||||||
|
if (Environment.TickCount64 - _lastFullscreenToggle < HotKeyPressDelayMs)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_lastFullscreenToggle = Environment.TickCount64;
|
||||||
|
|
||||||
WindowState state = _owner.WindowState;
|
WindowState state = _owner.WindowState;
|
||||||
|
|
||||||
if (state == WindowState.FullScreen)
|
if (state == WindowState.FullScreen)
|
||||||
@ -1085,6 +1095,11 @@ namespace Ryujinx.Ava.Ui.ViewModels
|
|||||||
{
|
{
|
||||||
selection.Favorite = !selection.Favorite;
|
selection.Favorite = !selection.Favorite;
|
||||||
|
|
||||||
|
_owner.ApplicationLibrary.LoadAndSaveMetaData(selection.TitleId, appMetadata =>
|
||||||
|
{
|
||||||
|
appMetadata.Favorite = selection.Favorite;
|
||||||
|
});
|
||||||
|
|
||||||
RefreshView();
|
RefreshView();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,6 +48,11 @@ namespace Ryujinx.Ava.Ui.ViewModels
|
|||||||
private int _graphicsBackendMultithreadingIndex;
|
private int _graphicsBackendMultithreadingIndex;
|
||||||
private float _previousVolumeLevel;
|
private float _previousVolumeLevel;
|
||||||
private float _volume;
|
private float _volume;
|
||||||
|
private bool _isVulkanAvailable = true;
|
||||||
|
private bool _directoryChanged = false;
|
||||||
|
private List<string> _gpuIds = new List<string>();
|
||||||
|
private KeyboardHotkeys _keyboardHotkeys;
|
||||||
|
private int _graphicsBackendIndex;
|
||||||
|
|
||||||
public int ResolutionScale
|
public int ResolutionScale
|
||||||
{
|
{
|
||||||
@ -97,6 +102,28 @@ namespace Ryujinx.Ava.Ui.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsVulkanAvailable
|
||||||
|
{
|
||||||
|
get => _isVulkanAvailable;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_isVulkanAvailable = value;
|
||||||
|
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool DirectoryChanged
|
||||||
|
{
|
||||||
|
get => _directoryChanged;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_directoryChanged = value;
|
||||||
|
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bool EnableDiscordIntegration { get; set; }
|
public bool EnableDiscordIntegration { get; set; }
|
||||||
public bool CheckUpdatesOnStart { get; set; }
|
public bool CheckUpdatesOnStart { get; set; }
|
||||||
public bool ShowConfirmExit { get; set; }
|
public bool ShowConfirmExit { get; set; }
|
||||||
@ -143,10 +170,10 @@ namespace Ryujinx.Ava.Ui.ViewModels
|
|||||||
public int BaseStyleIndex { get; set; }
|
public int BaseStyleIndex { get; set; }
|
||||||
public int GraphicsBackendIndex
|
public int GraphicsBackendIndex
|
||||||
{
|
{
|
||||||
get => graphicsBackendIndex;
|
get => _graphicsBackendIndex;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
graphicsBackendIndex = value;
|
_graphicsBackendIndex = value;
|
||||||
OnPropertyChanged();
|
OnPropertyChanged();
|
||||||
OnPropertyChanged(nameof(IsVulkanSelected));
|
OnPropertyChanged(nameof(IsVulkanSelected));
|
||||||
}
|
}
|
||||||
@ -170,14 +197,9 @@ namespace Ryujinx.Ava.Ui.ViewModels
|
|||||||
public DateTimeOffset DateOffset { get; set; }
|
public DateTimeOffset DateOffset { get; set; }
|
||||||
public TimeSpan TimeOffset { get; set; }
|
public TimeSpan TimeOffset { get; set; }
|
||||||
public AvaloniaList<TimeZone> TimeZones { get; set; }
|
public AvaloniaList<TimeZone> TimeZones { get; set; }
|
||||||
|
|
||||||
public AvaloniaList<string> GameDirectories { get; set; }
|
public AvaloniaList<string> GameDirectories { get; set; }
|
||||||
public ObservableCollection<ComboBoxItem> AvailableGpus { get; set; }
|
public ObservableCollection<ComboBoxItem> AvailableGpus { get; set; }
|
||||||
|
|
||||||
private KeyboardHotkeys _keyboardHotkeys;
|
|
||||||
private int graphicsBackendIndex;
|
|
||||||
private List<string> _gpuIds = new List<string>();
|
|
||||||
|
|
||||||
public KeyboardHotkeys KeyboardHotkeys
|
public KeyboardHotkeys KeyboardHotkeys
|
||||||
{
|
{
|
||||||
get => _keyboardHotkeys;
|
get => _keyboardHotkeys;
|
||||||
@ -233,20 +255,31 @@ namespace Ryujinx.Ava.Ui.ViewModels
|
|||||||
if (!Program.UseVulkan)
|
if (!Program.UseVulkan)
|
||||||
{
|
{
|
||||||
var devices = VulkanRenderer.GetPhysicalDevices();
|
var devices = VulkanRenderer.GetPhysicalDevices();
|
||||||
foreach (var device in devices)
|
|
||||||
|
if (devices.Length == 0)
|
||||||
{
|
{
|
||||||
_gpuIds.Add(device.Id);
|
IsVulkanAvailable = false;
|
||||||
names.Add($"{device.Name} {(device.IsDiscrete ? "(dGpu)" : "")}");
|
GraphicsBackendIndex = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach (var device in devices)
|
||||||
|
{
|
||||||
|
_gpuIds.Add(device.Id);
|
||||||
|
names.Add($"{device.Name} {(device.IsDiscrete ? "(dGPU)" : "")}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foreach (var device in VulkanPhysicalDevice.SuitableDevices)
|
foreach (var device in VulkanPhysicalDevice.SuitableDevices)
|
||||||
{
|
{
|
||||||
_gpuIds.Add(VulkanInitialization.StringFromIdPair(device.Value.VendorID, device.Value.DeviceID));
|
_gpuIds.Add(
|
||||||
|
VulkanInitialization.StringFromIdPair(device.Value.VendorID, device.Value.DeviceID));
|
||||||
var value = device.Value;
|
var value = device.Value;
|
||||||
var name = value.DeviceName;
|
var name = value.DeviceName;
|
||||||
names.Add($"{Marshal.PtrToStringAnsi((IntPtr)name)} {(device.Value.DeviceType == PhysicalDeviceType.DiscreteGpu ? "(dGpu)" : "")}");
|
names.Add(
|
||||||
|
$"{Marshal.PtrToStringAnsi((IntPtr)name)} {(device.Value.DeviceType == PhysicalDeviceType.DiscreteGpu ? "(dGPU)" : "")}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -376,10 +409,14 @@ namespace Ryujinx.Ava.Ui.ViewModels
|
|||||||
|
|
||||||
public async Task SaveSettings()
|
public async Task SaveSettings()
|
||||||
{
|
{
|
||||||
List<string> gameDirs = new List<string>(GameDirectories);
|
|
||||||
|
|
||||||
ConfigurationState config = ConfigurationState.Instance;
|
ConfigurationState config = ConfigurationState.Instance;
|
||||||
|
|
||||||
|
if (_directoryChanged)
|
||||||
|
{
|
||||||
|
List<string> gameDirs = new List<string>(GameDirectories);
|
||||||
|
config.Ui.GameDirs.Value = gameDirs;
|
||||||
|
}
|
||||||
|
|
||||||
if (_validTzRegions.Contains(TimeZone))
|
if (_validTzRegions.Contains(TimeZone))
|
||||||
{
|
{
|
||||||
config.System.TimeZone.Value = TimeZone;
|
config.System.TimeZone.Value = TimeZone;
|
||||||
@ -444,7 +481,6 @@ namespace Ryujinx.Ava.Ui.ViewModels
|
|||||||
|
|
||||||
config.System.SystemTimeOffset.Value = systemTimeOffset.Seconds;
|
config.System.SystemTimeOffset.Value = systemTimeOffset.Seconds;
|
||||||
config.Graphics.ShadersDumpPath.Value = ShaderDumpPath;
|
config.Graphics.ShadersDumpPath.Value = ShaderDumpPath;
|
||||||
config.Ui.GameDirs.Value = gameDirs;
|
|
||||||
config.System.FsGlobalAccessLogMode.Value = FsGlobalAccessLogMode;
|
config.System.FsGlobalAccessLogMode.Value = FsGlobalAccessLogMode;
|
||||||
config.System.MemoryManagerMode.Value = (MemoryManagerMode)MemoryMode;
|
config.System.MemoryManagerMode.Value = (MemoryManagerMode)MemoryMode;
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using Avalonia;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Controls;
|
|
||||||
using Avalonia.Input;
|
using Avalonia.Input;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
using Avalonia.Threading;
|
using Avalonia.Threading;
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
using Avalonia;
|
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
using Ryujinx.Ava.Common.Locale;
|
using Ryujinx.Ava.Common.Locale;
|
||||||
using Ryujinx.Ava.Ui.Models;
|
using Ryujinx.Ava.Ui.Models;
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
using Avalonia;
|
using Avalonia.Collections;
|
||||||
using Avalonia.Collections;
|
|
||||||
using Ryujinx.Ava.Common.Locale;
|
using Ryujinx.Ava.Common.Locale;
|
||||||
using Ryujinx.Ava.Ui.Models;
|
using Ryujinx.Ava.Ui.Models;
|
||||||
using Ryujinx.HLE.FileSystem;
|
using Ryujinx.HLE.FileSystem;
|
||||||
using Ryujinx.HLE.HOS;
|
using Ryujinx.HLE.HOS;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
|
@ -12,7 +12,6 @@ using Ryujinx.Ava.Ui.Applet;
|
|||||||
using Ryujinx.Ava.Ui.Controls;
|
using Ryujinx.Ava.Ui.Controls;
|
||||||
using Ryujinx.Ava.Ui.Models;
|
using Ryujinx.Ava.Ui.Models;
|
||||||
using Ryujinx.Ava.Ui.ViewModels;
|
using Ryujinx.Ava.Ui.ViewModels;
|
||||||
using Ryujinx.Ava.Ui.Vulkan;
|
|
||||||
using Ryujinx.Common.Configuration;
|
using Ryujinx.Common.Configuration;
|
||||||
using Ryujinx.Common.Logging;
|
using Ryujinx.Common.Logging;
|
||||||
using Ryujinx.Graphics.Gpu;
|
using Ryujinx.Graphics.Gpu;
|
||||||
@ -27,7 +26,6 @@ using Ryujinx.Ui.Common.Configuration;
|
|||||||
using SixLabors.ImageSharp.PixelFormats;
|
using SixLabors.ImageSharp.PixelFormats;
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -656,7 +654,12 @@ namespace Ryujinx.Ava.Ui.Windows
|
|||||||
{
|
{
|
||||||
AppHost = null;
|
AppHost = null;
|
||||||
|
|
||||||
Dispatcher.UIThread.Post(Close);
|
Dispatcher.UIThread.Post(() =>
|
||||||
|
{
|
||||||
|
MainContent = null;
|
||||||
|
|
||||||
|
Close();
|
||||||
|
});
|
||||||
};
|
};
|
||||||
AppHost?.Stop();
|
AppHost?.Stop();
|
||||||
|
|
||||||
|
@ -519,7 +519,7 @@
|
|||||||
HorizontalContentAlignment="Left"
|
HorizontalContentAlignment="Left"
|
||||||
ToolTip.Tip="{locale:Locale SettingsTabGraphicsBackendTooltip}"
|
ToolTip.Tip="{locale:Locale SettingsTabGraphicsBackendTooltip}"
|
||||||
SelectedIndex="{Binding GraphicsBackendIndex}">
|
SelectedIndex="{Binding GraphicsBackendIndex}">
|
||||||
<ComboBoxItem>
|
<ComboBoxItem IsVisible="{Binding IsVulkanAvailable}">
|
||||||
<TextBlock Text="Vulkan" />
|
<TextBlock Text="Vulkan" />
|
||||||
</ComboBoxItem>
|
</ComboBoxItem>
|
||||||
<ComboBoxItem>
|
<ComboBoxItem>
|
||||||
|
@ -162,6 +162,7 @@ namespace Ryujinx.Ava.Ui.Windows
|
|||||||
if (!string.IsNullOrWhiteSpace(path) && Directory.Exists(path) && !ViewModel.GameDirectories.Contains(path))
|
if (!string.IsNullOrWhiteSpace(path) && Directory.Exists(path) && !ViewModel.GameDirectories.Contains(path))
|
||||||
{
|
{
|
||||||
ViewModel.GameDirectories.Add(path);
|
ViewModel.GameDirectories.Add(path);
|
||||||
|
ViewModel.DirectoryChanged = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -170,6 +171,7 @@ namespace Ryujinx.Ava.Ui.Windows
|
|||||||
if (!string.IsNullOrWhiteSpace(path))
|
if (!string.IsNullOrWhiteSpace(path))
|
||||||
{
|
{
|
||||||
ViewModel.GameDirectories.Add(path);
|
ViewModel.GameDirectories.Add(path);
|
||||||
|
ViewModel.DirectoryChanged = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -181,6 +183,7 @@ namespace Ryujinx.Ava.Ui.Windows
|
|||||||
foreach (string path in selected)
|
foreach (string path in selected)
|
||||||
{
|
{
|
||||||
ViewModel.GameDirectories.Remove(path);
|
ViewModel.GameDirectories.Remove(path);
|
||||||
|
ViewModel.DirectoryChanged = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,10 +235,12 @@ namespace Ryujinx.Ava.Ui.Windows
|
|||||||
|
|
||||||
ControllerSettings?.SaveCurrentProfile();
|
ControllerSettings?.SaveCurrentProfile();
|
||||||
|
|
||||||
if (Owner is MainWindow window)
|
if (Owner is MainWindow window && ViewModel.DirectoryChanged)
|
||||||
{
|
{
|
||||||
window.ViewModel.LoadApplications();
|
window.ViewModel.LoadApplications();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ViewModel.DirectoryChanged = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnClosed(EventArgs e)
|
protected override void OnClosed(EventArgs e)
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
using Avalonia;
|
|
||||||
using Avalonia.Collections;
|
using Avalonia.Collections;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Threading;
|
using Avalonia.Threading;
|
||||||
@ -18,7 +17,6 @@ using Ryujinx.HLE.FileSystem;
|
|||||||
using Ryujinx.HLE.HOS;
|
using Ryujinx.HLE.HOS;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
using Avalonia;
|
|
||||||
using Avalonia.Controls;
|
|
||||||
using Ryujinx.Ava.Common.Locale;
|
using Ryujinx.Ava.Common.Locale;
|
||||||
using Ryujinx.Modules;
|
using Ryujinx.Modules;
|
||||||
using System;
|
using System;
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
using Ryujinx.Common.Configuration.Hid.Controller.Motion;
|
using Ryujinx.Common.Configuration.Hid.Controller.Motion;
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using NotImplementedException = System.NotImplementedException;
|
|
||||||
|
|
||||||
namespace Ryujinx.Common.Configuration.Hid.Controller
|
namespace Ryujinx.Common.Configuration.Hid.Controller
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System.Runtime.InteropServices;
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
namespace Ryujinx.Common.GraphicsDriver.NVAPI
|
namespace Ryujinx.Common.GraphicsDriver.NVAPI
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
|
||||||
|
|
||||||
namespace Ryujinx.Common.Logging
|
namespace Ryujinx.Common.Logging
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
|
||||||
|
|
||||||
namespace Ryujinx.Common.Logging
|
namespace Ryujinx.Common.Logging
|
||||||
{
|
{
|
||||||
|
@ -87,7 +87,7 @@ namespace Ryujinx.Common.Memory
|
|||||||
/// Gets a span from the array.
|
/// Gets a span from the array.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>Span of the array</returns>
|
/// <returns>Span of the array</returns>
|
||||||
public Span<T> ToSpan() => Length == 0 ? Span<T>.Empty : MemoryMarshal.CreateSpan(ref this[0], Length);
|
public Span<T> AsSpan() => Length == 0 ? Span<T>.Empty : MemoryMarshal.CreateSpan(ref this[0], Length);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the array base pointer.
|
/// Gets the array base pointer.
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user