static void emit_op3fn(struct tnl_program *p, GLuint op, struct ureg dest, GLuint mask, struct ureg src0, struct ureg src1, struct ureg src2, const char *fn, GLuint line) { GLuint nr = p->program->Base.NumInstructions++; if (nr >= p->nr_instructions) { p->program->Base.Instructions = _mesa_realloc(p->program->Base.Instructions, sizeof(struct prog_instruction) * p->nr_instructions, sizeof(struct prog_instruction) * (p->nr_instructions *= 2)); } { struct prog_instruction *inst = &p->program->Base.Instructions[nr]; memset(inst, 0, sizeof(*inst)); inst->Opcode = op; inst->StringPos = 0; inst->Data = 0; emit_arg( &inst->SrcReg[0], src0 ); emit_arg( &inst->SrcReg[1], src1 ); emit_arg( &inst->SrcReg[2], src2 ); emit_dst( &inst->DstReg, dest, mask ); debug_insn(inst, fn, line); } }
static void emit_op3fn(struct tnl_program *p, enum prog_opcode op, struct ureg dest, GLuint mask, struct ureg src0, struct ureg src1, struct ureg src2, const char *fn, GLuint line) { GLuint nr = p->program->Base.NumInstructions++; struct prog_instruction *inst = &p->program->Base.Instructions[nr]; if (p->program->Base.NumInstructions > MAX_INSN) { _mesa_problem(0, "Out of instructions in emit_op3fn\n"); return; } inst->Opcode = (enum prog_opcode) op; inst->StringPos = 0; inst->Data = 0; emit_arg( &inst->SrcReg[0], src0 ); emit_arg( &inst->SrcReg[1], src1 ); emit_arg( &inst->SrcReg[2], src2 ); emit_dst( &inst->DstReg, dest, mask ); debug_insn(inst, fn, line); }
static void emit_op3fn(struct tnl_program *p, enum prog_opcode op, struct ureg dest, GLuint mask, struct ureg src0, struct ureg src1, struct ureg src2, const char *fn, GLuint line) { GLuint nr; struct prog_instruction *inst; assert((GLint) p->program->Base.NumInstructions <= p->max_inst); if (p->program->Base.NumInstructions == p->max_inst) { /* need to extend the program's instruction array */ struct prog_instruction *newInst; /* double the size */ p->max_inst *= 2; newInst = _mesa_alloc_instructions(p->max_inst); if (!newInst) { _mesa_error(NULL, GL_OUT_OF_MEMORY, "vertex program build"); return; } _mesa_copy_instructions(newInst, p->program->Base.Instructions, p->program->Base.NumInstructions); _mesa_free_instructions(p->program->Base.Instructions, p->program->Base.NumInstructions); p->program->Base.Instructions = newInst; } nr = p->program->Base.NumInstructions++; inst = &p->program->Base.Instructions[nr]; inst->Opcode = (enum prog_opcode) op; inst->Data = 0; emit_arg( &inst->SrcReg[0], src0 ); emit_arg( &inst->SrcReg[1], src1 ); emit_arg( &inst->SrcReg[2], src2 ); emit_dst( &inst->DstReg, dest, mask ); debug_insn(inst, fn, line); }
static rsexp compile_application (RState* r, rsexp expr, rsexp next) { rsexp proc, args, code; if (!validate_application (r, expr)) return R_FAILURE; proc = r_car (expr); args = r_cdr (expr); r_gc_scope_open (r); ensure_or_goto (code = emit_apply (r), exit); ensure_or_goto (code = compile (r, proc, code), exit); while (!r_null_p (args)) { ensure_or_goto (code = emit_arg (r, code), exit); ensure_or_goto (code = compile (r, r_car (args), code), exit); args = r_cdr (args); } if (!tail_p (r, next)) code = emit_frame (r, next, code); exit: r_gc_scope_close_and_protect (r, code); return code; }
static rsexp compile_call_cc (RState* r, rsexp expr, rsexp next) { rsexp code; if (!validate_call_cc (r, expr)) return R_FAILURE; r_gc_scope_open (r); ensure_or_goto (code = emit_apply (r), exit); ensure_or_goto (code = compile (r, r_cadr (expr), code), exit); ensure_or_goto (code = emit_arg (r, code), exit); ensure_or_goto (code = emit_capture_cc (r, code), exit); if (!tail_p (r, next)) code = emit_frame (r, next, code); exit: r_gc_scope_close_and_protect (r, code); return code; }