Use concrete types when possible for improved performance

This commit is contained in:
Marco Carvalho
2025-01-05 11:54:53 -03:00
parent 850df38f1e
commit c80c397967
45 changed files with 150 additions and 171 deletions

View File

@@ -379,8 +379,8 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
/// <param name="hash">Code and constant buffer data hash</param>
/// <returns>Entry index</returns>
private int WriteNewEntry(
Stream tocFileStream,
Stream dataFileStream,
FileStream tocFileStream,
FileStream dataFileStream,
ref TocHeader header,
ReadOnlySpan<byte> data,
ReadOnlySpan<byte> cb1Data,

View File

@@ -746,7 +746,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
/// <param name="magic">Magic value to be written</param>
/// <param name="codegenVersion">Shader codegen version, only valid for the host file</param>
/// <param name="timestamp">File creation timestamp</param>
private static void CreateToc(Stream tocFileStream, ref TocHeader header, uint magic, uint codegenVersion, ulong timestamp)
private static void CreateToc(FileStream tocFileStream, ref TocHeader header, uint magic, uint codegenVersion, ulong timestamp)
{
BinarySerializer writer = new(tocFileStream);

View File

@@ -1,3 +1,4 @@
using Microsoft.IO;
using Ryujinx.Common;
using Ryujinx.Common.Memory;
using Ryujinx.Graphics.GAL;
@@ -12,7 +13,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
{
public static byte[] Pack(ShaderSource[] sources)
{
using MemoryStream output = MemoryStreamManager.Shared.GetStream();
using RecyclableMemoryStream output = MemoryStreamManager.Shared.GetStream();
output.Write(sources.Length);