From 9d2ef284bb3ec419b8f53f56bff7f6dd5492ee4c Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Fri, 18 Mar 2011 11:06:47 -0700 Subject: [PATCH] r300/compiler: Use a 4-bit writemask in pair instructions We now use a 4-bit writemask for all instruction types, which makes it easier to write generic helper functions to manipulte writemasks. NOTE: This is a candidate for the 7.10 branch. --- src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c | 3 ++- src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c | 2 +- src/mesa/drivers/dri/r300/compiler/radeon_program_pair.h | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c b/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c index 301b4446693..2f8d6e4d04b 100644 --- a/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c +++ b/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c @@ -259,7 +259,8 @@ static void emit_paired(struct r300_fragment_program_compiler *c, struct rc_pair } code->inst[ip].inst0 |= R500_INST_TEX_SEM_WAIT; - code->inst[ip].inst0 |= (inst->RGB.WriteMask << 11) | (inst->Alpha.WriteMask << 14); + code->inst[ip].inst0 |= (inst->RGB.WriteMask << 11); + code->inst[ip].inst0 |= inst->Alpha.WriteMask ? 1 << 14 : 0; code->inst[ip].inst0 |= (inst->RGB.OutputWriteMask << 15) | (inst->Alpha.OutputWriteMask << 18); if (inst->Nop) { code->inst[ip].inst0 |= R500_INST_NOP; diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c b/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c index 9e03eb1aca8..fed3a3f7642 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c @@ -289,7 +289,7 @@ static void set_pair_instruction(struct r300_fragment_program_compiler *c, } if (needalpha) { - pair->Alpha.WriteMask |= GET_BIT(inst->DstReg.WriteMask, 3); + pair->Alpha.WriteMask |= (GET_BIT(inst->DstReg.WriteMask, 3) << 3); if (pair->Alpha.WriteMask) { pair->Alpha.DestIndex = inst->DstReg.Index; } diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.h b/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.h index 6708b16d29a..d1a435fc530 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.h @@ -71,7 +71,7 @@ struct rc_pair_instruction_arg { struct rc_pair_sub_instruction { unsigned int Opcode:8; unsigned int DestIndex:RC_REGISTER_INDEX_BITS; - unsigned int WriteMask:3; + unsigned int WriteMask:4; unsigned int Target:2; unsigned int OutputWriteMask:3; unsigned int DepthWriteMask:1; -- 2.30.2