summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/nouveau/nouveau_shader_2.c
diff options
context:
space:
mode:
authorBen Skeggs <darktama@iinet.net.au>2006-11-27 01:57:37 +0000
committerBen Skeggs <darktama@iinet.net.au>2006-11-27 01:57:37 +0000
commit98818f159baeaeba45d656d612b64b2f22c63753 (patch)
treedcc4b50c7715665fa29e8f5915c3089de725db68 /src/mesa/drivers/dri/nouveau/nouveau_shader_2.c
parent2f411b0a8bf9af96d7ef582564d8e462abd0f28d (diff)
- Add InitInstruction to hw shader backend, and remove SetUnusedSource.
- NV30FP/NV40VP: Clear any fields before we OR new values into them - NV40VP: It seems that it might be possible to write a result reg at the same time a temp is written. In InitInstruction, initialise OUT_DEST to OUT_DEST_TEMP so result regs don't get clobbered by default.
Diffstat (limited to 'src/mesa/drivers/dri/nouveau/nouveau_shader_2.c')
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_shader_2.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_shader_2.c b/src/mesa/drivers/dri/nouveau/nouveau_shader_2.c
index 1cb0ca490e..b39f4668b9 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_shader_2.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_shader_2.c
@@ -34,6 +34,8 @@
#include "macros.h"
#include "enums.h"
+#include "program.h"
+
#include "nouveau_shader.h"
struct pass2_rec {
@@ -100,7 +102,7 @@ pass2_add_instruction(nvsPtr nvs, nvsInstruction *inst,
nvsSwzComp default_swz[4] = { NVS_SWZ_X, NVS_SWZ_Y, NVS_SWZ_Z, NVS_SWZ_W };
nvsFunc *shader = nvs->func;
nvsRegister reg;
- int i, srcpos_used = ~7;
+ int i;
shader->SetOpcode(shader, op->NV, slot);
if (inst->saturate ) shader->SetSaturate(shader);
@@ -129,7 +131,6 @@ pass2_add_instruction(nvsPtr nvs, nvsInstruction *inst,
if (reg.file == NVS_FILE_ATTRIB)
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) {
int idx_slot = nvs->params[reg.index].hw_index_cnt++;
nvs->params[reg.index].hw_index = realloc(
@@ -138,10 +139,6 @@ pass2_add_instruction(nvsPtr nvs, nvsInstruction *inst,
}
}
}
- for (i = 0; i < 3; i++) {
- if (!(srcpos_used & (1<<i)))
- shader->SetUnusedSource(shader, i);
- }
reg = pass2_mangle_reg(nvs, inst, inst->dest);
if (reg.file == NVS_FILE_RESULT)
@@ -153,9 +150,9 @@ static int
pass2_assemble_instruction(nvsPtr nvs, nvsInstruction *inst, int last)
{
nvsFunc *shader = nvs->func;
- struct _op_xlat *op, *op2;
- unsigned int hw_inst[8] = {0,0,0,0,0,0,0,0,0};
- int slot, slot2;
+ struct _op_xlat *op;
+ unsigned int hw_inst[8];
+ int slot;
int instsz;
int i;
@@ -164,6 +161,7 @@ pass2_assemble_instruction(nvsPtr nvs, nvsInstruction *inst, int last)
/* Assemble this instruction */
if (!(op = shader->GetOPTXFromSOP(inst->op, &slot)))
return 0;
+ shader->InitInstruction(shader);
pass2_add_instruction(nvs, inst, op, slot);
if (last)
shader->SetLastInst(shader);