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

get error log of shader if it fails to compile #137

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
14 changes: 14 additions & 0 deletions sway/desktop/fx_renderer.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,13 @@ static GLuint compile_shader(GLuint type, const GLchar **srcs, size_t srcs_len)
glGetShaderiv(shader, GL_COMPILE_STATUS, &ok);
if (ok == GL_FALSE) {
sway_log(SWAY_ERROR, "Failed to compile shader");

char log[1024];
GLsizei length = 0;
glGetShaderInfoLog(shader, 1024, &length, log);
log[length-1] = '\0';
sway_log(SWAY_ERROR, "Error log: \"%s\"", log);

glDeleteShader(shader);
shader = 0;
}
Expand Down Expand Up @@ -151,6 +158,13 @@ static GLuint link_program(const GLchar *frag_src, enum fx_gles2_shader_source s
glGetProgramiv(prog, GL_LINK_STATUS, &ok);
if (ok == GL_FALSE) {
sway_log(SWAY_ERROR, "Failed to link shader");

char log[1024];
GLsizei length = 0;
glGetProgramInfoLog(prog, 1024, &length, log);
log[length-1] = '\0';
sway_log(SWAY_ERROR, "Error log: \"%s\"", log);

glDeleteProgram(prog);
goto error;
}
Expand Down