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

[dxgi] Add option to force-enable MAILBOX present mode

Provides Enhanced Sync-like functionality (#678).
This commit is contained in:
Philip Rebohle 2018-09-29 08:13:52 +02:00
parent 6fb09cb9fc
commit 894d9606d5
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
4 changed files with 17 additions and 1 deletions

View File

@ -41,6 +41,7 @@ namespace dxvk {
this->numBackBuffers = config.getOption<int32_t>("dxgi.numBackBuffers", 0);
this->syncInterval = config.getOption<int32_t>("dxgi.syncInterval", -1);
this->syncMode = DxgiSyncMode(config.getOption<int32_t>("dxgi.syncMode", 0));
this->d3d10Enable = config.getOption<bool>("d3d10.enable", true);
}

View File

@ -8,6 +8,14 @@
namespace dxvk {
/**
* \brief Sync mode
*/
enum class DxgiSyncMode : int32_t {
Default = 0,
Mailbox = 1,
};
/**
* \brief DXGI options
*
@ -46,6 +54,9 @@ namespace dxvk {
/// passed to IDXGISwapChain::Present.
int32_t syncInterval;
/// Vsync mode
DxgiSyncMode syncMode;
/// Enables D3D10 support
bool d3d10Enable;
};

View File

@ -13,7 +13,8 @@ namespace dxvk {
HWND window)
: m_window (window),
m_device (device),
m_context (device->createContext()) {
m_context (device->createContext()),
m_syncMode(pOptions->syncMode) {
// Some games don't work with deferred surface creation,
// so we should default to initializing it immediately.
@ -367,6 +368,8 @@ namespace dxvk {
size_t n = 0;
if (Vsync) {
if (m_syncMode == DxgiSyncMode::Mailbox)
modes[n++] = VK_PRESENT_MODE_MAILBOX_KHR;
modes[n++] = VK_PRESENT_MODE_FIFO_KHR;
} else {
modes[n++] = VK_PRESENT_MODE_IMMEDIATE_KHR;

View File

@ -163,6 +163,7 @@ namespace dxvk {
DxvkLogicOpState m_loState;
DxvkBlendMode m_blendMode;
DxvkSwapchainProperties m_options;
DxgiSyncMode m_syncMode;
VkSurfaceFormatKHR PickSurfaceFormat(DXGI_FORMAT Fmt) const;