Abstract fullscreen details into SDLC functions

This commit is contained in:
Cameron Gutman committed 2025-01-30 22:41:44 -06:00
1 parent 13b2b28c2f
commit a37020b974
10 files changed
+65 -25

No files matched your search

@@ -427,7 +427,7 @@ bool D3D11VARenderer::initialize(PDECODER_PARAMETERS params)
// 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) {
SDLC_IsFullscreenExclusive(params->window)) {
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
"Defaulting to DXVA2 for FSE without DXGI_FEATURE_PRESENT_ALLOW_TEARING support");
return false;
@@ -436,8 +436,8 @@ bool D3D11VARenderer::initialize(PDECODER_PARAMETERS params)
HWND window = (HWND)SDLC_Win32_GetHwnd(params->window);
// Always use windowed or borderless windowed mode.. SDL does mode-setting for us in
// full-screen exclusive mode (SDL_WINDOW_FULLSCREEN), so this actually works out okay.
// Always use windowed or borderless windowed mode. SDL does mode-setting for us in
// full-screen exclusive mode, so this actually works out okay.
ComPtr<IDXGISwapChain1> swapChain;
hr = m_Factory->CreateSwapChainForHwnd(m_Device.Get(),
window,
@@ -1184,7 +1184,7 @@ int D3D11VARenderer::getRendererAttributes()
// In windowed mode, we will render as fast we can and DWM will grab whatever is latest at the
// time unless the user opts for pacing. We will use pacing in full-screen mode and normal DWM
// sequencing in full-screen desktop mode to behave similarly to the DXVA2 renderer.
if ((SDL_GetWindowFlags(m_DecoderParams.window) & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN) {
if (SDLC_IsFullscreenExclusive(m_DecoderParams.window)) {
attributes |= RENDERER_ATTRIBUTE_FORCE_PACING;
}
@@ -549,7 +549,6 @@ bool DXVA2Renderer::initializeDevice(SDL_Window* window, bool enableVsync)
}
int adapterIndex = SDL_Direct3D9GetAdapterIndex(SDL_GetWindowDisplayIndex(window));
Uint32 windowFlags = SDL_GetWindowFlags(window);
// Initialize quirks *before* calling CreateDeviceEx() to allow our below
// logic to avoid a hang with NahimicOSD.dll's broken full-screen handling.
@@ -583,7 +582,7 @@ bool DXVA2Renderer::initializeDevice(SDL_Window* window, bool enableVsync)
}
}
if ((windowFlags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN) {
if (SDLC_IsFullscreenExclusive(window)) {
d3dpp.Windowed = false;
d3dpp.BackBufferWidth = currentMode.Width;
d3dpp.BackBufferHeight = currentMode.Height;
@@ -144,7 +144,7 @@ bool SdlRenderer::initialize(PDECODER_PARAMETERS params)
switch (SDLC_GetVideoDriver()) {
case SDLC_VIDEO_WIN32:
// DWM is always tear-free except in full-screen exclusive mode
if ((SDL_GetWindowFlags(params->window) & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN) {
if (SDLC_IsFullscreenExclusive(params->window)) {
if (params->enableVsync) {
rendererFlags |= SDL_RENDERER_PRESENTVSYNC;
}