aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Graphics.Texture/LayoutConverter.cs
diff options
context:
space:
mode:
authorjhorv <38920027+jhorv@users.noreply.github.com>2024-08-03 14:50:53 -0400
committerGitHub <noreply@github.com>2024-08-03 19:50:53 +0100
commit59ddb26628fc2ab94f1c274a254c76b3e368f8b6 (patch)
tree57a91040e67a4afb1aec5350704990592efe1acc /src/Ryujinx.Graphics.Texture/LayoutConverter.cs
parent83fda10f6ef68950de395b5f9f6ab0bf58adced4 (diff)
replace ByteMemoryPool usage in Ryujinx.Graphics (#7129)
* chore: replace `ByteMemoryPool` usage with `MemoryOwner<byte>` * refactor: `PixelConverter.ConvertR4G4ToR4G4B4A4()` - rename old `outputSpan` to `outputSpanUInt16`, reuse same output `Span<byte>` as newly-freed name `outputSpan` * eliminate temporary buffer allocations * chore, perf: use MemoryOwner<byte> instead of IMemoryOwner<byte>
Diffstat (limited to 'src/Ryujinx.Graphics.Texture/LayoutConverter.cs')
-rw-r--r--src/Ryujinx.Graphics.Texture/LayoutConverter.cs13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/Ryujinx.Graphics.Texture/LayoutConverter.cs b/src/Ryujinx.Graphics.Texture/LayoutConverter.cs
index d6732674..5426af20 100644
--- a/src/Ryujinx.Graphics.Texture/LayoutConverter.cs
+++ b/src/Ryujinx.Graphics.Texture/LayoutConverter.cs
@@ -1,7 +1,6 @@
using Ryujinx.Common;
using Ryujinx.Common.Memory;
using System;
-using System.Buffers;
using System.Runtime.Intrinsics;
using static Ryujinx.Graphics.Texture.BlockLinearConstants;
@@ -95,7 +94,7 @@ namespace Ryujinx.Graphics.Texture
};
}
- public static IMemoryOwner<byte> ConvertBlockLinearToLinear(
+ public static MemoryOwner<byte> ConvertBlockLinearToLinear(
int width,
int height,
int depth,
@@ -121,8 +120,8 @@ namespace Ryujinx.Graphics.Texture
blockHeight,
bytesPerPixel);
- IMemoryOwner<byte> outputOwner = ByteMemoryPool.Rent(outSize);
- Span<byte> output = outputOwner.Memory.Span;
+ MemoryOwner<byte> outputOwner = MemoryOwner<byte>.Rent(outSize);
+ Span<byte> output = outputOwner.Span;
int outOffs = 0;
@@ -249,7 +248,7 @@ namespace Ryujinx.Graphics.Texture
return outputOwner;
}
- public static IMemoryOwner<byte> ConvertLinearStridedToLinear(
+ public static MemoryOwner<byte> ConvertLinearStridedToLinear(
int width,
int height,
int blockWidth,
@@ -265,8 +264,8 @@ namespace Ryujinx.Graphics.Texture
int outStride = BitUtils.AlignUp(w * bytesPerPixel, HostStrideAlignment);
lineSize = Math.Min(lineSize, outStride);
- IMemoryOwner<byte> output = ByteMemoryPool.Rent(h * outStride);
- Span<byte> outSpan = output.Memory.Span;
+ MemoryOwner<byte> output = MemoryOwner<byte>.Rent(h * outStride);
+ Span<byte> outSpan = output.Span;
int outOffs = 0;
int inOffs = 0;