<div dir="ltr"><div>The fixed size is insufficient for shaders I'm debugging. Rather than just bump it up, make it dynamic.<br><br></div><div>Thanks,<br><br></div>-C<br><span style="font-family:courier new,monospace"><br>
</span><div><div><span style="font-family:courier new,monospace">Signed-off-by: Cody Northrop <<a href="mailto:cody@lunarg.com">cody@lunarg.com</a>><br>---<br> src/mesa/main/shaderapi.c | 14 +++++++++++---<br> 1 file changed, 11 insertions(+), 3 deletions(-)<br>
<br>diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c<br>index 6f84acd..e63c124 100644<br>--- a/src/mesa/main/shaderapi.c<br>+++ b/src/mesa/main/shaderapi.c<br>@@ -1392,7 +1392,7 @@ _mesa_LinkProgram(GLhandleARB programObj)<br>
static GLcharARB *<br> read_shader(const char *fname)<br> {<br>- const int max = 50*1000;<br>+ int shader_size = 0;<br> FILE *f = fopen(fname, "r");<br> GLcharARB *buffer, *shader;<br> int len;<br>
@@ -1401,8 +1401,16 @@ read_shader(const char *fname)<br> return NULL;<br> }<br> <br>- buffer = malloc(max);<br>- len = fread(buffer, 1, max, f);<br>+ /* allocate enough room for the entire shader */<br>+ fseek(f, 0, SEEK_END);<br>
+ shader_size = ftell(f);<br>+ rewind(f);<br>+ assert(shader_size);<br>+<br>+ buffer = malloc(shader_size);<br>+ assert(buffer);<br>+<br>+ len = fread(buffer, 1, shader_size, f);<br> buffer[len] = 0;<br> <br>
fclose(f);<br>-- <br>1.8.3.2</span><br><br><br><br></div></div></div>