diff options
Diffstat (limited to 'src/glsl/main.cpp')
-rw-r--r-- | src/glsl/main.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp index dd43d12474b..8b0bccdcb71 100644 --- a/src/glsl/main.cpp +++ b/src/glsl/main.cpp @@ -36,6 +36,25 @@ #include "ir_print_visitor.h" #include "program.h" +extern "C" struct gl_shader * +_mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type); + +/* Copied from shader_api.c for the stand-alone compiler. + */ +struct gl_shader * +_mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type) +{ + struct gl_shader *shader; + assert(type == GL_FRAGMENT_SHADER || type == GL_VERTEX_SHADER); + shader = talloc_zero(NULL, struct gl_shader); + if (shader) { + shader->Type = type; + shader->Name = name; + shader->RefCount = 1; + } + return shader; +} + /* Returned string will have 'ctx' as its talloc owner. */ static char * load_text_file(void *ctx, const char *file_name) @@ -271,6 +290,9 @@ main(int argc, char **argv) printf("Info log for linking:\n%s\n", whole_program->InfoLog); } + for (unsigned i = 0; i < whole_program->_NumLinkedShaders; i++) + talloc_free(whole_program->_LinkedShaders[i]); + talloc_free(whole_program); _mesa_glsl_release_types(); |