Merge branch 'master' into i915-unification
[mesa.git] / src / mesa / shader / nvfragparse.c
index 6690c9a85142a01e25cfabe6800ffcdfb17accf3..0f1a1eade4afcd7ae75667125527d94f986104d2 100644 (file)
 
 #include "glheader.h"
 #include "context.h"
-#include "hash.h"
 #include "imports.h"
 #include "macros.h"
-#include "mtypes.h"
 #include "prog_parameter.h"
 #include "prog_instruction.h"
 #include "nvfragparse.h"
-#include "nvprogram.h"
 #include "program.h"
 
 
@@ -1039,25 +1036,23 @@ Parse_VectorSrc(struct parse_state *parseState,
    else if (IsDigit(token[0]) || token[0] == '-' || token[0] == '+' || token[0] == '.'){
       /* literal scalar constant */
       GLfloat values[4];
-      GLuint paramIndex, swizzle;
+      GLuint paramIndex;
       if (!Parse_ScalarConstant(parseState, values))
          RETURN_ERROR;
       paramIndex = _mesa_add_unnamed_constant(parseState->parameters,
-                                              values, 4, &swizzle);
-      ASSERT(swizzle == SWIZZLE_NOOP);
+                                              values, 4, NULL);
       srcReg->File = PROGRAM_NAMED_PARAM;
       srcReg->Index = paramIndex;
    }
    else if (token[0] == '{'){
       /* literal vector constant */
       GLfloat values[4];
-      GLuint paramIndex, swizzle;
+      GLuint paramIndex;
       (void) Parse_String(parseState, "{");
       if (!Parse_VectorConstant(parseState, values))
          RETURN_ERROR;
       paramIndex = _mesa_add_unnamed_constant(parseState->parameters,
-                                              values, 4, &swizzle);
-      ASSERT(swizzle == SWIZZLE_NOOP);
+                                              values, 4, NULL);
       srcReg->File = PROGRAM_NAMED_PARAM;
       srcReg->Index = paramIndex;      
    }
@@ -1143,13 +1138,12 @@ Parse_ScalarSrcReg(struct parse_state *parseState,
    else if (token[0] == '{') {
       /* vector literal */
       GLfloat values[4];
-      GLuint paramIndex, swizzle;
+      GLuint paramIndex;
       (void) Parse_String(parseState, "{");
       if (!Parse_VectorConstant(parseState, values))
          RETURN_ERROR;
       paramIndex = _mesa_add_unnamed_constant(parseState->parameters,
-                                              values, 4, &swizzle);
-      ASSERT(swizzle == SWIZZLE_NOOP);
+                                              values, 4, NULL);
       srcReg->File = PROGRAM_NAMED_PARAM;
       srcReg->Index = paramIndex;      
    }
@@ -1170,12 +1164,11 @@ Parse_ScalarSrcReg(struct parse_state *parseState,
    else if (IsDigit(token[0])) {
       /* scalar literal */
       GLfloat values[4];
-      GLuint paramIndex, swizzle;
+      GLuint paramIndex;
       if (!Parse_ScalarConstant(parseState, values))
          RETURN_ERROR;
       paramIndex = _mesa_add_unnamed_constant(parseState->parameters,
-                                              values, 4, &swizzle);
-      ASSERT(swizzle == SWIZZLE_NOOP);
+                                              values, 4, NULL);
       srcReg->Index = paramIndex;      
       srcReg->File = PROGRAM_NAMED_PARAM;
       needSuffix = GL_FALSE;
@@ -1548,8 +1541,7 @@ _mesa_parse_nv_fragment_program(GLcontext *ctx, GLenum dstTarget,
          _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV");
          return;  /* out of memory */
       }
-      _mesa_memcpy(newInst, instBuffer,
-                   parseState.numInst * sizeof(struct prog_instruction));
+      _mesa_copy_instructions(newInst, instBuffer, parseState.numInst);
 
       /* install the program */
       program->Base.Target = target;
@@ -1566,7 +1558,7 @@ _mesa_parse_nv_fragment_program(GLcontext *ctx, GLenum dstTarget,
       program->Base.InputsRead = parseState.inputsRead;
       program->Base.OutputsWritten = parseState.outputsWritten;
       for (u = 0; u < ctx->Const.MaxTextureImageUnits; u++)
-         program->TexturesUsed[u] = parseState.texturesUsed[u];
+         program->Base.TexturesUsed[u] = parseState.texturesUsed[u];
 
       /* save program parameters */
       program->Base.Parameters = parseState.parameters;