1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-31 14:52:11 +01:00

[d3d11] Enable longMad/longDot behaviour by default

And remove the respective config options.
This commit is contained in:
Philip Rebohle 2024-08-12 18:37:51 +02:00 committed by Philip Rebohle
parent beaf01ecad
commit 60e04503a6
7 changed files with 20 additions and 78 deletions

View File

@ -526,20 +526,9 @@
# Supported values:
# - True/False
# d3d11.longMad = False
# d3d9.longMad = False
# Long Dot
#
# Whether to emit dot products as an FMA chain or as a plain SPIR-V dot product.
#
# Supported values:
# - True/False
# d3d11.longDot = False
# Device Local Constant Buffers
#
# Enables using device local, host accessible memory for constant buffers in D3D9.

View File

@ -31,8 +31,6 @@ namespace dxvk {
this->numBackBuffers = config.getOption<int32_t>("dxgi.numBackBuffers", 0);
this->maxFrameLatency = config.getOption<int32_t>("dxgi.maxFrameLatency", 0);
this->exposeDriverCommandLists = config.getOption<bool>("d3d11.exposeDriverCommandLists", true);
this->longMad = config.getOption<bool>("d3d11.longMad", false);
this->longDot = config.getOption<bool>("d3d11.longDot", false);
this->reproducibleCommandStream = config.getOption<bool>("d3d11.reproducibleCommandStream", false);
// Clamp LOD bias so that people don't abuse this in unintended ways

View File

@ -118,12 +118,6 @@ namespace dxvk {
/// Shader dump path
std::string shaderDumpPath;
/// Translate Mad/Dfma to separate FMul+FAdd
bool longMad;
/// Translate DpX to a precise FMul+FFma chain
bool longDot;
/// Ensure that for the same D3D commands the output VK commands
/// don't change between runs. Useful for comparative benchmarking,
/// can negatively affect performance.

View File

@ -1623,7 +1623,9 @@ namespace dxvk {
case DxbcOpcode::Mad:
case DxbcOpcode::DFma:
if (likely(!m_moduleInfo.options.longMad)) {
if (ins.controls.precise()) {
// FXC only emits precise mad if the shader explicitly uses
// the HLSL mad()/fma() intrinsics, let's preserve that.
dst.id = m_module.opFFma(typeId,
src.at(0).id, src.at(1).id, src.at(2).id);
} else {
@ -2046,35 +2048,25 @@ namespace dxvk {
dst.type.ccount = 1;
dst.id = 0;
if (!m_moduleInfo.options.longDot) {
dst.id = m_module.opDot(
getVectorTypeId(dst.type),
src.at(0).id,
src.at(1).id);
uint32_t componentType = getVectorTypeId(dst.type);
uint32_t componentCount = srcMask.popCount();
if (ins.controls.precise() || m_precise)
m_module.decorate(dst.id, spv::DecorationNoContraction);
} else {
uint32_t componentType = getVectorTypeId(dst.type);
uint32_t componentCount = srcMask.popCount();
for (uint32_t i = 0; i < componentCount; i++) {
if (dst.id) {
dst.id = m_module.opFFma(componentType,
m_module.opCompositeExtract(componentType, src.at(0).id, 1, &i),
m_module.opCompositeExtract(componentType, src.at(1).id, 1, &i),
dst.id);
} else {
dst.id = m_module.opFMul(componentType,
m_module.opCompositeExtract(componentType, src.at(0).id, 1, &i),
m_module.opCompositeExtract(componentType, src.at(1).id, 1, &i));
}
// Unconditionally mark as precise since the exact order of operation
// matters for some games, even if the instruction itself is not marked
// as precise.
m_module.decorate(dst.id, spv::DecorationNoContraction);
for (uint32_t i = 0; i < componentCount; i++) {
if (dst.id) {
dst.id = m_module.opFFma(componentType,
m_module.opCompositeExtract(componentType, src.at(0).id, 1, &i),
m_module.opCompositeExtract(componentType, src.at(1).id, 1, &i),
dst.id);
} else {
dst.id = m_module.opFMul(componentType,
m_module.opCompositeExtract(componentType, src.at(0).id, 1, &i),
m_module.opCompositeExtract(componentType, src.at(1).id, 1, &i));
}
// Unconditionally mark as precise since the exact order of operation
// matters for some games, even if the instruction itself is not marked
// as precise.
m_module.decorate(dst.id, spv::DecorationNoContraction);
}
dst = emitDstOperandModifiers(dst, ins.modifiers);

View File

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

View File

@ -54,12 +54,6 @@ namespace dxvk {
/// Minimum storage buffer alignment
VkDeviceSize minSsboAlignment = 0;
/// Translate Mad/Dfma to separate FMul+FAdd
bool longMad;
/// Translate DpX to a precise FMul+FFma chain
bool longDot;
};
}

View File

@ -479,35 +479,12 @@ namespace dxvk {
{ "d3d11.exposeDriverCommandLists", "False" },
{ "dxgi.hideNvidiaGpu", "False" },
}} },
/* Red Faction Guerrilla Re-Mars-tered *
* Broken skybox */
{ R"(\\rfg\.exe$)", {{
{ "d3d11.longMad", "True" },
}} },
/* Guild Wars 2 - Fixes invisibility effect *
* flicker when invariantPosition is enabled */
{ R"(\\Gw2-64\.exe$)", {{
{ "d3d11.longMad", "True" },
}} },
/* Ghostbusters: The Video Game Remastered *
* Flickering on character faces */
{ R"(\\ghost\.exe$)", {{
{ "d3d11.longMad", "True" },
}} },
/* Watch_Dogs series - Some objects flicker */
{ R"(\\watch(_)?dogs(2|Legion)?\.exe$)", {{
{ "d3d11.longMad", "True" },
}} },
/* Crysis 1/Warhead - Game bug in d3d10 makes *
* it select lowest supported refresh rate */
{ R"(\\Crysis(64)?\.exe$)", {{
{ "d3d9.maxFrameRate", "-1" },
{ "dxgi.maxFrameRate", "-1" },
}} },
/* Kuro no Kiseki - Broken water on NV */
{ R"(\\(kuro|ed9)\.exe$)", {{
{ "d3d11.longDot", "True" },
}} },
/**********************************************/
/* D3D9 GAMES */