mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-22 21:29:44 +00:00
Only set/access texture info cache from the main thread
This commit is contained in:
1 parent
f684bc0a1b
commit
e158faada0
2 files changed
+5
-2
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);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user