summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorCorbin Simpson <[email protected]>2008-05-17 12:45:46 -0700
committerCorbin Simpson <[email protected]>2008-05-17 12:45:46 -0700
commitc57b3b1d2c4344603763c8d200f111a132d3899f (patch)
treef0cd8b905fc58efb2a42b8c331587fb0e91ff755 /src
parent6dd3c0ed962dd3c2d4db331d4c745b39b7dde8c3 (diff)
r5xx: Added OPCODE_DPH.
Like DP4, but with one swizzle change.
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/r300/r500_fragprog.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/r300/r500_fragprog.c b/src/mesa/drivers/dri/r300/r500_fragprog.c
index 8abdc26733b..4f2ff514ccd 100644
--- a/src/mesa/drivers/dri/r300/r500_fragprog.c
+++ b/src/mesa/drivers/dri/r300/r500_fragprog.c
@@ -497,6 +497,26 @@ static GLboolean parse_program(struct r500_fragment_program *fp)
fp->inst[counter].inst5 = R500_ALU_RGBA_OP_DP4
| R500_ALU_RGBA_ADDRD(dest);
break;
+ case OPCODE_DPH:
+ src[0] = make_src(fp, fpi->SrcReg[0]);
+ src[1] = make_src(fp, fpi->SrcReg[1]);
+ /* Based on DP3 */
+ fp->inst[counter].inst0 = R500_INST_TYPE_ALU
+ | R500_INST_TEX_SEM_WAIT | pixel_mask;
+ fp->inst[counter].inst1 = R500_RGB_ADDR0(src[0])
+ | R500_RGB_ADDR1(src[1]);
+ fp->inst[counter].inst2 = R500_ALPHA_ADDR0(src[0])
+ | R500_ALPHA_ADDR1(src[1]);
+ fp->inst[counter].inst3 = R500_ALU_RGB_SEL_A_SRC0
+ | MAKE_SWIZ_RGB_A(make_rgb_swizzle(fpi->SrcReg[0]))
+ | R500_ALU_RGB_SEL_B_SRC1 | MAKE_SWIZ_RGB_B(make_rgb_swizzle(fpi->SrcReg[1]));
+ fp->inst[counter].inst4 = R500_ALPHA_OP_DP
+ | R500_ALPHA_ADDRD(dest)
+ | R500_ALPHA_SEL_A_SRC0 | MAKE_SWIZ_ALPHA_A(R500_SWIZZLE_ONE)
+ | R500_ALPHA_SEL_B_SRC1 | MAKE_SWIZ_ALPHA_B(make_alpha_swizzle(fpi->SrcReg[1]));
+ fp->inst[counter].inst5 = R500_ALU_RGBA_OP_DP4
+ | R500_ALU_RGBA_ADDRD(dest);
+ break;
case OPCODE_EX2:
src[0] = make_src(fp, fpi->SrcReg[0]);
fp->inst[counter].inst0 = R500_INST_TYPE_ALU