mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-30 12:23:39 +01:00
DalamudAssetManager: avoid locks and lookups (#2015)
* Made DalamudAsset-to-something tables into arrays from dictionaries. Number of items in the DalamudAsset enum aren't many, and the numbers are small enough that implementing lookup tables as arrays aren't wasting much memory space. * Removed locking from asset accessors, while still guaranteeing that the load operation happens only once per asset. * ISharedImmediateTexture: made it not even access assets if textures are available.
This commit is contained in:
parent
981387504b
commit
8822810229
8 changed files with 168 additions and 145 deletions
|
|
@ -171,17 +171,14 @@ internal abstract class SharedImmediateTexture
|
|||
|
||||
/// <inheritdoc/>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public IDalamudTextureWrap GetWrapOrEmpty() => this.GetWrapOrDefault(Service<DalamudAssetManager>.Get().Empty4X4);
|
||||
public IDalamudTextureWrap GetWrapOrEmpty() =>
|
||||
this.TryGetWrap(out var texture, out _) ? texture : Service<DalamudAssetManager>.Get().Empty4X4;
|
||||
|
||||
/// <inheritdoc/>
|
||||
[return: NotNullIfNotNull(nameof(defaultWrap))]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public IDalamudTextureWrap? GetWrapOrDefault(IDalamudTextureWrap? defaultWrap)
|
||||
{
|
||||
if (!this.TryGetWrap(out var texture, out _))
|
||||
texture = null;
|
||||
return texture ?? defaultWrap;
|
||||
}
|
||||
public IDalamudTextureWrap? GetWrapOrDefault(IDalamudTextureWrap? defaultWrap) =>
|
||||
this.TryGetWrap(out var texture, out _) ? texture : defaultWrap;
|
||||
|
||||
/// <inheritdoc/>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue