[PATCH] nv50: use register count from tgsi program info
Christoph Bumiller
e0425955 at student.tuwien.ac.at
Sun Jun 21 08:50:37 PDT 2009
---
src/gallium/drivers/nv50/nv50_program.c | 57 +++++++++++++++++--------------
1 files changed, 31 insertions(+), 26 deletions(-)
diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c
index c250659..71a084e 100644
--- a/src/gallium/drivers/nv50/nv50_program.c
+++ b/src/gallium/drivers/nv50/nv50_program.c
@@ -1695,11 +1695,6 @@ prep_inspect_insn(struct nv50_pc *pc, const union tgsi_full_token *tok,
dst = &insn->FullDstRegisters[0].DstRegister;
mask = dst->WriteMask;
- if (!r_usage[0])
- r_usage[0] = CALLOC(pc->temp_nr * 4, sizeof(unsigned));
- if (!r_usage[1])
- r_usage[1] = CALLOC(pc->attr_nr * 4, sizeof(unsigned));
-
if (dst->File == TGSI_FILE_TEMPORARY) {
for (c = 0; c < 4; c++) {
if (!(mask & (1 << c)))
@@ -1792,17 +1787,11 @@ nv50_program_tx_prep(struct nv50_pc *pc)
/* track register access for temps and attrs */
unsigned *r_usage[2];
- r_usage[0] = NULL;
- r_usage[1] = NULL;
- depr = fcol = bcol = fcrd = 0xffff;
+ r_usage[0] = CALLOC(pc->temp_nr * 4, sizeof(unsigned));
+ r_usage[1] = CALLOC(pc->attr_nr * 4, sizeof(unsigned));
- if (pc->p->type == PIPE_SHADER_FRAGMENT) {
- pc->p->cfg.fp.regs[0] = 0x01000404;
- pc->p->cfg.fp.regs[1] = 0x00000400;
- pc->p->cfg.fp.map[0] = 0x03020100;
- pc->p->cfg.fp.high_map = 1;
- }
+ depr = fcol = bcol = fcrd = 0xffff;
tgsi_parse_init(&p, pc->p->pipe.tokens);
while (!tgsi_parse_end_of_tokens(&p)) {
@@ -1832,13 +1821,8 @@ nv50_program_tx_prep(struct nv50_pc *pc)
switch (d->Declaration.File) {
case TGSI_FILE_TEMPORARY:
- if (pc->temp_nr < (last + 1))
- pc->temp_nr = last + 1;
break;
case TGSI_FILE_OUTPUT:
- if (pc->result_nr < (last + 1))
- pc->result_nr = last + 1;
-
if (!d->Declaration.Semantic)
break;
@@ -1855,9 +1839,6 @@ nv50_program_tx_prep(struct nv50_pc *pc)
break;
case TGSI_FILE_INPUT:
{
- if (pc->attr_nr < (last + 1))
- pc->attr_nr = last + 1;
-
if (pc->p->type != PIPE_SHADER_FRAGMENT)
break;
@@ -1903,8 +1884,6 @@ nv50_program_tx_prep(struct nv50_pc *pc)
}
break;
case TGSI_FILE_CONSTANT:
- if (pc->param_nr < (last + 1))
- pc->param_nr = last + 1;
break;
case TGSI_FILE_SAMPLER:
break;
@@ -2102,6 +2081,33 @@ free_nv50_pc(struct nv50_pc *pc)
FREE(pc);
}
+static void
+ctor_nv50_pc(struct nv50_pc *pc, struct nv50_program *p)
+{
+ pc->p = p;
+ p->cfg.high_temp = 4;
+
+ pc->temp_nr = p->info.file_max[TGSI_FILE_TEMPORARY] + 1;
+ pc->attr_nr = p->info.file_max[TGSI_FILE_INPUT] + 1;
+ pc->result_nr = p->info.file_max[TGSI_FILE_OUTPUT] + 1;
+ pc->param_nr = p->info.file_max[TGSI_FILE_CONSTANT] + 1;
+
+ switch (p->type) {
+ case PIPE_SHADER_VERTEX:
+ break;
+ case PIPE_SHADER_FRAGMENT:
+ p->cfg.fp.regs[0] = 0x01000404;
+ p->cfg.fp.regs[1] = 0x00000400;
+
+ p->cfg.fp.map[0] = 0x03020100;
+ p->cfg.fp.high_map = 1;
+ break;
+ default:
+ assert(!"unsupported GPU program type");
+ break;
+ }
+}
+
static boolean
nv50_program_tx(struct nv50_program *p)
{
@@ -2113,8 +2119,7 @@ nv50_program_tx(struct nv50_program *p)
pc = CALLOC_STRUCT(nv50_pc);
if (!pc)
return FALSE;
- pc->p = p;
- pc->p->cfg.high_temp = 4;
+ ctor_nv50_pc(pc, p);
ret = nv50_program_tx_prep(pc);
if (ret == FALSE)
--
1.6.0.6
--------------090503050107050804030002
Content-Type: text/plain;
name="0006-nv50-move-some-stuff-into-nv50_program_tx_postproce.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename*0="0006-nv50-move-some-stuff-into-nv50_program_tx_postproce.pat";
filename*1="ch"
More information about the Nouveau
mailing list