static void
nv40_fp_cal(struct nvfx_fpc *fpc, unsigned target)
{
- struct nvfx_label_relocation reloc;
+ struct nvfx_relocation reloc;
uint32_t *hw;
fpc->inst_offset = fpc->fp->insn_len;
grow_insns(fpc, 4);
hw[3] = 0;
reloc.target = target;
reloc.location = fpc->inst_offset + 2;
- util_dynarray_append(&fpc->label_relocs, struct nvfx_label_relocation, reloc);
+ util_dynarray_append(&fpc->label_relocs, struct nvfx_relocation, reloc);
}
static void
static void
nv40_fp_rep(struct nvfx_fpc *fpc, unsigned count, unsigned target)
{
- struct nvfx_label_relocation reloc;
+ struct nvfx_relocation reloc;
uint32_t *hw;
fpc->inst_offset = fpc->fp->insn_len;
grow_insns(fpc, 4);
hw[3] = 0; /* | end_offset */
reloc.target = target;
reloc.location = fpc->inst_offset + 3;
- util_dynarray_append(&fpc->label_relocs, struct nvfx_label_relocation, reloc);
+ util_dynarray_append(&fpc->label_relocs, struct nvfx_relocation, reloc);
//util_dynarray_append(&fpc->loop_stack, unsigned, target);
}
static void
nv40_fp_bra(struct nvfx_fpc *fpc, unsigned target)
{
- struct nvfx_label_relocation reloc;
+ struct nvfx_relocation reloc;
uint32_t *hw;
fpc->inst_offset = fpc->fp->insn_len;
grow_insns(fpc, 4);
hw[3] = 0; /* | endif_offset */
reloc.target = target;
reloc.location = fpc->inst_offset + 2;
- util_dynarray_append(&fpc->label_relocs, struct nvfx_label_relocation, reloc);
+ util_dynarray_append(&fpc->label_relocs, struct nvfx_relocation, reloc);
reloc.target = target;
reloc.location = fpc->inst_offset + 3;
- util_dynarray_append(&fpc->label_relocs, struct nvfx_label_relocation, reloc);
+ util_dynarray_append(&fpc->label_relocs, struct nvfx_relocation, reloc);
}
static void
}
util_dynarray_append(&insns, unsigned, fp->insn_len);
- for(unsigned i = 0; i < fpc->label_relocs.size; i += sizeof(struct nvfx_label_relocation))
+ for(unsigned i = 0; i < fpc->label_relocs.size; i += sizeof(struct nvfx_relocation))
{
- struct nvfx_label_relocation* label_reloc = (struct nvfx_label_relocation*)((char*)fpc->label_relocs.data + i);
+ struct nvfx_relocation* label_reloc = (struct nvfx_relocation*)((char*)fpc->label_relocs.data + i);
fp->insn[label_reloc->location] |= ((unsigned*)insns.data)[label_reloc->target];
}
util_dynarray_fini(&insns);
{
struct nvfx_vertex_program *vp = vpc->vp;
uint32_t sr = 0;
+ struct nvfx_relocation reloc;
switch (src.reg.type) {
case NVFXSR_TEMP:
case NVFXSR_CONST:
sr |= (NVFX_VP(SRC_REG_TYPE_CONST) <<
NVFX_VP(SRC_REG_TYPE_SHIFT));
- assert(vpc->vpi->const_index == -1 ||
- vpc->vpi->const_index == src.reg.index);
- vpc->vpi->const_index = src.reg.index;
+ reloc.location = vp->nr_insns - 1;
+ reloc.target = src.reg.index;
+ util_dynarray_append(&vp->const_relocs, struct nvfx_relocation, reloc);
break;
case NVFXSR_NONE:
sr |= (NVFX_VP(SRC_REG_TYPE_INPUT) <<
vp->insns = realloc(vp->insns, ++vp->nr_insns * sizeof(*vpc->vpi));
vpc->vpi = &vp->insns[vp->nr_insns - 1];
memset(vpc->vpi, 0, sizeof(*vpc->vpi));
- vpc->vpi->const_index = -1;
hw = vpc->vpi->data;
struct nvfx_reg dst;
struct nvfx_src none = nvfx_src(nvfx_reg(NVFXSR_NONE, 0));
struct nvfx_insn insn;
- struct nvfx_label_relocation reloc;
+ struct nvfx_relocation reloc;
struct nvfx_loop_entry loop;
int mask;
int ai = -1, ci = -1, ii = -1;
reloc.location = vpc->vp->nr_insns;
reloc.target = finst->Label.Label + 1;
- util_dynarray_append(&vpc->label_relocs, struct nvfx_label_relocation, reloc);
+ util_dynarray_append(&vpc->label_relocs, struct nvfx_relocation, reloc);
insn = arith(SCA, BRA, none.reg, 0, none, none, none);
insn.cc_test = NVFX_COND_EQ;
case TGSI_OPCODE_CAL:
reloc.location = vpc->vp->nr_insns;
reloc.target = finst->Label.Label;
- util_dynarray_append(&vpc->label_relocs, struct nvfx_label_relocation, reloc);
+ util_dynarray_append(&vpc->label_relocs, struct nvfx_relocation, reloc);
if(finst->Instruction.Opcode == TGSI_OPCODE_CAL)
insn = arith(SCA, CAL, none.reg, 0, none, none, none);
reloc.location = vpc->vp->nr_insns;
reloc.target = loop.cont_target;
- util_dynarray_append(&vpc->label_relocs, struct nvfx_label_relocation, reloc);
+ util_dynarray_append(&vpc->label_relocs, struct nvfx_relocation, reloc);
nvfx_vp_emit(vpc, arith(SCA, BRA, none.reg, 0, none, none, none));
break;
reloc.location = vpc->vp->nr_insns;
reloc.target = loop.cont_target;
- util_dynarray_append(&vpc->label_relocs, struct nvfx_label_relocation, reloc);
+ util_dynarray_append(&vpc->label_relocs, struct nvfx_relocation, reloc);
nvfx_vp_emit(vpc, arith(SCA, BRA, none.reg, 0, none, none, none));
break;
reloc.location = vpc->vp->nr_insns;
reloc.target = loop.brk_target;
- util_dynarray_append(&vpc->label_relocs, struct nvfx_label_relocation, reloc);
+ util_dynarray_append(&vpc->label_relocs, struct nvfx_relocation, reloc);
nvfx_vp_emit(vpc, arith(SCA, BRA, none.reg, 0, none, none, none));
break;
util_dynarray_append(&insns, unsigned, vp->nr_insns);
- for(unsigned i = 0; i < vpc->label_relocs.size; i += sizeof(struct nvfx_label_relocation))
+ for(unsigned i = 0; i < vpc->label_relocs.size; i += sizeof(struct nvfx_relocation))
{
- struct nvfx_label_relocation* label_reloc = (struct nvfx_label_relocation*)((char*)vpc->label_relocs.data + i);
- struct nvfx_label_relocation hw_reloc;
+ struct nvfx_relocation* label_reloc = (struct nvfx_relocation*)((char*)vpc->label_relocs.data + i);
+ struct nvfx_relocation hw_reloc;
hw_reloc.location = label_reloc->location;
hw_reloc.target = ((unsigned*)insns.data)[label_reloc->target];
//debug_printf("hw %u -> tgsi %u = hw %u\n", hw_reloc.location, label_reloc->target, hw_reloc.target);
- util_dynarray_append(&vp->branch_relocs, struct nvfx_label_relocation, hw_reloc);
+ util_dynarray_append(&vp->branch_relocs, struct nvfx_relocation, hw_reloc);
}
util_dynarray_fini(&insns);
util_dynarray_trim(&vp->branch_relocs);
*/
if (vp->exec_start != vp->exec->start) {
//printf("vp_relocs %u -> %u\n", vp->exec_start, vp->exec->start);
- for(unsigned i = 0; i < vp->branch_relocs.size; i += sizeof(struct nvfx_label_relocation))
+ for(unsigned i = 0; i < vp->branch_relocs.size; i += sizeof(struct nvfx_relocation))
{
- struct nvfx_label_relocation* reloc = (struct nvfx_label_relocation*)((char*)vp->branch_relocs.data + i);
+ struct nvfx_relocation* reloc = (struct nvfx_relocation*)((char*)vp->branch_relocs.data + i);
uint32_t* hw = vp->insns[reloc->location].data;
unsigned target = vp->exec->start + reloc->target;
}
if (vp->nr_consts && vp->data_start != vp->data->start) {
- for (i = 0; i < vp->nr_insns; i++) {
- struct nvfx_vertex_program_exec *vpi = &vp->insns[i];
+ for(unsigned i = 0; i < vp->const_relocs.size; i += sizeof(struct nvfx_relocation))
+ {
+ struct nvfx_relocation* reloc = (struct nvfx_relocation*)((char*)vp->const_relocs.data + i);
+ struct nvfx_vertex_program_exec *vpi = &vp->insns[reloc->location];
- if (vpi->const_index >= 0) {
- vpi->data[1] &= ~NVFX_VP(INST_CONST_SRC_MASK);
- vpi->data[1] |=
- (vpi->const_index + vp->data->start) <<
+ vpi->data[1] &= ~NVFX_VP(INST_CONST_SRC_MASK);
+ vpi->data[1] |=
+ (reloc->target + vp->data->start) <<
NVFX_VP(INST_CONST_SRC_SHIFT);
-
- }
}
vp->data_start = vp->data->start;