Skip to content
Open
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
9 changes: 9 additions & 0 deletions src/engine/client/backend/vulkan/backend_vulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4055,13 +4055,22 @@ class CCommandProcessorFragment_Vulkan : public CCommandProcessorFragment_GLBase

VkExtent2D AutoViewportExtent = RetSize;
bool UsesForcedViewport = false;
#ifdef CONF_FAMILY_WINDOWS
// keep this in sync with graphics_threaded AdjustViewport's check
if(AutoViewportExtent.height > 4 * AutoViewportExtent.width / 5 && g_GraphicsForcedAspect)
{
AutoViewportExtent.height = 4 * AutoViewportExtent.width / 5;
UsesForcedViewport = true;
}

#else
if(AutoViewportExtent.height > 3 * AutoViewportExtent.width / 4)
{
AutoViewportExtent.height = 3 * AutoViewportExtent.width / 4;
UsesForcedViewport = true;
}
#endif

SSwapImgViewportExtent Ext;
Ext.m_SwapImageViewport = RetSize;
Ext.m_ForcedViewport = AutoViewportExtent;
Expand Down
3 changes: 1 addition & 2 deletions src/engine/client/backend_sdl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1144,8 +1144,7 @@ int CGraphicsBackend_SDL_GL::Init(const char *pName, int *pScreen, int *pWidth,
#if CONF_PLATFORM_LINUX && SDL_VERSION_ATLEAST(2, 0, 22)
// needed to workaround SDL from forcing exclusively X11 if linking against the GLX flavour of GLEW instead of the EGL one
// w/o this on Wayland systems (no XWayland support) SDL's Video subsystem will fail to load (starting from SDL2.30+)
if(Linked.major == 2 && Linked.minor >= 30)
Copy link
Collaborator

@SollyBunny SollyBunny Dec 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure of the behaviour of SDL3 compat in this scenario, if Linked.major == 3, then this should be >= 2. Please try your setup with actual SDL2 (yay -S aur/sdl2)

SDL_SetHint(SDL_HINT_VIDEODRIVER, "x11,wayland");
SDL_SetHintWithPriority(SDL_HINT_VIDEODRIVER, "wayland,x11", SDL_HINT_OVERRIDE);
#endif
}

Expand Down
19 changes: 19 additions & 0 deletions src/engine/client/graphics_threaded.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2263,6 +2263,7 @@ void CGraphics_Threaded::SetForcedAspect(bool Force)

void CGraphics_Threaded::AdjustViewport(bool SendViewportChangeToBackend)
{
#ifdef CONF_FAMILY_WINDOWS
// adjust the viewport to only allow certain aspect ratios
// keep this in sync with backend_vulkan GetSwapImageSize's check
if(m_ScreenHeight > 4 * m_ScreenWidth / 5 && g_GraphicsForcedAspect)
Expand All @@ -2279,6 +2280,24 @@ void CGraphics_Threaded::AdjustViewport(bool SendViewportChangeToBackend)
{
m_IsForcedViewport = false;
}

#else
if(m_ScreenHeight > 3 * m_ScreenWidth / 4)
{
m_IsForcedViewport = true;
m_ScreenHeight = 3 * m_ScreenWidth / 4;

if(SendViewportChangeToBackend)
{
UpdateViewport(0, 0, m_ScreenWidth, m_ScreenHeight, true);
}
}
else
{
m_IsForcedViewport = false;
}
#endif

}

void CGraphics_Threaded::UpdateViewport(int X, int Y, int W, int H, bool ByResize)
Expand Down
Loading