summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/r300/radeon_program_alu.c
diff options
context:
space:
mode:
authorNicolai Haehnle <nhaehnle@gmail.com>2008-07-05 22:35:46 +0200
committerNicolai Haehnle <nhaehnle@gmail.com>2008-07-06 10:00:35 +0200
commit03abd021f2fa1d043682c9f1bbb1c080fba6b033 (patch)
tree081871d72436c40ecdbf3d0e65f25a2f1c768813 /src/mesa/drivers/dri/r300/radeon_program_alu.c
parent62bccd6df0c963a14e801bcac95dc8046b978a7f (diff)
downloadexternal_mesa3d-03abd021f2fa1d043682c9f1bbb1c080fba6b033.zip
external_mesa3d-03abd021f2fa1d043682c9f1bbb1c080fba6b033.tar.gz
external_mesa3d-03abd021f2fa1d043682c9f1bbb1c080fba6b033.tar.bz2
r300: Translate fragment program LRP in radeon_program_alu.c
Diffstat (limited to 'src/mesa/drivers/dri/r300/radeon_program_alu.c')
-rw-r--r--src/mesa/drivers/dri/r300/radeon_program_alu.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/r300/radeon_program_alu.c b/src/mesa/drivers/dri/r300/radeon_program_alu.c
index 85ea810..483dfa2 100644
--- a/src/mesa/drivers/dri/r300/radeon_program_alu.c
+++ b/src/mesa/drivers/dri/r300/radeon_program_alu.c
@@ -296,6 +296,19 @@ static void transform_LIT(struct radeon_transform_context* t,
emit1(t->Program, OPCODE_MOV, inst->DstReg, srctemp);
}
+static void transform_LRP(struct radeon_transform_context* t,
+ struct prog_instruction* inst)
+{
+ int tempreg = radeonFindFreeTemporary(t);
+
+ emit2(t->Program, OPCODE_ADD,
+ dstreg(PROGRAM_TEMPORARY, tempreg),
+ inst->SrcReg[1], negate(inst->SrcReg[2]));
+ emit3(t->Program, OPCODE_MAD,
+ inst->DstReg,
+ inst->SrcReg[0], srcreg(PROGRAM_TEMPORARY, tempreg), inst->SrcReg[2]);
+}
+
static void transform_POW(struct radeon_transform_context* t,
struct prog_instruction* inst)
{
@@ -360,7 +373,7 @@ static void transform_XPD(struct radeon_transform_context* t,
* no userData necessary.
*
* Eliminates the following ALU instructions:
- * ABS, DPH, FLR, LIT, POW, SGE, SLT, SUB, SWZ, XPD
+ * ABS, DPH, FLR, LIT, LRP, POW, SGE, SLT, SUB, SWZ, XPD
* using:
* MOV, ADD, MUL, MAD, FRC, DP3, LG2, EX2, CMP
*
@@ -375,6 +388,7 @@ GLboolean radeonTransformALU(struct radeon_transform_context* t,
case OPCODE_DPH: transform_DPH(t, inst); return GL_TRUE;
case OPCODE_FLR: transform_FLR(t, inst); return GL_TRUE;
case OPCODE_LIT: transform_LIT(t, inst); return GL_TRUE;
+ case OPCODE_LRP: transform_LRP(t, inst); return GL_TRUE;
case OPCODE_POW: transform_POW(t, inst); return GL_TRUE;
case OPCODE_SGE: transform_SGE(t, inst); return GL_TRUE;
case OPCODE_SLT: transform_SLT(t, inst); return GL_TRUE;