diff --git a/FCL/src/main/assets/app_runtime/lwjgl/lwjgl.jar b/FCL/src/main/assets/app_runtime/lwjgl/lwjgl.jar index 3348eeb8..05d105b5 100644 Binary files a/FCL/src/main/assets/app_runtime/lwjgl/lwjgl.jar and b/FCL/src/main/assets/app_runtime/lwjgl/lwjgl.jar differ diff --git a/FCL/src/main/assets/app_runtime/lwjgl/version b/FCL/src/main/assets/app_runtime/lwjgl/version index 8e0d31b3..42342876 100644 --- a/FCL/src/main/assets/app_runtime/lwjgl/version +++ b/FCL/src/main/assets/app_runtime/lwjgl/version @@ -1 +1 @@ -1690399681223 \ No newline at end of file +1690424430137 \ No newline at end of file diff --git a/FCLauncher/src/main/jni/glfw/context.c b/FCLauncher/src/main/jni/glfw/context.c index d7d268e3..f1a705e3 100644 --- a/FCLauncher/src/main/jni/glfw/context.c +++ b/FCLauncher/src/main/jni/glfw/context.c @@ -9,6 +9,7 @@ #include #include #include +#include "fcl_bridge.h" ////////////////////////////////////////////////////////////////////////// @@ -389,6 +390,31 @@ GLFWbool _glfwStringInExtensionString(const char* string, const char* extensions ////// GLFW public API ////// ////////////////////////////////////////////////////////////////////////// +GLFWAPI int glfwGetOSMesaWidth() { + struct ANativeWindow* window = fclGetNativeWindow(); + return ANativeWindow_getWidth(window); +} + +GLFWAPI int glfwGetOSMesaHeight() { + struct ANativeWindow* window = fclGetNativeWindow(); + return ANativeWindow_getHeight(window); +} + +GLFWAPI void* glfwGetOSMesaCurrentContext() { + if (!_glfw.osmesa.GetCurrentContext) + { + _glfwInputError(GLFW_PLATFORM_ERROR, "OSMesa: Failed to load required entry points"); + _glfwTerminateOSMesa(); + return GLFW_FALSE; + } + return OSMesaGetCurrentContext(); +} + +GLFWAPI long glfwGetGraphicBuffersAddr(GLFWwindow* handle) { + _GLFWwindow* window = (_GLFWwindow*) handle; + return &window->context.osmesa.buffer; +} + GLFWAPI void glfwMakeContextCurrent(GLFWwindow* handle) { _GLFWwindow* window = (_GLFWwindow*) handle; diff --git a/FCLauncher/src/main/jni/glfw/include/glfw3.h b/FCLauncher/src/main/jni/glfw/include/glfw3.h index faab5b62..f2f8ccf4 100644 --- a/FCLauncher/src/main/jni/glfw/include/glfw3.h +++ b/FCLauncher/src/main/jni/glfw/include/glfw3.h @@ -5435,6 +5435,26 @@ GLFWAPI uint64_t glfwGetTimerValue(void); */ GLFWAPI uint64_t glfwGetTimerFrequency(void); +/*! + * This function is to get OSMesa width + */ +GLFWAPI int glfwGetOSMesaWidth(); + +/*! + * This function is to get OSMesa height + */ +GLFWAPI int glfwGetOSMesaHeight(); + +/*! + * This function is to get OSMesa Current Context + */ +GLFWAPI void* glfwGetOSMesaCurrentContext(); + +/*! + * This function is to get Graphic Buffers Addr + */ +GLFWAPI long glfwGetGraphicBuffersAddr(GLFWwindow* window); + /*! @brief Makes the context of the specified window current for the calling * thread. * diff --git a/FCLauncher/src/main/jniLibs/armeabi-v7a/libvirglrenderer_1.so b/FCLauncher/src/main/jniLibs/armeabi-v7a/libvirglrenderer_1.so deleted file mode 100644 index dd009149..00000000 Binary files a/FCLauncher/src/main/jniLibs/armeabi-v7a/libvirglrenderer_1.so and /dev/null differ diff --git a/FCLauncher/src/main/jniLibs/x86_64/libvirglrenderer_1.so b/FCLauncher/src/main/jniLibs/x86_64/libvirglrenderer_1.so deleted file mode 100644 index 19e66c7c..00000000 Binary files a/FCLauncher/src/main/jniLibs/x86_64/libvirglrenderer_1.so and /dev/null differ diff --git a/LWJGL/src/main/java/org/lwjgl/glfw/GLFW.java b/LWJGL/src/main/java/org/lwjgl/glfw/GLFW.java index 11e9727e..125c31cb 100644 --- a/LWJGL/src/main/java/org/lwjgl/glfw/GLFW.java +++ b/LWJGL/src/main/java/org/lwjgl/glfw/GLFW.java @@ -790,6 +790,10 @@ public class GLFW { SetTime = apiGetFunctionAddress(GLFW, "glfwSetTime"), GetTimerValue = apiGetFunctionAddress(GLFW, "glfwGetTimerValue"), GetTimerFrequency = apiGetFunctionAddress(GLFW, "glfwGetTimerFrequency"), + GetOSMesaWidth = apiGetFunctionAddress(GLFW, "glfwGetOSMesaWidth"), + GetOSMesaHeight = apiGetFunctionAddress(GLFW, "glfwGetOSMesaHeight"), + GetOSMesaCurrentContext = apiGetFunctionAddress(GLFW, "glfwGetOSMesaCurrentContext"), + GetGraphicBuffersAddr = apiGetFunctionAddress(GLFW, "glfwGetGraphicBuffersAddr"), MakeContextCurrent = apiGetFunctionAddress(GLFW, "glfwMakeContextCurrent"), GetCurrentContext = apiGetFunctionAddress(GLFW, "glfwGetCurrentContext"), SwapBuffers = apiGetFunctionAddress(GLFW, "glfwSwapBuffers"), @@ -4380,6 +4384,46 @@ public class GLFW { return invokeJ(__functionAddress); } + // --- [ glfwGetOSMesaWidth ] --- + + /** + * Get OSMesa width + */ + public static int glfwGetOSMesaWidth() { + long __functionAddress = Functions.GetOSMesaWidth; + return invokeI(__functionAddress); + } + + // --- [ glfwGetOSMesaHeight ] --- + + /** + * Get OSMesa height + */ + public static int glfwGetOSMesaHeight() { + long __functionAddress = Functions.GetOSMesaHeight; + return invokeI(__functionAddress); + } + + // --- [ glfwGetOSMesaContext ] --- + + /** + * Get OSMesa Context + */ + public static long glfwGetOSMesaCurrentContext() { + long __functionAddress = Functions.GetOSMesaCurrentContext; + return invokeJ(__functionAddress); + } + + // --- [ glfwGetGraphicBuffersAddr ] --- + + /** + * Get Graphic Buffers Addr + */ + public static long glfwGetGraphicBuffersAddr(@NativeType("GLFWwindow *") long window) { + long __functionAddress = Functions.GetGraphicBuffersAddr; + return invokePJ(window, __functionAddress); + } + // --- [ glfwMakeContextCurrent ] --- /** diff --git a/LWJGL/src/main/java/org/lwjgl/opengl/GL.java b/LWJGL/src/main/java/org/lwjgl/opengl/GL.java index 5744c1f2..b2a84dd1 100644 --- a/LWJGL/src/main/java/org/lwjgl/opengl/GL.java +++ b/LWJGL/src/main/java/org/lwjgl/opengl/GL.java @@ -4,6 +4,7 @@ */ package org.lwjgl.opengl; +import org.lwjgl.glfw.GLFW; import org.lwjgl.system.*; import org.lwjgl.system.macosx.*; import org.lwjgl.system.windows.*; @@ -20,6 +21,7 @@ import static org.lwjgl.opengl.WGL.*; import static org.lwjgl.system.APIUtil.*; import static org.lwjgl.system.Checks.*; import static org.lwjgl.system.JNI.*; +import static org.lwjgl.system.JNI.callJPI; import static org.lwjgl.system.MemoryStack.*; import static org.lwjgl.system.MemoryUtil.*; import static org.lwjgl.system.linux.X11.*; @@ -346,6 +348,11 @@ public final class GL { GLCapabilities caps = null; try { + if (System.getProperty("org.lwjgl.opengl.libname", "").equals("libOSMesa_8.so")) { + long window = GLFW.glfwGetCurrentContext(); + callJPI(GLFW.glfwGetOSMesaCurrentContext(), GLFW.glfwGetGraphicBuffersAddr(window), GL_UNSIGNED_BYTE, GLFW.glfwGetOSMesaWidth(), GLFW.glfwGetOSMesaHeight(), functionProvider.getFunctionAddress("OSMesaMakeCurrent")); + } + // We don't have a current ContextCapabilities when this method is called // so we have to use the native bindings directly. long GetError = functionProvider.getFunctionAddress("glGetError");