mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-22 13:19:44 +00:00
Better Splash support (#1220)
This commit is contained in:
1 parent
b05f17a477
commit
9f5afaaec3
5 files changed
+42
-56
No files matched your search
@@ -60,11 +60,11 @@ public class GLSM_ServerSideState_UnitTest {
|
||||
|
||||
sharedDrawable = new SharedDrawable(Display.getDrawable());
|
||||
|
||||
// Register the sharedDrawable so makeCurrent() can detect it
|
||||
GLStateManager.setSharedDrawable(sharedDrawable);
|
||||
// Register the main display context (DrawableGL) so makeCurrent() can identify it
|
||||
GLStateManager.setDrawableGL(Display.getDrawable());
|
||||
|
||||
// Main thread holds DrawableGL, so enable caching for it: This sets drawableGLHolder = current thread
|
||||
GLStateManager.setCachingEnabled(true);
|
||||
// Switch to DrawableGL to enable caching for main thread
|
||||
GLStateManager.makeCurrent(Display.getDrawable());
|
||||
|
||||
// Verify main thread has caching enabled
|
||||
assertTrue(GLStateManager.isCachingEnabled(), "Main thread should have caching enabled (it holds DrawableGL)");
|
||||
@@ -140,7 +140,7 @@ public class GLSM_ServerSideState_UnitTest {
|
||||
}
|
||||
|
||||
// Restore original state
|
||||
GLStateManager.setSharedDrawable(null);
|
||||
GLStateManager.setDrawableGL(null);
|
||||
setSplashComplete(originalSplashComplete);
|
||||
if (originalSplashComplete) {
|
||||
GLStateManager.markSplashComplete();
|
||||
|
||||
@@ -32,11 +32,12 @@ public class GLSM_TextureInfoCache_UnitTest {
|
||||
// Disable caching (simulate SharedDrawable context)
|
||||
Field splashCompleteField = GLStateManager.class.getDeclaredField("splashComplete");
|
||||
splashCompleteField.setAccessible(true);
|
||||
boolean original = splashCompleteField.getBoolean(null);
|
||||
boolean originalSplash = splashCompleteField.getBoolean(null);
|
||||
Thread originalHolder = GLStateManager.getDrawableGLHolder();
|
||||
|
||||
try {
|
||||
splashCompleteField.setBoolean(null, false);
|
||||
GLStateManager.setCachingEnabled(false);
|
||||
GLStateManager.setDrawableGLHolder(null); // Current thread != null, so caching disabled
|
||||
assertFalse(GLStateManager.isCachingEnabled());
|
||||
|
||||
GLStateManager.glDeleteTextures(texId);
|
||||
@@ -46,7 +47,8 @@ public class GLSM_TextureInfoCache_UnitTest {
|
||||
// Cache entry should be gone - we should get a fresh object
|
||||
assertNotSame(info, TextureInfoCache.INSTANCE.getInfo(texId));
|
||||
} finally {
|
||||
splashCompleteField.setBoolean(null, original);
|
||||
splashCompleteField.setBoolean(null, originalSplash);
|
||||
GLStateManager.setDrawableGLHolder(originalHolder);
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user