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] Tolerate all errors in with_opengl() #884

Merged
merged 3 commits into from
Apr 27, 2020
Merged
Changes from 1 commit
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
8 changes: 6 additions & 2 deletions taichi/backends/opengl/opengl_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,8 @@ bool initialize_opengl(bool error_tolerance) {
if (!window) {
const char *desc = nullptr;
int status = glfwGetError(&desc);
if (error_tolerance && status == GLFW_API_UNAVAILABLE) {
if (error_tolerance) {
// error tolerated, returning false
// note that we only tolerate GLFW_API_UNAVAILABLE
TI_TRACE("GLFW: OpenGL API unavailable");
supported = std::make_optional<bool>(false);
return false;
Expand All @@ -284,6 +283,11 @@ bool initialize_opengl(bool error_tolerance) {
glfwMakeContextCurrent(window);

if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) {
if (error_tolerance) {
TI_TRACE("[glsl] cannot initialize GLAD");
supported = std::make_optional<bool>(false);
return false;
}
TI_ERROR("[glsl] cannot initialize GLAD");
}
#define PER_OPENGL_EXTENSION(x) \
Expand Down