Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[opengl] [Bug] Fix crash with old GLX #1134

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
shallow = true
[submodule "external/glfw"]
path = external/glfw
url = https://github.com/taichi-dev/glfw
url = https://github.com/archibate/glfw
shallow = true
[submodule "external/glad"]
path = external/glad
Expand Down
2 changes: 1 addition & 1 deletion external/glfw
Submodule glfw updated 1 files
+43 −0 src/glx_context.c
17 changes: 17 additions & 0 deletions taichi/backends/opengl/opengl_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,23 @@ bool initialize_opengl(bool error_tolerance) {
}
TI_ERROR("[glsl] cannot initialize GLAD");
}

const char *glver = (const char *)glGetString(GL_VERSION);
if (glver)
TI_TRACE("[glsl] OpenGL {}", glver);

GLint major = 0, minor = 0;
glGetIntegerv(GL_MAJOR_VERSION, &major);
check_opengl_error("glGetIntegerv(GL_MAJOR_VERSION)");
glGetIntegerv(GL_MINOR_VERSION, &minor);
check_opengl_error("glGetIntegerv(GL_MINOR_VERSION)");

if (major < 4 || minor < 3) {
TI_DEBUG("[glsl] OpenGL version {}.{} < 4.3, not supported", major, minor);
supported = std::make_optional<bool>(false);
return false;
}

#define PER_OPENGL_EXTENSION(x) \
if ((opengl_has_##x = GLAD_##x)) \
TI_TRACE("[glsl] Found " #x);
Expand Down