Compare commits

...
Author SHA1 Message Date
Jason Mitchell e158faada0 Only set/access texture info cache from the main thread 2024-05-14 22:35:21 -07:00
2 changed files with 5 additions and 2 deletions

No files matched your search

@@ -236,6 +236,9 @@ public class GLStateManager {
}
public static boolean isMainThread() {
return Thread.currentThread() == MainThread;
}
public static void assertMainThread() {
if (Thread.currentThread() != CurrentThread && !runningSplash) {
@@ -21,7 +21,7 @@ public class TextureInfoCache {
}
public TextureInfo getInfo(int id) {
if(id < 0) return null;
if(id < 0 || !GLStateManager.isMainThread()) return null;
return cache.computeIfAbsent(id, TextureInfo::new);
}
@@ -45,7 +45,7 @@ public class TextureInfoCache {
}
public void onDeleteTexture(int id) {
if(id >= 0) cache.remove(id);
if(id >= 0 && GLStateManager.isMainThread()) cache.remove(id);
}
}