slang: Use _mesa_snprintf() wrapper.
[mesa.git] / src / mesa / shader / programopt.c
index f3511ba00ecdfb7735b9f7a459b733389c1e6023..e283f8933b21df76f3f8f6042fa660d75df7098b 100644 (file)
@@ -31,8 +31,8 @@
  */
 
 
-#include "glheader.h"
-#include "context.h"
+#include "main/glheader.h"
+#include "main/context.h"
 #include "prog_parameter.h"
 #include "prog_statevars.h"
 #include "program.h"
@@ -171,7 +171,7 @@ _mesa_append_fog_code(GLcontext *ctx, struct gl_fragment_program *fprog)
       if (inst->Opcode == OPCODE_END)
          break;
       if (inst->DstReg.File == PROGRAM_OUTPUT &&
-          inst->DstReg.Index == FRAG_RESULT_COLR) {
+          inst->DstReg.Index == FRAG_RESULT_COLOR) {
          /* change the instruction to write to colorTemp w/ clamping */
          inst->DstReg.File = PROGRAM_TEMPORARY;
          inst->DstReg.Index = colorTemp;
@@ -249,7 +249,7 @@ _mesa_append_fog_code(GLcontext *ctx, struct gl_fragment_program *fprog)
    /* LRP result.color.xyz, fogFactorTemp.xxxx, colorTemp, fogColorRef; */
    inst->Opcode = OPCODE_LRP;
    inst->DstReg.File = PROGRAM_OUTPUT;
-   inst->DstReg.Index = FRAG_RESULT_COLR;
+   inst->DstReg.Index = FRAG_RESULT_COLOR;
    inst->DstReg.WriteMask = WRITEMASK_XYZ;
    inst->SrcReg[0].File = PROGRAM_TEMPORARY;
    inst->SrcReg[0].Index = fogFactorTemp;
@@ -264,7 +264,7 @@ _mesa_append_fog_code(GLcontext *ctx, struct gl_fragment_program *fprog)
    /* MOV result.color.w, colorTemp.x;  # copy alpha */
    inst->Opcode = OPCODE_MOV;
    inst->DstReg.File = PROGRAM_OUTPUT;
-   inst->DstReg.Index = FRAG_RESULT_COLR;
+   inst->DstReg.Index = FRAG_RESULT_COLOR;
    inst->DstReg.WriteMask = WRITEMASK_W;
    inst->SrcReg[0].File = PROGRAM_TEMPORARY;
    inst->SrcReg[0].Index = colorTemp;
@@ -368,21 +368,21 @@ _mesa_count_texture_instructions(struct gl_program *prog)
 
 /**
  * Scan/rewrite program to remove reads of custom (output) registers.
- * The passed type has to be either PROGRAM_VARYING or PROGRAM_OUTPUT.
- * In GLSL vertex shaders, varying vars can be read and written.
- * Normally, vertex varying vars are implemented as output registers.
+ * The passed type has to be either PROGRAM_OUTPUT or PROGRAM_VARYING
+ * (for vertex shaders).
+ * In GLSL shaders, varying vars can be read and written.
  * On some hardware, trying to read an output register causes trouble.
  * So, rewrite the program to use a temporary register in this case.
  */
 void
-_mesa_remove_output_reads(struct gl_program *prog, enum register_file type)
+_mesa_remove_output_reads(struct gl_program *prog, gl_register_file type)
 {
    GLuint i;
    GLint outputMap[VERT_RESULT_MAX];
    GLuint numVaryingReads = 0;
 
-   assert(prog->Target == GL_VERTEX_PROGRAM_ARB);
    assert(type == PROGRAM_VARYING || type == PROGRAM_OUTPUT);
+   assert(prog->Target == GL_VERTEX_PROGRAM_ARB || type != PROGRAM_VARYING);
 
    for (i = 0; i < VERT_RESULT_MAX; i++)
       outputMap[i] = -1;