glsl: Add assert to check input to strcmp.
[mesa.git] / src / mesa / shader / arbprogparse.c
index 05ee4f563eb7a2fe8b40bb8c1ab76e03a882da98..6373529e4e86c4665e58e38089dd1fcd5a3f22b6 100644 (file)
@@ -54,11 +54,8 @@ having three separate program parameter arrays.
 #include "main/glheader.h"
 #include "main/imports.h"
 #include "main/context.h"
-#include "main/macros.h"
 #include "main/mtypes.h"
-#include "shader/grammar/grammar_mesa.h"
 #include "arbprogparse.h"
-#include "program.h"
 #include "programopt.h"
 #include "prog_parameter.h"
 #include "prog_statevars.h"
@@ -87,6 +84,9 @@ _mesa_parse_arb_fragment_program(GLcontext* ctx, GLenum target,
       return;
    }
 
+   if (program->Base.String != NULL)
+      free(program->Base.String);
+
    /* Copy the relevant contents of the arb_program struct into the
     * fragment_program struct.
     */
@@ -121,6 +121,8 @@ _mesa_parse_arb_fragment_program(GLcontext* ctx, GLenum target,
    case OPTION_FOG_LINEAR: program->FogOption = GL_LINEAR; break;
    default:                program->FogOption = GL_NONE;   break;
    }
+   program->OriginUpperLeft = state.option.OriginUpperLeft;
+   program->PixelCenterInteger = state.option.PixelCenterInteger;
 
    program->UsesKill            = state.fragment.UsesKill;
 
@@ -128,7 +130,7 @@ _mesa_parse_arb_fragment_program(GLcontext* ctx, GLenum target,
       program->Base.InputsRead |= FRAG_BIT_FOGC;
 
    if (program->Base.Instructions)
-      _mesa_free(program->Base.Instructions);
+      free(program->Base.Instructions);
    program->Base.Instructions = prog.Instructions;
 
    if (program->Base.Parameters)
@@ -146,7 +148,7 @@ _mesa_parse_arb_fragment_program(GLcontext* ctx, GLenum target,
    }
 
 #if DEBUG_FP
-   _mesa_printf("____________Fragment program %u ________\n", program->Base.Id);
+   printf("____________Fragment program %u ________\n", program->Base.Id);
    _mesa_print_program(&program->Base);
 #endif
 }
@@ -178,6 +180,9 @@ _mesa_parse_arb_vertex_program(GLcontext *ctx, GLenum target,
       return;
    }
 
+   if (program->Base.String != NULL)
+      free(program->Base.String);
+
    /* Copy the relevant contents of the arb_program struct into the 
     * vertex_program struct.
     */
@@ -198,7 +203,7 @@ _mesa_parse_arb_vertex_program(GLcontext *ctx, GLenum target,
       ? GL_TRUE : GL_FALSE;
 
    if (program->Base.Instructions)
-      _mesa_free(program->Base.Instructions);
+      free(program->Base.Instructions);
    program->Base.Instructions = prog.Instructions;
 
    if (program->Base.Parameters)
@@ -206,7 +211,7 @@ _mesa_parse_arb_vertex_program(GLcontext *ctx, GLenum target,
    program->Base.Parameters = prog.Parameters; 
 
 #if DEBUG_VP
-   _mesa_printf("____________Vertex program %u __________\n", program->Base.Id);
+   printf("____________Vertex program %u __________\n", program->Base.Id);
    _mesa_print_program(&program->Base);
 #endif
 }