Change _mesa_init_instruction() to initialize an array of instructions.
This commit is contained in:
@@ -474,7 +474,7 @@ emit_op(struct texenv_fragment_program *p,
|
||||
GLuint nr = p->program->Base.NumInstructions++;
|
||||
struct prog_instruction *inst = &p->program->Base.Instructions[nr];
|
||||
|
||||
_mesa_init_instruction(inst);
|
||||
_mesa_init_instructions(inst, 1);
|
||||
inst->Opcode = op;
|
||||
|
||||
emit_arg( &inst->SrcReg[0], src0 );
|
||||
|
@@ -2650,7 +2650,7 @@ parse_fp_instruction (GLcontext * ctx, const GLubyte ** inst,
|
||||
GLubyte instClass, type, code;
|
||||
GLboolean rel;
|
||||
|
||||
_mesa_init_instruction(fp);
|
||||
_mesa_init_instructions(fp, 1);
|
||||
|
||||
/* Record the position in the program string for debugging */
|
||||
fp->StringPos = Program->Position;
|
||||
@@ -3142,7 +3142,7 @@ parse_vp_instruction (GLcontext * ctx, const GLubyte ** inst,
|
||||
/* The actual opcode name */
|
||||
code = *(*inst)++;
|
||||
|
||||
_mesa_init_instruction(vp);
|
||||
_mesa_init_instructions(vp, 1);
|
||||
/* Record the position in the program string for debugging */
|
||||
vp->StringPos = Program->Position;
|
||||
|
||||
@@ -3684,7 +3684,7 @@ parse_instructions(GLcontext * ctx, const GLubyte * inst,
|
||||
/* Finally, tag on an OPCODE_END instruction */
|
||||
{
|
||||
const GLuint numInst = Program->Base.NumInstructions;
|
||||
_mesa_init_instruction(Program->Base.Instructions + numInst);
|
||||
_mesa_init_instructions(Program->Base.Instructions + numInst, 1);
|
||||
Program->Base.Instructions[numInst].Opcode = OPCODE_END;
|
||||
/* YYY Wrong Position in program, whatever, at least not random -> crash
|
||||
Program->Position = parse_position (&inst);
|
||||
|
@@ -1273,7 +1273,7 @@ Parse_InstructionSequence(struct parse_state *parseState,
|
||||
GLubyte token[100];
|
||||
|
||||
/* Initialize the instruction */
|
||||
_mesa_init_instruction(inst);
|
||||
_mesa_init_instructions(inst, 1);
|
||||
|
||||
/* special instructions */
|
||||
if (Parse_String(parseState, "DEFINE")) {
|
||||
|
@@ -1143,7 +1143,7 @@ Parse_InstructionSequence(struct parse_state *parseState,
|
||||
struct prog_instruction *inst = program + parseState->numInst;
|
||||
|
||||
/* Initialize the instruction */
|
||||
_mesa_init_instruction(inst);
|
||||
_mesa_init_instructions(inst, 1);
|
||||
|
||||
if (Parse_String(parseState, "MOV")) {
|
||||
if (!Parse_UnaryOpInstruction(parseState, inst, OPCODE_MOV))
|
||||
|
@@ -1307,26 +1307,32 @@ _mesa_load_state_parameters(GLcontext *ctx,
|
||||
|
||||
/**
|
||||
* Initialize program instruction fields to defaults.
|
||||
* \param inst first instruction to initialize
|
||||
* \param count number of instructions to initialize
|
||||
*/
|
||||
void
|
||||
_mesa_init_instruction(struct prog_instruction *inst)
|
||||
_mesa_init_instructions(struct prog_instruction *inst, GLuint count)
|
||||
{
|
||||
_mesa_bzero(inst, sizeof(struct prog_instruction));
|
||||
GLuint i;
|
||||
|
||||
inst->SrcReg[0].File = PROGRAM_UNDEFINED;
|
||||
inst->SrcReg[0].Swizzle = SWIZZLE_NOOP;
|
||||
inst->SrcReg[1].File = PROGRAM_UNDEFINED;
|
||||
inst->SrcReg[1].Swizzle = SWIZZLE_NOOP;
|
||||
inst->SrcReg[2].File = PROGRAM_UNDEFINED;
|
||||
inst->SrcReg[2].Swizzle = SWIZZLE_NOOP;
|
||||
_mesa_bzero(inst, count * sizeof(struct prog_instruction));
|
||||
|
||||
inst->DstReg.File = PROGRAM_UNDEFINED;
|
||||
inst->DstReg.WriteMask = WRITEMASK_XYZW;
|
||||
inst->DstReg.CondMask = COND_TR;
|
||||
inst->DstReg.CondSwizzle = SWIZZLE_NOOP;
|
||||
for (i = 0; i < count; i++) {
|
||||
inst[i].SrcReg[0].File = PROGRAM_UNDEFINED;
|
||||
inst[i].SrcReg[0].Swizzle = SWIZZLE_NOOP;
|
||||
inst[i].SrcReg[1].File = PROGRAM_UNDEFINED;
|
||||
inst[i].SrcReg[1].Swizzle = SWIZZLE_NOOP;
|
||||
inst[i].SrcReg[2].File = PROGRAM_UNDEFINED;
|
||||
inst[i].SrcReg[2].Swizzle = SWIZZLE_NOOP;
|
||||
|
||||
inst->SaturateMode = SATURATE_OFF;
|
||||
inst->Precision = FLOAT32;
|
||||
inst[i].DstReg.File = PROGRAM_UNDEFINED;
|
||||
inst[i].DstReg.WriteMask = WRITEMASK_XYZW;
|
||||
inst[i].DstReg.CondMask = COND_TR;
|
||||
inst[i].DstReg.CondSwizzle = SWIZZLE_NOOP;
|
||||
|
||||
inst[i].SaturateMode = SATURATE_OFF;
|
||||
inst[i].Precision = FLOAT32;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@@ -343,7 +343,7 @@ struct prog_instruction
|
||||
|
||||
|
||||
extern void
|
||||
_mesa_init_instruction(struct prog_instruction *inst);
|
||||
_mesa_init_instructions(struct prog_instruction *inst, GLuint count);
|
||||
|
||||
extern GLuint
|
||||
_mesa_num_inst_src_regs(enum prog_opcode opcode);
|
||||
|
@@ -85,8 +85,8 @@ _mesa_insert_mvp_code(GLcontext *ctx, struct gl_vertex_program *vprog)
|
||||
* newInst[2] = DP4 result.position.z, mvp.row[2], vertex.position;
|
||||
* newInst[3] = DP4 result.position.w, mvp.row[3], vertex.position;
|
||||
*/
|
||||
_mesa_init_instructions(newInst, 4);
|
||||
for (i = 0; i < 4; i++) {
|
||||
_mesa_init_instruction(newInst + i);
|
||||
newInst[i].Opcode = OPCODE_DP4;
|
||||
newInst[i].DstReg.File = PROGRAM_OUTPUT;
|
||||
newInst[i].DstReg.Index = VERT_RESULT_HPOS;
|
||||
@@ -191,8 +191,7 @@ _mesa_append_fog_code(GLcontext *ctx, struct gl_fragment_program *fprog)
|
||||
}
|
||||
assert(inst->Opcode == OPCODE_END); /* we'll overwrite this inst */
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
_mesa_init_instruction(inst + i);
|
||||
_mesa_init_instructions(inst, 6);
|
||||
|
||||
/* emit instructions to compute fog blending factor */
|
||||
if (fprog->FogOption == GL_LINEAR) {
|
||||
|
Reference in New Issue
Block a user