Memory Changes part 2 (ryubing/ryujinx!123)

See merge request ryubing/ryujinx!123
This commit is contained in:
LotP
2025-08-25 17:44:15 -05:00
parent d499449f57
commit 50ab108ee1
90 changed files with 2133 additions and 1159 deletions

View File

@@ -17,12 +17,12 @@ namespace Ryujinx.Graphics.Vic.Image
ResourceManager rm,
ref SlotConfig config,
ref SlotSurfaceConfig surfaceConfig,
ref Array8<PlaneOffsets> offsets)
Span<PlaneOffsets> offsets)
{
switch (surfaceConfig.SlotPixelFormat)
{
case PixelFormat.Y8___V8U8_N420:
return ReadNv12(rm, ref config, ref surfaceConfig, ref offsets);
return ReadNv12(rm, ref config, ref surfaceConfig, offsets);
}
Logger.Error?.Print(LogClass.Vic, $"Unsupported pixel format \"{surfaceConfig.SlotPixelFormat}\".");
@@ -37,9 +37,9 @@ namespace Ryujinx.Graphics.Vic.Image
ResourceManager rm,
ref SlotConfig config,
ref SlotSurfaceConfig surfaceConfig,
ref Array8<PlaneOffsets> offsets)
Span<PlaneOffsets> offsets)
{
InputSurface input = ReadSurface(rm, ref config, ref surfaceConfig, ref offsets, 1, 2);
InputSurface input = ReadSurface(rm, ref config, ref surfaceConfig, offsets, 1, 2);
int width = input.Width;
int height = input.Height;
@@ -273,7 +273,7 @@ namespace Ryujinx.Graphics.Vic.Image
ResourceManager rm,
ref SlotConfig config,
ref SlotSurfaceConfig surfaceConfig,
ref Array8<PlaneOffsets> offsets,
Span<PlaneOffsets> offsets,
int bytesPerPixel,
int planes)
{
@@ -301,17 +301,17 @@ namespace Ryujinx.Graphics.Vic.Image
if (planes > 0)
{
surface.SetBuffer0(ReadBuffer(rm, ref config, ref offsets, linear, 0, lw, lh, bytesPerPixel, gobBlocksInY));
surface.SetBuffer0(ReadBuffer(rm, ref config, offsets, linear, 0, lw, lh, bytesPerPixel, gobBlocksInY));
}
if (planes > 1)
{
surface.SetBuffer1(ReadBuffer(rm, ref config, ref offsets, linear, 1, cw, ch, planes == 2 ? 2 : 1, gobBlocksInY));
surface.SetBuffer1(ReadBuffer(rm, ref config, offsets, linear, 1, cw, ch, planes == 2 ? 2 : 1, gobBlocksInY));
}
if (planes > 2)
{
surface.SetBuffer2(ReadBuffer(rm, ref config, ref offsets, linear, 2, cw, ch, 1, gobBlocksInY));
surface.SetBuffer2(ReadBuffer(rm, ref config, offsets, linear, 2, cw, ch, 1, gobBlocksInY));
}
return surface;
@@ -320,7 +320,7 @@ namespace Ryujinx.Graphics.Vic.Image
private static RentedBuffer ReadBuffer(
ResourceManager rm,
scoped ref SlotConfig config,
scoped ref Array8<PlaneOffsets> offsets,
Span<PlaneOffsets> offsets,
bool linear,
int plane,
int width,

View File

@@ -35,18 +35,21 @@ namespace Ryujinx.Graphics.Vic
config.OutputSurfaceConfig.OutSurfaceWidth + 1,
config.OutputSurfaceConfig.OutSurfaceHeight + 1);
for (int i = 0; i < config.SlotStruct.Length; i++)
Span<SlotStruct> slotStructSpan = config.SlotStruct.AsSpan();
Span<Array8<PlaneOffsets>> setSurfacexSlotxSpan = _state.State.SetSurfacexSlotx.AsSpan();
for (int i = 0; i < slotStructSpan.Length; i++)
{
ref SlotStruct slot = ref config.SlotStruct[i];
ref SlotStruct slot = ref slotStructSpan[i];
if (!slot.SlotConfig.SlotEnable)
{
continue;
}
ref Array8<PlaneOffsets> offsets = ref _state.State.SetSurfacexSlotx[i];
Span<PlaneOffsets> offsets = setSurfacexSlotxSpan[i].AsSpan();
using Surface src = SurfaceReader.Read(_rm, ref slot.SlotConfig, ref slot.SlotSurfaceConfig, ref offsets);
using Surface src = SurfaceReader.Read(_rm, ref slot.SlotConfig, ref slot.SlotSurfaceConfig, offsets);
int x1 = config.OutputConfig.TargetRectLeft;
int y1 = config.OutputConfig.TargetRectTop;