GLShader: fix return value of create_shader()
This commit is contained in:
parent
e600ec871f
commit
9824ef9373
@ -33,32 +33,30 @@ static GLuint create_shader(GLenum shader_type, const char *source, size_t size)
|
|||||||
glCompileShader(id);
|
glCompileShader(id);
|
||||||
|
|
||||||
glGetShaderiv(id, GL_COMPILE_STATUS, &status);
|
glGetShaderiv(id, GL_COMPILE_STATUS, &status);
|
||||||
if (status == GL_TRUE)
|
if (status != GL_TRUE)
|
||||||
{
|
{
|
||||||
return true;
|
GLint log_length;
|
||||||
}
|
glGetShaderiv(id, GL_INFO_LOG_LENGTH, &log_length);
|
||||||
|
if (log_length > 0)
|
||||||
GLint log_length;
|
{
|
||||||
glGetShaderiv(id, GL_INFO_LOG_LENGTH, &log_length);
|
char log[log_length + 1];
|
||||||
if (log_length > 0)
|
glGetShaderInfoLog(id, log_length, &log_length, log);
|
||||||
{
|
log[log_length] = '\0';
|
||||||
char log[log_length + 1];
|
glDeleteShader(id);
|
||||||
glGetShaderInfoLog(id, log_length, &log_length, log);
|
rb_raise(rb_eRuntimeError,
|
||||||
log[log_length] = '\0';
|
"Error compiling %s shader:\n%s\n%s\n%s\n",
|
||||||
glDeleteShader(id);
|
get_shader_type_name(shader_type),
|
||||||
rb_raise(rb_eRuntimeError,
|
"--------------------",
|
||||||
"Error compiling %s shader:\n%s\n%s\n%s\n",
|
log,
|
||||||
get_shader_type_name(shader_type),
|
"--------------------");
|
||||||
"--------------------",
|
}
|
||||||
log,
|
else
|
||||||
"--------------------");
|
{
|
||||||
}
|
glDeleteShader(id);
|
||||||
else
|
rb_raise(rb_eRuntimeError,
|
||||||
{
|
"Error compiling %s shader",
|
||||||
glDeleteShader(id);
|
get_shader_type_name(shader_type));
|
||||||
rb_raise(rb_eRuntimeError,
|
}
|
||||||
"Error compiling %s shader",
|
|
||||||
get_shader_type_name(shader_type));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user