Prefer D3D11VA for FSE V-Sync off

This commit is contained in:
Cameron Gutman 2023-08-03 19:41:35 -05:00
parent dc5414bd0d
commit 7404e5fce2
2 changed files with 20 additions and 3 deletions

View file

@ -367,6 +367,15 @@ bool D3D11VARenderer::initialize(PDECODER_PARAMETERS params)
hr);
// Non-fatal
}
// DXVA2 may let us take over for FSE V-sync off cases. However, if we don't have DXGI_FEATURE_PRESENT_ALLOW_TEARING
// then we should not attempt to do this unless there's no other option (HDR, DXVA2 failed in pass 1, etc).
if (!m_AllowTearing && m_DecoderSelectionPass == 0 && !(params->videoFormat & VIDEO_FORMAT_MASK_10BIT) &&
(SDL_GetWindowFlags(params->window) & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN) {
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
"Defaulting to DXVA2 for FSE without DXGI_FEATURE_PRESENT_ALLOW_TEARING support");
return false;
}
}
SDL_SysWMinfo info;

View file

@ -568,9 +568,11 @@ bool DXVA2Renderer::initializeDevice(SDL_Window* window, bool enableVsync)
return false;
}
// If we have a WDDM 2.0 or later display driver and we're not running in
// full-screen exclusive mode (or we're on a multi-GPU system in FSE),
// prefer the D3D11VA renderer.
// If we have a WDDM 2.0 or later display driver, prefer the D3D11VA renderer
// in all of the following cases:
// - Multi-GPU systems
// - Windowed and borderless windowed modes
// - Full-screen exclusive with V-sync off
//
// D3D11VA is better in this case because it can enable tearing in non-FSE
// modes when the user has V-Sync disabled. In non-FSE V-Sync cases, D3D11VA
@ -601,6 +603,12 @@ bool DXVA2Renderer::initializeDevice(SDL_Window* window, bool enableVsync)
d3d9ex->Release();
return false;
}
else if (!enableVsync) {
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
"Defaulting to D3D11VA for FSE V-Sync Off mode");
d3d9ex->Release();
return false;
}
}
D3DCAPS9 deviceCaps;