Skip to content

Commit

Permalink
[opengl] Tolerate all errors in with_opengl() (#884)
Browse files Browse the repository at this point in the history
* [opengl] tolerate all errors in with_opengl()

* [skip ci] better message

* trigger ci
  • Loading branch information
archibate authored Apr 27, 2020
1 parent 6874c2b commit 7b85ffe
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions taichi/backends/opengl/opengl_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,21 +269,25 @@ bool initialize_opengl(bool error_tolerance) {
if (!window) {
const char *desc = nullptr;
int status = glfwGetError(&desc);
if (error_tolerance && status == GLFW_API_UNAVAILABLE) {
if (!desc)
desc = "Unknown Error";
if (error_tolerance) {
// error tolerated, returning false
// note that we only tolerate GLFW_API_UNAVAILABLE
TI_TRACE("GLFW: OpenGL API unavailable");
TI_TRACE("[glsl] cannot create GLFW window: error {}: {}", status, desc);
supported = std::make_optional<bool>(false);
return false;
}
if (!desc)
desc = "Unknown Error";
TI_ERROR("[glsl] cannot create GLFW window: error {}: {}", status, desc);
}
glfwHideWindow(window);
glfwMakeContextCurrent(window);

if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) {
if (error_tolerance) {
TI_WARN("[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

0 comments on commit 7b85ffe

Please sign in to comment.