diff options
author | Corbin Simpson <MostAwesomeDude@gmail.com> | 2008-05-23 00:12:37 -0700 |
---|---|---|
committer | Corbin Simpson <MostAwesomeDude@gmail.com> | 2008-05-23 00:18:14 -0700 |
commit | 34010bcc91bc2e8503e7b80187c1aea0e51e53b0 (patch) | |
tree | 9638fb72f29c6516f07b8080a3ab6c12c33a3382 /src | |
parent | d4e93864b8f05f8973d291ac287b27febbb5cb62 (diff) |
r5xx: Add OPCODE_DST.
Works completely, swizzles and everything.
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/r300/r500_fragprog.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/r300/r500_fragprog.c b/src/mesa/drivers/dri/r300/r500_fragprog.c index 35116a14e9..dba7138374 100644 --- a/src/mesa/drivers/dri/r300/r500_fragprog.c +++ b/src/mesa/drivers/dri/r300/r500_fragprog.c @@ -429,7 +429,7 @@ static GLboolean parse_program(struct r500_fragment_program *fp) const struct prog_instruction *inst = mp->Base.Instructions; struct prog_instruction *fpi; GLuint src[3], dest, temp[2]; - int flags, pixel_mask = 0, output_mask = 0, counter = 0; + int temp_swiz, pixel_mask = 0, output_mask = 0, counter = 0; if (!inst || inst[0].Opcode == OPCODE_END) { ERROR("The program is empty!\n"); @@ -600,6 +600,33 @@ 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_DST: + src[0] = make_src(fp, fpi->SrcReg[0]); + src[1] = make_src(fp, fpi->SrcReg[1]); + /* [1, src0.y*src1.y, src0.z, src1.w] + * So basically MUL with lotsa swizzling. */ + emit_alu(fp, counter, fpi); + 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 + | R500_ALU_RGB_SEL_B_SRC1; + /* Select [1, y, z, 1] */ + temp_swiz = (make_rgb_swizzle(fpi->SrcReg[0]) & ~0x7) | R500_SWIZZLE_ONE; + fp->inst[counter].inst3 |= MAKE_SWIZ_RGB_A(temp_swiz); + /* Select [1, y, 1, w] */ + temp_swiz = (make_rgb_swizzle(fpi->SrcReg[0]) & ~0x1c7) | R500_SWIZZLE_ONE | (R500_SWIZZLE_ONE << 6); + fp->inst[counter].inst3 |= MAKE_SWIZ_RGB_B(temp_swiz); + fp->inst[counter].inst4 = R500_ALPHA_OP_MAD + | 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_MAD + | R500_ALU_RGBA_ADDRD(dest) + | MAKE_SWIZ_RGBA_C(R500_SWIZ_RGB_ZERO) + | MAKE_SWIZ_ALPHA_C(R500_SWIZZLE_ZERO); + break; case OPCODE_EX2: src[0] = make_src(fp, fpi->SrcReg[0]); emit_alu(fp, counter, fpi); |