int t2rs;
unsigned long num_temporaries; /* Number of temp vars used by program */
int inputs[VERT_ATTRIB_MAX];
+ GLuint outputs;
};
/* 64 appears to be the maximum */
GLuint vic_1 = 0; /* R300_VAP_INPUT_CNTL_1 */
GLuint aa_vap_reg = 0; /* VAP register assignment */
GLuint i;
- GLuint inputs = 0;
+ GLuint inputs = 0, outputs = 0;
#define CONFIGURE_AOS(r, f, v, sz, cn) { \
nr = 0;
} else {
inputs = TNL_CONTEXT(ctx)->render_inputs;
+ /* Hack to see what would happen if we would enable tex units according to their enabled values.
+ Why arent we doing this?
+ As for vertex programs tex coords should be passed if program wants them as some programs might deliver
+ some other values to the program with them. Futher more some programs might generate output tex coords
+ without taking them as inputs. */
+ /*for (i=0;i<ctx->Const.MaxTextureUnits;i++)
+ if(ctx->Texture.Unit[i].Enabled == 0)
+ inputs &= ~ (_TNL_BIT_TEX0<<i);*/
}
rmesa->state.render_inputs = inputs;
#endif
/* Stage 3: VAP output */
+ if (rmesa->current_vp != NULL)
+ outputs = rmesa->current_vp->outputs;
+ else
+ outputs = inputs;
+
R300_STATECHANGE(r300, vof);
- r300->hw.vof.cmd[R300_VOF_CNTL_0]=R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT
- | R300_VAP_OUTPUT_VTX_FMT_0__COLOR_PRESENT;
+
+ r300->hw.vof.cmd[R300_VOF_CNTL_0]=0;
+ if(outputs & _TNL_BIT_POS)
+ r300->hw.vof.cmd[R300_VOF_CNTL_0] |= R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT;
+ if(outputs & _TNL_BIT_COLOR0)
+ r300->hw.vof.cmd[R300_VOF_CNTL_0] |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_PRESENT;
r300->hw.vof.cmd[R300_VOF_CNTL_1]=0;
for(i=0;i < ctx->Const.MaxTextureUnits;i++)
- if(r300->state.render_inputs & (_TNL_BIT_TEX0<<i))
+ if(outputs & (_TNL_BIT_TEX0<<i))
r300->hw.vof.cmd[R300_VOF_CNTL_1]|=(4<<(3*i));
rmesa->state.aos_count = nr;
/*if(ctx->Texture.Unit[i].Enabled == 0)
continue;*/
if( ((r300->state.render_inputs & (_TNL_BIT_TEX0<<i))!=0) != ((ctx->Texture.Unit[i].Enabled)!=0) ) {
- WARN_ONCE("Mismatch between render_inputs and ctx->Texture.Unit[i].Enabled value.\n");
+ WARN_ONCE("Mismatch between render_inputs and ctx->Texture.Unit[i].Enabled value(%d vs %d).\n",
+ ((r300->state.render_inputs & (_TNL_BIT_TEX0<<i))!=0), ((ctx->Texture.Unit[i].Enabled)!=0));
}
if(r300->state.render_inputs & (_TNL_BIT_TEX0<<i)) {
0x00,
0x00
};
+ GLuint vap_outputs;
/* This needs to be rewritten - it is a hack at best */
cur_reg = 0;
r300->hw.rr.cmd[R300_RR_ROUTE_0] = 0;
+ if (r300->current_vp != NULL)
+ vap_outputs = r300->current_vp->outputs;
+ else
+ vap_outputs = r300->state.render_inputs;
+
for (i=0;i<ctx->Const.MaxTextureUnits;i++) {
r300->hw.ri.cmd[R300_RI_INTERP_0+i] = 0
| R300_RS_INTERP_USED
cur_reg++;
}
}
- if (r300->state.render_inputs & _TNL_BIT_COLOR0)
+ if (vap_outputs & _TNL_BIT_COLOR0)
r300->hw.rr.cmd[R300_RR_ROUTE_0] |= 0
| R300_RS_ROUTE_0_COLOR
| (cur_reg << R300_RS_ROUTE_0_COLOR_DEST_SHIFT);
int max_reg=-1;
if(src->File == PROGRAM_INPUT){
- /*
- switch(src->Index){
- case 0: return 0;
- case 3: return 1;
-
- case 2: return 2;
- case 8: return 8;
-
- default: printf("unknown input index %d\n", src->Index); exit(0); break;
- }*/
if(vp->inputs[src->Index] != -1)
return vp->inputs[src->Index];
for(i=0; i < VERT_ATTRIB_MAX; i++)
vp->inputs[i]=-1;
+ vp->outputs = 0;
+ /* FIXME: hardcoded values in arbprogparse.c:parse_result_binding ()
+ We might want to use these constants for VAP output in general as well once they have been added to
+ mesa headers.
+ */
+ if(mesa_vp->OutputsWritten & (1<<0))
+ vp->outputs |= _TNL_BIT_POS;
+ if(mesa_vp->OutputsWritten & (1<<1))
+ vp->outputs |= _TNL_BIT_COLOR0;
+ if(mesa_vp->OutputsWritten & (1<<2))
+ vp->outputs |= _TNL_BIT_COLOR1;
+ for(i=0; i < 8/*ctx->Const.MaxTextureUnits*/; i++)
+ if(mesa_vp->OutputsWritten & (1<<(7+i)))
+ vp->outputs |= _TNL_BIT_TEX(i);
+ if(mesa_vp->OutputsWritten & ~(0x7 | 0x3f80))
+ fprintf(stderr, "%s:Odd bits(0x%08x)\n", __FUNCTION__, mesa_vp->OutputsWritten);
+
o_inst=vp->program.body.i;
for(vpi=mesa_vp->Instructions; vpi->Opcode != VP_OPCODE_END; vpi++, o_inst++){