Navigation Menu

Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Fixed compiling source shaders
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Feb 6, 2011
1 parent 9ec985f commit a7f806b
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/render/opengles2/SDL_render_gles2.c
Expand Up @@ -608,7 +608,7 @@ GLES2_CacheShader(SDL_Renderer *renderer, GLES2_ShaderType type, SDL_BlendMode b
entry->id = glCreateShader(instance->type);
if (instance->format == (GLenum)-1)
{
glShaderSource(entry->id, 1, (const char **)&instance->data, &instance->length);
glShaderSource(entry->id, 1, (const char **)&instance->data, NULL);
glCompileShader(entry->id);
glGetShaderiv(entry->id, GL_COMPILE_STATUS, &compileSuccessful);
}
Expand All @@ -619,7 +619,22 @@ GLES2_CacheShader(SDL_Renderer *renderer, GLES2_ShaderType type, SDL_BlendMode b
}
if (glGetError() != GL_NO_ERROR || !compileSuccessful)
{
SDL_SetError("Failed to load the specified shader");
char *info = NULL;
int length;

glGetShaderiv(entry->id, GL_INFO_LOG_LENGTH, &length);
if (length > 0) {
info = SDL_stack_alloc(char, length);
if (info) {
glGetShaderInfoLog(entry->id, length, &length, info);
}
}
if (info) {
SDL_SetError("Failed to load the shader: %s", info);
SDL_stack_free(info);
} else {
SDL_SetError("Failed to load the shader");
}
glDeleteShader(entry->id);
SDL_free(entry);
return NULL;
Expand Down

0 comments on commit a7f806b

Please sign in to comment.