summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorBen Skeggs <darktama@iinet.net.au>2006-11-26 10:19:44 +0000
committerBen Skeggs <darktama@iinet.net.au>2006-11-26 10:19:44 +0000
commit6ff3d2577ec1099a90cce9292118814c00ab0e6a (patch)
tree5061a00a856dc98f25ed5d8795bfd79e29f570de /src/mesa
parent9c9e6abbf82fbf591575a9c352f86721bc72aa90 (diff)
Fix progs/fp/tri-xpd
Fragprog consts are inlined, so make sure we update *all* occurances of a param :)
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_shader.h6
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_shader_2.c8
-rw-r--r--src/mesa/drivers/dri/nouveau/nv30_fragprog.c8
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 baf59d0259..fac8851a57 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 1f09b6d453..1cb0ca490e 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, &reg, op->srcpos[i]);
srcpos_used |= (1<<op->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 2e35d08c07..46391eb911 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; i<nvs->params[id].hw_index_cnt; i++) {
+ current = nvs->program + nvs->params[id].hw_index[i];
+ COPY_4V(current, new);
+ }
nvs->on_hardware = 0;
}