summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/nv50/nv50_program.c
diff options
context:
space:
mode:
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>2010-08-31 20:36:45 +0200
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>2010-09-01 18:02:50 +0200
commite08f70a41d1012a0270468866614485a3415168e (patch)
tree00731e941018bc94714b836075324c950bae9b1d /src/gallium/drivers/nv50/nv50_program.c
parent6f9978050eb8648888a728fc09b99e279c2b7b15 (diff)
nv50: make use of TGSI immediate type
Diffstat (limited to 'src/gallium/drivers/nv50/nv50_program.c')
-rw-r--r--src/gallium/drivers/nv50/nv50_program.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c
index 182a591eb3..523603ca3a 100644
--- a/src/gallium/drivers/nv50/nv50_program.c
+++ b/src/gallium/drivers/nv50/nv50_program.c
@@ -187,13 +187,14 @@ prog_immediate(struct nv50_translation_info *ti,
const struct tgsi_full_immediate *imm)
{
int c;
- unsigned n = ++ti->immd32_nr;
+ unsigned n = ti->immd32_nr++;
- if (n == (1 << (ffs(n) - 1)))
- ti->immd32 = REALLOC(ti->immd32, (n / 2) * 16, (n * 2) * 16);
+ assert(ti->immd32_nr <= ti->scan.immediate_count);
for (c = 0; c < 4; ++c)
- ti->immd32[(n - 1) * 4 + c] = imm->u[c].Uint;
+ ti->immd32[n * 4 + c] = imm->u[c].Uint;
+
+ ti->immd32_ty[n] = imm->Immediate.DataType;
}
static INLINE unsigned
@@ -495,6 +496,9 @@ nv50_prog_scan(struct nv50_translation_info *ti)
tgsi_dump(p->pipe.tokens, 0);
#endif
+ ti->immd32 = (uint32_t *)MALLOC(ti->scan.immediate_count * 16);
+ ti->immd32_ty = (ubyte *)MALLOC(ti->scan.immediate_count * sizeof(ubyte));
+
tgsi_parse_init(&parse, p->pipe.tokens);
while (!tgsi_parse_end_of_tokens(&parse)) {
tgsi_parse_token(&parse);
@@ -561,6 +565,8 @@ nv50_program_tx(struct nv50_program *p)
out:
if (ti->immd32)
FREE(ti->immd32);
+ if (ti->immd32_ty)
+ FREE(ti->immd32_ty);
FREE(ti);
return ret ? FALSE : TRUE;
}