Mercurial > sdl-ios-xcode
comparison src/render/opengles2/SDL_render_gles2.c @ 5215:7b6101f3ea58
Fixed compiling source shaders
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 06 Feb 2011 10:59:37 -0800 |
parents | 115fff0641ee |
children | 25ad4a50d34f |
comparison
equal
deleted
inserted
replaced
5214:fb058f09061d | 5215:7b6101f3ea58 |
---|---|
606 /* Compile or load the selected shader instance */ | 606 /* Compile or load the selected shader instance */ |
607 glGetError(); | 607 glGetError(); |
608 entry->id = glCreateShader(instance->type); | 608 entry->id = glCreateShader(instance->type); |
609 if (instance->format == (GLenum)-1) | 609 if (instance->format == (GLenum)-1) |
610 { | 610 { |
611 glShaderSource(entry->id, 1, (const char **)&instance->data, &instance->length); | 611 glShaderSource(entry->id, 1, (const char **)&instance->data, NULL); |
612 glCompileShader(entry->id); | 612 glCompileShader(entry->id); |
613 glGetShaderiv(entry->id, GL_COMPILE_STATUS, &compileSuccessful); | 613 glGetShaderiv(entry->id, GL_COMPILE_STATUS, &compileSuccessful); |
614 } | 614 } |
615 else | 615 else |
616 { | 616 { |
617 glShaderBinary(1, &entry->id, instance->format, instance->data, instance->length); | 617 glShaderBinary(1, &entry->id, instance->format, instance->data, instance->length); |
618 compileSuccessful = GL_TRUE; | 618 compileSuccessful = GL_TRUE; |
619 } | 619 } |
620 if (glGetError() != GL_NO_ERROR || !compileSuccessful) | 620 if (glGetError() != GL_NO_ERROR || !compileSuccessful) |
621 { | 621 { |
622 SDL_SetError("Failed to load the specified shader"); | 622 char *info = NULL; |
623 int length; | |
624 | |
625 glGetShaderiv(entry->id, GL_INFO_LOG_LENGTH, &length); | |
626 if (length > 0) { | |
627 info = SDL_stack_alloc(char, length); | |
628 if (info) { | |
629 glGetShaderInfoLog(entry->id, length, &length, info); | |
630 } | |
631 } | |
632 if (info) { | |
633 SDL_SetError("Failed to load the shader: %s", info); | |
634 SDL_stack_free(info); | |
635 } else { | |
636 SDL_SetError("Failed to load the shader"); | |
637 } | |
623 glDeleteShader(entry->id); | 638 glDeleteShader(entry->id); |
624 SDL_free(entry); | 639 SDL_free(entry); |
625 return NULL; | 640 return NULL; |
626 } | 641 } |
627 | 642 |