summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nv40
diff options
context:
space:
mode:
authorBen Skeggs <[email protected]>2008-03-23 16:26:42 +1100
committerBen Skeggs <[email protected]>2008-03-23 16:26:42 +1100
commitba223e91df8f372a983e99c453947e4340d7d884 (patch)
tree2e1ed8e9e6828f7154c6e828ec0cb4934105fb75 /src/gallium/drivers/nv40
parent01cb2cd93efe7ad94d7fd36aa5a776c2e3ab4c7d (diff)
nv40: fp: fix multiple refs to a single const withing an instruction
Diffstat (limited to 'src/gallium/drivers/nv40')
-rw-r--r--src/gallium/drivers/nv40/nv40_fragprog.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/gallium/drivers/nv40/nv40_fragprog.c b/src/gallium/drivers/nv40/nv40_fragprog.c
index 4e425366985..4cdbf962ab4 100644
--- a/src/gallium/drivers/nv40/nv40_fragprog.c
+++ b/src/gallium/drivers/nv40/nv40_fragprog.c
@@ -41,6 +41,7 @@ struct nv40_fpc {
uint colour_id;
unsigned inst_offset;
+ unsigned have_const;
struct {
int pipe;
@@ -113,7 +114,11 @@ emit_src(struct nv40_fpc *fpc, int pos, struct nv40_sreg src)
sr |= (src.index << NV40_FP_REG_SRC_SHIFT);
break;
case NV40SR_CONST:
- grow_insns(fpc, 4);
+ if (!fpc->have_const) {
+ grow_insns(fpc, 4);
+ fpc->have_const = 1;
+ }
+
hw = &fp->insn[fpc->inst_offset];
if (fpc->consts[src.index].pipe >= 0) {
struct nv40_fragment_program_data *fpd;
@@ -190,6 +195,7 @@ nv40_fp_arith(struct nv40_fpc *fpc, int sat, int op,
uint32_t *hw;
fpc->inst_offset = fp->insn_len;
+ fpc->have_const = 0;
grow_insns(fpc, 4);
hw = &fp->insn[fpc->inst_offset];
memset(hw, 0, sizeof(uint32_t) * 4);