Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to enforce relaxed fifo present mode #1583

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion dxvk.conf
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,17 @@
# Supported values: True, False

# dxgi.tearFree = False
# d3d9.tearFree = False

# Enables the relaxed fifo present mode in case regular Vsync is enabled.
# This should result in tearing but reduce stutter if FPS are too low,
# but may be unsupported on some systems.
# Please do not report issues with this option.
#
# Supported values: True, False

# dxgi.forceTear = False
# d3d9.forceTear = False

# Performs range check on dynamically indexed constant buffers in shaders.
# This may be needed to work around a certain type of game bug, but may
Expand Down Expand Up @@ -324,4 +334,4 @@
# Supported values:
# - True/False

# d3d9.longMad = False
# d3d9.longMad = False
3 changes: 2 additions & 1 deletion src/d3d11/d3d11_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ namespace dxvk {
this->maxFrameLatency = config.getOption<int32_t>("dxgi.maxFrameLatency", 0);
this->syncInterval = config.getOption<int32_t>("dxgi.syncInterval", -1);
this->tearFree = config.getOption<bool>("dxgi.tearFree", false);
this->forceTear = config.getOption<bool>("dxgi.forceTear", false);

this->constantBufferRangeCheck = config.getOption<bool>("d3d11.constantBufferRangeCheck", false)
&& DxvkGpuVendor(devInfo.core.properties.vendorID) != DxvkGpuVendor::Amd;
Expand All @@ -37,4 +38,4 @@ namespace dxvk {
Logger::warn("D3D11: Apitrace mode enabled, may affect performance!");
}

}
}
5 changes: 4 additions & 1 deletion src/d3d11/d3d11_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ namespace dxvk {
/// Tear-free mode if vsync is disabled
bool tearFree;

/// Tearing if vsync is enabled
bool forceTear;

/// Override maximum frame latency if the app specifies
/// a higher value. May help with frame timing issues.
int32_t maxFrameLatency;
Expand All @@ -89,4 +92,4 @@ namespace dxvk {
bool apitraceMode;
};

}
}
6 changes: 4 additions & 2 deletions src/d3d11/d3d11_swapchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -848,12 +848,14 @@ namespace dxvk {
uint32_t n = 0;

if (Vsync) {
if (m_parent->GetOptions()->forceTear)
pDstModes[n++] = VK_PRESENT_MODE_FIFO_RELAXED_KHR;
pDstModes[n++] = VK_PRESENT_MODE_FIFO_KHR;
} else {
if (!m_parent->GetOptions()->tearFree)
pDstModes[n++] = VK_PRESENT_MODE_IMMEDIATE_KHR;
pDstModes[n++] = VK_PRESENT_MODE_MAILBOX_KHR;
pDstModes[n++] = VK_PRESENT_MODE_FIFO_RELAXED_KHR;
pDstModes[n++] = VK_PRESENT_MODE_IMMEDIATE_KHR;
}

return n;
Expand Down Expand Up @@ -887,4 +889,4 @@ namespace dxvk {
return str::format("D3D", apiVersion, " FL", flHi, "_", flLo);
}

}
}
4 changes: 3 additions & 1 deletion src/d3d9/d3d9_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ namespace dxvk {
this->enableDialogMode = config.getOption<bool> ("d3d9.enableDialogMode", false);
this->forceSamplerTypeSpecConstants = config.getOption<bool> ("d3d9.forceSamplerTypeSpecConstants", false);
this->forceSwapchainMSAA = config.getOption<int32_t> ("d3d9.forceSwapchainMSAA", -1);
this->tearFree = config.getOption<bool> ("d3d9.tearFree", false);
this->forceTear = config.getOption<bool> ("d3d9.forceTear", false);

this->forceAspectRatio = config.getOption<std::string>("d3d9.forceAspectRatio", "");
this->allowDoNotWait = config.getOption<bool> ("d3d9.allowDoNotWait", true);
Expand All @@ -80,4 +82,4 @@ namespace dxvk {
applyTristate(this->d3d9FloatEmulation, config.getOption<Tristate>("d3d9.floatEmulation", Tristate::Auto));
}

}
}
8 changes: 7 additions & 1 deletion src/d3d9/d3d9_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ namespace dxvk {
/// This solves some rendering bugs in games that have z-pass shaders which
/// don't match entirely to the regular vertex shader in this way.
bool longMad;

/// Tear-free mode if vsync is disabled
bool tearFree;

/// Tearing if vsync is enabled
bool forceTear;
};

}
}
9 changes: 6 additions & 3 deletions src/d3d9/d3d9_swapchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1362,11 +1362,14 @@ namespace dxvk {
uint32_t n = 0;

if (Vsync) {
if (m_parent->GetOptions()->forceTear)
pDstModes[n++] = VK_PRESENT_MODE_FIFO_RELAXED_KHR;
pDstModes[n++] = VK_PRESENT_MODE_FIFO_KHR;
} else {
pDstModes[n++] = VK_PRESENT_MODE_IMMEDIATE_KHR;
if (!m_parent->GetOptions()->tearFree)
pDstModes[n++] = VK_PRESENT_MODE_IMMEDIATE_KHR;
pDstModes[n++] = VK_PRESENT_MODE_MAILBOX_KHR;
pDstModes[n++] = VK_PRESENT_MODE_FIFO_RELAXED_KHR;
pDstModes[n++] = VK_PRESENT_MODE_IMMEDIATE_KHR;
}

return n;
Expand Down Expand Up @@ -1555,4 +1558,4 @@ namespace dxvk {
return this->GetParent()->IsExtended() ? "D3D9Ex" : "D3D9";
}

}
}