2022-01-27 22:50:32 +01:00
|
|
|
using Ryujinx.Common;
|
2024-01-22 21:14:46 +01:00
|
|
|
using Ryujinx.Graphics.Device;
|
2019-10-13 08:02:07 +02:00
|
|
|
using Ryujinx.Graphics.GAL;
|
2020-07-24 04:53:25 +02:00
|
|
|
using Ryujinx.Graphics.Gpu.Engine.GPFifo;
|
2019-10-13 08:02:07 +02:00
|
|
|
using Ryujinx.Graphics.Gpu.Memory;
|
2021-06-29 19:32:02 +02:00
|
|
|
using Ryujinx.Graphics.Gpu.Shader;
|
2020-04-19 03:25:57 +02:00
|
|
|
using Ryujinx.Graphics.Gpu.Synchronization;
|
2019-10-13 08:02:07 +02:00
|
|
|
using System;
|
2021-06-29 19:32:02 +02:00
|
|
|
using System.Collections.Concurrent;
|
2021-01-17 21:08:06 +01:00
|
|
|
using System.Collections.Generic;
|
2020-11-13 00:15:34 +01:00
|
|
|
using System.Threading;
|
2019-10-13 08:02:07 +02:00
|
|
|
|
|
|
|
namespace Ryujinx.Graphics.Gpu
|
|
|
|
{
|
2019-12-31 21:08:20 +01:00
|
|
|
/// <summary>
|
|
|
|
/// GPU emulation context.
|
|
|
|
/// </summary>
|
2019-12-31 23:09:49 +01:00
|
|
|
public sealed class GpuContext : IDisposable
|
2019-10-13 08:02:07 +02:00
|
|
|
{
|
2022-01-27 22:50:32 +01:00
|
|
|
private const int NsToTicksFractionNumerator = 384;
|
|
|
|
private const int NsToTicksFractionDenominator = 625;
|
|
|
|
|
2020-11-13 00:15:34 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Event signaled when the host emulation context is ready to be used by the gpu context.
|
|
|
|
/// </summary>
|
|
|
|
public ManualResetEvent HostInitalized { get; }
|
|
|
|
|
2019-12-31 21:08:20 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Host renderer.
|
|
|
|
/// </summary>
|
2019-10-13 08:02:07 +02:00
|
|
|
public IRenderer Renderer { get; }
|
|
|
|
|
2019-12-31 21:08:20 +01:00
|
|
|
/// <summary>
|
2020-07-24 04:53:25 +02:00
|
|
|
/// GPU General Purpose FIFO queue.
|
2019-12-31 21:08:20 +01:00
|
|
|
/// </summary>
|
2020-07-24 04:53:25 +02:00
|
|
|
public GPFifoDevice GPFifo { get; }
|
2019-10-13 08:02:07 +02:00
|
|
|
|
2020-04-19 03:25:57 +02:00
|
|
|
/// <summary>
|
|
|
|
/// GPU synchronization manager.
|
|
|
|
/// </summary>
|
|
|
|
public SynchronizationManager Synchronization { get; }
|
|
|
|
|
2019-12-31 21:08:20 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Presentation window.
|
|
|
|
/// </summary>
|
2019-11-24 03:24:03 +01:00
|
|
|
public Window Window { get; }
|
|
|
|
|
2019-12-31 21:08:20 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Internal sequence number, used to avoid needless resource data updates
|
|
|
|
/// in the middle of a command buffer before synchronizations.
|
|
|
|
/// </summary>
|
2019-10-13 08:02:07 +02:00
|
|
|
internal int SequenceNumber { get; private set; }
|
|
|
|
|
2021-01-17 21:08:06 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Internal sync number, used to denote points at which host synchronization can be requested.
|
|
|
|
/// </summary>
|
|
|
|
internal ulong SyncNumber { get; private set; }
|
|
|
|
|
|
|
|
/// <summary>
|
2022-01-09 17:28:48 +01:00
|
|
|
/// Actions to be performed when a CPU waiting syncpoint or barrier is triggered.
|
2021-01-17 21:08:06 +01:00
|
|
|
/// If there are more than 0 items when this happens, a host sync object will be generated for the given <see cref="SyncNumber"/>,
|
|
|
|
/// and the SyncNumber will be incremented.
|
|
|
|
/// </summary>
|
2023-05-01 21:05:12 +02:00
|
|
|
internal List<ISyncActionHandler> SyncActions { get; }
|
2021-01-17 21:08:06 +01:00
|
|
|
|
2022-01-09 17:28:48 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Actions to be performed when a CPU waiting syncpoint is triggered.
|
|
|
|
/// If there are more than 0 items when this happens, a host sync object will be generated for the given <see cref="SyncNumber"/>,
|
|
|
|
/// and the SyncNumber will be incremented.
|
|
|
|
/// </summary>
|
2023-05-01 21:05:12 +02:00
|
|
|
internal List<ISyncActionHandler> SyncpointActions { get; }
|
2022-01-09 17:28:48 +01:00
|
|
|
|
2022-12-01 16:30:13 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Buffer migrations that are currently in-flight. These are checked whenever sync is created to determine if buffer migration
|
|
|
|
/// copies have completed on the GPU, and their data can be freed.
|
|
|
|
/// </summary>
|
|
|
|
internal List<BufferMigration> BufferMigrations { get; }
|
|
|
|
|
2021-06-24 01:51:41 +02:00
|
|
|
/// <summary>
|
2021-06-29 19:32:02 +02:00
|
|
|
/// Queue with deferred actions that must run on the render thread.
|
2021-06-24 01:51:41 +02:00
|
|
|
/// </summary>
|
2021-06-29 19:32:02 +02:00
|
|
|
internal Queue<Action> DeferredActions { get; }
|
2021-06-24 01:51:41 +02:00
|
|
|
|
2021-06-29 19:32:02 +02:00
|
|
|
/// <summary>
|
|
|
|
/// Registry with physical memories that can be used with this GPU context, keyed by owner process ID.
|
|
|
|
/// </summary>
|
2022-02-09 21:18:07 +01:00
|
|
|
internal ConcurrentDictionary<ulong, PhysicalMemory> PhysicalMemoryRegistry { get; }
|
2019-10-13 08:02:07 +02:00
|
|
|
|
2023-07-11 19:07:41 +02:00
|
|
|
/// <summary>
|
|
|
|
/// Support buffer updater.
|
|
|
|
/// </summary>
|
|
|
|
internal SupportBufferUpdater SupportBufferUpdater { get; }
|
|
|
|
|
2019-12-31 21:08:20 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Host hardware capabilities.
|
|
|
|
/// </summary>
|
2022-08-20 21:20:27 +02:00
|
|
|
internal Capabilities Capabilities;
|
2019-10-13 08:02:07 +02:00
|
|
|
|
2021-03-03 01:39:36 +01:00
|
|
|
/// <summary>
|
2021-03-22 19:40:07 +01:00
|
|
|
/// Event for signalling shader cache loading progress.
|
2021-03-03 01:39:36 +01:00
|
|
|
/// </summary>
|
2021-06-29 19:32:02 +02:00
|
|
|
public event Action<ShaderCacheState, int, int> ShaderCacheStateChanged;
|
|
|
|
|
2022-01-09 17:28:48 +01:00
|
|
|
private Thread _gpuThread;
|
2022-12-01 16:30:13 +01:00
|
|
|
private bool _pendingSync;
|
2021-03-03 01:39:36 +01:00
|
|
|
|
GPU: Remove swizzle undefined matching and rework depth aliasing (#4896)
* GPU: Remove swizzle undefined matching and rework depth aliasing
@gdkchan pointed out that UI textures in TOTK seemed to be setting their texture swizzle incorrectly (texture was RGB but was sampling A, swizzle for A was wrong), so I determined that SwizzleComponentMatches was the problem and set on eliminating it. This PR combines existing work to select the most recently modified texture (now used when selecting which aliased texture to use) with some additional changes to remove the swizzle check and support aliased view creation.
The original observation (#1538) was that we wanted to match depth textures for the purposes of aliasing with color textures, but they often had different swizzle from what was sampled (as it's generally the identity swizzle once rendered). At the time, I decided to allow swizzles to match if only the defined components matched, which fixed the issue in all known cases but could easily be broken by a game _expecting_ a given swizzle, such as a 1/0 value on a component.
This error case could also occur in textures that don't even depth alias, such as R11G11B10, as the rule was created to generally apply to all cases.
The solution is now to fail this exact match test, and allow the search for an R32 texture to create a swizzled view of a D32 texture (and other such cases). This allows the creation of a view that mismatches the requested format, which wasn't present before and was the reason for the swizzle matching approach.
The exact match and view creation rules now follow the same rules over what textures to select when there are multiple options (such as a "perfect" match and an "aliased" match at the same time). It now selects the most recently modified texture, which is done with a new sequence number in the GpuContext (because we don't have enough of these).
Reportedly fixes UI having weird coloured backgrounds in TOTK. This also fixes an issue in MK8D where returning from a race resulted in the character selection cubemaps being broken. May work around issues introduced by the "short texture cache" PR due to modification ordering, though they won't be truly fixed.
Should allow (#4365) to avoid copies in more cases. Need to test that.
I tested a bunch of games #1538 originally affected and they seem to be fine. This change affects all games so it would be good to get some wide testing on it.
* Address feedback 1, fix an issue
* Workaround: Do not allow copies for format alias.
These should be removed when D32<->R32 copy dependencies become legal
2023-05-12 02:30:47 +02:00
|
|
|
private long _modifiedSequence;
|
2023-07-02 02:47:54 +02:00
|
|
|
private readonly ulong _firstTimestamp;
|
GPU: Remove swizzle undefined matching and rework depth aliasing (#4896)
* GPU: Remove swizzle undefined matching and rework depth aliasing
@gdkchan pointed out that UI textures in TOTK seemed to be setting their texture swizzle incorrectly (texture was RGB but was sampling A, swizzle for A was wrong), so I determined that SwizzleComponentMatches was the problem and set on eliminating it. This PR combines existing work to select the most recently modified texture (now used when selecting which aliased texture to use) with some additional changes to remove the swizzle check and support aliased view creation.
The original observation (#1538) was that we wanted to match depth textures for the purposes of aliasing with color textures, but they often had different swizzle from what was sampled (as it's generally the identity swizzle once rendered). At the time, I decided to allow swizzles to match if only the defined components matched, which fixed the issue in all known cases but could easily be broken by a game _expecting_ a given swizzle, such as a 1/0 value on a component.
This error case could also occur in textures that don't even depth alias, such as R11G11B10, as the rule was created to generally apply to all cases.
The solution is now to fail this exact match test, and allow the search for an R32 texture to create a swizzled view of a D32 texture (and other such cases). This allows the creation of a view that mismatches the requested format, which wasn't present before and was the reason for the swizzle matching approach.
The exact match and view creation rules now follow the same rules over what textures to select when there are multiple options (such as a "perfect" match and an "aliased" match at the same time). It now selects the most recently modified texture, which is done with a new sequence number in the GpuContext (because we don't have enough of these).
Reportedly fixes UI having weird coloured backgrounds in TOTK. This also fixes an issue in MK8D where returning from a race resulted in the character selection cubemaps being broken. May work around issues introduced by the "short texture cache" PR due to modification ordering, though they won't be truly fixed.
Should allow (#4365) to avoid copies in more cases. Need to test that.
I tested a bunch of games #1538 originally affected and they seem to be fine. This change affects all games so it would be good to get some wide testing on it.
* Address feedback 1, fix an issue
* Workaround: Do not allow copies for format alias.
These should be removed when D32<->R32 copy dependencies become legal
2023-05-12 02:30:47 +02:00
|
|
|
|
2024-01-18 18:17:38 +01:00
|
|
|
private readonly ManualResetEvent _gpuReadyEvent;
|
|
|
|
|
2019-12-31 21:08:20 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Creates a new instance of the GPU emulation context.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="renderer">Host renderer</param>
|
2019-10-13 08:02:07 +02:00
|
|
|
public GpuContext(IRenderer renderer)
|
|
|
|
{
|
|
|
|
Renderer = renderer;
|
|
|
|
|
2020-07-24 04:53:25 +02:00
|
|
|
GPFifo = new GPFifoDevice(this);
|
2019-10-13 08:02:07 +02:00
|
|
|
|
2020-04-19 03:25:57 +02:00
|
|
|
Synchronization = new SynchronizationManager();
|
|
|
|
|
2019-11-24 03:24:03 +01:00
|
|
|
Window = new Window(this);
|
|
|
|
|
2020-11-13 00:15:34 +01:00
|
|
|
HostInitalized = new ManualResetEvent(false);
|
2024-01-18 18:17:38 +01:00
|
|
|
_gpuReadyEvent = new ManualResetEvent(false);
|
2021-01-17 21:08:06 +01:00
|
|
|
|
2023-05-01 21:05:12 +02:00
|
|
|
SyncActions = new List<ISyncActionHandler>();
|
|
|
|
SyncpointActions = new List<ISyncActionHandler>();
|
2022-12-01 16:30:13 +01:00
|
|
|
BufferMigrations = new List<BufferMigration>();
|
2021-06-24 01:51:41 +02:00
|
|
|
|
2021-06-29 19:32:02 +02:00
|
|
|
DeferredActions = new Queue<Action>();
|
|
|
|
|
2022-02-09 21:18:07 +01:00
|
|
|
PhysicalMemoryRegistry = new ConcurrentDictionary<ulong, PhysicalMemory>();
|
2023-05-17 20:38:59 +02:00
|
|
|
|
2023-07-11 19:07:41 +02:00
|
|
|
SupportBufferUpdater = new SupportBufferUpdater(renderer);
|
|
|
|
|
2023-05-17 20:38:59 +02:00
|
|
|
_firstTimestamp = ConvertNanosecondsToTicks((ulong)PerformanceCounter.ElapsedNanoseconds);
|
2021-06-24 01:51:41 +02:00
|
|
|
}
|
|
|
|
|
2021-06-29 19:32:02 +02:00
|
|
|
/// <summary>
|
|
|
|
/// Creates a new GPU channel.
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>The GPU channel</returns>
|
2021-06-24 01:51:41 +02:00
|
|
|
public GpuChannel CreateChannel()
|
|
|
|
{
|
|
|
|
return new GpuChannel(this);
|
2020-11-13 00:15:34 +01:00
|
|
|
}
|
|
|
|
|
2021-06-29 19:32:02 +02:00
|
|
|
/// <summary>
|
|
|
|
/// Creates a new GPU memory manager.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="pid">ID of the process that owns the memory manager</param>
|
|
|
|
/// <returns>The memory manager</returns>
|
|
|
|
/// <exception cref="ArgumentException">Thrown when <paramref name="pid"/> is invalid</exception>
|
2022-02-09 21:18:07 +01:00
|
|
|
public MemoryManager CreateMemoryManager(ulong pid)
|
2021-06-29 19:32:02 +02:00
|
|
|
{
|
|
|
|
if (!PhysicalMemoryRegistry.TryGetValue(pid, out var physicalMemory))
|
|
|
|
{
|
|
|
|
throw new ArgumentException("The PID is invalid or the process was not registered", nameof(pid));
|
|
|
|
}
|
|
|
|
|
|
|
|
return new MemoryManager(physicalMemory);
|
|
|
|
}
|
|
|
|
|
2024-01-22 21:14:46 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Creates a new device memory manager.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="pid">ID of the process that owns the memory manager</param>
|
|
|
|
/// <returns>The memory manager</returns>
|
|
|
|
/// <exception cref="ArgumentException">Thrown when <paramref name="pid"/> is invalid</exception>
|
|
|
|
public DeviceMemoryManager CreateDeviceMemoryManager(ulong pid)
|
|
|
|
{
|
|
|
|
if (!PhysicalMemoryRegistry.TryGetValue(pid, out var physicalMemory))
|
|
|
|
{
|
|
|
|
throw new ArgumentException("The PID is invalid or the process was not registered", nameof(pid));
|
|
|
|
}
|
|
|
|
|
|
|
|
return physicalMemory.CreateDeviceMemoryManager();
|
|
|
|
}
|
|
|
|
|
2021-06-29 19:32:02 +02:00
|
|
|
/// <summary>
|
|
|
|
/// Registers virtual memory used by a process for GPU memory access, caching and read/write tracking.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="pid">ID of the process that owns <paramref name="cpuMemory"/></param>
|
|
|
|
/// <param name="cpuMemory">Virtual memory owned by the process</param>
|
|
|
|
/// <exception cref="ArgumentException">Thrown if <paramref name="pid"/> was already registered</exception>
|
2022-02-09 21:18:07 +01:00
|
|
|
public void RegisterProcess(ulong pid, Cpu.IVirtualMemoryManagerTracked cpuMemory)
|
2021-06-29 19:32:02 +02:00
|
|
|
{
|
|
|
|
var physicalMemory = new PhysicalMemory(this, cpuMemory);
|
|
|
|
if (!PhysicalMemoryRegistry.TryAdd(pid, physicalMemory))
|
|
|
|
{
|
|
|
|
throw new ArgumentException("The PID was already registered", nameof(pid));
|
|
|
|
}
|
|
|
|
|
|
|
|
physicalMemory.ShaderCache.ShaderCacheStateChanged += ShaderCacheStateUpdate;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Unregisters a process, indicating that its memory will no longer be used, and that caches can be freed.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="pid">ID of the process</param>
|
2022-02-09 21:18:07 +01:00
|
|
|
public void UnregisterProcess(ulong pid)
|
2021-06-29 19:32:02 +02:00
|
|
|
{
|
|
|
|
if (PhysicalMemoryRegistry.TryRemove(pid, out var physicalMemory))
|
|
|
|
{
|
|
|
|
physicalMemory.ShaderCache.ShaderCacheStateChanged -= ShaderCacheStateUpdate;
|
|
|
|
physicalMemory.Dispose();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-27 22:50:32 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Converts a nanoseconds timestamp value to Maxwell time ticks.
|
|
|
|
/// </summary>
|
|
|
|
/// <remarks>
|
|
|
|
/// The frequency is 614400000 Hz.
|
|
|
|
/// </remarks>
|
|
|
|
/// <param name="nanoseconds">Timestamp in nanoseconds</param>
|
|
|
|
/// <returns>Maxwell ticks</returns>
|
|
|
|
private static ulong ConvertNanosecondsToTicks(ulong nanoseconds)
|
|
|
|
{
|
|
|
|
// We need to divide first to avoid overflows.
|
|
|
|
// We fix up the result later by calculating the difference and adding
|
|
|
|
// that to the result.
|
|
|
|
ulong divided = nanoseconds / NsToTicksFractionDenominator;
|
|
|
|
|
|
|
|
ulong rounded = divided * NsToTicksFractionDenominator;
|
|
|
|
|
|
|
|
ulong errorBias = (nanoseconds - rounded) * NsToTicksFractionNumerator / NsToTicksFractionDenominator;
|
|
|
|
|
|
|
|
return divided * NsToTicksFractionNumerator + errorBias;
|
|
|
|
}
|
|
|
|
|
GPU: Remove swizzle undefined matching and rework depth aliasing (#4896)
* GPU: Remove swizzle undefined matching and rework depth aliasing
@gdkchan pointed out that UI textures in TOTK seemed to be setting their texture swizzle incorrectly (texture was RGB but was sampling A, swizzle for A was wrong), so I determined that SwizzleComponentMatches was the problem and set on eliminating it. This PR combines existing work to select the most recently modified texture (now used when selecting which aliased texture to use) with some additional changes to remove the swizzle check and support aliased view creation.
The original observation (#1538) was that we wanted to match depth textures for the purposes of aliasing with color textures, but they often had different swizzle from what was sampled (as it's generally the identity swizzle once rendered). At the time, I decided to allow swizzles to match if only the defined components matched, which fixed the issue in all known cases but could easily be broken by a game _expecting_ a given swizzle, such as a 1/0 value on a component.
This error case could also occur in textures that don't even depth alias, such as R11G11B10, as the rule was created to generally apply to all cases.
The solution is now to fail this exact match test, and allow the search for an R32 texture to create a swizzled view of a D32 texture (and other such cases). This allows the creation of a view that mismatches the requested format, which wasn't present before and was the reason for the swizzle matching approach.
The exact match and view creation rules now follow the same rules over what textures to select when there are multiple options (such as a "perfect" match and an "aliased" match at the same time). It now selects the most recently modified texture, which is done with a new sequence number in the GpuContext (because we don't have enough of these).
Reportedly fixes UI having weird coloured backgrounds in TOTK. This also fixes an issue in MK8D where returning from a race resulted in the character selection cubemaps being broken. May work around issues introduced by the "short texture cache" PR due to modification ordering, though they won't be truly fixed.
Should allow (#4365) to avoid copies in more cases. Need to test that.
I tested a bunch of games #1538 originally affected and they seem to be fine. This change affects all games so it would be good to get some wide testing on it.
* Address feedback 1, fix an issue
* Workaround: Do not allow copies for format alias.
These should be removed when D32<->R32 copy dependencies become legal
2023-05-12 02:30:47 +02:00
|
|
|
/// <summary>
|
|
|
|
/// Gets a sequence number for resource modification ordering. This increments on each call.
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>A sequence number for resource modification ordering</returns>
|
2024-01-18 18:17:38 +01:00
|
|
|
internal long GetModifiedSequence()
|
GPU: Remove swizzle undefined matching and rework depth aliasing (#4896)
* GPU: Remove swizzle undefined matching and rework depth aliasing
@gdkchan pointed out that UI textures in TOTK seemed to be setting their texture swizzle incorrectly (texture was RGB but was sampling A, swizzle for A was wrong), so I determined that SwizzleComponentMatches was the problem and set on eliminating it. This PR combines existing work to select the most recently modified texture (now used when selecting which aliased texture to use) with some additional changes to remove the swizzle check and support aliased view creation.
The original observation (#1538) was that we wanted to match depth textures for the purposes of aliasing with color textures, but they often had different swizzle from what was sampled (as it's generally the identity swizzle once rendered). At the time, I decided to allow swizzles to match if only the defined components matched, which fixed the issue in all known cases but could easily be broken by a game _expecting_ a given swizzle, such as a 1/0 value on a component.
This error case could also occur in textures that don't even depth alias, such as R11G11B10, as the rule was created to generally apply to all cases.
The solution is now to fail this exact match test, and allow the search for an R32 texture to create a swizzled view of a D32 texture (and other such cases). This allows the creation of a view that mismatches the requested format, which wasn't present before and was the reason for the swizzle matching approach.
The exact match and view creation rules now follow the same rules over what textures to select when there are multiple options (such as a "perfect" match and an "aliased" match at the same time). It now selects the most recently modified texture, which is done with a new sequence number in the GpuContext (because we don't have enough of these).
Reportedly fixes UI having weird coloured backgrounds in TOTK. This also fixes an issue in MK8D where returning from a race resulted in the character selection cubemaps being broken. May work around issues introduced by the "short texture cache" PR due to modification ordering, though they won't be truly fixed.
Should allow (#4365) to avoid copies in more cases. Need to test that.
I tested a bunch of games #1538 originally affected and they seem to be fine. This change affects all games so it would be good to get some wide testing on it.
* Address feedback 1, fix an issue
* Workaround: Do not allow copies for format alias.
These should be removed when D32<->R32 copy dependencies become legal
2023-05-12 02:30:47 +02:00
|
|
|
{
|
|
|
|
return _modifiedSequence++;
|
|
|
|
}
|
|
|
|
|
2022-01-27 22:50:32 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Gets the value of the GPU timer.
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>The current GPU timestamp</returns>
|
2024-01-18 18:17:38 +01:00
|
|
|
internal ulong GetTimestamp()
|
2022-01-27 22:50:32 +01:00
|
|
|
{
|
2023-07-02 02:47:54 +02:00
|
|
|
// Guest timestamp will start at 0, instead of host value.
|
2023-05-17 20:38:59 +02:00
|
|
|
ulong ticks = ConvertNanosecondsToTicks((ulong)PerformanceCounter.ElapsedNanoseconds) - _firstTimestamp;
|
2022-01-27 22:50:32 +01:00
|
|
|
|
|
|
|
if (GraphicsConfig.FastGpuTime)
|
|
|
|
{
|
|
|
|
// Divide by some amount to report time as if operations were performed faster than they really are.
|
|
|
|
// This can prevent some games from switching to a lower resolution because rendering is too slow.
|
|
|
|
ticks /= 256;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ticks;
|
|
|
|
}
|
|
|
|
|
2021-06-29 19:32:02 +02:00
|
|
|
/// <summary>
|
|
|
|
/// Shader cache state update handler.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="state">Current state of the shader cache load process</param>
|
|
|
|
/// <param name="current">Number of the current shader being processed</param>
|
|
|
|
/// <param name="total">Total number of shaders to process</param>
|
|
|
|
private void ShaderCacheStateUpdate(ShaderCacheState state, int current, int total)
|
|
|
|
{
|
|
|
|
ShaderCacheStateChanged?.Invoke(state, current, total);
|
|
|
|
}
|
|
|
|
|
2020-11-13 00:15:34 +01:00
|
|
|
/// <summary>
|
2020-11-17 22:40:19 +01:00
|
|
|
/// Initialize the GPU shader cache.
|
2020-11-13 00:15:34 +01:00
|
|
|
/// </summary>
|
New shader cache implementation (#3194)
* New shader cache implementation
* Remove some debug code
* Take transform feedback varying count into account
* Create shader cache directory if it does not exist + fragment output map related fixes
* Remove debug code
* Only check texture descriptors if the constant buffer is bound
* Also check CPU VA on GetSpanMapped
* Remove more unused code and move cache related code
* XML docs + remove more unused methods
* Better codegen for TransformFeedbackDescriptor.AsSpan
* Support migration from old cache format, remove more unused code
Shader cache rebuild now also rewrites the shared toc and data files
* Fix migration error with BRX shaders
* Add a limit to the async translation queue
Avoid async translation threads not being able to keep up and the queue growing very large
* Re-create specialization state on recompile
This might be required if a new version of the shader translator requires more or less state, or if there is a bug related to the GPU state access
* Make shader cache more error resilient
* Add some missing XML docs and move GpuAccessor docs to the interface/use inheritdoc
* Address early PR feedback
* Fix rebase
* Remove IRenderer.CompileShader and IShader interface, replace with new ShaderSource struct passed to CreateProgram directly
* Handle some missing exceptions
* Make shader cache purge delete both old and new shader caches
* Register textures on new specialization state
* Translate and compile shaders in forward order (eliminates diffs due to different binding numbers)
* Limit in-flight shader compilation to the maximum number of compilation threads
* Replace ParallelDiskCacheLoader state changed event with a callback function
* Better handling for invalid constant buffer 1 data length
* Do not create the old cache directory structure if the old cache does not exist
* Constant buffer use should be per-stage. This change will invalidate existing new caches (file format version was incremented)
* Replace rectangle texture with just coordinate normalization
* Skip incompatible shaders that are missing texture information, instead of crashing
This is required if we, for example, support new texture instruction to the shader translator, and then they allow access to textures that were not accessed before. In this scenario, the old cache entry is no longer usable
* Fix coordinates normalization on cubemap textures
* Check if title ID is null before combining shader cache path
* More robust constant buffer address validation on spec state
* More robust constant buffer address validation on spec state (2)
* Regenerate shader cache with one stream, rather than one per shader.
* Only create shader cache directory during initialization
* Logging improvements
* Proper shader program disposal
* PR feedback, and add a comment on serialized structs
* XML docs for RegisterTexture
Co-authored-by: riperiperi <rhy3756547@hotmail.com>
2022-04-10 15:49:44 +02:00
|
|
|
public void InitializeShaderCache(CancellationToken cancellationToken)
|
2020-11-13 00:15:34 +01:00
|
|
|
{
|
|
|
|
HostInitalized.WaitOne();
|
|
|
|
|
2021-06-29 19:32:02 +02:00
|
|
|
foreach (var physicalMemory in PhysicalMemoryRegistry.Values)
|
|
|
|
{
|
New shader cache implementation (#3194)
* New shader cache implementation
* Remove some debug code
* Take transform feedback varying count into account
* Create shader cache directory if it does not exist + fragment output map related fixes
* Remove debug code
* Only check texture descriptors if the constant buffer is bound
* Also check CPU VA on GetSpanMapped
* Remove more unused code and move cache related code
* XML docs + remove more unused methods
* Better codegen for TransformFeedbackDescriptor.AsSpan
* Support migration from old cache format, remove more unused code
Shader cache rebuild now also rewrites the shared toc and data files
* Fix migration error with BRX shaders
* Add a limit to the async translation queue
Avoid async translation threads not being able to keep up and the queue growing very large
* Re-create specialization state on recompile
This might be required if a new version of the shader translator requires more or less state, or if there is a bug related to the GPU state access
* Make shader cache more error resilient
* Add some missing XML docs and move GpuAccessor docs to the interface/use inheritdoc
* Address early PR feedback
* Fix rebase
* Remove IRenderer.CompileShader and IShader interface, replace with new ShaderSource struct passed to CreateProgram directly
* Handle some missing exceptions
* Make shader cache purge delete both old and new shader caches
* Register textures on new specialization state
* Translate and compile shaders in forward order (eliminates diffs due to different binding numbers)
* Limit in-flight shader compilation to the maximum number of compilation threads
* Replace ParallelDiskCacheLoader state changed event with a callback function
* Better handling for invalid constant buffer 1 data length
* Do not create the old cache directory structure if the old cache does not exist
* Constant buffer use should be per-stage. This change will invalidate existing new caches (file format version was incremented)
* Replace rectangle texture with just coordinate normalization
* Skip incompatible shaders that are missing texture information, instead of crashing
This is required if we, for example, support new texture instruction to the shader translator, and then they allow access to textures that were not accessed before. In this scenario, the old cache entry is no longer usable
* Fix coordinates normalization on cubemap textures
* Check if title ID is null before combining shader cache path
* More robust constant buffer address validation on spec state
* More robust constant buffer address validation on spec state (2)
* Regenerate shader cache with one stream, rather than one per shader.
* Only create shader cache directory during initialization
* Logging improvements
* Proper shader program disposal
* PR feedback, and add a comment on serialized structs
* XML docs for RegisterTexture
Co-authored-by: riperiperi <rhy3756547@hotmail.com>
2022-04-10 15:49:44 +02:00
|
|
|
physicalMemory.ShaderCache.Initialize(cancellationToken);
|
2021-06-29 19:32:02 +02:00
|
|
|
}
|
2024-01-18 18:17:38 +01:00
|
|
|
|
|
|
|
_gpuReadyEvent.Set();
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Waits until the GPU is ready to receive commands.
|
|
|
|
/// </summary>
|
|
|
|
public void WaitUntilGpuReady()
|
|
|
|
{
|
|
|
|
_gpuReadyEvent.WaitOne();
|
2019-10-13 08:02:07 +02:00
|
|
|
}
|
|
|
|
|
2022-01-09 17:28:48 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Sets the current thread as the main GPU thread.
|
|
|
|
/// </summary>
|
|
|
|
public void SetGpuThread()
|
|
|
|
{
|
|
|
|
_gpuThread = Thread.CurrentThread;
|
2022-05-14 16:58:33 +02:00
|
|
|
|
|
|
|
Capabilities = Renderer.GetCapabilities();
|
2022-01-09 17:28:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Checks if the current thread is the GPU thread.
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>True if the thread is the GPU thread, false otherwise</returns>
|
|
|
|
public bool IsGpuThread()
|
|
|
|
{
|
|
|
|
return _gpuThread == Thread.CurrentThread;
|
|
|
|
}
|
|
|
|
|
Add a Multithreading layer for the GAL, multi-thread shader compilation at runtime (#2501)
* Initial Implementation
About as fast as nvidia GL multithreading, can be improved with faster command queuing.
* Struct based command list
Speeds up a bit. Still a lot of time lost to resource copy.
* Do shader init while the render thread is active.
* Introduce circular span pool V1
Ideally should be able to use structs instead of references for storing these spans on commands. Will try that next.
* Refactor SpanRef some more
Use a struct to represent SpanRef, rather than a reference.
* Flush buffers on background thread
* Use a span for UpdateRenderScale.
Much faster than copying the array.
* Calculate command size using reflection
* WIP parallel shaders
* Some minor optimisation
* Only 2 max refs per command now.
The command with 3 refs is gone. :relieved:
* Don't cast on the GPU side
* Remove redundant casts, force sync on window present
* Fix Shader Cache
* Fix host shader save.
* Fixup to work with new renderer stuff
* Make command Run static, use array of delegates as lookup
Profile says this takes less time than the previous way.
* Bring up to date
* Add settings toggle. Fix Muiltithreading Off mode.
* Fix warning.
* Release tracking lock for flushes
* Fix Conditional Render fast path with threaded gal
* Make handle iteration safe when releasing the lock
This is mostly temporary.
* Attempt to set backend threading on driver
Only really works on nvidia before launching a game.
* Fix race condition with BufferModifiedRangeList, exceptions in tracking actions
* Update buffer set commands
* Some cleanup
* Only use stutter workaround when using opengl renderer non-threaded
* Add host-conditional reservation of counter events
There has always been the possibility that conditional rendering could use a query object just as it is disposed by the counter queue. This change makes it so that when the host decides to use host conditional rendering, the query object is reserved so that it cannot be deleted. Counter events can optionally start reserved, as the threaded implementation can reserve them before the backend creates them, and there would otherwise be a short amount of time where the counter queue could dispose the event before a call to reserve it could be made.
* Address Feedback
* Make counter flush tracked again.
Hopefully does not cause any issues this time.
* Wait for FlushTo on the main queue thread.
Currently assumes only one thread will want to FlushTo (in this case, the GPU thread)
* Add SDL2 headless integration
* Add HLE macro commands.
Co-authored-by: Mary <mary@mary.zone>
2021-08-27 00:31:29 +02:00
|
|
|
/// <summary>
|
|
|
|
/// Processes the queue of shaders that must save their binaries to the disk cache.
|
|
|
|
/// </summary>
|
|
|
|
public void ProcessShaderCacheQueue()
|
|
|
|
{
|
|
|
|
foreach (var physicalMemory in PhysicalMemoryRegistry.Values)
|
|
|
|
{
|
|
|
|
physicalMemory.ShaderCache.ProcessShaderCacheQueue();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-31 21:08:20 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Advances internal sequence number.
|
|
|
|
/// This forces the update of any modified GPU resource.
|
|
|
|
/// </summary>
|
2019-10-13 08:02:07 +02:00
|
|
|
internal void AdvanceSequence()
|
|
|
|
{
|
|
|
|
SequenceNumber++;
|
|
|
|
}
|
|
|
|
|
2022-12-01 16:30:13 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Registers a buffer migration. These are checked to see if they can be disposed when the sync number increases,
|
|
|
|
/// and the migration copy has completed.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="migration">The buffer migration</param>
|
|
|
|
internal void RegisterBufferMigration(BufferMigration migration)
|
|
|
|
{
|
|
|
|
BufferMigrations.Add(migration);
|
|
|
|
_pendingSync = true;
|
|
|
|
}
|
|
|
|
|
2021-01-17 21:08:06 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Registers an action to be performed the next time a syncpoint is incremented.
|
|
|
|
/// This will also ensure a host sync object is created, and <see cref="SyncNumber"/> is incremented.
|
|
|
|
/// </summary>
|
2023-05-01 21:05:12 +02:00
|
|
|
/// <param name="action">The resource with action to be performed on sync object creation</param>
|
2022-01-09 17:28:48 +01:00
|
|
|
/// <param name="syncpointOnly">True if the sync action should only run when syncpoints are incremented</param>
|
2023-05-01 21:05:12 +02:00
|
|
|
internal void RegisterSyncAction(ISyncActionHandler action, bool syncpointOnly = false)
|
2021-01-17 21:08:06 +01:00
|
|
|
{
|
2022-01-09 17:28:48 +01:00
|
|
|
if (syncpointOnly)
|
|
|
|
{
|
|
|
|
SyncpointActions.Add(action);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SyncActions.Add(action);
|
2022-12-01 16:30:13 +01:00
|
|
|
_pendingSync = true;
|
2022-01-09 17:28:48 +01:00
|
|
|
}
|
2021-01-17 21:08:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Creates a host sync object if there are any pending sync actions. The actions will then be called.
|
|
|
|
/// If no actions are present, a host sync object is not created.
|
|
|
|
/// </summary>
|
2023-05-01 21:05:12 +02:00
|
|
|
/// <param name="flags">Modifiers for how host sync should be created</param>
|
|
|
|
internal void CreateHostSyncIfNeeded(HostSyncFlags flags)
|
2021-01-17 21:08:06 +01:00
|
|
|
{
|
2023-05-01 21:05:12 +02:00
|
|
|
bool syncpoint = flags.HasFlag(HostSyncFlags.Syncpoint);
|
|
|
|
bool strict = flags.HasFlag(HostSyncFlags.Strict);
|
|
|
|
bool force = flags.HasFlag(HostSyncFlags.Force);
|
|
|
|
|
2022-12-01 16:30:13 +01:00
|
|
|
if (BufferMigrations.Count > 0)
|
|
|
|
{
|
|
|
|
ulong currentSyncNumber = Renderer.GetCurrentSync();
|
|
|
|
|
|
|
|
for (int i = 0; i < BufferMigrations.Count; i++)
|
|
|
|
{
|
|
|
|
BufferMigration migration = BufferMigrations[i];
|
|
|
|
long diff = (long)(currentSyncNumber - migration.SyncNumber);
|
|
|
|
|
|
|
|
if (diff >= 0)
|
|
|
|
{
|
|
|
|
migration.Dispose();
|
|
|
|
BufferMigrations.RemoveAt(i--);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-05-01 21:05:12 +02:00
|
|
|
if (force || _pendingSync || (syncpoint && SyncpointActions.Count > 0))
|
2021-01-17 21:08:06 +01:00
|
|
|
{
|
Vulkan: Don't flush commands when creating most sync (#4087)
* Vulkan: Don't flush commands when creating most sync
When the WaitForIdle method is called, we create sync as some internal GPU method may read back written buffer data. Some games randomly intersperse compute dispatch into their render passes, which result in this happening an unbounded number of times depending on how many times they run compute.
Creating sync in Vulkan is expensive, as we need to flush the current command buffer so that it can be waited on. We have a limited number of active command buffers due to how we track resource usage, so submitting too many command buffers will force us to wait for them to return to the pool.
This PR allows less "important" sync (things which are less likely to be waited on) to wait on a command buffer's result without submitting it, instead relying on AutoFlush or another, more important sync to flush it later on.
Because of the possibility of us waiting for a command buffer that hasn't submitted yet, any thread needs to be able to force the active command buffer to submit. The ability to do this has been added to the backend multithreading via an "Interrupt", though it is not supported without multithreading.
OpenGL drivers should already be doing something similar so they don't blow up when creating lots of sync, which is why this hasn't been a problem for these games over there.
Improves Vulkan performance on Xenoblade DE, Pokemon Scarlet/Violet, and Zelda BOTW (still another large issue here)
* Add strict argument
This is technically a separate concern from whether the sync is a host syncpoint.
* Remove _interrupted variable
* Actually wait for the invoke
This is required by AMD GPUs, and also may have caused some issues on other GPUs.
* Remove unused using.
* I don't know why it added these ones.
* Address Feedback
* Fix typo
2022-12-29 15:39:04 +01:00
|
|
|
Renderer.CreateSync(SyncNumber, strict);
|
2021-01-17 21:08:06 +01:00
|
|
|
|
2024-05-08 13:53:25 +02:00
|
|
|
foreach (var action in SyncActions)
|
|
|
|
{
|
|
|
|
action.SyncPreAction(syncpoint);
|
|
|
|
}
|
|
|
|
foreach (var action in SyncpointActions)
|
|
|
|
{
|
|
|
|
action.SyncPreAction(syncpoint);
|
|
|
|
}
|
2021-01-17 21:08:06 +01:00
|
|
|
|
2023-05-01 21:05:12 +02:00
|
|
|
SyncNumber++;
|
2022-01-09 17:28:48 +01:00
|
|
|
|
2023-05-01 21:05:12 +02:00
|
|
|
SyncActions.RemoveAll(action => action.SyncAction(syncpoint));
|
|
|
|
SyncpointActions.RemoveAll(action => action.SyncAction(syncpoint));
|
2021-01-17 21:08:06 +01:00
|
|
|
}
|
2022-12-01 16:30:13 +01:00
|
|
|
|
|
|
|
_pendingSync = false;
|
2021-01-17 21:08:06 +01:00
|
|
|
}
|
|
|
|
|
2021-06-24 01:51:41 +02:00
|
|
|
/// <summary>
|
2021-06-29 19:32:02 +02:00
|
|
|
/// Performs deferred actions.
|
|
|
|
/// This is useful for actions that must run on the render thread, such as resource disposal.
|
2021-06-24 01:51:41 +02:00
|
|
|
/// </summary>
|
2021-06-29 19:32:02 +02:00
|
|
|
internal void RunDeferredActions()
|
2021-06-24 01:51:41 +02:00
|
|
|
{
|
2021-06-29 19:32:02 +02:00
|
|
|
while (DeferredActions.TryDequeue(out Action action))
|
2021-06-24 01:51:41 +02:00
|
|
|
{
|
2021-06-29 19:32:02 +02:00
|
|
|
action();
|
2021-06-24 01:51:41 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-31 23:09:49 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Disposes all GPU resources currently cached.
|
|
|
|
/// It's an error to push any GPU commands after disposal.
|
|
|
|
/// Additionally, the GPU commands FIFO must be empty for disposal,
|
|
|
|
/// and processing of all commands must have finished.
|
|
|
|
/// </summary>
|
|
|
|
public void Dispose()
|
|
|
|
{
|
2020-07-24 04:53:25 +02:00
|
|
|
GPFifo.Dispose();
|
2020-11-13 00:15:34 +01:00
|
|
|
HostInitalized.Dispose();
|
2024-01-18 18:17:38 +01:00
|
|
|
_gpuReadyEvent.Dispose();
|
POWER - Performance Optimizations With Extensive Ramifications (#2286)
* Refactoring of KMemoryManager class
* Replace some trivial uses of DRAM address with VA
* Get rid of GetDramAddressFromVa
* Abstracting more operations on derived page table class
* Run auto-format on KPageTableBase
* Managed to make TryConvertVaToPa private, few uses remains now
* Implement guest physical pages ref counting, remove manual freeing
* Make DoMmuOperation private and call new abstract methods only from the base class
* Pass pages count rather than size on Map/UnmapMemory
* Change memory managers to take host pointers
* Fix a guest memory leak and simplify KPageTable
* Expose new methods for host range query and mapping
* Some refactoring of MapPagesFromClientProcess to allow proper page ref counting and mapping without KPageLists
* Remove more uses of AddVaRangeToPageList, now only one remains (shared memory page checking)
* Add a SharedMemoryStorage class, will be useful for host mapping
* Sayonara AddVaRangeToPageList, you served us well
* Start to implement host memory mapping (WIP)
* Support memory tracking through host exception handling
* Fix some access violations from HLE service guest memory access and CPU
* Fix memory tracking
* Fix mapping list bugs, including a race and a error adding mapping ranges
* Simple page table for memory tracking
* Simple "volatile" region handle mode
* Update UBOs directly (experimental, rough)
* Fix the overlap check
* Only set non-modified buffers as volatile
* Fix some memory tracking issues
* Fix possible race in MapBufferFromClientProcess (block list updates were not locked)
* Write uniform update to memory immediately, only defer the buffer set.
* Fix some memory tracking issues
* Pass correct pages count on shared memory unmap
* Armeilleure Signal Handler v1 + Unix changes
Unix currently behaves like windows, rather than remapping physical
* Actually check if the host platform is unix
* Fix decommit on linux.
* Implement windows 10 placeholder shared memory, fix a buffer issue.
* Make PTC version something that will never match with master
* Remove testing variable for block count
* Add reference count for memory manager, fix dispose
Can still deadlock with OpenAL
* Add address validation, use page table for mapped check, add docs
Might clean up the page table traversing routines.
* Implement batched mapping/tracking.
* Move documentation, fix tests.
* Cleanup uniform buffer update stuff.
* Remove unnecessary assignment.
* Add unsafe host mapped memory switch
On by default. Would be good to turn this off for untrusted code (homebrew, exefs mods) and give the user the option to turn it on manually, though that requires some UI work.
* Remove C# exception handlers
They have issues due to current .NET limitations, so the meilleure one fully replaces them for now.
* Fix MapPhysicalMemory on the software MemoryManager.
* Null check for GetHostAddress, docs
* Add configuration for setting memory manager mode (not in UI yet)
* Add config to UI
* Fix type mismatch on Unix signal handler code emit
* Fix 6GB DRAM mode.
The size can be greater than `uint.MaxValue` when the DRAM is >4GB.
* Address some feedback.
* More detailed error if backing memory cannot be mapped.
* SetLastError on all OS functions for consistency
* Force pages dirty with UBO update instead of setting them directly.
Seems to be much faster across a few games. Need retesting.
* Rebase, configuration rework, fix mem tracking regression
* Fix race in FreePages
* Set memory managers null after decrementing ref count
* Remove readonly keyword, as this is now modified.
* Use a local variable for the signal handler rather than a register.
* Fix bug with buffer resize, and index/uniform buffer binding.
Should fix flickering in games.
* Add InvalidAccessHandler to MemoryTracking
Doesn't do anything yet
* Call invalid access handler on unmapped read/write.
Same rules as the regular memory manager.
* Make unsafe mapped memory its own MemoryManagerType
* Move FlushUboDirty into UpdateState.
* Buffer dirty cache, rather than ubo cache
Much cleaner, may be reusable for Inline2Memory updates.
* This doesn't return anything anymore.
* Add sigaction remove methods, correct a few function signatures.
* Return empty list of physical regions for size 0.
* Also on AddressSpaceManager
Co-authored-by: gdkchan <gab.dark.100@gmail.com>
2021-05-24 22:52:44 +02:00
|
|
|
|
2021-06-29 19:32:02 +02:00
|
|
|
// Has to be disposed before processing deferred actions, as it will produce some.
|
|
|
|
foreach (var physicalMemory in PhysicalMemoryRegistry.Values)
|
|
|
|
{
|
|
|
|
physicalMemory.Dispose();
|
|
|
|
}
|
|
|
|
|
2023-07-11 19:07:41 +02:00
|
|
|
SupportBufferUpdater.Dispose();
|
|
|
|
|
2021-06-29 19:32:02 +02:00
|
|
|
PhysicalMemoryRegistry.Clear();
|
|
|
|
|
|
|
|
RunDeferredActions();
|
2023-05-31 23:43:20 +02:00
|
|
|
|
|
|
|
Renderer.Dispose();
|
2019-12-31 23:09:49 +01:00
|
|
|
}
|
2019-10-13 08:02:07 +02:00
|
|
|
}
|
2023-07-02 02:47:54 +02:00
|
|
|
}
|