Fix progs/fp/tri-xpd

Fragprog consts are inlined, so make sure we update *all* occurances of a
    param :)
This commit is contained in:
Ben Skeggs 2006-11-26 10:19:44 +00:00
parent 9c9e6abbf8
commit 6ff3d2577e
3 changed files with 17 additions and 5 deletions

View file

@ -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 {

View file

@ -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++) {

View file

@ -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;
}