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

[dxbc] Implement DDiv, DFma and DRcp

This commit is contained in:
Philip Rebohle 2018-08-15 19:51:07 +02:00
parent fabcdbc3ae
commit 86fbba06be
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 38 additions and 2 deletions

View File

@ -1421,6 +1421,7 @@ namespace dxvk {
break;
case DxbcOpcode::Div:
case DxbcOpcode::DDiv:
dst.id = m_module.opFDiv(typeId,
src.at(0).id, src.at(1).id);
break;
@ -1441,6 +1442,7 @@ namespace dxvk {
break;
case DxbcOpcode::Mad:
case DxbcOpcode::DFma:
dst.id = m_module.opFFma(typeId,
src.at(0).id, src.at(1).id, src.at(2).id);
break;
@ -1463,13 +1465,20 @@ namespace dxvk {
src.at(0).id, src.at(1).id);
break;
case DxbcOpcode::Rcp: {
case DxbcOpcode::Rcp:
dst.id = m_module.opFDiv(typeId,
emitBuildConstVecf32(
1.0f, 1.0f, 1.0f, 1.0f,
ins.dst[0].mask).id,
src.at(0).id);
} break;
break;
case DxbcOpcode::DRcp:
dst.id = m_module.opFDiv(typeId,
emitBuildConstVecf64(1.0, 1.0,
ins.dst[0].mask).id,
src.at(0).id);
break;
case DxbcOpcode::RoundNe:
dst.id = m_module.opRoundEven(
@ -3903,6 +3912,28 @@ namespace dxvk {
}
DxbcRegisterValue DxbcCompiler::emitBuildConstVecf64(
double xy,
double zw,
const DxbcRegMask& writeMask) {
std::array<uint32_t, 2> ids = { 0, 0 };
uint32_t componentIndex = 0;
if (writeMask[0] && writeMask[1]) ids[componentIndex++] = m_module.constf64(xy);
if (writeMask[2] && writeMask[3]) ids[componentIndex++] = m_module.constf64(zw);
DxbcRegisterValue result;
result.type.ctype = DxbcScalarType::Float64;
result.type.ccount = componentIndex;
result.id = componentIndex > 1
? m_module.constComposite(
getVectorTypeId(result.type),
componentIndex, ids.data())
: ids[0];
return result;
}
DxbcRegisterValue DxbcCompiler::emitRegisterBitcast(
DxbcRegisterValue srcValue,
DxbcScalarType dstType) {

View File

@ -774,6 +774,11 @@ namespace dxvk {
int32_t w,
const DxbcRegMask& writeMask);
DxbcRegisterValue emitBuildConstVecf64(
double xy,
double zw,
const DxbcRegMask& writeMask);
/////////////////////////////////////////
// Generic register manipulation methods
DxbcRegisterValue emitRegisterBitcast(