[dxbc] Implement option to split up fma

This commit is contained in:
Robin Kertels 2024-04-27 15:42:25 +02:00
parent 462165da19
commit c25d98fc44
No known key found for this signature in database
GPG Key ID: 3824904F14D40757
6 changed files with 16 additions and 2 deletions

View File

@ -499,6 +499,7 @@
# Supported values:
# - True/False
# d3d11.longMad = False
# d3d9.longMad = False
# Device Local Constant Buffers

View File

@ -32,6 +32,7 @@ namespace dxvk {
this->maxFrameLatency = config.getOption<int32_t>("dxgi.maxFrameLatency", 0);
this->maxFrameRate = config.getOption<int32_t>("dxgi.maxFrameRate", 0);
this->exposeDriverCommandLists = config.getOption<bool>("d3d11.exposeDriverCommandLists", true);
this->longMad = config.getOption<bool>("d3d11.longMad", false);
// Clamp LOD bias so that people don't abuse this in unintended ways
this->samplerLodBias = dxvk::fclamp(this->samplerLodBias, -2.0f, 1.0f);

View File

@ -120,6 +120,9 @@ namespace dxvk {
/// Shader dump path
std::string shaderDumpPath;
/// Should we make our Mads a FFma or do it the long way with an FMul and an FAdd?
bool longMad;
};
}

View File

@ -1624,8 +1624,13 @@ namespace dxvk {
case DxbcOpcode::Mad:
case DxbcOpcode::DFma:
dst.id = m_module.opFFma(typeId,
src.at(0).id, src.at(1).id, src.at(2).id);
if (likely(!m_moduleInfo.options.longMad)) {
dst.id = m_module.opFFma(typeId,
src.at(0).id, src.at(1).id, src.at(2).id);
} else {
dst.id = m_module.opFMul(typeId, src.at(0).id, src.at(1).id);
dst.id = m_module.opFAdd(typeId, dst.id, src.at(2).id);
}
break;
case DxbcOpcode::Max:

View File

@ -38,6 +38,7 @@ namespace dxvk {
disableMsaa = options.disableMsaa;
forceSampleRateShading = options.forceSampleRateShading;
enableSampleShadingInterlock = device->features().extFragmentShaderInterlock.fragmentShaderSampleInterlock;
longMad = options.longMad;
// Figure out float control flags to match D3D11 rules
if (options.floatControls) {

View File

@ -54,6 +54,9 @@ namespace dxvk {
/// Minimum storage buffer alignment
VkDeviceSize minSsboAlignment = 0;
/// Should we make our Mads a FFma or do it the long way with an FMul and an FAdd?
bool longMad;
};
}