mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-21 21:02:15 +00:00
properly clear PBRAtlasTexture (#2085)
This commit is contained in:
1 parent
37a10eee3f
commit
6f054a09a9
4 files changed
+17
-2
No files matched your search
+3
-1
@@ -6,7 +6,9 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
public abstract class AutoClosableAbstractTexture extends AbstractTexture implements AutoCloseable {
|
||||
@Override
|
||||
public void close() throws Exception {}
|
||||
public void close() {
|
||||
deleteGlTexture();
|
||||
}
|
||||
|
||||
// TODO: Is this needed?
|
||||
public void bind() {
|
||||
|
||||
@@ -828,6 +828,7 @@ public class Iris {
|
||||
currentPack = null;
|
||||
|
||||
getPipelineManager().destroyPipeline();
|
||||
PBRTextureManager.INSTANCE.clear();
|
||||
|
||||
// Close the zip filesystem that the shaderpack was loaded from
|
||||
//
|
||||
|
||||
@@ -140,5 +140,8 @@ public class PBRAtlasTexture extends AutoClosableAbstractTexture {
|
||||
case SPECULAR -> pbrHolder.setSpecularAtlas(null);
|
||||
}
|
||||
}
|
||||
|
||||
clear();
|
||||
super.close();
|
||||
}
|
||||
}
|
||||
@@ -126,7 +126,16 @@ public class PBRTextureManager {
|
||||
}
|
||||
|
||||
private static void closeTexture(AbstractTexture texture) {
|
||||
texture.deleteGlTexture();
|
||||
if (texture instanceof AutoCloseable closeable) {
|
||||
try {
|
||||
closeable.close();
|
||||
return;
|
||||
} catch (Exception e) {
|
||||
Iris.logger.error("Failed to close PBR texture", e);
|
||||
}
|
||||
}
|
||||
|
||||
texture.deleteGlTexture();
|
||||
}
|
||||
|
||||
public static void notifyPBRTexturesChanged() {
|
||||
|
||||
Reference in new issue
Block a user