aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Gpu/Window.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2021-01-17 15:44:34 -0300
committerGitHub <noreply@github.com>2021-01-17 19:44:34 +0100
commitc4f56c570494a6186792439e3c0e74458cc82b5c (patch)
tree40be96f5f3f24b711e088bf2ca681d94aac68c15 /Ryujinx.Graphics.Gpu/Window.cs
parent3bad321d2b0994cd19129bc18ed98bb3ab81c3b0 (diff)
Support for resources on non-contiguous GPU memory regions (#1905)
* Support for resources on non-contiguous GPU memory regions * Implement MultiRange physical addresses, only used with a single range for now * Actually use non-contiguous ranges * GetPhysicalRegions fixes * Documentation and remove Address property from TextureInfo * Finish implementing GetWritableRegion * Fix typo
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Window.cs')
-rw-r--r--Ryujinx.Graphics.Gpu/Window.cs31
1 files changed, 28 insertions, 3 deletions
diff --git a/Ryujinx.Graphics.Gpu/Window.cs b/Ryujinx.Graphics.Gpu/Window.cs
index 9d269356..ad70adfd 100644
--- a/Ryujinx.Graphics.Gpu/Window.cs
+++ b/Ryujinx.Graphics.Gpu/Window.cs
@@ -1,5 +1,7 @@
using Ryujinx.Graphics.GAL;
using Ryujinx.Graphics.Gpu.Image;
+using Ryujinx.Graphics.Texture;
+using Ryujinx.Memory.Range;
using System;
using System.Collections.Concurrent;
using System.Threading;
@@ -26,6 +28,11 @@ namespace Ryujinx.Graphics.Gpu
public TextureInfo Info { get; }
/// <summary>
+ /// Physical memory locations where the texture data is located.
+ /// </summary>
+ public MultiRange Range { get; }
+
+ /// <summary>
/// Texture crop region.
/// </summary>
public ImageCrop Crop { get; }
@@ -49,18 +56,21 @@ namespace Ryujinx.Graphics.Gpu
/// Creates a new instance of the presentation texture.
/// </summary>
/// <param name="info">Information of the texture to be presented</param>
+ /// <param name="range">Physical memory locations where the texture data is located</param>
/// <param name="crop">Texture crop region</param>
/// <param name="acquireCallback">Texture acquire callback</param>
/// <param name="releaseCallback">Texture release callback</param>
/// <param name="userObj">User defined object passed to the release callback, can be used to identify the texture</param>
public PresentationTexture(
TextureInfo info,
+ MultiRange range,
ImageCrop crop,
Action<GpuContext, object> acquireCallback,
Action<object> releaseCallback,
object userObj)
{
Info = info;
+ Range = range;
Crop = crop;
AcquireCallback = acquireCallback;
ReleaseCallback = releaseCallback;
@@ -118,7 +128,7 @@ namespace Ryujinx.Graphics.Gpu
FormatInfo formatInfo = new FormatInfo(format, 1, 1, bytesPerPixel, 4);
TextureInfo info = new TextureInfo(
- address,
+ 0UL,
width,
height,
1,
@@ -133,7 +143,22 @@ namespace Ryujinx.Graphics.Gpu
Target.Texture2D,
formatInfo);
- _frameQueue.Enqueue(new PresentationTexture(info, crop, acquireCallback, releaseCallback, userObj));
+ int size = SizeCalculator.GetBlockLinearTextureSize(
+ width,
+ height,
+ 1,
+ 1,
+ 1,
+ 1,
+ 1,
+ bytesPerPixel,
+ gobBlocksInY,
+ 1,
+ 1).TotalSize;
+
+ MultiRange range = new MultiRange(address, (ulong)size);
+
+ _frameQueue.Enqueue(new PresentationTexture(info, range, crop, acquireCallback, releaseCallback, userObj));
}
/// <summary>
@@ -149,7 +174,7 @@ namespace Ryujinx.Graphics.Gpu
{
pt.AcquireCallback(_context, pt.UserObj);
- Texture texture = _context.Methods.TextureManager.FindOrCreateTexture(pt.Info, TextureSearchFlags.WithUpscale);
+ Texture texture = _context.Methods.TextureManager.FindOrCreateTexture(TextureSearchFlags.WithUpscale, pt.Info, 0, null, pt.Range);
texture.SynchronizeMemory();