Commit b1e7eb92 authored by Joshua Ashton's avatar Joshua Ashton 🐸

[dx9asm] Implement dp2add.

parent a2657231
Pipeline #37 passed with stage
in 1 minute and 37 seconds
......@@ -27,7 +27,7 @@ namespace dxup {
{"def", D3DSIO_DEF, 1, {Dst, Vec4}, {}, &ShaderCodeTranslator::handleDef},
{"defb", D3DSIO_DEFB, 1, {Dst, Bool}, {}, &ShaderCodeTranslator::handleDefB},
{"defi", D3DSIO_DEFI, 1, {Dst, Vec4}, {}, &ShaderCodeTranslator::handleDefi},
{"dp2add", D3DSIO_DP2ADD, 1, {Dst, Src0, Src1, Src3}, {}},
{"dp2add", D3DSIO_DP2ADD, 1, {Dst, Src0, Src1, Src2}, {}, &ShaderCodeTranslator::handleDp2Add},
{"dp3", D3DSIO_DP3, 1, {Dst, Src0, Src1}, { D3D10_SB_OPCODE_DP3, 0, 3, 3 }},
{"dp4", D3DSIO_DP4, 1, {Dst, Src0, Src1}, { D3D10_SB_OPCODE_DP4, 0 }},
{"dsx", D3DSIO_DSX, 1, {Dst, Src0}, {}},
......
......@@ -124,6 +124,7 @@ namespace dxup {
bool handleDefi(DX9Operation& operation);
bool handleDefB(DX9Operation& operation);
bool handleSinCos(DX9Operation& operation);
bool handleDp2Add(DX9Operation& operation);
bool handleIf(DX9Operation& operation);
bool handleIfc(DX9Operation& operation);
......
......@@ -553,6 +553,37 @@ namespace dxup {
return true;
}
bool ShaderCodeTranslator::handleDp2Add(DX9Operation& operation) {
const DX9Operand* dst = operation.getOperandByType(optype::Dst);
const DX9Operand* src0 = operation.getOperandByType(optype::Src0);
const DX9Operand* src1 = operation.getOperandByType(optype::Src1);
const DX9Operand* src2 = operation.getOperandByType(optype::Src2);
DXBCOperand dstOp = { *this, operation, *dst, 0 };
DXBCOperand src0Op = { *this, operation, *src0, 0 };
DXBCOperand src1Op = { *this, operation, *src1, 0 };
DXBCOperand src2Op = { *this, operation, *src2, 0 };
DXBCOperand tempOpSrc = getRegisterMap().getNextInternalTemp();
DXBCOperand tempOpDst = tempOpSrc;
tempOpSrc.setComponents(noSwizzle);
tempOpDst.setSwizzleOrWritemask(writeAll);
DXBCOperation{ D3D10_SB_OPCODE_DP2, false }
.appendOperand(tempOpDst)
.appendOperand(src0Op)
.appendOperand(src1Op)
.push(*this);
DXBCOperation{ D3D10_SB_OPCODE_ADD, false }
.appendOperand(dstOp)
.appendOperand(tempOpSrc)
.appendOperand(src2Op)
.push(*this);
return true;
}
struct CompareMode {
uint32_t opcode;
bool swap;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment