_mesa_copy_instructions(struct prog_instruction *dest,
const struct prog_instruction *src, GLuint n)
{
- GLuint i;
memcpy(dest, src, n * sizeof(struct prog_instruction));
- for (i = 0; i < n; i++) {
- if (src[i].Comment)
- dest[i].Comment = strdup(src[i].Comment);
- }
return dest;
}
void
_mesa_free_instructions(struct prog_instruction *inst, GLuint count)
{
- GLuint i;
- for (i = 0; i < count; i++) {
- free((char *)inst[i].Comment);
- }
free(inst);
}
}
-static void
-fprint_comment(FILE *f, const struct prog_instruction *inst)
-{
- if (inst->Comment)
- fprintf(f, "; # %s\n", inst->Comment);
- else
- fprintf(f, ";\n");
-}
-
-
void
_mesa_fprint_alu_instruction(FILE *f,
const struct prog_instruction *inst,
fprintf(f, ", ");
}
- fprint_comment(f, inst);
+ fprintf(f, ";\n");
}
inst->SrcReg[0].Index,
_mesa_swizzle_string(inst->SrcReg[0].Swizzle,
inst->SrcReg[0].Negate, GL_TRUE));
- fprint_comment(f, inst);
+ fprintf(f, ";\n");
break;
case OPCODE_TEX:
case OPCODE_TXP:
}
if (inst->TexShadow)
fprintf(f, " SHADOW");
- fprint_comment(f, inst);
+ fprintf(f, ";\n");
break;
case OPCODE_KIL:
fprintf(f, "%s", _mesa_opcode_string(inst->Opcode));
fprintf(f, " ");
fprint_src_reg(f, &inst->SrcReg[0], mode, prog);
- fprint_comment(f, inst);
+ fprintf(f, ";\n");
break;
case OPCODE_ARL:
fprintf(f, "ARL ");
fprint_dst_reg(f, &inst->DstReg, mode, prog);
fprintf(f, ", ");
fprint_src_reg(f, &inst->SrcReg[0], mode, prog);
- fprint_comment(f, inst);
+ fprintf(f, ";\n");
break;
case OPCODE_IF:
fprintf(f, "IF ");
fprint_src_reg(f, &inst->SrcReg[0], mode, prog);
fprintf(f, "; ");
fprintf(f, " # (if false, goto %d)", inst->BranchTarget);
- fprint_comment(f, inst);
+ fprintf(f, ";\n");
return indent + 3;
case OPCODE_ELSE:
fprintf(f, "ELSE; # (goto %d)\n", inst->BranchTarget);
fprintf(f, "%s; # (goto %d)",
_mesa_opcode_string(inst->Opcode),
inst->BranchTarget);
- fprint_comment(f, inst);
+ fprintf(f, ";\n");
break;
case OPCODE_BGNSUB:
fprintf(f, "BGNSUB");
- fprint_comment(f, inst);
+ fprintf(f, ";\n");
return indent + 3;
case OPCODE_ENDSUB:
if (mode == PROG_PRINT_DEBUG) {
fprintf(f, "ENDSUB");
- fprint_comment(f, inst);
+ fprintf(f, ";\n");
}
break;
case OPCODE_CAL:
fprintf(f, "CAL %u", inst->BranchTarget);
- fprint_comment(f, inst);
+ fprintf(f, ";\n");
break;
case OPCODE_RET:
fprintf(f, "RET");
- fprint_comment(f, inst);
+ fprintf(f, ";\n");
break;
case OPCODE_END:
case OPCODE_NOP:
if (mode == PROG_PRINT_DEBUG) {
fprintf(f, "NOP");
- fprint_comment(f, inst);
- }
- else if (inst->Comment) {
- /* ARB/NV extensions don't have NOP instruction */
- fprintf(f, "# %s\n", inst->Comment);
+ fprintf(f, ";\n");
}
break;
/* XXX may need other special-case instructions */