1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-02-27 13:54:16 +01:00

[dxso] Fix lrp instruction

Games expect this to be equivalent to add -> mad, but since we changed
mad to emit mul + add, this is no longer the case. Also remove OpFMix
path.
This commit is contained in:
Philip Rebohle 2024-11-10 20:06:11 +01:00
parent d9d99445bd
commit 35a82b2ff3
2 changed files with 8 additions and 18 deletions

View File

@ -1402,16 +1402,12 @@ namespace dxvk {
} }
DxsoRegisterValue DxsoCompiler::emitFma( DxsoRegisterValue DxsoCompiler::emitMad(
DxsoRegisterValue a, DxsoRegisterValue a,
DxsoRegisterValue b, DxsoRegisterValue b,
DxsoRegisterValue c) { DxsoRegisterValue c) {
auto az = emitMulOperand(a, b); DxsoRegisterValue result = emitMul(a, b);
auto bz = emitMulOperand(b, a); result.id = m_module.opFAdd(getVectorTypeId(result.type), result.id, c.id);
DxsoRegisterValue result;
result.type = a.type;
result.id = m_module.opFFma(getVectorTypeId(result.type), az.id, bz.id, c.id);
return result; return result;
} }
@ -1436,14 +1432,11 @@ namespace dxvk {
DxsoRegisterValue a) { DxsoRegisterValue a) {
uint32_t typeId = getVectorTypeId(x.type); uint32_t typeId = getVectorTypeId(x.type);
if (m_moduleInfo.options.d3d9FloatEmulation != D3D9FloatEmulation::Strict)
return {x.type, m_module.opFMix(typeId, x.id, y.id, a.id)};
DxsoRegisterValue ySubx; DxsoRegisterValue ySubx;
ySubx.type = x.type; ySubx.type = x.type;
ySubx.id = m_module.opFSub(typeId, y.id, x.id); ySubx.id = m_module.opFSub(typeId, y.id, x.id);
return emitFma(a, ySubx, x); return emitMad(a, ySubx, x);
} }
@ -1935,13 +1928,10 @@ namespace dxvk {
emitRegisterLoad(src[1], mask).id); emitRegisterLoad(src[1], mask).id);
break; break;
case DxsoOpcode::Mad: case DxsoOpcode::Mad:
result.id = emitMul( result.id = emitMad(
emitRegisterLoad(src[0], mask), emitRegisterLoad(src[0], mask),
emitRegisterLoad(src[1], mask)).id; emitRegisterLoad(src[1], mask),
emitRegisterLoad(src[2], mask)).id;
result.id = m_module.opFAdd(typeId,
result.id,
emitRegisterLoad(src[2], mask).id);
break; break;
case DxsoOpcode::Mul: case DxsoOpcode::Mul:
result.id = emitMul( result.id = emitMul(

View File

@ -543,7 +543,7 @@ namespace dxvk {
DxsoRegisterValue a, DxsoRegisterValue a,
DxsoRegisterValue b); DxsoRegisterValue b);
DxsoRegisterValue emitFma( DxsoRegisterValue emitMad(
DxsoRegisterValue a, DxsoRegisterValue a,
DxsoRegisterValue b, DxsoRegisterValue b,
DxsoRegisterValue c); DxsoRegisterValue c);