Parcourir la source

nv50: make assimilate_temp safe

Cannot change hw reg assigned to a TGSI TEMP on the fly if
we are in a loop, conditional, or can jump around wildly.
tags/7.8-rc1
Christoph Bumiller il y a 15 ans
Parent
révision
b3425bc360
1 fichiers modifiés avec 28 ajouts et 16 suppressions
  1. 28
    16
      src/gallium/drivers/nv50/nv50_program.c

+ 28
- 16
src/gallium/drivers/nv50/nv50_program.c Voir le fichier

@@ -285,22 +285,6 @@ alloc_temp(struct nv50_pc *pc, struct nv50_reg *dst)
return NULL;
}

/* Assign the hw of the discarded temporary register src
* to the tgsi register dst and free src.
*/
static void
assimilate_temp(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src)
{
assert(src->index == -1 && src->hw != -1);

if (dst->hw != -1)
pc->r_temp[dst->hw] = NULL;
pc->r_temp[src->hw] = dst;
dst->hw = src->hw;

FREE(src);
}

/* release the hardware resource held by r */
static void
release_hw(struct nv50_pc *pc, struct nv50_reg *r)
@@ -721,6 +705,34 @@ emit_mov_immdval(struct nv50_pc *pc, struct nv50_reg *dst, float f)
FREE(imm);
}

/* Assign the hw of the discarded temporary register src
* to the tgsi register dst and free src.
*/
static void
assimilate_temp(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src)
{
assert(src->index == -1 && src->hw != -1);

if (pc->if_lvl || pc->loop_lvl ||
(dst->type != P_TEMP) ||
(src->hw < pc->result_nr * 4 &&
pc->p->type == PIPE_SHADER_FRAGMENT) ||
pc->p->info.opcode_count[TGSI_OPCODE_CAL] ||
pc->p->info.opcode_count[TGSI_OPCODE_BRA]) {

emit_mov(pc, dst, src);
free_temp(pc, src);
return;
}

if (dst->hw != -1)
pc->r_temp[dst->hw] = NULL;
pc->r_temp[src->hw] = dst;
dst->hw = src->hw;

FREE(src);
}

static void
emit_nop(struct nv50_pc *pc)
{

Chargement…
Annuler
Enregistrer