bindbc-opengl
bindbc-opengl copied to clipboard
Segfault Crash in WSLg starting from 1.0.1 (not present in 1.0.0)
When using bindbc-opengl 1.0.1 or 1.0.2 in WSL (using WSLg), calling loadOpenGL
causes the program to crash without a stacktrace.
Reverting back to 1.0.0 prevents this issue.
Sample Code to Reproduce
import std.stdio;
import bindbc.glfw;
import bindbc.opengl;
void main()
{
prepareGLFW();
assert(glfwInit(), "Failed to init GLFW");
scope (exit) glfwTerminate();
GLFWwindow* window = glfwCreateWindow(800, 600, "Test", null, null);
assert(window, "Failed to create a GLFW window");
glfwMakeContextCurrent(window);
prepareOpenGL();
while (!glfwWindowShouldClose(window))
{
glClear(GL_COLOR_BUFFER_BIT);
glfwSwapBuffers(window);
glfwPollEvents();
}
}
private void prepareGLFW()
{
auto result = loadGLFW();
if (result != glfwSupport)
{
writeln("Result: ", result);
writeLoadErrors();
assert(0, "Failed to load GLFW");
}
writeln("GLFW loaded: ", result);
}
private void prepareOpenGL()
{
auto result = loadOpenGL();
if (result < GLSupport.gl31)
{
writeln("Result: ", result);
writeLoadErrors();
assert(0, "Failed to load OpenGL");
}
writeln("OpenGL loaded: ", result);
}
private void writeLoadErrors()
{
import std.string : fromStringz;
import loader = bindbc.loader.sharedlib;
foreach (error; loader.errors)
{
writefln("Error(%s): %s", error.error.fromStringz, error.message.fromStringz);
}
}
dub.sdl configuration:
dependency "bindbc-freetype" version="~>1.0.3"
dependency "bindbc-glfw" version="~>1.0.1"
dependency "bindbc-opengl" version="~>1.0.2"
versions "GLFW_31" "GL_31"
Expected Output:
Performing "debug" build using /usr/bin/dmd for x86_64.
bindbc-loader 1.0.1: target for configuration "noBC" is up to date.
bindbc-freetype 1.0.3: target for configuration "dynamic" is up to date.
bindbc-glfw 1.0.1: target for configuration "dynamic" is up to date.
bindbc-opengl 1.0.0: target for configuration "dynamic" is up to date.
minuette ~master: building configuration "application"...
Linking...
To force a rebuild of up-to-date targets, run again with --force.
Running minuette
GLFW loaded: glfw31
OpenGL loaded: gl31
A blank window opens and remains until closed by the user. This is the behaviour in 1.0.0.
Actual Output
Performing "debug" build using /usr/bin/dmd for x86_64.
bindbc-loader 1.0.1: target for configuration "noBC" is up to date.
bindbc-freetype 1.0.3: target for configuration "dynamic" is up to date.
bindbc-glfw 1.0.1: target for configuration "dynamic" is up to date.
bindbc-opengl 1.0.1: building configuration "dynamic"...
minuette ~master: building configuration "application"...
Linking...
To force a rebuild of up-to-date targets, run again with --force.
Running minuette
GLFW loaded: glfw31
Program exited with code -11
Hardware and Environment Information
WSL Ubuntu 20.04.3 LTS (inside of Windows 11 Pro Build 22000.708) DUB version 1.26.1, built on Jul 22 2021 DMD64 D Compiler v2.097.2
GLXInfo
Extended renderer info (GLX_MESA_query_renderer): Vendor: Microsoft Corporation (0xffffffff) Device: D3D12 (Intel(R) Iris(R) Xe Graphics) (0xffffffff) Version: 21.2.6 Accelerated: yes Video memory: 32787MB Unified memory: yes Preferred profile: core (0x1) Max core profile version: 3.3 Max compat profile version: 3.1 Max GLES1 profile version: 1.1 Max GLES[23] profile version: 3.0 OpenGL vendor string: Microsoft Corporation OpenGL renderer string: D3D12 (Intel(R) Iris(R) Xe Graphics) OpenGL core profile version string: 3.3 (Core Profile) Mesa 21.2.6 OpenGL core profile shading language version string: 3.30 OpenGL core profile context flags: (none) OpenGL core profile profile mask: core profile
Sorry, I missed this entirely. I had never considered testing this in WSL. I'm on Windows 10, but I'll see if I can reproduce it.
Can you please confirm whether this issue still occurs in v1.0.5?