# HG changeset patch # User Sam Lantinga # Date 1297018777 28800 # Node ID 7b6101f3ea581eb7e0d4daba215ccfba7bdb0062 # Parent fb058f09061d2a33ad99cb8cc2efd8484a238051 Fixed compiling source shaders diff -r fb058f09061d -r 7b6101f3ea58 src/render/opengles2/SDL_render_gles2.c --- a/src/render/opengles2/SDL_render_gles2.c Sun Feb 06 10:27:05 2011 -0800 +++ b/src/render/opengles2/SDL_render_gles2.c Sun Feb 06 10:59:37 2011 -0800 @@ -608,7 +608,7 @@ 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); } @@ -619,7 +619,22 @@ } 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;