amadeus: Update to REV9 (#2309)

* amadeus: Update to REV9

This implements all the changes made with REV9 on 12.0.0.

* Address Ac_k's comments
This commit is contained in:
Mary 2021-05-25 19:01:09 +02:00 committed by GitHub
parent 54ea2285f0
commit f3b0b4831c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
45 changed files with 1591 additions and 68 deletions

View file

@ -15,6 +15,9 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//
using Ryujinx.Audio.Renderer.Parameter;
using Ryujinx.Audio.Renderer.Utils;
using System;
using System.Diagnostics;
namespace Ryujinx.Audio.Renderer.Server.Effect
@ -34,6 +37,9 @@ namespace Ryujinx.Audio.Renderer.Server.Effect
/// </summary>
private uint _effectCount;
private EffectResultState[] _resultStatesCpu;
private EffectResultState[] _resultStatesDsp;
/// <summary>
/// Create a new <see cref="EffectContext"/>.
/// </summary>
@ -47,7 +53,8 @@ namespace Ryujinx.Audio.Renderer.Server.Effect
/// Initialize the <see cref="EffectContext"/>.
/// </summary>
/// <param name="effectCount">The total effect count.</param>
public void Initialize(uint effectCount)
/// <param name="resultStateCount">The total result state count.</param>
public void Initialize(uint effectCount, uint resultStateCount)
{
_effectCount = effectCount;
_effects = new BaseEffect[effectCount];
@ -56,6 +63,9 @@ namespace Ryujinx.Audio.Renderer.Server.Effect
{
_effects[i] = new BaseEffect();
}
_resultStatesCpu = new EffectResultState[resultStateCount];
_resultStatesDsp = new EffectResultState[resultStateCount];
}
/// <summary>
@ -78,5 +88,53 @@ namespace Ryujinx.Audio.Renderer.Server.Effect
return ref _effects[index];
}
/// <summary>
/// Get a reference to a <see cref="EffectResultState"/> at the given <paramref name="index"/>.
/// </summary>
/// <param name="index">The index to use.</param>
/// <returns>A reference to a <see cref="EffectResultState"/> at the given <paramref name="index"/>.</returns>
/// <remarks>The returned <see cref="EffectResultState"/> should only be used when updating the server state.</remarks>
public ref EffectResultState GetState(int index)
{
Debug.Assert(index >= 0 && index < _resultStatesCpu.Length);
return ref _resultStatesCpu[index];
}
/// <summary>
/// Get a reference to a <see cref="EffectResultState"/> at the given <paramref name="index"/>.
/// </summary>
/// <param name="index">The index to use.</param>
/// <returns>A reference to a <see cref="EffectResultState"/> at the given <paramref name="index"/>.</returns>
/// <remarks>The returned <see cref="EffectResultState"/> should only be used in the context of processing on the <see cref="Dsp.AudioProcessor"/>.</remarks>
public ref EffectResultState GetDspState(int index)
{
Debug.Assert(index >= 0 && index < _resultStatesDsp.Length);
return ref _resultStatesDsp[index];
}
/// <summary>
/// Get a memory instance to a <see cref="EffectResultState"/> at the given <paramref name="index"/>.
/// </summary>
/// <param name="index">The index to use.</param>
/// <returns>A memory instance to a <see cref="EffectResultState"/> at the given <paramref name="index"/>.</returns>
/// <remarks>The returned <see cref="Memory{EffectResultState}"/> should only be used in the context of processing on the <see cref="Dsp.AudioProcessor"/>.</remarks>
public Memory<EffectResultState> GetDspStateMemory(int index)
{
return SpanIOHelper.GetMemory(_resultStatesDsp.AsMemory(), index, (uint)_resultStatesDsp.Length);
}
/// <summary>
/// Update internal state during command generation.
/// </summary>
public void UpdateResultStateForCommandGeneration()
{
for (int index = 0; index < _resultStatesCpu.Length; index++)
{
_effects[index].UpdateResultState(ref _resultStatesCpu[index], ref _resultStatesDsp[index]);
}
}
}
}