protonscr

[native] Terraria outputs wrong swapchain buffer size under HiDPI Wayland

dxvkopen native
doitsujin/dxvk#5647 · opened 2026-05-25 by effects3d · updated 2026-08-10 · 5 comments · github
1 matching comments, n / p to jump
Eeffects3d 2026-05-25 github

My display's resolution and scaling is 2560x1440 and 1.25 respectively. I currently use the Jay Wayland compositor but observed this issue under Niri as well.

The game still uses Steam Linux Runtime 2.0, which doesn't come with the libraries needed for FNA's (Terraria's game engine) D3D11 renderer, which uses DXVK-Native on Linux, to function. Therefore, I copied the necessary libraries (libvkd3d.so.1.19.0, libvkd3d-utils.so.1.6.5 and libvkd3d-shader.so.1.17.0) from said runtime to the game's lib64 directory and renamed them so that it will match the symbols in libFNA3D.so.0 (libvkd3d.so.1, libvkd3d-utils.so.1 and libvkd3d-shader.so.1). Lastly, I added libdxvk_d3d11 and libdxvk_dxgi to the same directory and renamed them accordingly.

When I run Terraria under SDL's Wayland backend, along with having SDL_VIDEO_WAYLAND_SCALE_TO_DISPLAY=1 set due to the game not being designed to be DPI-aware under Wayland, the game appears very pixelated. Looking at the logs shows that the swapchain buffer size was 800x480 and not my display's resolution. This appears to affect DXVK versions 2.6 and onwards (2.5.1 was the last version where this wasn't an issue).

Software information

Name: Terraria
Launch options: SDL_VIDEO_DRIVER=wayland SDL_VIDEO_WAYLAND_SCALE_TO_DISPLAY=1 %command% /gldevice:D3D11

System information

  • GPU: AMD Radeon RX 6650 XT
  • Driver: Mesa 26.0.6
  • Wine version: N/A
  • DXVK version: v2.7.1-609-g02bcc98c

Log files

Terraria.bin.x86_64_d3d11.log
Terraria.bin.x86_64_dxgi.log

Ddoitsujin maintainer 2026-05-25 github

DXVK doesn't have much real agency over the swapchain size, we can only really do what the driver reports as the current surface size and that is evidently just 800x480. If we don't do that then presentation will just fail.

I don't see any reason why this would work with 2.5.1, the logic hasn't really changed.

Ddoitsujin maintainer 2026-05-25 github

Only thing I could see is that we somehow end up hitting this path:
https://github.com/doitsujin/dxvk/blob/02bcc98cc45ffc83a318dc2380548ffb6dae3ecf/src/dxvk/dxvk_presenter.cpp#L1155-L1158

Can you add some logging there for min/max/current sizes and post the result? I don't really have a way to debug native Terraria, nor do I have a High DPI setup.

That said, the "desired" size will match the size of the D3D11 swapchain (i.e. the game's render resolution), which once again isn't going to be what you want it to be, and if your compositor doesn't do the scaling then DXVK will. Maybe we should change it to query the drawable size instead and do scaling ourselves, but it's just jank and I don't really have a test case.

Eeffects3d 2026-05-25 github

Can you add some logging there for min/max/current sizes and post the result?

I wasn't sure how to do that so I just added DXVK_LOG_LEVEL=debug to the launch options and changed the game's resolution a bunch of times. I can try getting the correct logs if so desired.

Log: Terraria.bin.x86_64_d3d11.log
Demonstration: https://streamable.com/p9liaf

By the way, setting SDL_VIDEO_WAYLAND_SCALE_TO_DISPLAY=0 will make DXVK output a swapchain size that matches my display's resolution. However, Terraria remains slightly blurrier than running it under SDL's X11 video driver, due to the game not being DPI-aware and rendering its logical size (2048x1152) in fullscreen. The aforementioned environment variable is very much just a workaround for non-DPI-aware Wayland windows and I'm not sure whether this issue is actually DXVK's or SDL's fault.

Eeffects3d 2026-08-10 · hidden on GitHub github

Retested this with DXVK 3.0.2 and I can't seem to reproduce the issue anymore, so I'll just go ahead and close this.

Eeffects3d 2026-08-10 github

Had the wrong version of DXVK loaded. My bad.