diff options
author | gdkchan <gab.dark.100@gmail.com> | 2019-12-29 20:26:37 -0300 |
---|---|---|
committer | Thog <thog@protonmail.com> | 2020-01-09 02:13:00 +0100 |
commit | 32764f95602611e9daa50362330d760e8ed83fda (patch) | |
tree | f15d3c93714e45c88bce8bc177c3448ebaf518f8 /Ryujinx.Graphics.Gpu/Image/TexturePool.cs | |
parent | 53bbc1311f9819ac70fd51ae016e8c2070268086 (diff) |
Add XML documentation to Ryujinx.Graphics.Gpu.Image
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Image/TexturePool.cs')
-rw-r--r-- | Ryujinx.Graphics.Gpu/Image/TexturePool.cs | 58 |
1 files changed, 52 insertions, 6 deletions
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 { + /// <summary> + /// Texture pool. + /// </summary> class TexturePool : Pool<Texture> { - public LinkedListNode<TexturePool> CacheNode { get; set; } - private int _sequenceNumber; - public TexturePool( - GpuContext context, - ulong address, - int maximumId) : base(context, address, maximumId) { } + /// <summary> + /// Intrusive linked list node used on the texture pool cache. + /// </summary> + public LinkedListNode<TexturePool> CacheNode { get; set; } + /// <summary> + /// Constructs a new instance of the texture pool. + /// </summary> + /// <param name="context">GPU context that the texture pool belongs to</param> + /// <param name="address">Address of the texture pool in guest memory</param> + /// <param name="maximumId">Maximum texture ID of the texture pool (equal to maximum textures minus one)</param> + public TexturePool(GpuContext context, ulong address, int maximumId) : base(context, address, maximumId) { } + + /// <summary> + /// Gets the texture with the given ID. + /// </summary> + /// <param name="id">ID of the texture. This is effectively a zero-based index</param> + /// <returns>The texture with the given ID</returns> public override Texture Get(int id) { if ((uint)id >= Items.Length) @@ -62,6 +76,11 @@ namespace Ryujinx.Graphics.Gpu.Image return texture; } + /// <summary> + /// Gets the texture descriptor from a given texture ID. + /// </summary> + /// <param name="id">ID of the texture. This is effectively a zero-based index</param> + /// <returns>The texture descriptor</returns> public TextureDescriptor GetDescriptor(int id) { ulong address = Address + (ulong)(uint)id * DescriptorSize; @@ -71,6 +90,11 @@ namespace Ryujinx.Graphics.Gpu.Image return MemoryMarshal.Cast<byte, TextureDescriptor>(data)[0]; } + /// <summary> + /// Implementation of the texture pool range invalidation. + /// </summary> + /// <param name="address">Start address of the range of the texture pool</param> + /// <param name="size">Size of the range being invalidated</param> protected override void InvalidateRangeImpl(ulong address, ulong size) { ulong endAddress = address + size; @@ -101,6 +125,11 @@ namespace Ryujinx.Graphics.Gpu.Image } } + /// <summary> + /// Gets texture information from a texture descriptor. + /// </summary> + /// <param name="descriptor">The texture descriptor</param> + /// <returns>The texture information</returns> private TextureInfo GetInfo(TextureDescriptor descriptor) { ulong address = Context.MemoryManager.Translate(descriptor.UnpackAddress()); @@ -172,6 +201,13 @@ namespace Ryujinx.Graphics.Gpu.Image swizzleA); } + /// <summary> + /// 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. + /// </summary> + /// <param name="format">The format of the texture</param> + /// <param name="components">The texture swizzle components</param> + /// <returns>The depth-stencil mode</returns> private static DepthStencilMode GetDepthStencilMode(Format format, params SwizzleComponent[] components) { // R = Depth, G = Stencil. @@ -205,12 +241,22 @@ namespace Ryujinx.Graphics.Gpu.Image } } + /// <summary> + /// Checks if the swizzle component is equal to the red or green channels. + /// </summary> + /// <param name="component">The swizzle component to check</param> + /// <returns>True if the swizzle component is equal to the red or blue, false otherwise</returns> private static bool IsRG(SwizzleComponent component) { return component == SwizzleComponent.Red || component == SwizzleComponent.Green; } + /// <summary> + /// Decrements the reference count of the texture. + /// This indicates that the texture pool is not using it anymore. + /// </summary> + /// <param name="item">The texture to be deleted</param> protected override void Delete(Texture item) { item?.DecrementReferenceCount(); |