diff options
author | Maciej Cencora <[email protected]> | 2009-07-04 14:57:42 +0200 |
---|---|---|
committer | Maciej Cencora <[email protected]> | 2009-07-13 19:25:58 +0200 |
commit | d1e4caa6e2b6a1e20feb97ae51703d5b4b18f70b (patch) | |
tree | 52d3f19e7070b154619a790b7f2890ed75d06f1b /src | |
parent | 7360f83364b407e949529eeca9f8c421d2da3ded (diff) |
r300: recalculate used inputs and outputs after dead code removal
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/r300/radeon_nqssadce.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/r300/radeon_nqssadce.c b/src/mesa/drivers/dri/r300/radeon_nqssadce.c index 4a2e1cba402..d2591fa1bd2 100644 --- a/src/mesa/drivers/dri/r300/radeon_nqssadce.c +++ b/src/mesa/drivers/dri/r300/radeon_nqssadce.c @@ -264,6 +264,32 @@ static void process_instruction(struct nqssadce_state* s) } } +static void calculateInputsOutputs(struct gl_program *p) +{ + struct prog_instruction *inst; + int i, tmp; + GLuint InputsRead, OutputsWritten; + + inst = p->Instructions; + InputsRead = 0; + OutputsWritten = 0; + while (inst->Opcode != OPCODE_END) + { + tmp = _mesa_num_inst_src_regs(inst->Opcode); + for (i = 0; i < tmp; ++i) { + if (inst->SrcReg[i].File == PROGRAM_INPUT) + InputsRead |= 1 << inst->SrcReg[i].Index; + } + + if (inst->DstReg.File == PROGRAM_OUTPUT) + OutputsWritten |= 1 << inst->DstReg.Index; + + ++inst; + } + + p->InputsRead = InputsRead; + p->OutputsWritten = OutputsWritten; +} void radeonNqssaDce(GLcontext *ctx, struct gl_program *p, struct radeon_nqssadce_descr* descr) { @@ -280,4 +306,6 @@ void radeonNqssaDce(GLcontext *ctx, struct gl_program *p, struct radeon_nqssadce s.IP--; process_instruction(&s); } + + calculateInputsOutputs(p); } |