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);
|
||||
|
||||
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)
|
||||
{
|
||||
char log[log_length + 1];
|
||||
glGetShaderInfoLog(id, log_length, &log_length, log);
|
||||
log[log_length] = '\0';
|
||||
glDeleteShader(id);
|
||||
rb_raise(rb_eRuntimeError,
|
||||
"Error compiling %s shader:\n%s\n%s\n%s\n",
|
||||
get_shader_type_name(shader_type),
|
||||
"--------------------",
|
||||
log,
|
||||
"--------------------");
|
||||
}
|
||||
else
|
||||
{
|
||||
glDeleteShader(id);
|
||||
rb_raise(rb_eRuntimeError,
|
||||
"Error compiling %s shader",
|
||||
get_shader_type_name(shader_type));
|
||||
GLint log_length;
|
||||
glGetShaderiv(id, GL_INFO_LOG_LENGTH, &log_length);
|
||||
if (log_length > 0)
|
||||
{
|
||||
char log[log_length + 1];
|
||||
glGetShaderInfoLog(id, log_length, &log_length, log);
|
||||
log[log_length] = '\0';
|
||||
glDeleteShader(id);
|
||||
rb_raise(rb_eRuntimeError,
|
||||
"Error compiling %s shader:\n%s\n%s\n%s\n",
|
||||
get_shader_type_name(shader_type),
|
||||
"--------------------",
|
||||
log,
|
||||
"--------------------");
|
||||
}
|
||||
else
|
||||
{
|
||||
glDeleteShader(id);
|
||||
rb_raise(rb_eRuntimeError,
|
||||
"Error compiling %s shader",
|
||||
get_shader_type_name(shader_type));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user