aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Gpu/Window.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Window.cs')
-rw-r--r--Ryujinx.Graphics.Gpu/Window.cs60
1 files changed, 57 insertions, 3 deletions
diff --git a/Ryujinx.Graphics.Gpu/Window.cs b/Ryujinx.Graphics.Gpu/Window.cs
index d5494aa4..29c36248 100644
--- a/Ryujinx.Graphics.Gpu/Window.cs
+++ b/Ryujinx.Graphics.Gpu/Window.cs
@@ -7,17 +7,45 @@ namespace Ryujinx.Graphics.Gpu
{
using Texture = Image.Texture;
+ /// <summary>
+ /// GPU image presentation window.
+ /// </summary>
public class Window
{
private readonly GpuContext _context;
+ /// <summary>
+ /// Texture presented on the window.
+ /// </summary>
private struct PresentationTexture
{
- public TextureInfo Info { get; }
- public ImageCrop Crop { get; }
+ /// <summary>
+ /// Texture information.
+ /// </summary>
+ public TextureInfo Info { get; }
+
+ /// <summary>
+ /// Texture crop region.
+ /// </summary>
+ public ImageCrop Crop { get; }
+
+ /// <summary>
+ /// Texture release callback.
+ /// </summary>
public Action<object> Callback { get; }
- public object UserObj { get; }
+ /// <summary>
+ /// User defined object, passed to the release callback.
+ /// </summary>
+ public object UserObj { get; }
+
+ /// <summary>
+ /// Creates a new instance of the presentation texture.
+ /// </summary>
+ /// <param name="info">Information of the texture to be presented</param>
+ /// <param name="crop">Texture crop region</param>
+ /// <param name="callback">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,
ImageCrop crop,
@@ -33,6 +61,10 @@ namespace Ryujinx.Graphics.Gpu
private readonly ConcurrentQueue<PresentationTexture> _frameQueue;
+ /// <summary>
+ /// Creates a new instance of the GPU presentation window.
+ /// </summary>
+ /// <param name="context">GPU emulation context</param>
public Window(GpuContext context)
{
_context = context;
@@ -40,6 +72,23 @@ namespace Ryujinx.Graphics.Gpu
_frameQueue = new ConcurrentQueue<PresentationTexture>();
}
+ /// <summary>
+ /// Enqueues a frame for presentation.
+ /// This method is thread safe and can be called from any thread.
+ /// When the texture is presented and not needed anymore, the release callback is called.
+ /// It's an error to modify the texture after calling this method, before the release callback is called.
+ /// </summary>
+ /// <param name="address">CPU virtual address of the texture data</param>
+ /// <param name="width">Texture width</param>
+ /// <param name="height">Texture height</param>
+ /// <param name="stride">Texture stride for linear texture, should be zero otherwise</param>
+ /// <param name="isLinear">Indicates if the texture is linear, normally false</param>
+ /// <param name="gobBlocksInY">GOB blocks in the Y direction, for block linear textures</param>
+ /// <param name="format">Texture format</param>
+ /// <param name="bytesPerPixel">Texture format bytes per pixel (must match the format)</param>
+ /// <param name="crop">Texture crop region</param>
+ /// <param name="callback">Texture release callback</param>
+ /// <param name="userObj">User defined object passed to the release callback</param>
public void EnqueueFrameThreadSafe(
ulong address,
int width,
@@ -74,6 +123,11 @@ namespace Ryujinx.Graphics.Gpu
_frameQueue.Enqueue(new PresentationTexture(info, crop, callback, userObj));
}
+ /// <summary>
+ /// Presents a texture on the queue.
+ /// If the queue is empty, then no texture is presented.
+ /// </summary>
+ /// <param name="swapBuffersCallback">Callback method to call when a new texture should be presented on the screen</param>
public void Present(Action swapBuffersCallback)
{
_context.AdvanceSequence();