Changes
- Automatically set overrideWidth and overrideHeight - Multi-context moment. Current status of Forge 1.12.2: Exception type: EXC_BAD_ACCESS (SIGSEGV) Exception subtype: KERN_INVALID_ADDRESS: 0x964 Exception codes: 0x0000000000000001, 0x0000000000000964 Culprit: Unknown VM Protection: 0x964 is not in any region. Triggered by thread: 20 Thread name: Call stack: 0 libgl4es_115.dylib 0x000000012196738c 0x121900000 + 422796 // realize_glenv 1 libgl4es_115.dylib 0x00000001219672dc 0x121900000 + 422620 // realize_glenv 2 libgl4es_115.dylib 0x0000000121966e78 0x121900000 + 421496 // fpe_glDrawArrays 3 libgl4es_115.dylib 0x000000012199d4e4 0x121900000 + 644324 // draw_renderlist 4 libgl4es_115.dylib 0x000000012197e39c 0x121900000 + 517020 // gl4es_flush 5 libgl4es_115.dylib 0x00000001219609e4 0x121900000 + 395748 // proxy_glEnable
This commit is contained in:
1 parent
f060d7574e
commit
e079e86a80
7 files changed
+120
-187
No files matched your search
@@ -73,6 +73,10 @@ public class UIKit {
|
||||
}
|
||||
|
||||
public static void callback_SurfaceViewController_launchMinecraft(int width, int height) {
|
||||
MCOptionUtils.load();
|
||||
MCOptionUtils.set("overrideWidth", Integer.toString(width));
|
||||
MCOptionUtils.set("overrideHeight", Integer.toString(height));
|
||||
MCOptionUtils.save();
|
||||
System.setProperty("cacio.managed.screensize", width + "x" + height);
|
||||
|
||||
GLFW.internalChangeMonitorSize(width, height);
|
||||
|
||||
@@ -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;
|
||||
@@ -96,6 +97,14 @@ final class ContextGL implements Context {
|
||||
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;
|
||||
@@ -121,7 +130,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 +197,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; // handle
|
||||
}
|
||||
|
||||
/** Query whether the context is current */
|
||||
|
||||
@@ -61,7 +61,7 @@ public class Display {
|
||||
private static boolean window_created;
|
||||
|
||||
/** The Drawable instance that tracks the current Display context */
|
||||
private static DrawableLWJGL drawable;
|
||||
private static volatile DrawableLWJGL drawable = null;
|
||||
|
||||
private static Canvas parent;
|
||||
|
||||
@@ -206,30 +206,13 @@ public class Display {
|
||||
// System.out.println("TODO: Implement Display.create(PixelFormat,
|
||||
// Drawable)"); // TODO
|
||||
create(pixel_format);
|
||||
|
||||
final DrawableGL drawable = new DrawableGL() {
|
||||
public void destroy() {
|
||||
synchronized ( GlobalLock.lock ) {
|
||||
if ( !isCreated() )
|
||||
return;
|
||||
|
||||
releaseDrawable();
|
||||
super.destroy();
|
||||
destroyWindow();
|
||||
// x = y = -1;
|
||||
// cached_icons = null;
|
||||
reset();
|
||||
}
|
||||
}
|
||||
};
|
||||
Display.drawable = drawable;
|
||||
|
||||
try {
|
||||
drawable.setPixelFormat(pixel_format, null);
|
||||
try {
|
||||
createWindow();
|
||||
try {
|
||||
drawable.context = new ContextGL(drawable.peer_info, null /* attribs */, shared_drawable != null ? ((DrawableGL)shared_drawable).getContext() : null);
|
||||
((DrawableGL) drawable).context = new ContextGL(((DrawableGL) drawable).peer_info, null /* attribs */, shared_drawable != null ? ((DrawableGL)shared_drawable).getContext() : null);
|
||||
try {
|
||||
makeCurrentAndSetSwapInterval();
|
||||
initContext();
|
||||
@@ -311,8 +294,8 @@ public class Display {
|
||||
Window.charCallback = new GLFWCharCallback() {
|
||||
@Override
|
||||
public void invoke(long window, int codepoint) {
|
||||
GLFWInputImplementation.singleton.putKeyboardEvent(KeyCodes.toLwjglKey(32),(byte)1,(int)codepoint,Sys.getNanoTime(),false);
|
||||
GLFWInputImplementation.singleton.putKeyboardEvent(KeyCodes.toLwjglKey(32),(byte)0,(int)codepoint,Sys.getNanoTime(),false);
|
||||
GLFWInputImplementation.singleton.putKeyboardEvent(0,(byte)1,(int)codepoint,Sys.getNanoTime(),false);
|
||||
//GLFWInputImplementation.singleton.putKeyboardEvent(0,(byte)0,(int)codepoint,Sys.getNanoTime(),false);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -413,7 +396,25 @@ public class Display {
|
||||
displayY = (monitorHeight - mode.getHeight()) / 2;
|
||||
}
|
||||
|
||||
glfwMakeContextCurrent(Window.handle);
|
||||
//glfwMakeContextCurrent(Window.handle);
|
||||
final DrawableGL drawable = new DrawableGL() {
|
||||
public void destroy() {
|
||||
synchronized ( GlobalLock.lock ) {
|
||||
if ( !isCreated() )
|
||||
return;
|
||||
|
||||
releaseDrawable();
|
||||
super.destroy();
|
||||
destroyWindow();
|
||||
// x = y = -1;
|
||||
// cached_icons = null;
|
||||
reset();
|
||||
}
|
||||
}
|
||||
};
|
||||
drawable.context = new ContextGL(Window.handle);
|
||||
drawable.context.makeCurrent();
|
||||
Display.drawable = drawable;
|
||||
context = org.lwjgl.opengl.GLContext.createFromCurrent();
|
||||
|
||||
glfwSwapInterval(0);
|
||||
@@ -732,6 +733,7 @@ public class Display {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
displayCreated = true;
|
||||
|
||||
}
|
||||
@@ -918,6 +920,8 @@ public class Display {
|
||||
windowTitle = title;
|
||||
}
|
||||
|
||||
public static String getTitle() { return windowTitle; }
|
||||
|
||||
public static boolean isCloseRequested() {
|
||||
return glfwWindowShouldClose(Window.handle) == true;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user