}
static GLfloat RoughApproxExp2(GLfloat t)
-{
+{
#if 0
fi_type fi;
fi.i = (GLint) t;
}
static GLfloat ApproxExp2(GLfloat t)
-{
+{
return (GLfloat) _mesa_pow(2.0, t);
}
/**
* Perform a reduced swizzle:
*/
-static void do_RSW( struct arb_vp_machine *m, union instruction op )
+static void do_RSW( struct arb_vp_machine *m, union instruction op )
{
GLfloat *result = m->File[0][op.rsw.dst];
const GLfloat *arg0 = m->File[op.rsw.file0][op.rsw.idx0];
result[1] = arg0[GET_RSW(swz, 1)];
result[2] = arg0[GET_RSW(swz, 2)];
result[3] = arg0[GET_RSW(swz, 3)];
-
+
if (neg) {
if (neg & 0x1) result[0] = -result[0];
if (neg & 0x2) result[1] = -result[1];
{
GLfloat *dst = m->File[0][op.msk.dst];
const GLfloat *arg = m->File[op.msk.file][op.msk.idx];
-
+
if (op.msk.mask & 0x1) dst[0] = arg[0];
if (op.msk.mask & 0x2) dst[1] = arg[1];
if (op.msk.mask & 0x4) dst[2] = arg[2];
static void do_PRT( struct arb_vp_machine *m, union instruction op )
{
const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0];
-
- _mesa_printf("%d: %f %f %f %f\n", m->vtx_nr,
+
+ _mesa_printf("%d: %f %f %f %f\n", m->vtx_nr,
arg0[0], arg0[1], arg0[2], arg0[3]);
}
* internal registers and ignore write masks and swizzling issues.
*/
-static void do_ABS( struct arb_vp_machine *m, union instruction op )
+static void do_ABS( struct arb_vp_machine *m, union instruction op )
{
GLfloat *result = m->File[0][op.alu.dst];
const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0];
const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0];
const GLfloat *arg1 = m->File[op.alu.file1][op.alu.idx1];
- result[0] = (arg0[0] * arg1[0] +
- arg0[1] * arg1[1] +
+ result[0] = (arg0[0] * arg1[0] +
+ arg0[1] * arg1[1] +
arg0[2] * arg1[2]);
PUFF(result);
const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0];
const GLfloat *arg1 = m->File[op.alu.file1][op.alu.idx1];
- result[0] = (arg0[0] * arg1[0] +
- arg0[1] * arg1[1] +
- arg0[2] * arg1[2] +
+ result[0] = (arg0[0] * arg1[0] +
+ arg0[1] * arg1[1] +
+ arg0[2] * arg1[2] +
arg0[3] * arg1[3]);
PUFF(result);
const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0];
const GLfloat *arg1 = m->File[op.alu.file1][op.alu.idx1];
- result[0] = (arg0[0] * arg1[0] +
- arg0[1] * arg1[1] +
- arg0[2] * arg1[2] +
+ result[0] = (arg0[0] * arg1[0] +
+ arg0[1] * arg1[1] +
+ arg0[2] * arg1[2] +
1.0 * arg1[3]);
-
+
PUFF(result);
}
/* Intended to be high precision:
*/
-static void do_EX2( struct arb_vp_machine *m, union instruction op )
+static void do_EX2( struct arb_vp_machine *m, union instruction op )
{
GLfloat *result = m->File[0][op.alu.dst];
const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0];
result[3] = 1.0F;
}
-static void do_FLR( struct arb_vp_machine *m, union instruction op )
+static void do_FLR( struct arb_vp_machine *m, union instruction op )
{
GLfloat *result = m->File[0][op.alu.dst];
const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0];
result[3] = FLOORF(arg0[3]);
}
-static void do_FRC( struct arb_vp_machine *m, union instruction op )
+static void do_FRC( struct arb_vp_machine *m, union instruction op )
{
GLfloat *result = m->File[0][op.alu.dst];
const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0];
/* High precision log base 2:
*/
-static void do_LG2( struct arb_vp_machine *m, union instruction op )
+static void do_LG2( struct arb_vp_machine *m, union instruction op )
{
GLfloat *result = m->File[0][op.alu.dst];
const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0];
/* Intended to be "high" precision
*/
-static void do_POW( struct arb_vp_machine *m, union instruction op )
+static void do_POW( struct arb_vp_machine *m, union instruction op )
{
GLfloat *result = m->File[0][op.alu.dst];
const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0];
GLfloat *result = m->File[0][op.alu.dst];
const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0];
- result[0] = 1.0F / arg0[0];
+ result[0] = 1.0F / arg0[0];
PUFF(result);
}
result[3] = (arg0[3] < arg1[3]) ? 1.0F : 0.0F;
}
-static void do_SUB( struct arb_vp_machine *m, union instruction op )
+static void do_SUB( struct arb_vp_machine *m, union instruction op )
{
GLfloat *result = m->File[0][op.alu.dst];
const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0];
}
-static void do_XPD( struct arb_vp_machine *m, union instruction op )
+static void do_XPD( struct arb_vp_machine *m, union instruction op )
{
GLfloat *result = m->File[0][op.alu.dst];
const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0];
result[2] = arg0[0] * arg1[1] - arg0[1] * arg1[0];
}
-static void do_NOP( struct arb_vp_machine *m, union instruction op )
+static void do_NOP( struct arb_vp_machine *m, union instruction op )
{
}
};
if (file == 0) {
- if (reg == REG_RES)
+ if (reg == REG_RES)
_mesa_printf("RES");
else if (reg >= REG_ARG0 && reg <= REG_ARG1)
_mesa_printf("ARG%d", reg - REG_ARG0);
else
_mesa_printf("REG%d", reg);
}
- else
+ else
_mesa_printf("%s:%d", reg_file[file], reg);
}
_mesa_printf(".");
for (i = 0; i < 4; i++, swz >>= 2) {
const char *cswz = "xyzw";
- if (neg & (1<<i))
+ if (neg & (1<<i))
_mesa_printf("-");
_mesa_printf("%c", cswz[swz&0x3]);
}
#define ALU 1
#define SWZ 2
-static const struct opcode_info opcode_info[] =
+static const struct opcode_info opcode_info[] =
{
{ 1, "ABS", print_ALU },
{ 2, "ADD", print_ALU },
}
-static void (* const opcode_func[])(struct arb_vp_machine *, union instruction) =
+static void (* const opcode_func[])(struct arb_vp_machine *, union instruction) =
{
do_ABS,
do_ADD,
/* These two aren't populated by the parser?
*/
- case PROGRAM_LOCAL_PARAM:
+ case PROGRAM_LOCAL_PARAM:
reg = cvp_make_reg(FILE_LOCAL_PARAM, index);
- if (rel)
+ if (rel)
return cvp_emit_rel(cp, reg, tmpreg);
else
return reg;
- case PROGRAM_ENV_PARAM:
+ case PROGRAM_ENV_PARAM:
reg = cvp_make_reg(FILE_ENV_PARAM, index);
- if (rel)
+ if (rel)
return cvp_emit_rel(cp, reg, tmpreg);
else
return reg;
case PROGRAM_STATE_VAR:
reg = cvp_make_reg(FILE_STATE_PARAM, index);
- if (rel)
+ if (rel)
return cvp_emit_rel(cp, reg, tmpreg);
else
return reg;
{
struct reg reg = cvp_load_reg( cp, src->File, src->Index, src->RelAddr, arg );
union instruction rsw, noop;
-
- /* Emit any necessary swizzling.
+
+ /* Emit any necessary swizzling.
*/
rsw.dword = 0;
rsw.rsw.neg = src->Negate ? WRITEMASK_XYZW : 0;
}
/* Optimization: When writing (with a writemask) to an undefined
- * value for the first time, the writemask may be ignored.
+ * value for the first time, the writemask may be ignored.
*/
if (mask != WRITEMASK_XYZW && (cp->reg_active & (1 << idx))) {
fixup->msk.opcode = MSK;
}
}
-static struct reg cvp_emit_rsw( struct compilation *cp,
+static struct reg cvp_emit_rsw( struct compilation *cp,
GLuint dst,
struct reg src,
- GLuint neg,
+ GLuint neg,
GLuint swz,
GLboolean force)
{
op->rsw.idx0 = src.idx;
op->rsw.neg = neg;
op->rsw.swz = swz;
-
+
retval.file = FILE_REG;
retval.idx = dst;
return retval;
op->alu.dst = dst;
op->alu.file0 = src.file;
op->alu.idx0 = src.idx;
-
+
retval.file = FILE_REG;
retval.idx = dst;
return retval;
*/
case VP_OPCODE_MAD:
result = cvp_choose_result( cp, &inst->DstReg, &fixup );
- for (i = 0; i < 3; i++)
+ for (i = 0; i < 3; i++)
reg[i] = cvp_emit_arg( cp, &inst->SrcReg[i], REG_ARG0+i );
op = cvp_next_instruction(cp);
if (mask == WRITEMASK_XYZW) {
cvp_emit_rsw(cp, result, reg[0], neg0, swz0, GL_TRUE);
-
+
}
else if (mask == 0) {
cvp_emit_rsw(cp, result, reg[1], neg1, swz1, GL_TRUE);
default:
result = cvp_choose_result( cp, &inst->DstReg, &fixup );
- for (i = 0; i < info->nr_args; i++)
+ for (i = 0; i < info->nr_args; i++)
reg[i] = cvp_emit_arg( cp, &inst->SrcReg[i], REG_ARG0 + i );
op = cvp_next_instruction(cp);
if (result == REG_RES) {
op = cvp_next_instruction(cp);
op->dword = fixup.dword;
- }
+ }
break;
}
}
static void compile_vertex_program( struct vertex_program *program,
GLboolean try_codegen )
-{
+{
struct compilation cp;
struct tnl_compiled_program *p = CALLOC_STRUCT(tnl_compiled_program);
GLuint i;
- if (program->TnlData)
+ if (program->TnlData)
free_tnl_data( program );
-
+
program->TnlData = p;
/* Initialize cp. Note that ctx and VB aren't used in compilation
}
_mesa_printf("\n\n");
}
-
+
#ifdef USE_SSE_ASM
if (try_codegen)
_tnl_sse_codegen_vertex_program(p);
GLuint count = clip->count;
for (nr = 0, i = 0 ; i < count ; i++) {
- GLfloat dp = (coord[0] * a +
+ GLfloat dp = (coord[0] * a +
coord[1] * b +
coord[2] * c +
coord[3] * d);
}
/**
- * Execute the given vertex program.
- *
+ * Execute the given vertex program.
+ *
* TODO: Integrate the t_vertex.c code here, to build machine vertices
* directly at this point.
*
GLuint i, j, outputs;
if (!program || program->IsNVProgram)
- return GL_TRUE;
+ return GL_TRUE;
if (program->Parameters) {
_mesa_load_state_parameters(ctx, program->Parameters);
- }
-
+ }
+
p = (struct tnl_compiled_program *)program->TnlData;
assert(p);
m->input[j].size = m->VB->AttribPtr[i]->size;
ASSIGN_4V(m->File[0][REG_IN0 + i], 0, 0, 0, 1);
}
- }
+ }
for (i = 0; i < 15; i++) {
if (program->OutputsWritten & (1<<i)) {
m->output[j].idx = i;
m->output[j].data = (GLfloat *)m->attribs[i].data;
}
- }
+ }
/* Run the actual program:
}
else {
for (j = 0; j < p->nr_instructions; j++) {
- union instruction inst = p->instructions[j];
+ union instruction inst = p->instructions[j];
opcode_func[inst.alu.opcode]( m, inst );
}
}
validate_vertex_program( GLcontext *ctx, struct tnl_pipeline_stage *stage )
{
struct arb_vp_machine *m = ARB_VP_MACHINE(stage);
- struct vertex_program *program =
+ struct vertex_program *program =
(ctx->VertexProgram._Enabled ? ctx->VertexProgram.Current : 0);
if (!program && ctx->_MaintainTnlProgram) {
if (program) {
if (!program->TnlData)
compile_vertex_program( program, m->try_codegen );
-
+
/* Grab the state GL state and put into registers:
*/
m->File[FILE_LOCAL_PARAM] = program->Base.LocalParams;