From 6ff3d2577ec1099a90cce9292118814c00ab0e6a Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Sun, 26 Nov 2006 10:19:44 +0000 Subject: [PATCH] Fix progs/fp/tri-xpd Fragprog consts are inlined, so make sure we update *all* occurances of a param :) --- src/mesa/drivers/dri/nouveau/nouveau_shader.h | 6 +++++- src/mesa/drivers/dri/nouveau/nouveau_shader_2.c | 8 ++++++-- src/mesa/drivers/dri/nouveau/nv30_fragprog.c | 8 ++++++-- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/mesa/drivers/dri/nouveau/nouveau_shader.h b/src/mesa/drivers/dri/nouveau/nouveau_shader.h index baf59d02596..fac8851a578 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_shader.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_shader.h @@ -47,7 +47,11 @@ typedef struct _nouveauShader { struct { GLfloat *source_val; /* NULL if invariant */ float val[4]; - int hw_index; /* hw-specific value */ + /* Hardware-specific tracking, currently only nv30_fragprog + * makes use of it. + */ + int *hw_index; + int hw_index_cnt; } params[NVS_MAX_CONSTS]; struct { diff --git a/src/mesa/drivers/dri/nouveau/nouveau_shader_2.c b/src/mesa/drivers/dri/nouveau/nouveau_shader_2.c index 1f09b6d4536..1cb0ca490e2 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_shader_2.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_shader_2.c @@ -130,8 +130,12 @@ pass2_add_instruction(nvsPtr nvs, nvsInstruction *inst, nvs->inputs_read |= (1 << reg.index); shader->SetSource(shader, ®, op->srcpos[i]); srcpos_used |= (1<srcpos[i]); - if (reg.file == NVS_FILE_CONST && shader->GetSourceConstVal) - nvs->params[reg.index].hw_index = nvs->program_current + 4; + if (reg.file == NVS_FILE_CONST && shader->GetSourceConstVal) { + int idx_slot = nvs->params[reg.index].hw_index_cnt++; + nvs->params[reg.index].hw_index = realloc( + nvs->params[reg.index].hw_index, sizeof(int) * idx_slot+1); + nvs->params[reg.index].hw_index[idx_slot] = nvs->program_current + 4; + } } } for (i = 0; i < 3; i++) { diff --git a/src/mesa/drivers/dri/nouveau/nv30_fragprog.c b/src/mesa/drivers/dri/nouveau/nv30_fragprog.c index 2e35d08c07c..46391eb911f 100644 --- a/src/mesa/drivers/dri/nouveau/nv30_fragprog.c +++ b/src/mesa/drivers/dri/nouveau/nv30_fragprog.c @@ -60,11 +60,15 @@ NV30FPUploadToHW(GLcontext *ctx, nouveauShader *nvs) static void NV30FPUpdateConst(GLcontext *ctx, nouveauShader *nvs, int id) { - uint32_t *current = nvs->program + nvs->params[id].hw_index; uint32_t *new = nvs->params[id].source_val ? nvs->params[id].source_val : nvs->params[id].val; + uint32_t *current; + int i; - COPY_4V(current, new); + for (i=0; iparams[id].hw_index_cnt; i++) { + current = nvs->program + nvs->params[id].hw_index[i]; + COPY_4V(current, new); + } nvs->on_hardware = 0; } -- 2.30.2