[dxvk] Introduce dxvk.tearFree option

And replace the old frontend-specific options.
This commit is contained in:
Philip Rebohle 2023-05-31 15:57:34 +02:00
parent 85d52ccb88
commit ab00591297
8 changed files with 13 additions and 13 deletions

View File

@ -122,8 +122,7 @@
#
# Supported values: Auto, True, False
# dxgi.tearFree = Auto
# d3d9.tearFree = Auto
# dxvk.tearFree = Auto
# Assume single-use mode for command lists created on deferred contexts.

View File

@ -31,7 +31,6 @@ namespace dxvk {
this->maxFrameLatency = config.getOption<int32_t>("dxgi.maxFrameLatency", 0);
this->maxFrameRate = config.getOption<int32_t>("dxgi.maxFrameRate", 0);
this->syncInterval = config.getOption<int32_t>("dxgi.syncInterval", -1);
this->tearFree = config.getOption<Tristate>("dxgi.tearFree", Tristate::Auto);
// 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

@ -77,10 +77,6 @@ namespace dxvk {
/// passed to IDXGISwapChain::Present.
int32_t syncInterval;
/// Tear-free mode if vsync is disabled
/// Tearing mode if vsync is enabled
Tristate tearFree;
/// Override maximum frame latency if the app specifies
/// a higher value. May help with frame timing issues.
int32_t maxFrameLatency;

View File

@ -67,7 +67,6 @@ namespace dxvk {
this->allowDiscard = config.getOption<bool> ("d3d9.allowDiscard", true);
this->enumerateByDisplays = config.getOption<bool> ("d3d9.enumerateByDisplays", true);
this->longMad = config.getOption<bool> ("d3d9.longMad", false);
this->tearFree = config.getOption<Tristate> ("d3d9.tearFree", Tristate::Auto);
this->apitraceMode = config.getOption<bool> ("d3d9.apitraceMode", false);
this->deviceLocalConstantBuffers = config.getOption<bool> ("d3d9.deviceLocalConstantBuffers", false);
this->allowDirectBufferMapping = config.getOption<bool> ("d3d9.allowDirectBufferMapping", true);

View File

@ -127,10 +127,6 @@ namespace dxvk {
/// don't match entirely to the regular vertex shader in this way.
bool longMad;
/// Tear-free mode if vsync is disabled
/// Tearing mode if vsync is enabled
Tristate tearFree;
/// Apitrace mode: Maps all buffers in cached memory.
bool apitraceMode;

View File

@ -11,6 +11,7 @@ namespace dxvk {
useRawSsbo = config.getOption<Tristate>("dxvk.useRawSsbo", Tristate::Auto);
maxChunkSize = config.getOption<int32_t> ("dxvk.maxChunkSize", 0);
hud = config.getOption<std::string>("dxvk.hud", "");
tearFree = config.getOption<Tristate>("dxvk.tearFree", Tristate::Auto);
}
}

View File

@ -32,6 +32,10 @@ namespace dxvk {
/// HUD elements
std::string hud;
/// Forces swap chain into MAILBOX (if true)
/// or FIFO_RELAXED (if false) present mode
Tristate tearFree;
};
}

View File

@ -518,9 +518,15 @@ namespace dxvk {
std::array<VkPresentModeKHR, 2> desired = { };
uint32_t numDesired = 0;
Tristate tearFree = m_device->config().tearFree;
if (!syncInterval) {
desired[numDesired++] = VK_PRESENT_MODE_IMMEDIATE_KHR;
if (tearFree != Tristate::True)
desired[numDesired++] = VK_PRESENT_MODE_IMMEDIATE_KHR;
desired[numDesired++] = VK_PRESENT_MODE_MAILBOX_KHR;
} else {
if (tearFree == Tristate::False)
desired[numDesired++] = VK_PRESENT_MODE_FIFO_RELAXED_KHR;
}
// Just pick the first desired and supported mode