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 {
nvs->inputs_read |= (1 << reg.index);
shader->SetSource(shader, ®, 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++) {
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;
}