Lines Matching refs:fpc

45 temp(struct nvfx_fpc *fpc)  in temp()  argument
47 int idx = __builtin_ctzll(~fpc->r_temps); in temp()
49 if (idx >= fpc->max_temps) { in temp()
55 fpc->r_temps |= (1ULL << idx); in temp()
56 fpc->r_temps_discard |= (1ULL << idx); in temp()
61 release_temps(struct nvfx_fpc *fpc) in release_temps() argument
63 fpc->r_temps &= ~fpc->r_temps_discard; in release_temps()
64 fpc->r_temps_discard = 0ULL; in release_temps()
68 nvfx_fp_imm(struct nvfx_fpc *fpc, float a, float b, float c, float d) in nvfx_fp_imm() argument
71 int idx = fpc->imm_data.size >> 4; in nvfx_fp_imm()
73 memcpy(util_dynarray_grow(&fpc->imm_data, sizeof(float) * 4), v, 4 * sizeof(float)); in nvfx_fp_imm()
78 grow_insns(struct nvfx_fpc *fpc, int size) in grow_insns() argument
80 struct nv30_fragprog *fp = fpc->fp; in grow_insns()
87 emit_src(struct nvfx_fpc *fpc, int pos, struct nvfx_src src) in emit_src() argument
89 struct nv30_fragprog *fp = fpc->fp; in emit_src()
90 uint32_t *hw = &fp->insn[fpc->inst_offset]; in emit_src()
106 if (!fpc->have_const) { in emit_src()
107 grow_insns(fpc, 4); in emit_src()
108 hw = &fp->insn[fpc->inst_offset]; in emit_src()
109 fpc->have_const = 1; in emit_src()
112 memcpy(&fp->insn[fpc->inst_offset + 4], in emit_src()
113 (float*)fpc->imm_data.data + src.reg.index * 4, in emit_src()
119 if (!fpc->have_const) { in emit_src()
120 grow_insns(fpc, 4); in emit_src()
121 hw = &fp->insn[fpc->inst_offset]; in emit_src()
122 fpc->have_const = 1; in emit_src()
131 fpd->offset = fpc->inst_offset + 4; in emit_src()
160 emit_dst(struct nvfx_fpc *fpc, struct nvfx_reg dst) in emit_dst() argument
162 struct nv30_fragprog *fp = fpc->fp; in emit_dst()
163 uint32_t *hw = &fp->insn[fpc->inst_offset]; in emit_dst()
175 if (fpc->num_regs < (dst.index + 1)) in emit_dst()
176 fpc->num_regs = dst.index + 1; in emit_dst()
189 nvfx_fp_emit(struct nvfx_fpc *fpc, struct nvfx_insn insn) in nvfx_fp_emit() argument
191 struct nv30_fragprog *fp = fpc->fp; in nvfx_fp_emit()
194 fpc->inst_offset = fp->insn_len; in nvfx_fp_emit()
195 fpc->have_const = 0; in nvfx_fp_emit()
196 grow_insns(fpc, 4); in nvfx_fp_emit()
197 hw = &fp->insn[fpc->inst_offset]; in nvfx_fp_emit()
222 emit_dst(fpc, insn.dst); in nvfx_fp_emit()
223 emit_src(fpc, 0, insn.src[0]); in nvfx_fp_emit()
224 emit_src(fpc, 1, insn.src[1]); in nvfx_fp_emit()
225 emit_src(fpc, 2, insn.src[2]); in nvfx_fp_emit()
238 nv40_fp_if(struct nvfx_fpc *fpc, struct nvfx_src src) in nv40_fp_if() argument
244 nvfx_fp_emit(fpc, insn); in nv40_fp_if()
246 fpc->inst_offset = fpc->fp->insn_len; in nv40_fp_if()
247 grow_insns(fpc, 4); in nv40_fp_if()
248 hw = &fpc->fp->insn[fpc->inst_offset]; in nv40_fp_if()
261 util_dynarray_append(&fpc->if_stack, unsigned, fpc->inst_offset); in nv40_fp_if()
266 nv40_fp_cal(struct nvfx_fpc *fpc, unsigned target) in nv40_fp_cal() argument
270 fpc->inst_offset = fpc->fp->insn_len; in nv40_fp_cal()
271 grow_insns(fpc, 4); in nv40_fp_cal()
272 hw = &fpc->fp->insn[fpc->inst_offset]; in nv40_fp_cal()
281 reloc.location = fpc->inst_offset + 2; in nv40_fp_cal()
282 util_dynarray_append(&fpc->label_relocs, struct nvfx_relocation, reloc); in nv40_fp_cal()
286 nv40_fp_ret(struct nvfx_fpc *fpc) in nv40_fp_ret() argument
289 fpc->inst_offset = fpc->fp->insn_len; in nv40_fp_ret()
290 grow_insns(fpc, 4); in nv40_fp_ret()
291 hw = &fpc->fp->insn[fpc->inst_offset]; in nv40_fp_ret()
302 nv40_fp_rep(struct nvfx_fpc *fpc, unsigned count, unsigned target) in nv40_fp_rep() argument
306 fpc->inst_offset = fpc->fp->insn_len; in nv40_fp_rep()
307 grow_insns(fpc, 4); in nv40_fp_rep()
308 hw = &fpc->fp->insn[fpc->inst_offset]; in nv40_fp_rep()
322 reloc.location = fpc->inst_offset + 3; in nv40_fp_rep()
323 util_dynarray_append(&fpc->label_relocs, struct nvfx_relocation, reloc); in nv40_fp_rep()
329 nv40_fp_bra(struct nvfx_fpc *fpc, unsigned target) in nv40_fp_bra() argument
333 fpc->inst_offset = fpc->fp->insn_len; in nv40_fp_bra()
334 grow_insns(fpc, 4); in nv40_fp_bra()
335 hw = &fpc->fp->insn[fpc->inst_offset]; in nv40_fp_bra()
346 reloc.location = fpc->inst_offset + 2; in nv40_fp_bra()
347 util_dynarray_append(&fpc->label_relocs, struct nvfx_relocation, reloc); in nv40_fp_bra()
349 reloc.location = fpc->inst_offset + 3; in nv40_fp_bra()
350 util_dynarray_append(&fpc->label_relocs, struct nvfx_relocation, reloc); in nv40_fp_bra()
354 nv40_fp_brk(struct nvfx_fpc *fpc) in nv40_fp_brk() argument
357 fpc->inst_offset = fpc->fp->insn_len; in nv40_fp_brk()
358 grow_insns(fpc, 4); in nv40_fp_brk()
359 hw = &fpc->fp->insn[fpc->inst_offset]; in nv40_fp_brk()
371 tgsi_src(struct nvfx_fpc *fpc, const struct tgsi_full_src_register *fsrc) in tgsi_src() argument
377 src.reg = fpc->r_input[fsrc->Register.Index]; in tgsi_src()
383 assert(fsrc->Register.Index < fpc->nr_imm); in tgsi_src()
384 src.reg = fpc->r_imm[fsrc->Register.Index]; in tgsi_src()
387 src.reg = fpc->r_temp[fsrc->Register.Index]; in tgsi_src()
391 src.reg = fpc->r_result[fsrc->Register.Index]; in tgsi_src()
413 tgsi_dst(struct nvfx_fpc *fpc, const struct tgsi_full_dst_register *fdst) { in tgsi_dst() argument
416 return fpc->r_result[fdst->Register.Index]; in tgsi_dst()
418 return fpc->r_temp[fdst->Register.Index]; in tgsi_dst()
440 nvfx_fragprog_parse_instruction(struct nv30_context* nvfx, struct nvfx_fpc *fpc, in nvfx_fragprog_parse_instruction() argument
459 src[i] = tgsi_src(fpc, fsrc); in nvfx_fragprog_parse_instruction()
470 if(fpc->fp->info.input_semantic_name[fsrc->Register.Index] == TGSI_SEMANTIC_FOG && (0 in nvfx_fragprog_parse_instruction()
477 struct nvfx_src addend = nvfx_src(nvfx_fp_imm(fpc, 0, 0, 0, 1)); in nvfx_fragprog_parse_instruction()
482 src[i] = nvfx_src(temp(fpc)); in nvfx_fragprog_parse_instruction()
483 … nvfx_fp_emit(fpc, arith(0, ADD, src[i].reg, NVFX_FP_MASK_ALL, tgsi_src(fpc, fsrc), addend, none)); in nvfx_fragprog_parse_instruction()
486 src[i] = tgsi_src(fpc, fsrc); in nvfx_fragprog_parse_instruction()
488 src[i] = nvfx_src(temp(fpc)); in nvfx_fragprog_parse_instruction()
489 … nvfx_fp_emit(fpc, arith(0, MOV, src[i].reg, NVFX_FP_MASK_ALL, tgsi_src(fpc, fsrc), none, none)); in nvfx_fragprog_parse_instruction()
496 src[i] = tgsi_src(fpc, fsrc); in nvfx_fragprog_parse_instruction()
498 src[i] = nvfx_src(temp(fpc)); in nvfx_fragprog_parse_instruction()
499 … nvfx_fp_emit(fpc, arith(0, MOV, src[i].reg, NVFX_FP_MASK_ALL, tgsi_src(fpc, fsrc), none, none)); in nvfx_fragprog_parse_instruction()
506 src[i] = tgsi_src(fpc, fsrc); in nvfx_fragprog_parse_instruction()
508 src[i] = nvfx_src(temp(fpc)); in nvfx_fragprog_parse_instruction()
509 … nvfx_fp_emit(fpc, arith(0, MOV, src[i].reg, NVFX_FP_MASK_ALL, tgsi_src(fpc, fsrc), none, none)); in nvfx_fragprog_parse_instruction()
526 dst = tgsi_dst(fpc, &finst->Dst[0]); in nvfx_fragprog_parse_instruction()
532 nvfx_fp_emit(fpc, arith(sat, MOV, dst, mask, abs(src[0]), none, none)); in nvfx_fragprog_parse_instruction()
535 nvfx_fp_emit(fpc, arith(sat, ADD, dst, mask, src[0], src[1], none)); in nvfx_fragprog_parse_instruction()
538 tmp = nvfx_src(temp(fpc)); in nvfx_fragprog_parse_instruction()
539 nvfx_fp_emit(fpc, arith(0, FLR, tmp.reg, mask, neg(src[0]), none, none)); in nvfx_fragprog_parse_instruction()
540 nvfx_fp_emit(fpc, arith(sat, MOV, dst, mask, neg(tmp), none, none)); in nvfx_fragprog_parse_instruction()
545 nvfx_fp_emit(fpc, insn); in nvfx_fragprog_parse_instruction()
549 nvfx_fp_emit(fpc, insn); in nvfx_fragprog_parse_instruction()
553 nvfx_fp_emit(fpc, insn); in nvfx_fragprog_parse_instruction()
556 nvfx_fp_emit(fpc, arith(sat, COS, dst, mask, src[0], none, none)); in nvfx_fragprog_parse_instruction()
560 tmp = nvfx_src(temp(fpc)); in nvfx_fragprog_parse_instruction()
561 …nvfx_fp_emit(fpc, arith(sat, DDX, tmp.reg, NVFX_FP_MASK_X | NVFX_FP_MASK_Y, swz(src[0], Z, W, Z, W… in nvfx_fragprog_parse_instruction()
562 …nvfx_fp_emit(fpc, arith(0, MOV, tmp.reg, NVFX_FP_MASK_Z | NVFX_FP_MASK_W, swz(tmp, X, Y, X, Y), no… in nvfx_fragprog_parse_instruction()
563 … nvfx_fp_emit(fpc, arith(sat, DDX, tmp.reg, NVFX_FP_MASK_X | NVFX_FP_MASK_Y, src[0], none, none)); in nvfx_fragprog_parse_instruction()
564 nvfx_fp_emit(fpc, arith(0, MOV, dst, mask, tmp, none, none)); in nvfx_fragprog_parse_instruction()
566 nvfx_fp_emit(fpc, arith(sat, DDX, dst, mask, src[0], none, none)); in nvfx_fragprog_parse_instruction()
571 tmp = nvfx_src(temp(fpc)); in nvfx_fragprog_parse_instruction()
572 …nvfx_fp_emit(fpc, arith(sat, DDY, tmp.reg, NVFX_FP_MASK_X | NVFX_FP_MASK_Y, swz(src[0], Z, W, Z, W… in nvfx_fragprog_parse_instruction()
573 …nvfx_fp_emit(fpc, arith(0, MOV, tmp.reg, NVFX_FP_MASK_Z | NVFX_FP_MASK_W, swz(tmp, X, Y, X, Y), no… in nvfx_fragprog_parse_instruction()
574 … nvfx_fp_emit(fpc, arith(sat, DDY, tmp.reg, NVFX_FP_MASK_X | NVFX_FP_MASK_Y, src[0], none, none)); in nvfx_fragprog_parse_instruction()
575 nvfx_fp_emit(fpc, arith(0, MOV, dst, mask, tmp, none, none)); in nvfx_fragprog_parse_instruction()
577 nvfx_fp_emit(fpc, arith(sat, DDY, dst, mask, src[0], none, none)); in nvfx_fragprog_parse_instruction()
581 tmp = nvfx_src(temp(fpc)); in nvfx_fragprog_parse_instruction()
582 … nvfx_fp_emit(fpc, arith(0, MUL, tmp.reg, NVFX_FP_MASK_X | NVFX_FP_MASK_Y, src[0], src[1], none)); in nvfx_fragprog_parse_instruction()
583 nvfx_fp_emit(fpc, arith(0, ADD, dst, mask, swz(tmp, X, X, X, X), swz(tmp, Y, Y, Y, Y), none)); in nvfx_fragprog_parse_instruction()
586 nvfx_fp_emit(fpc, arith(sat, DP3, dst, mask, src[0], src[1], none)); in nvfx_fragprog_parse_instruction()
589 nvfx_fp_emit(fpc, arith(sat, DP4, dst, mask, src[0], src[1], none)); in nvfx_fragprog_parse_instruction()
592 tmp = nvfx_src(temp(fpc)); in nvfx_fragprog_parse_instruction()
593 nvfx_fp_emit(fpc, arith(0, DP3, tmp.reg, NVFX_FP_MASK_X, src[0], src[1], none)); in nvfx_fragprog_parse_instruction()
594 …nvfx_fp_emit(fpc, arith(sat, ADD, dst, mask, swz(tmp, X, X, X, X), swz(src[1], W, W, W, W), none)); in nvfx_fragprog_parse_instruction()
597 nvfx_fp_emit(fpc, arith(sat, DST, dst, mask, src[0], src[1], none)); in nvfx_fragprog_parse_instruction()
600 nvfx_fp_emit(fpc, arith(sat, EX2, dst, mask, src[0], none, none)); in nvfx_fragprog_parse_instruction()
603 nvfx_fp_emit(fpc, arith(sat, FLR, dst, mask, src[0], none, none)); in nvfx_fragprog_parse_instruction()
606 nvfx_fp_emit(fpc, arith(sat, FRC, dst, mask, src[0], none, none)); in nvfx_fragprog_parse_instruction()
609 nvfx_fp_emit(fpc, arith(0, KIL, none.reg, 0, none, none, none)); in nvfx_fragprog_parse_instruction()
614 nvfx_fp_emit(fpc, insn); in nvfx_fragprog_parse_instruction()
618 nvfx_fp_emit(fpc, insn); in nvfx_fragprog_parse_instruction()
621 nvfx_fp_emit(fpc, arith(sat, LG2, dst, mask, src[0], none, none)); in nvfx_fragprog_parse_instruction()
625 nvfx_fp_emit(fpc, arith(sat, LIT_NV30, dst, mask, src[0], none, none)); in nvfx_fragprog_parse_instruction()
632 struct nvfx_src maxs = nvfx_src(nvfx_fp_imm(fpc, 0, FLT_MIN, 0, 0)); in nvfx_fragprog_parse_instruction()
633 tmp = nvfx_src(temp(fpc)); in nvfx_fragprog_parse_instruction()
635 … nvfx_fp_emit(fpc, arith(0, MOV, tmp.reg, NVFX_FP_MASK_X | NVFX_FP_MASK_Y, maxs, none, none)); in nvfx_fragprog_parse_instruction()
638 …nvfx_fp_emit(fpc, arith(0, MAX, tmp.reg, NVFX_FP_MASK_Y | NVFX_FP_MASK_W, swz(src[0], X, X, X, Y),… in nvfx_fragprog_parse_instruction()
639 … nvfx_fp_emit(fpc, arith(0, LG2, tmp.reg, NVFX_FP_MASK_W, swz(tmp, W, W, W, W), none, none)); in nvfx_fragprog_parse_instruction()
640 …nvfx_fp_emit(fpc, arith(0, MUL, tmp.reg, NVFX_FP_MASK_W, swz(tmp, W, W, W, W), swz(src[0], W, W, W… in nvfx_fragprog_parse_instruction()
641 nvfx_fp_emit(fpc, arith(sat, LITEX2_NV40, dst, mask, swz(tmp, Y, Y, W, W), none, none)); in nvfx_fragprog_parse_instruction()
646 nvfx_fp_emit(fpc, arith(sat, LRP_NV30, dst, mask, src[0], src[1], src[2])); in nvfx_fragprog_parse_instruction()
648 tmp = nvfx_src(temp(fpc)); in nvfx_fragprog_parse_instruction()
649 nvfx_fp_emit(fpc, arith(0, MAD, tmp.reg, mask, neg(src[0]), src[2], src[2])); in nvfx_fragprog_parse_instruction()
650 nvfx_fp_emit(fpc, arith(sat, MAD, dst, mask, src[0], src[1], tmp)); in nvfx_fragprog_parse_instruction()
654 nvfx_fp_emit(fpc, arith(sat, MAD, dst, mask, src[0], src[1], src[2])); in nvfx_fragprog_parse_instruction()
657 nvfx_fp_emit(fpc, arith(sat, MAX, dst, mask, src[0], src[1], none)); in nvfx_fragprog_parse_instruction()
660 nvfx_fp_emit(fpc, arith(sat, MIN, dst, mask, src[0], src[1], none)); in nvfx_fragprog_parse_instruction()
663 nvfx_fp_emit(fpc, arith(sat, MOV, dst, mask, src[0], none, none)); in nvfx_fragprog_parse_instruction()
666 nvfx_fp_emit(fpc, arith(sat, MUL, dst, mask, src[0], src[1], none)); in nvfx_fragprog_parse_instruction()
672 nvfx_fp_emit(fpc, arith(sat, POW_NV30, dst, mask, src[0], src[1], none)); in nvfx_fragprog_parse_instruction()
674 tmp = nvfx_src(temp(fpc)); in nvfx_fragprog_parse_instruction()
675 … nvfx_fp_emit(fpc, arith(0, LG2, tmp.reg, NVFX_FP_MASK_X, swz(src[0], X, X, X, X), none, none)); in nvfx_fragprog_parse_instruction()
676 …nvfx_fp_emit(fpc, arith(0, MUL, tmp.reg, NVFX_FP_MASK_X, swz(tmp, X, X, X, X), swz(src[1], X, X, X… in nvfx_fragprog_parse_instruction()
677 nvfx_fp_emit(fpc, arith(sat, EX2, dst, mask, swz(tmp, X, X, X, X), none, none)); in nvfx_fragprog_parse_instruction()
681 nvfx_fp_emit(fpc, arith(sat, RCP, dst, mask, src[0], none, none)); in nvfx_fragprog_parse_instruction()
685 nvfx_fp_emit(fpc, arith(0, RFL_NV30, dst, mask, src[0], src[1], none)); in nvfx_fragprog_parse_instruction()
687 tmp = nvfx_src(temp(fpc)); in nvfx_fragprog_parse_instruction()
688 nvfx_fp_emit(fpc, arith(0, DP3, tmp.reg, NVFX_FP_MASK_X, src[0], src[0], none)); in nvfx_fragprog_parse_instruction()
689 nvfx_fp_emit(fpc, arith(0, DP3, tmp.reg, NVFX_FP_MASK_Y, src[0], src[1], none)); in nvfx_fragprog_parse_instruction()
692 nvfx_fp_emit(fpc, insn); in nvfx_fragprog_parse_instruction()
693 nvfx_fp_emit(fpc, arith(sat, MAD, dst, mask, swz(tmp, Z, Z, Z, Z), src[0], neg(src[1]))); in nvfx_fragprog_parse_instruction()
698 … nvfx_fp_emit(fpc, arith(sat, RSQ_NV30, dst, mask, abs(swz(src[0], X, X, X, X)), none, none)); in nvfx_fragprog_parse_instruction()
700 tmp = nvfx_src(temp(fpc)); in nvfx_fragprog_parse_instruction()
703 nvfx_fp_emit(fpc, insn); in nvfx_fragprog_parse_instruction()
704 nvfx_fp_emit(fpc, arith(sat, EX2, dst, mask, neg(swz(tmp, X, X, X, X)), none, none)); in nvfx_fragprog_parse_instruction()
712 … nvfx_fp_emit(fpc, arith(sat, COS, dst, NVFX_FP_MASK_X, swz(src[0], X, X, X, X), none, none)); in nvfx_fragprog_parse_instruction()
714 … nvfx_fp_emit(fpc, arith(sat, SIN, dst, NVFX_FP_MASK_Y, swz(src[0], X, X, X, X), none, none)); in nvfx_fragprog_parse_instruction()
719 … nvfx_fp_emit(fpc, arith(sat, SIN, dst, NVFX_FP_MASK_Y, swz(src[0], X, X, X, X), none, none)); in nvfx_fragprog_parse_instruction()
721 … nvfx_fp_emit(fpc, arith(sat, COS, dst, NVFX_FP_MASK_X, swz(src[0], X, X, X, X), none, none)); in nvfx_fragprog_parse_instruction()
725 nvfx_fp_emit(fpc, arith(sat, SEQ, dst, mask, src[0], src[1], none)); in nvfx_fragprog_parse_instruction()
728 nvfx_fp_emit(fpc, arith(sat, SFL, dst, mask, src[0], src[1], none)); in nvfx_fragprog_parse_instruction()
731 nvfx_fp_emit(fpc, arith(sat, SGE, dst, mask, src[0], src[1], none)); in nvfx_fragprog_parse_instruction()
734 nvfx_fp_emit(fpc, arith(sat, SGT, dst, mask, src[0], src[1], none)); in nvfx_fragprog_parse_instruction()
737 nvfx_fp_emit(fpc, arith(sat, SIN, dst, mask, src[0], none, none)); in nvfx_fragprog_parse_instruction()
740 nvfx_fp_emit(fpc, arith(sat, SLE, dst, mask, src[0], src[1], none)); in nvfx_fragprog_parse_instruction()
743 nvfx_fp_emit(fpc, arith(sat, SLT, dst, mask, src[0], src[1], none)); in nvfx_fragprog_parse_instruction()
746 nvfx_fp_emit(fpc, arith(sat, SNE, dst, mask, src[0], src[1], none)); in nvfx_fragprog_parse_instruction()
750 struct nvfx_src minones = swz(nvfx_src(nvfx_fp_imm(fpc, -1, -1, -1, -1)), X, X, X, X); in nvfx_fragprog_parse_instruction()
754 nvfx_fp_emit(fpc, insn); in nvfx_fragprog_parse_instruction()
758 nvfx_fp_emit(fpc, insn); in nvfx_fragprog_parse_instruction()
763 nvfx_fp_emit(fpc, insn); in nvfx_fragprog_parse_instruction()
768 nvfx_fp_emit(fpc, arith(sat, STR, dst, mask, src[0], src[1], none)); in nvfx_fragprog_parse_instruction()
771 nvfx_fp_emit(fpc, arith(sat, ADD, dst, mask, src[0], neg(src[1]), none)); in nvfx_fragprog_parse_instruction()
774 nvfx_fp_emit(fpc, tex(sat, TEX, unit, dst, mask, src[0], none, none)); in nvfx_fragprog_parse_instruction()
777 tmp = nvfx_src(temp(fpc)); in nvfx_fragprog_parse_instruction()
780 nvfx_fp_emit(fpc, insn); in nvfx_fragprog_parse_instruction()
782 nvfx_fp_emit(fpc, arith(0, FLR, tmp.reg, mask, abs(src[0]), none, none)); in nvfx_fragprog_parse_instruction()
783 nvfx_fp_emit(fpc, arith(sat, MOV, dst, mask, tmp, none, none)); in nvfx_fragprog_parse_instruction()
787 nvfx_fp_emit(fpc, insn); in nvfx_fragprog_parse_instruction()
790 nvfx_fp_emit(fpc, tex(sat, TXB, unit, dst, mask, src[0], none, none)); in nvfx_fragprog_parse_instruction()
794 nvfx_fp_emit(fpc, tex(sat, TXL_NV40, unit, dst, mask, src[0], none, none)); in nvfx_fragprog_parse_instruction()
796 nvfx_fp_emit(fpc, tex(sat, TEX, unit, dst, mask, src[0], none, none)); in nvfx_fragprog_parse_instruction()
799 nvfx_fp_emit(fpc, tex(sat, TXP, unit, dst, mask, src[0], none, none)); in nvfx_fragprog_parse_instruction()
802 tmp = nvfx_src(temp(fpc)); in nvfx_fragprog_parse_instruction()
803 …nvfx_fp_emit(fpc, arith(0, MUL, tmp.reg, mask, swz(src[0], Z, X, Y, Y), swz(src[1], Y, Z, X, X), n… in nvfx_fragprog_parse_instruction()
804 …nvfx_fp_emit(fpc, arith(sat, MAD, dst, (mask & ~NVFX_FP_MASK_W), swz(src[0], Y, Z, X, X), swz(src[… in nvfx_fragprog_parse_instruction()
812 nv40_fp_if(fpc, src[0]); in nvfx_fragprog_parse_instruction()
820 assert(util_dynarray_contains(&fpc->if_stack, unsigned)); in nvfx_fragprog_parse_instruction()
821 hw = &fpc->fp->insn[util_dynarray_top(&fpc->if_stack, unsigned)]; in nvfx_fragprog_parse_instruction()
822 hw[2] = NV40_FP_OP_OPCODE_IS_BRANCH | fpc->fp->insn_len; in nvfx_fragprog_parse_instruction()
831 assert(util_dynarray_contains(&fpc->if_stack, unsigned)); in nvfx_fragprog_parse_instruction()
832 hw = &fpc->fp->insn[util_dynarray_pop(&fpc->if_stack, unsigned)]; in nvfx_fragprog_parse_instruction()
834 hw[2] = NV40_FP_OP_OPCODE_IS_BRANCH | fpc->fp->insn_len; in nvfx_fragprog_parse_instruction()
835 hw[3] = fpc->fp->insn_len; in nvfx_fragprog_parse_instruction()
843 nv40_fp_bra(fpc, finst->Label.Label); in nvfx_fragprog_parse_instruction()
854 nv40_fp_cal(fpc, finst->Label.Label); in nvfx_fragprog_parse_instruction()
860 nv40_fp_ret(fpc); in nvfx_fragprog_parse_instruction()
867 nv40_fp_rep(fpc, 255, finst->Label.Label); in nvfx_fragprog_parse_instruction()
876 nv40_fp_brk(fpc); in nvfx_fragprog_parse_instruction()
895 release_temps(fpc); in nvfx_fragprog_parse_instruction()
911 nvfx_fragprog_parse_decl_input(struct nv30_context *nvfx, struct nvfx_fpc *fpc, in nvfx_fragprog_parse_decl_input() argument
934 fpc->fp->texcoord[fdec->Semantic.Index] = fdec->Semantic.Index; in nvfx_fragprog_parse_decl_input()
935 fpc->fp->texcoords |= (1 << fdec->Semantic.Index); in nvfx_fragprog_parse_decl_input()
936 fpc->fp->vp_or |= (0x00004000 << fdec->Semantic.Index); in nvfx_fragprog_parse_decl_input()
944 fpc->r_input[idx] = nvfx_reg(NVFXSR_INPUT, hw); in nvfx_fragprog_parse_decl_input()
949 nvfx_fragprog_assign_generic(struct nv30_context *nvfx, struct nvfx_fpc *fpc, in nvfx_fragprog_assign_generic() argument
960 if (fpc->fp->texcoord[hw] == 0xffff) { in nvfx_fragprog_assign_generic()
961 fpc->fp->texcoord[hw] = fdec->Semantic.Index; in nvfx_fragprog_assign_generic()
963 fpc->fp->texcoords |= (0x1 << hw); in nvfx_fragprog_assign_generic()
964 fpc->fp->vp_or |= (0x00004000 << hw); in nvfx_fragprog_assign_generic()
966 fpc->fp->vp_or |= (0x00001000 << (hw - 8)); in nvfx_fragprog_assign_generic()
969 fpc->fp->point_sprite_control |= (0x00000100 << hw); in nvfx_fragprog_assign_generic()
971 fpc->r_input[idx] = nvfx_reg(NVFXSR_INPUT, hw); in nvfx_fragprog_assign_generic()
984 nvfx_fragprog_parse_decl_output(struct nv30_context* nvfx, struct nvfx_fpc *fpc, in nvfx_fragprog_parse_decl_output() argument
1012 fpc->r_result[idx] = nvfx_reg(NVFXSR_OUTPUT, hw); in nvfx_fragprog_parse_decl_output()
1013 fpc->r_temps |= (1ULL << hw); in nvfx_fragprog_parse_decl_output()
1018 nvfx_fragprog_prepare(struct nv30_context* nvfx, struct nvfx_fpc *fpc) in nvfx_fragprog_prepare() argument
1023 fpc->r_imm = CALLOC(fpc->fp->info.immediate_count, sizeof(struct nvfx_reg)); in nvfx_fragprog_prepare()
1025 tgsi_parse_init(&p, fpc->fp->pipe.tokens); in nvfx_fragprog_prepare()
1037 if (!nvfx_fragprog_parse_decl_input(nvfx, fpc, fdec)) in nvfx_fragprog_prepare()
1041 if (!nvfx_fragprog_parse_decl_output(nvfx, fpc, fdec)) in nvfx_fragprog_prepare()
1061 assert(fpc->nr_imm < fpc->fp->info.immediate_count); in nvfx_fragprog_prepare()
1063fpc->r_imm[fpc->nr_imm++] = nvfx_fp_imm(fpc, imm->u[0].Float, imm->u[1].Float, imm->u[2].Float, im… in nvfx_fragprog_prepare()
1072 tgsi_parse_init(&p, fpc->fp->pipe.tokens); in nvfx_fragprog_prepare()
1081 if (!nvfx_fragprog_assign_generic(nvfx, fpc, fdec)) in nvfx_fragprog_prepare()
1095 fpc->r_temp = CALLOC(high_temp, sizeof(struct nvfx_reg)); in nvfx_fragprog_prepare()
1097 fpc->r_temp[i] = temp(fpc); in nvfx_fragprog_prepare()
1098 fpc->r_temps_discard = 0ULL; in nvfx_fragprog_prepare()
1104 if (fpc->r_temp) { in nvfx_fragprog_prepare()
1105 FREE(fpc->r_temp); in nvfx_fragprog_prepare()
1106 fpc->r_temp = NULL; in nvfx_fragprog_prepare()
1119 struct nvfx_fpc *fpc = NULL; in _nvfx_fragprog_translate() local
1126 fpc = CALLOC_STRUCT(nvfx_fpc); in _nvfx_fragprog_translate()
1127 if (!fpc) in _nvfx_fragprog_translate()
1130 fpc->max_temps = nvfx->use_nv4x ? 48 : 32; in _nvfx_fragprog_translate()
1131 fpc->fp = fp; in _nvfx_fragprog_translate()
1132 fpc->num_regs = 2; in _nvfx_fragprog_translate()
1154 if (!nvfx_fragprog_prepare(nvfx, fpc)) in _nvfx_fragprog_translate()
1170 if (!nvfx_fragprog_parse_instruction(nvfx, fpc, finst)) in _nvfx_fragprog_translate()
1180 for(unsigned i = 0; i < fpc->label_relocs.size; i += sizeof(struct nvfx_relocation)) in _nvfx_fragprog_translate()
1182 …struct nvfx_relocation* label_reloc = (struct nvfx_relocation*)((char*)fpc->label_relocs.data + i); in _nvfx_fragprog_translate()
1188 fp->fp_control |= (fpc->num_regs-1)/2; in _nvfx_fragprog_translate()
1190 fp->fp_control |= fpc->num_regs << NV40_3D_FP_CONTROL_TEMP_COUNT__SHIFT; in _nvfx_fragprog_translate()
1194 fp->insn[fpc->inst_offset] |= 0x00000001; in _nvfx_fragprog_translate()
1197 fpc->inst_offset = fp->insn_len; in _nvfx_fragprog_translate()
1198 grow_insns(fpc, 4); in _nvfx_fragprog_translate()
1199 fp->insn[fpc->inst_offset + 0] = 0x00000001; in _nvfx_fragprog_translate()
1200 fp->insn[fpc->inst_offset + 1] = 0x00000000; in _nvfx_fragprog_translate()
1201 fp->insn[fpc->inst_offset + 2] = 0x00000000; in _nvfx_fragprog_translate()
1202 fp->insn[fpc->inst_offset + 3] = 0x00000000; in _nvfx_fragprog_translate()
1219 if(fpc) in _nvfx_fragprog_translate()
1221 if (fpc->r_temp) in _nvfx_fragprog_translate()
1222 FREE(fpc->r_temp); in _nvfx_fragprog_translate()
1223 util_dynarray_fini(&fpc->if_stack); in _nvfx_fragprog_translate()
1224 util_dynarray_fini(&fpc->label_relocs); in _nvfx_fragprog_translate()
1225 util_dynarray_fini(&fpc->imm_data); in _nvfx_fragprog_translate()
1227 FREE(fpc); in _nvfx_fragprog_translate()