From 32764f95602611e9daa50362330d760e8ed83fda Mon Sep 17 00:00:00 2001 From: gdkchan Date: Sun, 29 Dec 2019 20:26:37 -0300 Subject: Add XML documentation to Ryujinx.Graphics.Gpu.Image --- Ryujinx.Graphics.Gpu/Image/TexturePool.cs | 58 +++++++++++++++++++++++++++---- 1 file changed, 52 insertions(+), 6 deletions(-) (limited to 'Ryujinx.Graphics.Gpu/Image/TexturePool.cs') diff --git a/Ryujinx.Graphics.Gpu/Image/TexturePool.cs b/Ryujinx.Graphics.Gpu/Image/TexturePool.cs index f6fa5069..91f6338f 100644 --- a/Ryujinx.Graphics.Gpu/Image/TexturePool.cs +++ b/Ryujinx.Graphics.Gpu/Image/TexturePool.cs @@ -7,17 +7,31 @@ using System.Runtime.InteropServices; namespace Ryujinx.Graphics.Gpu.Image { + /// + /// Texture pool. + /// class TexturePool : Pool { - public LinkedListNode CacheNode { get; set; } - private int _sequenceNumber; - public TexturePool( - GpuContext context, - ulong address, - int maximumId) : base(context, address, maximumId) { } + /// + /// Intrusive linked list node used on the texture pool cache. + /// + public LinkedListNode CacheNode { get; set; } + /// + /// Constructs a new instance of the texture pool. + /// + /// GPU context that the texture pool belongs to + /// Address of the texture pool in guest memory + /// Maximum texture ID of the texture pool (equal to maximum textures minus one) + public TexturePool(GpuContext context, ulong address, int maximumId) : base(context, address, maximumId) { } + + /// + /// Gets the texture with the given ID. + /// + /// ID of the texture. This is effectively a zero-based index + /// The texture with the given ID public override Texture Get(int id) { if ((uint)id >= Items.Length) @@ -62,6 +76,11 @@ namespace Ryujinx.Graphics.Gpu.Image return texture; } + /// + /// Gets the texture descriptor from a given texture ID. + /// + /// ID of the texture. This is effectively a zero-based index + /// The texture descriptor public TextureDescriptor GetDescriptor(int id) { ulong address = Address + (ulong)(uint)id * DescriptorSize; @@ -71,6 +90,11 @@ namespace Ryujinx.Graphics.Gpu.Image return MemoryMarshal.Cast(data)[0]; } + /// + /// Implementation of the texture pool range invalidation. + /// + /// Start address of the range of the texture pool + /// Size of the range being invalidated protected override void InvalidateRangeImpl(ulong address, ulong size) { ulong endAddress = address + size; @@ -101,6 +125,11 @@ namespace Ryujinx.Graphics.Gpu.Image } } + /// + /// Gets texture information from a texture descriptor. + /// + /// The texture descriptor + /// The texture information private TextureInfo GetInfo(TextureDescriptor descriptor) { ulong address = Context.MemoryManager.Translate(descriptor.UnpackAddress()); @@ -172,6 +201,13 @@ namespace Ryujinx.Graphics.Gpu.Image swizzleA); } + /// + /// Gets the texture depth-stencil mode, based on the swizzle components of each color channel. + /// The depth-stencil mode is determined based on how the driver sets those parameters. + /// + /// The format of the texture + /// The texture swizzle components + /// The depth-stencil mode private static DepthStencilMode GetDepthStencilMode(Format format, params SwizzleComponent[] components) { // R = Depth, G = Stencil. @@ -205,12 +241,22 @@ namespace Ryujinx.Graphics.Gpu.Image } } + /// + /// Checks if the swizzle component is equal to the red or green channels. + /// + /// The swizzle component to check + /// True if the swizzle component is equal to the red or blue, false otherwise private static bool IsRG(SwizzleComponent component) { return component == SwizzleComponent.Red || component == SwizzleComponent.Green; } + /// + /// Decrements the reference count of the texture. + /// This indicates that the texture pool is not using it anymore. + /// + /// The texture to be deleted protected override void Delete(Texture item) { item?.DecrementReferenceCount(); -- cgit v1.2.3