Add comments on caching (#1829)

This commit is contained in:
srkizer 2024-06-07 15:42:38 +09:00 committed by GitHub
parent a1b8ff9141
commit 5365dd14d8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 3 deletions

View file

@ -20,6 +20,8 @@ public interface ISharedImmediateTexture
/// <returns>An instance of <see cref="IDalamudTextureWrap"/> that is guaranteed to be available for the current
/// frame being drawn.</returns>
/// <remarks>
/// <para>Do not cache the result of this function across draw calls for different frames.
/// <see cref="ISharedImmediateTexture"/>s may be cached, but the performance benefit will be minimal.</para>
/// <para>Calling outside the main thread will fail.</para>
/// <para>This function does not throw.</para>
/// <para><see cref="IDisposable.Dispose"/> will be ignored.</para>
@ -35,6 +37,8 @@ public interface ISharedImmediateTexture
/// <returns>An instance of <see cref="IDalamudTextureWrap"/> that is guaranteed to be available for the current
/// frame being drawn.</returns>
/// <remarks>
/// <para>Do not cache the result of this function across draw calls for different frames.
/// <see cref="ISharedImmediateTexture"/>s may be cached, but the performance benefit will be minimal.</para>
/// <para>Calling outside the main thread will fail.</para>
/// <para>This function does not throw.</para>
/// <para><see cref="IDisposable.Dispose"/> will be ignored.</para>
@ -50,6 +54,8 @@ public interface ISharedImmediateTexture
/// <returns><c>true</c> if <paramref name="texture"/> points to the loaded texture; <c>false</c> if the texture is
/// still being loaded, or the load has failed.</returns>
/// <remarks>
/// <para>Do not cache the result of this function across draw calls for different frames.
/// <see cref="ISharedImmediateTexture"/>s may be cached, but the performance benefit will be minimal.</para>
/// <para>Calling outside the main thread will fail.</para>
/// <para>This function does not throw.</para>
/// <para><see cref="IDisposable.Dispose"/> on the returned <paramref name="texture"/> will be ignored.</para>

View file

@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Reflection;
@ -189,6 +189,7 @@ public interface ITextureProvider
/// <remarks>
/// <para>This function is under the effect of <see cref="ITextureSubstitutionProvider.GetSubstitutedPath"/>.</para>
/// <para>This function does not throw exceptions.</para>
/// <para>Caching the returned object is not recommended. Performance benefit will be minimal.</para>
/// </remarks>
ISharedImmediateTexture GetFromGameIcon(in GameIconLookup lookup);
@ -198,20 +199,27 @@ public interface ITextureProvider
/// <remarks>
/// <para>This function is under the effect of <see cref="ITextureSubstitutionProvider.GetSubstitutedPath"/>.</para>
/// <para>This function does not throw exceptions.</para>
/// <para>Caching the returned object is not recommended. Performance benefit will be minimal.</para>
/// </remarks>
ISharedImmediateTexture GetFromGame(string path);
/// <summary>Gets a shared texture corresponding to the given file on the filesystem.</summary>
/// <param name="path">A path to a file on the filesystem.</param>
/// <returns>The shared texture that you may use to obtain the loaded texture wrap and load states.</returns>
/// <remarks><para>This function does not throw exceptions.</para></remarks>
/// <remarks>
/// <para>This function does not throw exceptions.</para>
/// <para>Caching the returned object is not recommended. Performance benefit will be minimal.</para>
/// </remarks>
ISharedImmediateTexture GetFromFile(string path);
/// <summary>Gets a shared texture corresponding to the given file of the assembly manifest resources.</summary>
/// <param name="assembly">The assembly containing manifest resources.</param>
/// <param name="name">The case-sensitive name of the manifest resource being requested.</param>
/// <returns>The shared texture that you may use to obtain the loaded texture wrap and load states.</returns>
/// <remarks><para>This function does not throw exceptions.</para></remarks>
/// <remarks>
/// <para>This function does not throw exceptions.</para>
/// <para>Caching the returned object is not recommended. Performance benefit will be minimal.</para>
/// </remarks>
ISharedImmediateTexture GetFromManifestResource(Assembly assembly, string name);
/// <summary>Get a path for a specific icon's .tex file.</summary>