1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-11-29 01:24:11 +01:00

[dxso] Implement zerowins for Lerp.

Fixes #2545.
This commit is contained in:
Georg Lehmann 2022-03-16 14:02:30 +01:00 committed by Joshie
parent 1f88ee595f
commit 630fee59fc
2 changed files with 28 additions and 4 deletions

View File

@ -1500,6 +1500,25 @@ namespace dxvk {
return dot;
}
DxsoRegisterValue DxsoCompiler::emitMix(
DxsoRegisterValue x,
DxsoRegisterValue y,
DxsoRegisterValue a) {
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)};
uint32_t oneId = m_module.constfReplicant(1.0f, a.type.ccount);
DxsoRegisterValue revA;
revA.type = a.type;
revA.id = m_module.opFSub(typeId, oneId, a.id);
DxsoRegisterValue xRevA = emitMul(x, revA);
return emitFma(a, y, xRevA);
}
DxsoRegisterValue DxsoCompiler::emitCross(
DxsoRegisterValue a,
@ -2226,10 +2245,10 @@ namespace dxvk {
}
break;
case DxsoOpcode::Lrp:
result.id = m_module.opFMix(typeId,
emitRegisterLoad(src[2], mask).id,
emitRegisterLoad(src[1], mask).id,
emitRegisterLoad(src[0], mask).id);
result.id = emitMix(
emitRegisterLoad(src[2], mask),
emitRegisterLoad(src[1], mask),
emitRegisterLoad(src[0], mask)).id;
break;
case DxsoOpcode::Frc:
result.id = m_module.opFract(typeId,

View File

@ -562,6 +562,11 @@ namespace dxvk {
DxsoRegisterValue a,
DxsoRegisterValue b);
DxsoRegisterValue emitMix(
DxsoRegisterValue x,
DxsoRegisterValue y,
DxsoRegisterValue a);
DxsoRegisterValue emitCross(
DxsoRegisterValue a,
DxsoRegisterValue b);