diff --git a/Dalamud/DalamudAsset.cs b/Dalamud/DalamudAsset.cs
index 15d342962..0d91a4b75 100644
--- a/Dalamud/DalamudAsset.cs
+++ b/Dalamud/DalamudAsset.cs
@@ -14,20 +14,20 @@ public enum DalamudAsset
///
/// Nothing.
///
- [DalamudAsset(DalamudAssetPurpose.Empty, data: new byte[0])]
+ [DalamudAsset(DalamudAssetPurpose.Empty, data: [])]
Unspecified = 0,
///
- /// : The fallback empty texture.
+ /// : A texture that is completely transparent.
///
- [DalamudAsset(DalamudAssetPurpose.TextureFromRaw, data: new byte[] { 0, 0, 0, 0, 0, 0, 0, 0 })]
+ [DalamudAsset(DalamudAssetPurpose.TextureFromRaw, data: [0, 0, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF])]
[DalamudAssetRawTexture(4, 4, DXGI_FORMAT.DXGI_FORMAT_BC1_UNORM, 8)]
Empty4X4 = 1000,
///
- /// : The fallback empty texture.
+ /// : A texture that is completely white.
///
- [DalamudAsset(DalamudAssetPurpose.TextureFromRaw, data: new byte[] { 0xFF, 0xFF, 0xFF, 0xFF, 0, 0, 0, 0 })]
+ [DalamudAsset(DalamudAssetPurpose.TextureFromRaw, data: [0xFF, 0xFF, 0xFF, 0xFF, 0, 0, 0, 0])]
[DalamudAssetRawTexture(4, 4, DXGI_FORMAT.DXGI_FORMAT_BC1_UNORM, 8)]
White4X4 = 1014,
diff --git a/Dalamud/Interface/Internal/Windows/Data/Widgets/TexWidget.cs b/Dalamud/Interface/Internal/Windows/Data/Widgets/TexWidget.cs
index a889d2a24..0d2b744b4 100644
--- a/Dalamud/Interface/Internal/Windows/Data/Widgets/TexWidget.cs
+++ b/Dalamud/Interface/Internal/Windows/Data/Widgets/TexWidget.cs
@@ -525,7 +525,6 @@ internal class TexWidget : IDataWindowWidget
ImGui.TableSetupColumn("Source", ImGuiTableColumnFlags.WidthStretch);
ImGui.TableSetupColumn("RefCount", ImGuiTableColumnFlags.WidthFixed, ImGui.CalcTextSize("RefCount__").X);
ImGui.TableSetupColumn("SelfRef", ImGuiTableColumnFlags.WidthFixed, ImGui.CalcTextSize("00.000___").X);
- ImGui.TableSetupColumn("CanRevive", ImGuiTableColumnFlags.WidthFixed, ImGui.CalcTextSize("CanRevive__").X);
ImGui.TableSetupColumn(
"Actions",
ImGuiTableColumnFlags.WidthFixed,
@@ -582,9 +581,6 @@ internal class TexWidget : IDataWindowWidget
ImGui.TableNextColumn();
this.TextCopiable(remain <= 0 ? "-" : $"{remain:00.000}", true, true);
- ImGui.TableNextColumn();
- ImGui.TextUnformatted(texture.HasRevivalPossibility ? "Yes" : "No");
-
ImGui.TableNextColumn();
if (ImGuiComponents.IconButton(FontAwesomeIcon.Save))
{
diff --git a/Dalamud/Interface/Textures/Internal/SharedImmediateTextures/SharedImmediateTexture.cs b/Dalamud/Interface/Textures/Internal/SharedImmediateTextures/SharedImmediateTexture.cs
index 1c218f6af..c71d83fe8 100644
--- a/Dalamud/Interface/Textures/Internal/SharedImmediateTextures/SharedImmediateTexture.cs
+++ b/Dalamud/Interface/Textures/Internal/SharedImmediateTextures/SharedImmediateTexture.cs
@@ -29,7 +29,6 @@ internal abstract class SharedImmediateTexture
private bool resourceReleased;
private int refCount;
private long selfReferenceExpiry;
- private IDalamudTextureWrap? availableOnAccessWrapForApi9;
private CancellationTokenSource? cancellationTokenSource;
private NotOwnedTextureWrap? nonOwningWrap;
@@ -67,10 +66,6 @@ internal abstract class SharedImmediateTexture
/// Gets the source path. Debug use only.
public string SourcePathForDebug { get; }
- /// Gets a value indicating whether this instance of supports revival.
- ///
- public bool HasRevivalPossibility => this.RevivalPossibility?.TryGetTarget(out _) is true;
-
/// Gets or sets the underlying texture wrap.
public Task? UnderlyingWrap { get; set; }
@@ -91,16 +86,6 @@ internal abstract class SharedImmediateTexture
/// Intended to be called from implementors' constructors and .
protected CancellationToken LoadCancellationToken => this.cancellationTokenSource?.Token ?? default;
- /// Gets or sets a weak reference to an object that demands this objects to be alive.
- ///
- /// TextureManager must keep references to all shared textures, regardless of whether textures' contents are
- /// flushed, because API9 functions demand that the returned textures may be stored so that they can used anytime,
- /// possibly reviving a dead-inside object. The object referenced by this property is given out to such use cases,
- /// which gets created from . If this no longer points to an alive
- /// object, and is null, then this object is not used from API9 use case.
- ///
- private WeakReference? RevivalPossibility { get; set; }
-
///
public int AddRef() => this.TryAddRef(out var newRefCount) switch
{
@@ -180,7 +165,6 @@ internal abstract class SharedImmediateTexture
if (exp != Interlocked.CompareExchange(ref this.selfReferenceExpiry, SelfReferenceExpiryExpired, exp))
continue;
- this.availableOnAccessWrapForApi9 = null;
return this.Release();
}
}
@@ -255,35 +239,6 @@ internal abstract class SharedImmediateTexture
return new RefCountableWrappingTextureWrap(dtw, this);
}
- /// Gets a texture wrap which ensures that the values will be populated on access.
- /// The texture wrap, or null if failed.
- [Api10ToDo(Api10ToDoAttribute.DeleteCompatBehavior)]
- public IDalamudTextureWrap? GetAvailableOnAccessWrapForApi9()
- {
- if (this.availableOnAccessWrapForApi9 is not null)
- return this.availableOnAccessWrapForApi9;
-
- lock (this.reviveLock)
- {
- if (this.availableOnAccessWrapForApi9 is not null)
- return this.availableOnAccessWrapForApi9;
-
- if (this.RevivalPossibility?.TryGetTarget(out this.availableOnAccessWrapForApi9) is true)
- return this.availableOnAccessWrapForApi9;
-
- var newRefTask = this.RentAsync(this.LoadCancellationToken);
- newRefTask.Wait(this.LoadCancellationToken);
- if (!newRefTask.IsCompletedSuccessfully)
- return null;
- newRefTask.Result.Dispose();
-
- this.availableOnAccessWrapForApi9 = new AvailableOnAccessTextureWrap(this);
- this.RevivalPossibility = new(this.availableOnAccessWrapForApi9);
- }
-
- return this.availableOnAccessWrapForApi9;
- }
-
/// Adds a plugin to , in a thread-safe way.
/// The plugin to add.
public void AddOwnerPlugin(LocalPlugin plugin)
@@ -383,9 +338,6 @@ internal abstract class SharedImmediateTexture
throw;
}
- if (this.RevivalPossibility?.TryGetTarget(out var target) is true)
- this.availableOnAccessWrapForApi9 = target;
-
Interlocked.Increment(ref this.refCount);
this.resourceReleased = false;
return IRefCountable.RefCountResult.StillAlive;
@@ -468,12 +420,6 @@ internal abstract class SharedImmediateTexture
public Task RentAsync(CancellationToken cancellationToken = default) =>
this.inner.RentAsync(cancellationToken);
- ///
- [Api10ToDo(Api10ToDoAttribute.DeleteCompatBehavior)]
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public IDalamudTextureWrap? GetAvailableOnAccessWrapForApi9() =>
- this.inner.GetAvailableOnAccessWrapForApi9();
-
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void AddOwnerPlugin(LocalPlugin plugin) =>
@@ -562,56 +508,4 @@ internal abstract class SharedImmediateTexture
}
}
}
-
- /// A texture wrap that revives and waits for the underlying texture as needed on every access.
- [Api10ToDo(Api10ToDoAttribute.DeleteCompatBehavior)]
- private sealed class AvailableOnAccessTextureWrap : ForwardingTextureWrap
- {
- private readonly SharedImmediateTexture inner;
-
- /// Initializes a new instance of the class.
- /// The shared texture.
- public AvailableOnAccessTextureWrap(SharedImmediateTexture inner) => this.inner = inner;
-
- ///
- public override IDalamudTextureWrap CreateWrapSharingLowLevelResource()
- {
- this.inner.AddRef();
- try
- {
- if (!this.inner.TryGetWrapCore(out var wrap, out _))
- {
- this.inner.UnderlyingWrap?.Wait();
-
- if (!this.inner.TryGetWrapCore(out wrap, out _))
- {
- // Calling dispose on Empty4x4 is a no-op, so we can just return that.
- this.inner.Release();
- return Service.Get().Empty4X4;
- }
- }
-
- return new RefCountableWrappingTextureWrap(wrap, this.inner);
- }
- catch
- {
- this.inner.Release();
- throw;
- }
- }
-
- ///
- public override string ToString() => $"{nameof(AvailableOnAccessTextureWrap)}({this.inner})";
-
- ///
- protected override bool TryGetWrap(out IDalamudTextureWrap? wrap)
- {
- if (this.inner.TryGetWrapCore(out var t, out _))
- wrap = t;
-
- this.inner.UnderlyingWrap?.Wait();
- wrap = this.inner.nonOwningWrap ?? Service.Get().Empty4X4;
- return true;
- }
- }
}
diff --git a/Dalamud/Interface/Textures/Internal/TextureManager.SharedTextures.cs b/Dalamud/Interface/Textures/Internal/TextureManager.SharedTextures.cs
index e437b6c28..92152b1fb 100644
--- a/Dalamud/Interface/Textures/Internal/TextureManager.SharedTextures.cs
+++ b/Dalamud/Interface/Textures/Internal/TextureManager.SharedTextures.cs
@@ -159,7 +159,7 @@ internal sealed partial class TextureManager
{
if (this.gameDict.TryRemove(path, out var r))
{
- if (r.ReleaseSelfReference(true) != 0 || r.HasRevivalPossibility)
+ if (r.ReleaseSelfReference(true) != 0)
{
lock (this.invalidatedTextures)
this.invalidatedTextures.Add(r);
@@ -201,7 +201,7 @@ internal sealed partial class TextureManager
[MethodImpl(MethodImplOptions.AggressiveInlining)]
static bool TextureFinalReleasePredicate(SharedImmediateTexture v) =>
- v.ContentQueried && v.ReleaseSelfReference(false) == 0 && !v.HasRevivalPossibility;
+ v.ContentQueried && v.ReleaseSelfReference(false) == 0;
}
}
}