WRITEMASK_W != VSF_FLAG_W
#error Cannot change these!
#endif
-
+
#define SCALAR_FLAG (1<<31)
#define FLAG_MASK (1<<31)
#define OP_MASK (0xf) /* we are unlikely to have more than 15 */
OPN(END, 0),
};
#undef OPN
-
+
int r300VertexProgUpdateParams(GLcontext *ctx, struct r300_vertex_program_cont *vp, float *dst)
{
int pi;
struct gl_vertex_program *mesa_vp = &vp->mesa_program;
float *dst_o=dst;
struct gl_program_parameter_list *paramList;
-
+
if (mesa_vp->IsNVProgram) {
_mesa_load_tracked_matrices(ctx);
-
+
for (pi=0; pi < MAX_NV_VERTEX_PROGRAM_PARAMS; pi++) {
*dst++=ctx->VertexProgram.Parameters[pi][0];
*dst++=ctx->VertexProgram.Parameters[pi][1];
}
return dst - dst_o;
}
-
+
assert(mesa_vp->Base.Parameters);
_mesa_load_state_parameters(ctx, mesa_vp->Base.Parameters);
-
+
if(mesa_vp->Base.Parameters->NumParameters * 4 > VSF_MAX_FRAGMENT_LENGTH){
fprintf(stderr, "%s:Params exhausted\n", __FUNCTION__);
exit(-1);
}
-
+
paramList = mesa_vp->Base.Parameters;
for(pi=0; pi < paramList->NumParameters; pi++){
switch(paramList->Parameters[pi].Type){
-
+
case PROGRAM_STATE_VAR:
case PROGRAM_NAMED_PARAM:
//fprintf(stderr, "%s", vp->Parameters->Parameters[pi].Name);
*dst++=paramList->ParameterValues[pi][2];
*dst++=paramList->ParameterValues[pi][3];
break;
-
+
default: _mesa_problem(NULL, "Bad param type in %s", __FUNCTION__);
}
-
+
}
-
+
return dst - dst_o;
}
-
+
static unsigned long t_dst_mask(GLuint mask)
{
/* WRITEMASK_* is equivalent to VSF_FLAG_* */
static unsigned long t_dst_class(enum register_file file)
{
-
+
switch(file){
case PROGRAM_TEMPORARY:
return VSF_OUT_CLASS_TMP;
return VSF_OUT_CLASS_RESULT;
case PROGRAM_ADDRESS:
return VSF_OUT_CLASS_ADDR;
- /*
+ /*
case PROGRAM_INPUT:
case PROGRAM_LOCAL_PARAM:
case PROGRAM_ENV_PARAM:
static unsigned long t_src_class(enum register_file file)
{
-
+
switch(file){
case PROGRAM_TEMPORARY:
return VSF_IN_CLASS_TMP;
-
+
case PROGRAM_INPUT:
return VSF_IN_CLASS_ATTR;
-
+
case PROGRAM_LOCAL_PARAM:
case PROGRAM_ENV_PARAM:
case PROGRAM_NAMED_PARAM:
case PROGRAM_STATE_VAR:
return VSF_IN_CLASS_PARAM;
- /*
+ /*
case PROGRAM_OUTPUT:
case PROGRAM_WRITE_ONLY:
case PROGRAM_ADDRESS:
static void vp_dump_inputs(struct r300_vertex_program *vp, char *caller)
{
int i;
-
+
if(vp == NULL){
fprintf(stderr, "vp null in call to %s from %s\n", __FUNCTION__, caller);
return ;
}
-
+
fprintf(stderr, "%s:<", caller);
for(i=0; i < VERT_ATTRIB_MAX; i++)
fprintf(stderr, "%d ", vp->inputs[i]);
fprintf(stderr, ">\n");
-
+
}
#endif
{
int i;
int max_reg=-1;
-
+
if(src->File == PROGRAM_INPUT){
if(vp->inputs[src->Index] != -1)
return vp->inputs[src->Index];
-
+
for(i=0; i < VERT_ATTRIB_MAX; i++)
if(vp->inputs[i] > max_reg)
max_reg=vp->inputs[i];
-
+
vp->inputs[src->Index]=max_reg+1;
-
- //vp_dump_inputs(vp, __FUNCTION__);
-
+
+ //vp_dump_inputs(vp, __FUNCTION__);
+
return vp->inputs[src->Index];
}else{
if (src->Index < 0) {
static unsigned long t_src_scalar(struct r300_vertex_program *vp, struct prog_src_register *src)
{
-
+
return MAKE_VSF_SOURCE(t_src_index(vp, src),
t_swizzle(GET_SWZ(src->Swizzle, 0)),
t_swizzle(GET_SWZ(src->Swizzle, 0)),
case OPCODE_SGE: return R300_VPI_OUT_OP_SGE;
case OPCODE_SLT: return R300_VPI_OUT_OP_SLT;
case OPCODE_DP4: return R300_VPI_OUT_OP_DOT;
-
- default:
+
+ default:
fprintf(stderr, "%s: Should not be called with opcode %d!", __FUNCTION__, opcode);
}
exit(-1);
static unsigned long op_operands(enum prog_opcode opcode)
{
int i;
-
+
/* Can we trust mesas opcodes to be in order ? */
for(i=0; i < sizeof(op_names) / sizeof(*op_names); i++)
if(op_names[i].opcode == opcode)
return op_names[i].ip;
-
+
fprintf(stderr, "op %d not found in op_names\n", opcode);
exit(-1);
return 0;
}else if(dst->File == PROGRAM_ADDRESS) {
assert(dst->Index == 0);
}
-
+
return GL_TRUE;
}
t_src_class(b.File) == VSF_IN_CLASS_PARAM) || \
(t_src_class(a.File) == VSF_IN_CLASS_ATTR && \
t_src_class(b.File) == VSF_IN_CLASS_ATTR)))) \
-
+
#define ZERO_SRC_0 (MAKE_VSF_SOURCE(t_src_index(vp, &src[0]), \
SWIZZLE_ZERO, SWIZZLE_ZERO, \
SWIZZLE_ZERO, SWIZZLE_ZERO, \
t_src_class(src[0].File), VSF_FLAG_NONE) | (src[0].RelAddr << 4))
-
+
#define ZERO_SRC_1 (MAKE_VSF_SOURCE(t_src_index(vp, &src[1]), \
SWIZZLE_ZERO, SWIZZLE_ZERO, \
SWIZZLE_ZERO, SWIZZLE_ZERO, \
SWIZZLE_ZERO, SWIZZLE_ZERO, \
SWIZZLE_ZERO, SWIZZLE_ZERO, \
t_src_class(src[2].File), VSF_FLAG_NONE) | (src[2].RelAddr << 4))
-
+
#define ONE_SRC_0 (MAKE_VSF_SOURCE(t_src_index(vp, &src[0]), \
SWIZZLE_ONE, SWIZZLE_ONE, \
SWIZZLE_ONE, SWIZZLE_ONE, \
t_src_class(src[0].File), VSF_FLAG_NONE) | (src[0].RelAddr << 4))
-
+
#define ONE_SRC_1 (MAKE_VSF_SOURCE(t_src_index(vp, &src[1]), \
SWIZZLE_ONE, SWIZZLE_ONE, \
SWIZZLE_ONE, SWIZZLE_ONE, \
SWIZZLE_ONE, SWIZZLE_ONE, \
SWIZZLE_ONE, SWIZZLE_ONE, \
t_src_class(src[2].File), VSF_FLAG_NONE) | (src[2].RelAddr << 4))
-
+
/* DP4 version seems to trigger some hw peculiarity */
//#define PREFER_DP4
vp->pos_end=0; /* Not supported yet */
vp->program.length=0;
/*vp->num_temporaries=mesa_vp->Base.NumTemporaries;*/
-
+
for(i=0; i < VERT_ATTRIB_MAX; i++)
vp->inputs[i] = -1;
for(i=0; i < VERT_RESULT_MAX; i++)
vp->outputs[i] = -1;
-
+
assert(vp->key.OutputsWritten & (1 << VERT_RESULT_HPOS));
-
+
/* Assign outputs */
if(vp->key.OutputsWritten & (1 << VERT_RESULT_HPOS))
vp->outputs[VERT_RESULT_HPOS] = cur_reg++;
-
+
if(vp->key.OutputsWritten & (1 << VERT_RESULT_PSIZ))
vp->outputs[VERT_RESULT_PSIZ] = cur_reg++;
-
+
if(vp->key.OutputsWritten & (1 << VERT_RESULT_COL0))
vp->outputs[VERT_RESULT_COL0] = cur_reg++;
-
+
if(vp->key.OutputsWritten & (1 << VERT_RESULT_COL1))
vp->outputs[VERT_RESULT_COL1] = cur_reg++;
-
+
#if 0 /* Not supported yet */
if(vp->key.OutputsWritten & (1 << VERT_RESULT_BFC0))
vp->outputs[VERT_RESULT_BFC0] = cur_reg++;
-
+
if(vp->key.OutputsWritten & (1 << VERT_RESULT_BFC1))
vp->outputs[VERT_RESULT_BFC1] = cur_reg++;
-
+
if(vp->key.OutputsWritten & (1 << VERT_RESULT_FOGC))
vp->outputs[VERT_RESULT_FOGC] = cur_reg++;
#endif
-
+
for(i=VERT_RESULT_TEX0; i <= VERT_RESULT_TEX7; i++)
if(vp->key.OutputsWritten & (1 << i))
vp->outputs[i] = cur_reg++;
-
+
vp->translated = GL_TRUE;
vp->native = GL_TRUE;
-
+
o_inst=vp->program.body.i;
for(; vpi->Opcode != OPCODE_END; vpi++, o_inst++){
FREE_TEMPS();
vpi->DstReg.File = PROGRAM_TEMPORARY;
vpi->DstReg.Index = u_temp_i;
}
-
+
operands=op_operands(vpi->Opcode);
are_srcs_scalar=operands & SCALAR_FLAG;
operands &= OP_MASK;
-
+
for(i=0; i < operands; i++)
src[i]=vpi->SrcReg[i];
-
+
if(operands == 3){ /* TODO: scalars */
if( CMP_SRCS(src[1], src[2]) || CMP_SRCS(src[0], src[2]) ){
o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, u_temp_i,
VSF_FLAG_ALL, VSF_OUT_CLASS_TMP);
-
+
o_inst->src1=MAKE_VSF_SOURCE(t_src_index(vp, &src[2]),
SWIZZLE_X, SWIZZLE_Y,
SWIZZLE_Z, SWIZZLE_W,
o_inst->src2=ZERO_SRC_2;
o_inst->src3=ZERO_SRC_2;
o_inst++;
-
+
src[2].File=PROGRAM_TEMPORARY;
src[2].Index=u_temp_i;
src[2].RelAddr=0;
u_temp_i--;
}
-
+
}
-
+
if(operands >= 2){
if( CMP_SRCS(src[1], src[0]) ){
o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, u_temp_i,
VSF_FLAG_ALL, VSF_OUT_CLASS_TMP);
-
+
o_inst->src1=MAKE_VSF_SOURCE(t_src_index(vp, &src[0]),
SWIZZLE_X, SWIZZLE_Y,
SWIZZLE_Z, SWIZZLE_W,
o_inst->src2=ZERO_SRC_0;
o_inst->src3=ZERO_SRC_0;
o_inst++;
-
+
src[0].File=PROGRAM_TEMPORARY;
src[0].Index=u_temp_i;
src[0].RelAddr=0;
u_temp_i--;
}
}
-
+
/* These ops need special handling. */
switch(vpi->Opcode){
case OPCODE_POW:
o_inst->src2=ZERO_SRC_0;
o_inst->src3=t_src_scalar(vp, &src[1]);
goto next;
-
- case OPCODE_MOV://ADD RESULT 1.X Y Z W PARAM 0{} {X Y Z W} PARAM 0{} {ZERO ZERO ZERO ZERO}
+
+ case OPCODE_MOV://ADD RESULT 1.X Y Z W PARAM 0{} {X Y Z W} PARAM 0{} {ZERO ZERO ZERO ZERO}
case OPCODE_SWZ:
#if 1
o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, t_dst_index(vp, &vpi->DstReg),
o_inst->src3=ZERO_SRC_0;
#else
hw_op=(src[0].File == PROGRAM_TEMPORARY) ? R300_VPI_OUT_OP_MAD_2 : R300_VPI_OUT_OP_MAD;
-
+
o_inst->op=MAKE_VSF_OP(hw_op, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
o_inst->src1=t_src(vp, &src[0]);
o_inst->src2=ONE_SRC_0;
o_inst->src3=ZERO_SRC_0;
-#endif
+#endif
goto next;
-
+
case OPCODE_ADD:
#if 1
hw_op=(src[0].File == PROGRAM_TEMPORARY &&
src[1].File == PROGRAM_TEMPORARY) ? R300_VPI_OUT_OP_MAD_2 : R300_VPI_OUT_OP_MAD;
-
+
o_inst->op=MAKE_VSF_OP(hw_op, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
o_inst->src1=ONE_SRC_0;
o_inst->src1=t_src(vp, &src[0]);
o_inst->src2=t_src(vp, &src[1]);
o_inst->src3=ZERO_SRC_1;
-
+
#endif
goto next;
-
+
case OPCODE_MAD:
hw_op=(src[0].File == PROGRAM_TEMPORARY &&
src[1].File == PROGRAM_TEMPORARY &&
src[2].File == PROGRAM_TEMPORARY) ? R300_VPI_OUT_OP_MAD_2 : R300_VPI_OUT_OP_MAD;
-
+
o_inst->op=MAKE_VSF_OP(hw_op, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
o_inst->src1=t_src(vp, &src[0]);
o_inst->src2=t_src(vp, &src[1]);
o_inst->src3=t_src(vp, &src[2]);
goto next;
-
+
case OPCODE_MUL: /* HW mul can take third arg but appears to have some other limitations. */
hw_op=(src[0].File == PROGRAM_TEMPORARY &&
src[1].File == PROGRAM_TEMPORARY) ? R300_VPI_OUT_OP_MAD_2 : R300_VPI_OUT_OP_MAD;
-
+
o_inst->op=MAKE_VSF_OP(hw_op, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
o_inst->src1=t_src(vp, &src[0]);
o_inst->src3=ZERO_SRC_1;
goto next;
-
- case OPCODE_DP3://DOT RESULT 1.X Y Z W PARAM 0{} {X Y Z ZERO} PARAM 0{} {X Y Z ZERO}
+
+ case OPCODE_DP3://DOT RESULT 1.X Y Z W PARAM 0{} {X Y Z ZERO} PARAM 0{} {X Y Z ZERO}
o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_DOT, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
-
+
o_inst->src1=MAKE_VSF_SOURCE(t_src_index(vp, &src[0]),
t_swizzle(GET_SWZ(src[0].Swizzle, 0)),
t_swizzle(GET_SWZ(src[0].Swizzle, 1)),
SWIZZLE_ZERO,
t_src_class(src[0].File),
src[0].NegateBase ? VSF_FLAG_XYZ : VSF_FLAG_NONE) | (src[0].RelAddr << 4);
-
+
o_inst->src2=MAKE_VSF_SOURCE(t_src_index(vp, &src[1]),
t_swizzle(GET_SWZ(src[1].Swizzle, 0)),
t_swizzle(GET_SWZ(src[1].Swizzle, 1)),
#if 1
hw_op=(src[0].File == PROGRAM_TEMPORARY &&
src[1].File == PROGRAM_TEMPORARY) ? R300_VPI_OUT_OP_MAD_2 : R300_VPI_OUT_OP_MAD;
-
+
o_inst->op=MAKE_VSF_OP(hw_op, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
o_inst->src1=t_src(vp, &src[0]);
#else
o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
-
+
o_inst->src1=t_src(vp, &src[0]);
o_inst->src2=MAKE_VSF_SOURCE(t_src_index(vp, &src[1]),
t_swizzle(GET_SWZ(src[1].Swizzle, 0)),
o_inst->src3=0;
#endif
goto next;
-
+
case OPCODE_ABS://MAX RESULT 1.X Y Z W PARAM 0{} {X Y Z W} PARAM 0{X Y Z W } {X Y Z W} neg Xneg Yneg Zneg W
o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_MAX, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
-
+
o_inst->src1=t_src(vp, &src[0]);
o_inst->src2=MAKE_VSF_SOURCE(t_src_index(vp, &src[0]),
t_swizzle(GET_SWZ(src[0].Swizzle, 0)),
(!src[0].NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[0].RelAddr << 4);
o_inst->src3=0;
goto next;
-
+
case OPCODE_FLR:
- /* FRC TMP 0.X Y Z W PARAM 0{} {X Y Z W}
+ /* FRC TMP 0.X Y Z W PARAM 0{} {X Y Z W}
ADD RESULT 1.X Y Z W PARAM 0{} {X Y Z W} TMP 0{X Y Z W } {X Y Z W} neg Xneg Yneg Zneg W */
o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_FRC, u_temp_i,
t_dst_mask(vpi->DstReg.WriteMask), VSF_OUT_CLASS_TMP);
-
+
o_inst->src1=t_src(vp, &src[0]);
o_inst->src2=ZERO_SRC_0;
o_inst->src3=ZERO_SRC_0;
o_inst++;
-
+
o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_ADD, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
-
+
o_inst->src1=t_src(vp, &src[0]);
o_inst->src2=MAKE_VSF_SOURCE(u_temp_i,
VSF_IN_COMPONENT_X,
o_inst->src3=ZERO_SRC_0;
u_temp_i--;
goto next;
-
+
case OPCODE_LG2:// LG2 RESULT 1.X Y Z W PARAM 0{} {X X X X}
o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_LG2, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
-
+
o_inst->src1=MAKE_VSF_SOURCE(t_src_index(vp, &src[0]),
t_swizzle(GET_SWZ(src[0].Swizzle, 0)),
t_swizzle(GET_SWZ(src[0].Swizzle, 0)),
o_inst->src2=ZERO_SRC_0;
o_inst->src3=ZERO_SRC_0;
goto next;
-
- case OPCODE_LIT://LIT TMP 1.Y Z TMP 1{} {X W Z Y} TMP 1{} {Y W Z X} TMP 1{} {Y X Z W}
+
+ case OPCODE_LIT://LIT TMP 1.Y Z TMP 1{} {X W Z Y} TMP 1{} {Y W Z X} TMP 1{} {Y X Z W}
o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_LIT, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
/* NOTE: Users swizzling might not work. */
t_src_class(src[0].File),
src[0].NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[0].RelAddr << 4);
goto next;
-
- case OPCODE_DPH://DOT RESULT 1.X Y Z W PARAM 0{} {X Y Z ONE} PARAM 0{} {X Y Z W}
+
+ case OPCODE_DPH://DOT RESULT 1.X Y Z W PARAM 0{} {X Y Z ONE} PARAM 0{} {X Y Z W}
o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_DOT, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
-
+
o_inst->src1=MAKE_VSF_SOURCE(t_src_index(vp, &src[0]),
t_swizzle(GET_SWZ(src[0].Swizzle, 0)),
t_swizzle(GET_SWZ(src[0].Swizzle, 1)),
o_inst->src2=t_src(vp, &src[1]);
o_inst->src3=ZERO_SRC_1;
goto next;
-
+
case OPCODE_XPD:
/* mul r0, r1.yzxw, r2.zxyw
mad r0, -r2.yzxw, r1.zxyw, r0
NOTE: might need MAD_2
*/
-
+
o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_MAD, u_temp_i,
t_dst_mask(vpi->DstReg.WriteMask), VSF_OUT_CLASS_TMP);
-
+
o_inst->src1=MAKE_VSF_SOURCE(t_src_index(vp, &src[0]),
t_swizzle(GET_SWZ(src[0].Swizzle, 1)), // y
t_swizzle(GET_SWZ(src[0].Swizzle, 2)), // z
t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // w
t_src_class(src[0].File),
src[0].NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[0].RelAddr << 4);
-
+
o_inst->src2=MAKE_VSF_SOURCE(t_src_index(vp, &src[1]),
t_swizzle(GET_SWZ(src[1].Swizzle, 2)), // z
t_swizzle(GET_SWZ(src[1].Swizzle, 0)), // x
t_swizzle(GET_SWZ(src[1].Swizzle, 3)), // w
t_src_class(src[1].File),
src[1].NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[1].RelAddr << 4);
-
+
o_inst->src3=ZERO_SRC_1;
o_inst++;
u_temp_i--;
-
+
o_inst->op=MAKE_VSF_OP(R300_VPI_OUT_OP_MAD, t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
-
+
o_inst->src1=MAKE_VSF_SOURCE(t_src_index(vp, &src[1]),
t_swizzle(GET_SWZ(src[1].Swizzle, 1)), // y
t_swizzle(GET_SWZ(src[1].Swizzle, 2)), // z
t_swizzle(GET_SWZ(src[1].Swizzle, 3)), // w
t_src_class(src[1].File),
(!src[1].NegateBase) ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[1].RelAddr << 4);
-
+
o_inst->src2=MAKE_VSF_SOURCE(t_src_index(vp, &src[0]),
t_swizzle(GET_SWZ(src[0].Swizzle, 2)), // z
t_swizzle(GET_SWZ(src[0].Swizzle, 0)), // x
t_swizzle(GET_SWZ(src[0].Swizzle, 3)), // w
t_src_class(src[0].File),
src[0].NegateBase ? VSF_FLAG_ALL : VSF_FLAG_NONE) | (src[0].RelAddr << 4);
-
+
o_inst->src3=MAKE_VSF_SOURCE(u_temp_i+1,
VSF_IN_COMPONENT_X,
VSF_IN_COMPONENT_Y,
VSF_IN_COMPONENT_W,
VSF_IN_CLASS_TMP,
VSF_FLAG_NONE);
-
+
goto next;
case OPCODE_RCC:
default:
break;
}
-
+
o_inst->op=MAKE_VSF_OP(t_opcode(vpi->Opcode), t_dst_index(vp, &vpi->DstReg),
t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File));
-
+
if(are_srcs_scalar){
switch(operands){
case 1:
o_inst->src2=ZERO_SRC_0;
o_inst->src3=ZERO_SRC_0;
break;
-
+
case 2:
o_inst->src1=t_src_scalar(vp, &src[0]);
o_inst->src2=t_src_scalar(vp, &src[1]);
o_inst->src3=ZERO_SRC_1;
break;
-
+
case 3:
o_inst->src1=t_src_scalar(vp, &src[0]);
o_inst->src2=t_src_scalar(vp, &src[1]);
o_inst->src3=t_src_scalar(vp, &src[2]);
break;
-
+
default:
fprintf(stderr, "scalars and op RCC not handled yet");
exit(-1);
o_inst->src2=ZERO_SRC_0;
o_inst->src3=ZERO_SRC_0;
break;
-
+
case 2:
o_inst->src1=t_src(vp, &src[0]);
o_inst->src2=t_src(vp, &src[1]);
o_inst->src3=ZERO_SRC_1;
break;
-
+
case 3:
o_inst->src1=t_src(vp, &src[0]);
o_inst->src2=t_src(vp, &src[1]);
o_inst->src3=t_src(vp, &src[2]);
break;
-
+
default:
fprintf(stderr, "scalars and op RCC not handled yet");
exit(-1);
}
next: ;
}
-
+
/* Will most likely segfault before we get here... fix later. */
if(o_inst - vp->program.body.i >= VSF_MAX_FRAGMENT_LENGTH/4) {
vp->program.length = 0;
vpi[i].SrcReg[2].Index = 0;
vpi[i].SrcReg[2].Swizzle = SWIZZLE_XYZW;
}
-#endif
+#endif
}
_mesa_copy_instructions (&vpi[i], prog->Instructions, prog->NumInstructions);
struct prog_instruction *vpi;
struct prog_instruction *vpi_insert;
int i = 0;
-
+
vpi = _mesa_alloc_instructions (prog->NumInstructions + 2);
_mesa_init_instructions (vpi, prog->NumInstructions + 2);
/* all but END */
r300_translate_vertex_shader(vp, mesa_vp->Base.Instructions);
- return vp;
+ return vp;
}
void r300_select_vertex_shader(r300ContextPtr r300)
for (i = 0; i < ctx->Const.MaxTextureUnits; i++)
if (!(InputsRead & (FRAG_BIT_TEX0 << i)))
break;
-
+
if(i == ctx->Const.MaxTextureUnits){
fprintf(stderr, "\tno free texcoord found\n");
exit(0);
if ((InputsRead & FRAG_BIT_COL1) /*||
(InputsRead & FRAG_BIT_FOGC)*/)
wanted_key.OutputsWritten |= 1 << VERT_RESULT_COL1;
-
+
for (i = 0; i < ctx->Const.MaxTextureUnits; i++)
if (InputsRead & (FRAG_BIT_TEX0 << i))
wanted_key.OutputsWritten |= 1 << (VERT_RESULT_TEX0 + i);