mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-17 08:35:37 -04:00
Multi-context
This commit is contained in:
parent
55b31833c4
commit
02378b9ba2
@ -96,7 +96,7 @@ public final class Tools {
|
||||
if(pvcConfig != null && pvcConfig.gamePath != null && !pvcConfig.gamePath.isEmpty()) gamedirPath = pvcConfig.gamePath;
|
||||
else gamedirPath = Tools.DIR_GAME_NEW;
|
||||
if(pvcConfig != null && pvcConfig.jvmArgs != null && !pvcConfig.jvmArgs.isEmpty()) LauncherPreferences.PREF_CUSTOM_JAVA_ARGS = pvcConfig.jvmArgs;
|
||||
PojavLoginActivity.disableSplash(gamedirPath);
|
||||
//PojavLoginActivity.disableSplash(gamedirPath);
|
||||
String[] launchArgs = getMinecraftArgs(profile, versionInfo, gamedirPath);
|
||||
|
||||
// ctx.appendlnToLog("Minecraft Args: " + Arrays.toString(launchArgs));
|
||||
|
@ -63,7 +63,8 @@ final class ContextGL implements Context {
|
||||
private static final ThreadLocal<ContextGL> current_context_local = new ThreadLocal<ContextGL>();
|
||||
|
||||
/** Handle to the native GL rendering context */
|
||||
private final ByteBuffer handle;
|
||||
//private final ByteBuffer handle;
|
||||
private final long handle;
|
||||
private final PeerInfo peer_info;
|
||||
|
||||
private final ContextAttribs contextAttribs;
|
||||
@ -95,7 +96,13 @@ final class ContextGL implements Context {
|
||||
static ContextGL getCurrentContext() {
|
||||
return current_context_local.get();
|
||||
}
|
||||
|
||||
ContextGL(long handle) {
|
||||
this.peer_info = null;
|
||||
this.contextAttribs = null;
|
||||
this.forwardCompatible = false;
|
||||
this.handle = handle;
|
||||
System.out.println("LWJGLX: ready-handle context created");
|
||||
}
|
||||
/** Create a context with the specified peer info and shared context */
|
||||
ContextGL(PeerInfo peer_info, ContextAttribs attribs, ContextGL shared_context) throws LWJGLException {
|
||||
ContextGL context_lock = shared_context != null ? shared_context : this;
|
||||
@ -120,8 +127,11 @@ final class ContextGL implements Context {
|
||||
*/
|
||||
|
||||
forwardCompatible = false;
|
||||
|
||||
this.handle = null;
|
||||
long share = 0;
|
||||
if(shared_context != null) {
|
||||
share = shared_context.handle;
|
||||
}
|
||||
this.handle = GLFW.nativeEglCreateContext(share);
|
||||
// implementation.create(peer_info, attribList, shared_context != null ? shared_context.handle : null);
|
||||
/* } catch (LWJGLException e) {
|
||||
// GLContext.unloadOpenGLLibrary();
|
||||
@ -184,12 +194,13 @@ final class ContextGL implements Context {
|
||||
throw new IllegalStateException("Context is destroyed");
|
||||
thread = Thread.currentThread();
|
||||
current_context_local.set(this);
|
||||
GLFW.glfwMakeContextCurrent(Display.Window.handle);
|
||||
GLFW.glfwMakeContextCurrent(handle);
|
||||
GLContext.initCapabilities();
|
||||
isCurrent = true;
|
||||
}
|
||||
|
||||
ByteBuffer getHandle() {
|
||||
return handle;
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Query whether the context is current */
|
||||
|
@ -412,7 +412,7 @@ public class Display {
|
||||
}
|
||||
}
|
||||
};
|
||||
drawable.context = new ContextGL(null, null, null);
|
||||
drawable.context = new ContextGL(Window.handle);
|
||||
drawable.context.makeCurrent();
|
||||
Display.drawable = drawable;
|
||||
context = org.lwjgl.opengl.GLContext.createFromCurrent();
|
||||
|
@ -3,13 +3,18 @@ package org.lwjgl.opengl;
|
||||
|
||||
public class GLContext {
|
||||
|
||||
private static ContextCapabilities contextCapabilities = new ContextCapabilities();
|
||||
private static ThreadLocal<ContextCapabilities> contextCapabilities = new ThreadLocal<>();
|
||||
|
||||
public static GLContext createFromCurrent() {
|
||||
return new GLContext();
|
||||
}
|
||||
|
||||
public static void initCapabilities() {
|
||||
if(contextCapabilities.get() == null) {
|
||||
System.out.println("LWJGLX: GL caps init");
|
||||
contextCapabilities.set(new ContextCapabilities());
|
||||
}
|
||||
}
|
||||
public static ContextCapabilities getCapabilities() {
|
||||
return contextCapabilities;
|
||||
return contextCapabilities.get();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user