From cda571268bf95789c1fc1044c284c4fe06bbc0e4 Mon Sep 17 00:00:00 2001 From: arbee Date: Sat, 13 Jun 2015 14:31:36 -0400 Subject: [PATCH] GLSL: unlimit shader file size. [R. Belmont] --- src/osd/modules/opengl/gl_shader_tool.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/osd/modules/opengl/gl_shader_tool.c b/src/osd/modules/opengl/gl_shader_tool.c index abf1420f77a..5d308882ed8 100644 --- a/src/osd/modules/opengl/gl_shader_tool.c +++ b/src/osd/modules/opengl/gl_shader_tool.c @@ -376,7 +376,7 @@ int gl_compile_shader_file( GLhandleARB *shader, GLenum type, const char * shade { int err = 0, i, c; FILE * file = NULL; - const int buffer_len=8192; + int buffer_len = 8192; GLcharARB *buffer=NULL; if(shader==NULL || shader_file==NULL) @@ -395,6 +395,11 @@ int gl_compile_shader_file( GLhandleARB *shader, GLenum type, const char * shade return -1; } + // get the real file size + fseek(file, 0, SEEK_END); + buffer_len = (int)ftell(file); + fseek(file, 0, SEEK_SET); + buffer = (GLcharARB *) malloc(buffer_len); memset(buffer, 0, buffer_len);