fix GL_DOT3_RGBA texture combiner mode in generated fragment programs (bug #11030)
[mesa.git] / src / mesa / swrast / s_atifragshader.c
index 75df50b0baa0a60cc4001cef8dc90d983a54fccf..947054faa3053fca17463af6a37e6cc2bd6b72db 100644 (file)
@@ -268,7 +268,7 @@ handle_pass_op(struct atifs_machine *machine, struct atifs_setupinst *texinst,
    if (pass_tex >= GL_TEXTURE0_ARB && pass_tex <= GL_TEXTURE7_ARB) {
       pass_tex -= GL_TEXTURE0_ARB;
       COPY_4V(machine->Registers[idx],
-             span->array->texcoords[pass_tex][column]);
+             span->array->attribs[FRAG_ATTRIB_TEX0 + pass_tex][column]);
    }
    else if (pass_tex >= GL_REG_0_ATI && pass_tex <= GL_REG_5_ATI) {
       pass_tex -= GL_REG_0_ATI;
@@ -290,7 +290,8 @@ handle_sample_op(GLcontext * ctx, struct atifs_machine *machine,
 
    if (coord_source >= GL_TEXTURE0_ARB && coord_source <= GL_TEXTURE7_ARB) {
       coord_source -= GL_TEXTURE0_ARB;
-      COPY_4V(tex_coords, span->array->texcoords[coord_source][column]);
+      COPY_4V(tex_coords,
+              span->array->attribs[FRAG_ATTRIB_TEX0 + coord_source][column]);
    }
    else if (coord_source >= GL_REG_0_ATI && coord_source <= GL_REG_5_ATI) {
       coord_source -= GL_REG_0_ATI;
@@ -325,7 +326,8 @@ execute_shader(GLcontext *ctx, const struct ati_fragment_shader *shader,
    struct atifs_instruction *inst;
    struct atifs_setupinst *texinst;
    GLint optype;
-   GLint i, j, pass;
+   GLuint i;
+   GLint j, pass;
    GLint dstreg;
    GLfloat src[2][3][4];
    GLfloat zeros[4] = { 0.0, 0.0, 0.0, 0.0 };
@@ -348,7 +350,7 @@ execute_shader(GLcontext *ctx, const struct ati_fragment_shader *shader,
 
         /* setup the source registers for color and alpha ops */
         for (optype = 0; optype < 2; optype++) {
-           for (i = 0; i < inst->ArgCount[optype]; i++) {
+           for (i = 0; i < inst->ArgCount[optype]; i++) {
               GLint index = inst->SrcReg[optype][i].Index;
 
               if (index >= GL_REG_0_ATI && index <= GL_REG_5_ATI)
@@ -572,8 +574,8 @@ init_machine(GLcontext * ctx, struct atifs_machine *machine,
         machine->Registers[i][j] = 0.0;
    }
 
-   COPY_4V(inputs[ATI_FS_INPUT_PRIMARY], span->array->color.sz4.rgba[col]);
-   COPY_4V(inputs[ATI_FS_INPUT_SECONDARY], span->array->color.sz4.spec[col]);
+   COPY_4V(inputs[ATI_FS_INPUT_PRIMARY], span->array->attribs[FRAG_ATTRIB_COL0][col]);
+   COPY_4V(inputs[ATI_FS_INPUT_SECONDARY], span->array->attribs[FRAG_ATTRIB_COL1][col]);
 }
 
 
@@ -604,7 +606,7 @@ _swrast_exec_fragment_shader(GLcontext * ctx, SWspan *span)
            const GLfloat *colOut = machine.Registers[0];
             /*fprintf(stderr,"outputs %f %f %f %f\n",
               colOut[0], colOut[1], colOut[2], colOut[3]); */
-            COPY_4V(span->array->color.sz4.rgba[i], colOut);
+            COPY_4V(span->array->attribs[FRAG_ATTRIB_COL0][i], colOut);
         }
       }
    }