LWJGL / lwjgl3

LWJGL is a Java library that enables cross-platform access to popular native APIs useful in the development of graphics (OpenGL, Vulkan, bgfx), audio (OpenAL, Opus), parallel computing (OpenCL, CUDA) and XR (OpenVR, LibOVR, OpenXR) applications.
https://www.lwjgl.org
BSD 3-Clause "New" or "Revised" License
4.82k stars 639 forks source link

"Extension string retrieval is broken" since 3.3.3 on Linux with intel iGPU #955

Open krzyk opened 10 months ago

krzyk commented 10 months ago

Version

3.3.3, 3.3.2

Platform

Linux x64

JDK

Temurin or OpenJDK builds 11 - 21

Module

LWJGL Core

Bug description

This is unfortunately related in someway to libgdx, so I'm not sure where the issue is. Is it a incorrect way libgdx calls lwjgl3 or something that got broken in lwjgl3.

I hava a libgdx basic demo app at https://github.com/krzyk/libgdx-test which works fine in libgdx 1.11.1 version which uses lwjgl3 3.3.1, but breaks when it upgrades to lwjgl3 3.3.2

First reported at https://github.com/libgdx/libgdx/issues/7308 but the issue appeared only when changed dependency from lwjgl3 version 3.3.1 to 3.3.2.

My system is: Linux (kernel 6.6.8) Ubuntu 20.04 (but with custom video/mesa drivers)

libva info: VA-API version 1.21.0
libva info: User environment variable requested driver 'iHD'
libva info: Trying to open /usr/local/lib/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_21
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.21 (libva 2.6.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 23.4.3 (32841e3dc)

System has two GPUs (nvidia and intel one) but only intel one us used - nvidia doesn't have any drivers installed.

All OpenGL apps (like games, glxgears) work fine, the only issue is with lwjgl3 3.3.2 versions breaking on extensions string retrieval (like in the stacktrace).

Stacktrace or crash log output

[LWJGL] GLFW_PLATFORM_ERROR error
        Description : Extension string retrieval is broken
        Stacktrace  :
                org.lwjgl.glfw.GLFW.nglfwCreateWindow(GLFW.java:2058)
                org.lwjgl.glfw.GLFW.glfwCreateWindow(GLFW.java:2229)
                com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.createGlfwWindow(Lwjgl3Application.java:527)
                com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.createWindow(Lwjgl3Application.java:463)
                com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.createWindow(Lwjgl3Application.java:449)
                com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.<init>(Lwjgl3Application.java:163)
                com.mygdx.game.DesktopLauncher.main(DesktopLauncher.java:13)
[LWJGL] GLFW_PLATFORM_ERROR error
        Description : Extension string retrieval is broken
        Stacktrace  :
                org.lwjgl.glfw.GLFW.nglfwCreateWindow(GLFW.java:2058)
                org.lwjgl.glfw.GLFW.glfwCreateWindow(GLFW.java:2229)
                com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.createGlfwWindow(Lwjgl3Application.java:527)
                com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.createWindow(Lwjgl3Application.java:463)
                com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.createWindow(Lwjgl3Application.java:449)
                com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.<init>(Lwjgl3Application.java:163)
                com.mygdx.game.DesktopLauncher.main(DesktopLauncher.java:13)
[LWJGL] GLFW_PLATFORM_ERROR error
        Description : Extension string retrieval is broken
        Stacktrace  :
                org.lwjgl.glfw.GLFW.nglfwCreateWindow(GLFW.java:2058)
                org.lwjgl.glfw.GLFW.glfwCreateWindow(GLFW.java:2229)
                com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.createGlfwWindow(Lwjgl3Application.java:527)
                com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.createWindow(Lwjgl3Application.java:463)
                com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.createWindow(Lwjgl3Application.java:449)
                com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.<init>(Lwjgl3Application.java:163)
                com.mygdx.game.DesktopLauncher.main(DesktopLauncher.java:13)
Exception in thread "main" java.lang.NullPointerException
        at org.lwjgl.system.Checks.check(Checks.java:188)
        at org.lwjgl.system.MemoryUtil.memLengthNT1(MemoryUtil.java:2406)
        at org.lwjgl.system.MemoryUtil.memASCII(MemoryUtil.java:2673)
        at org.lwjgl.opengl.GL.createCapabilities(GL.java:442)
        at org.lwjgl.opengl.GL.createCapabilities(GL.java:311)
        at org.lwjgl.opengl.GL.createCapabilities(GL.java:295)
        at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.createGlfwWindow(Lwjgl3Application.java:572)
        at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.createWindow(Lwjgl3Application.java:463)
        at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.createWindow(Lwjgl3Application.java:449)
        at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.createWindow(Lwjgl3Application.java:449)
        at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.<init>(Lwjgl3Application.java:163)
        at com.mygdx.game.DesktopLauncher.main(DesktopLauncher.java:13)
Spasi commented 10 months ago

Hey @krzyk,

Please check if Nvidia's libglvnd is present (and possibly broken/misconfigured) in your system. The issue might be related to #880. To verify, try running the application with -Dorg.lwjgl.opengl.libname=libGL.so.1 and calling GLFWNativeGLX.setPath(GL.getFunctionProvider()) before initializing GLFW.